From e5c748eb848402539cca577e78470c502c487004 Mon Sep 17 00:00:00 2001 From: "Hercules.ws" Date: Wed, 26 Feb 2014 19:11:22 +0100 Subject: HPM Hooks Update Signed-off-by: HerculesWSAPI --- src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc | 8 ++++ .../HPMHooking/HPMHooking.HookingPoints.inc | 2 + src/plugins/HPMHooking/HPMHooking.Hooks.inc | 51 ++++++++++++++++++++++ 3 files changed, 61 insertions(+) (limited to 'src/plugins') diff --git a/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc index 5bc9f7da0..a4dc79e3a 100644 --- a/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc @@ -4271,6 +4271,10 @@ struct { struct HPMHookPoint *HP_script_generic_ui_array_expand_post; struct HPMHookPoint *HP_script_array_cpy_list_pre; struct HPMHookPoint *HP_script_array_cpy_list_post; + struct HPMHookPoint *HP_script_hardcoded_constants_pre; + struct HPMHookPoint *HP_script_hardcoded_constants_post; + struct HPMHookPoint *HP_script_mapindexname2id_pre; + struct HPMHookPoint *HP_script_mapindexname2id_post; struct HPMHookPoint *HP_searchstore_open_pre; struct HPMHookPoint *HP_searchstore_open_post; struct HPMHookPoint *HP_searchstore_query_pre; @@ -9296,6 +9300,10 @@ struct { int HP_script_generic_ui_array_expand_post; int HP_script_array_cpy_list_pre; int HP_script_array_cpy_list_post; + int HP_script_hardcoded_constants_pre; + int HP_script_hardcoded_constants_post; + int HP_script_mapindexname2id_pre; + int HP_script_mapindexname2id_post; int HP_searchstore_open_pre; int HP_searchstore_open_post; int HP_searchstore_query_pre; diff --git a/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc index 9cd73bce8..e34217c0d 100644 --- a/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc @@ -2169,6 +2169,8 @@ struct HookingPointData HookingPoints[] = { { HP_POP(script->reg_destroy, HP_script_reg_destroy) }, { HP_POP(script->generic_ui_array_expand, HP_script_generic_ui_array_expand) }, { HP_POP(script->array_cpy_list, HP_script_array_cpy_list) }, + { HP_POP(script->hardcoded_constants, HP_script_hardcoded_constants) }, + { HP_POP(script->mapindexname2id, HP_script_mapindexname2id) }, /* searchstore */ { HP_POP(searchstore->open, HP_searchstore_open) }, { HP_POP(searchstore->query, HP_searchstore_query) }, diff --git a/src/plugins/HPMHooking/HPMHooking.Hooks.inc b/src/plugins/HPMHooking/HPMHooking.Hooks.inc index 3bc658d24..9e62546d0 100644 --- a/src/plugins/HPMHooking/HPMHooking.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking.Hooks.inc @@ -55180,6 +55180,57 @@ unsigned int* HP_script_array_cpy_list(struct script_array *sa) { } return retVal___; } +void HP_script_hardcoded_constants(void) { + int hIndex = 0; + if( HPMHooks.count.HP_script_hardcoded_constants_pre ) { + void (*preHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_hardcoded_constants_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_script_hardcoded_constants_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.script.hardcoded_constants(); + } + if( HPMHooks.count.HP_script_hardcoded_constants_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_hardcoded_constants_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_script_hardcoded_constants_post[hIndex].func; + postHookFunc(); + } + } + return; +} +unsigned short HP_script_mapindexname2id(struct script_state *st, const char *name) { + int hIndex = 0; + unsigned short retVal___ = 0; + if( HPMHooks.count.HP_script_mapindexname2id_pre ) { + unsigned short (*preHookFunc) (struct script_state *st, const char *name); + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_mapindexname2id_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_script_mapindexname2id_pre[hIndex].func; + retVal___ = preHookFunc(st, name); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.script.mapindexname2id(st, name); + } + if( HPMHooks.count.HP_script_mapindexname2id_post ) { + unsigned short (*postHookFunc) (unsigned short retVal___, struct script_state *st, const char *name); + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_mapindexname2id_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_script_mapindexname2id_post[hIndex].func; + retVal___ = postHookFunc(retVal___, st, name); + } + } + return retVal___; +} /* searchstore */ bool HP_searchstore_open(struct map_session_data *sd, unsigned int uses, unsigned short effect) { int hIndex = 0; -- cgit v1.2.3-60-g2f50