From 909bb005837aba3017870a529b106135e3b84b5b Mon Sep 17 00:00:00 2001 From: "Hercules.ws" Date: Tue, 11 Aug 2015 02:37:15 +0200 Subject: HPM Hooks Update Signed-off-by: HerculesWSAPI --- .../HPMHooking/HPMHooking_map.HPMHooksCore.inc | 20 ++++ .../HPMHooking/HPMHooking_map.HookingPoints.inc | 5 + src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 130 +++++++++++++++++++++ 3 files changed, 155 insertions(+) diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 650f31d35..33c991933 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -4159,6 +4159,10 @@ struct { struct HPMHookPoint *HP_script_label_add_post; struct HPMHookPoint *HP_script_run_pre; struct HPMHookPoint *HP_script_run_post; + struct HPMHookPoint *HP_script_run_npc_pre; + struct HPMHookPoint *HP_script_run_npc_post; + struct HPMHookPoint *HP_script_run_pet_pre; + struct HPMHookPoint *HP_script_run_pet_post; struct HPMHookPoint *HP_script_run_main_pre; struct HPMHookPoint *HP_script_run_main_post; struct HPMHookPoint *HP_script_run_timer_pre; @@ -4391,6 +4395,12 @@ struct { struct HPMHookPoint *HP_script_get_translation_file_name_post; struct HPMHookPoint *HP_script_parser_clean_leftovers_pre; struct HPMHookPoint *HP_script_parser_clean_leftovers_post; + struct HPMHookPoint *HP_script_run_use_script_pre; + struct HPMHookPoint *HP_script_run_use_script_post; + struct HPMHookPoint *HP_script_run_item_equip_script_pre; + struct HPMHookPoint *HP_script_run_item_equip_script_post; + struct HPMHookPoint *HP_script_run_item_unequip_script_pre; + struct HPMHookPoint *HP_script_run_item_unequip_script_post; struct HPMHookPoint *HP_searchstore_open_pre; struct HPMHookPoint *HP_searchstore_open_post; struct HPMHookPoint *HP_searchstore_query_pre; @@ -9380,6 +9390,10 @@ struct { int HP_script_label_add_post; int HP_script_run_pre; int HP_script_run_post; + int HP_script_run_npc_pre; + int HP_script_run_npc_post; + int HP_script_run_pet_pre; + int HP_script_run_pet_post; int HP_script_run_main_pre; int HP_script_run_main_post; int HP_script_run_timer_pre; @@ -9612,6 +9626,12 @@ struct { int HP_script_get_translation_file_name_post; int HP_script_parser_clean_leftovers_pre; int HP_script_parser_clean_leftovers_post; + int HP_script_run_use_script_pre; + int HP_script_run_use_script_post; + int HP_script_run_item_equip_script_pre; + int HP_script_run_item_equip_script_post; + int HP_script_run_item_unequip_script_pre; + int HP_script_run_item_unequip_script_post; int HP_searchstore_open_pre; int HP_searchstore_open_post; int HP_searchstore_query_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 33e6cd053..720d76b6c 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -2114,6 +2114,8 @@ struct HookingPointData HookingPoints[] = { { HP_POP(script->get_constant, HP_script_get_constant) }, { HP_POP(script->label_add, HP_script_label_add) }, { HP_POP(script->run, HP_script_run) }, + { HP_POP(script->run_npc, HP_script_run_npc) }, + { HP_POP(script->run_pet, HP_script_run_pet) }, { HP_POP(script->run_main, HP_script_run_main) }, { HP_POP(script->run_timer, HP_script_run_timer) }, { HP_POP(script->set_var, HP_script_set_var) }, @@ -2230,6 +2232,9 @@ struct HookingPointData HookingPoints[] = { { HP_POP(script->add_language, HP_script_add_language) }, { HP_POP(script->get_translation_file_name, HP_script_get_translation_file_name) }, { HP_POP(script->parser_clean_leftovers, HP_script_parser_clean_leftovers) }, + { HP_POP(script->run_use_script, HP_script_run_use_script) }, + { HP_POP(script->run_item_equip_script, HP_script_run_item_equip_script) }, + { HP_POP(script->run_item_unequip_script, HP_script_run_item_unequip_script) }, /* searchstore */ { HP_POP(searchstore->open, HP_searchstore_open) }, { HP_POP(searchstore->query, HP_searchstore_query) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index b8dd9db2f..402f146ba 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -55686,6 +55686,58 @@ void HP_script_run(struct script_code *rootscript, int pos, int rid, int oid) { } return; } +void HP_script_run_npc(struct script_code *rootscript, int pos, int rid, int oid) { + int hIndex = 0; + if( HPMHooks.count.HP_script_run_npc_pre ) { + void (*preHookFunc) (struct script_code *rootscript, int *pos, int *rid, int *oid); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_run_npc_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_script_run_npc_pre[hIndex].func; + preHookFunc(rootscript, &pos, &rid, &oid); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.script.run_npc(rootscript, pos, rid, oid); + } + if( HPMHooks.count.HP_script_run_npc_post ) { + void (*postHookFunc) (struct script_code *rootscript, int *pos, int *rid, int *oid); + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_run_npc_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_script_run_npc_post[hIndex].func; + postHookFunc(rootscript, &pos, &rid, &oid); + } + } + return; +} +void HP_script_run_pet(struct script_code *rootscript, int pos, int rid, int oid) { + int hIndex = 0; + if( HPMHooks.count.HP_script_run_pet_pre ) { + void (*preHookFunc) (struct script_code *rootscript, int *pos, int *rid, int *oid); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_run_pet_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_script_run_pet_pre[hIndex].func; + preHookFunc(rootscript, &pos, &rid, &oid); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.script.run_pet(rootscript, pos, rid, oid); + } + if( HPMHooks.count.HP_script_run_pet_post ) { + void (*postHookFunc) (struct script_code *rootscript, int *pos, int *rid, int *oid); + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_run_pet_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_script_run_pet_post[hIndex].func; + postHookFunc(rootscript, &pos, &rid, &oid); + } + } + return; +} void HP_script_run_main(struct script_state *st) { int hIndex = 0; if( HPMHooks.count.HP_script_run_main_pre ) { @@ -58915,6 +58967,84 @@ void HP_script_parser_clean_leftovers(void) { } return; } +void HP_script_run_use_script(struct map_session_data *sd, struct item_data *data, int oid) { + int hIndex = 0; + if( HPMHooks.count.HP_script_run_use_script_pre ) { + void (*preHookFunc) (struct map_session_data *sd, struct item_data *data, int *oid); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_run_use_script_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_script_run_use_script_pre[hIndex].func; + preHookFunc(sd, data, &oid); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.script.run_use_script(sd, data, oid); + } + if( HPMHooks.count.HP_script_run_use_script_post ) { + void (*postHookFunc) (struct map_session_data *sd, struct item_data *data, int *oid); + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_run_use_script_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_script_run_use_script_post[hIndex].func; + postHookFunc(sd, data, &oid); + } + } + return; +} +void HP_script_run_item_equip_script(struct map_session_data *sd, struct item_data *data, int oid) { + int hIndex = 0; + if( HPMHooks.count.HP_script_run_item_equip_script_pre ) { + void (*preHookFunc) (struct map_session_data *sd, struct item_data *data, int *oid); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_run_item_equip_script_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_script_run_item_equip_script_pre[hIndex].func; + preHookFunc(sd, data, &oid); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.script.run_item_equip_script(sd, data, oid); + } + if( HPMHooks.count.HP_script_run_item_equip_script_post ) { + void (*postHookFunc) (struct map_session_data *sd, struct item_data *data, int *oid); + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_run_item_equip_script_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_script_run_item_equip_script_post[hIndex].func; + postHookFunc(sd, data, &oid); + } + } + return; +} +void HP_script_run_item_unequip_script(struct map_session_data *sd, struct item_data *data, int oid) { + int hIndex = 0; + if( HPMHooks.count.HP_script_run_item_unequip_script_pre ) { + void (*preHookFunc) (struct map_session_data *sd, struct item_data *data, int *oid); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_run_item_unequip_script_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_script_run_item_unequip_script_pre[hIndex].func; + preHookFunc(sd, data, &oid); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.script.run_item_unequip_script(sd, data, oid); + } + if( HPMHooks.count.HP_script_run_item_unequip_script_post ) { + void (*postHookFunc) (struct map_session_data *sd, struct item_data *data, int *oid); + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_run_item_unequip_script_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_script_run_item_unequip_script_post[hIndex].func; + postHookFunc(sd, data, &oid); + } + } + return; +} /* searchstore */ bool HP_searchstore_open(struct map_session_data *sd, unsigned int uses, unsigned short effect) { int hIndex = 0; -- cgit v1.2.3-70-g09d2