From 42daa6d6e700118d40c8df340c27a4b39dac4d7c Mon Sep 17 00:00:00 2001 From: "Hercules.ws" Date: Sun, 10 May 2020 20:38:15 +0200 Subject: HPM Hooks Update Signed-off-by: HerculesWSAPI --- src/plugins/HPMHooking/HPMHooking.Defs.inc | 2 ++ .../HPMHooking/HPMHooking_map.HPMHooksCore.inc | 4 ++++ .../HPMHooking/HPMHooking_map.HookingPoints.inc | 1 + src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 27 ++++++++++++++++++++++ 4 files changed, 34 insertions(+) diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index 80ba50d73..ef71f1967 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -6988,6 +6988,8 @@ typedef const char* (*HPMHOOK_pre_script_print_line) (StringBuf **buf, const cha typedef const char* (*HPMHOOK_post_script_print_line) (const char* retVal___, StringBuf *buf, const char *p, const char *mark, int line); typedef void (*HPMHOOK_pre_script_errorwarning_sub) (StringBuf **buf, const char **src, const char **file, int *start_line, const char **error_msg, const char **error_pos); typedef void (*HPMHOOK_post_script_errorwarning_sub) (StringBuf *buf, const char *src, const char *file, int start_line, const char *error_msg, const char *error_pos); +typedef bool (*HPMHOOK_pre_script_is_permanent_variable) (const char **name); +typedef bool (*HPMHOOK_post_script_is_permanent_variable) (bool retVal___, const char *name); typedef int (*HPMHOOK_pre_script_set_reg) (struct script_state **st, struct map_session_data **sd, int64 *num, const char **name, const void **value, struct reg_db **ref); typedef int (*HPMHOOK_post_script_set_reg) (int retVal___, struct script_state *st, struct map_session_data *sd, int64 num, const char *name, const void *value, struct reg_db *ref); typedef void (*HPMHOOK_pre_script_set_reg_ref_str) (struct script_state **st, struct reg_db **n, int64 *num, const char **name, const char **str); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 70bc309f3..e8cb41240 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -5518,6 +5518,8 @@ struct { struct HPMHookPoint *HP_script_print_line_post; struct HPMHookPoint *HP_script_errorwarning_sub_pre; struct HPMHookPoint *HP_script_errorwarning_sub_post; + struct HPMHookPoint *HP_script_is_permanent_variable_pre; + struct HPMHookPoint *HP_script_is_permanent_variable_post; struct HPMHookPoint *HP_script_set_reg_pre; struct HPMHookPoint *HP_script_set_reg_post; struct HPMHookPoint *HP_script_set_reg_ref_str_pre; @@ -12417,6 +12419,8 @@ struct { int HP_script_print_line_post; int HP_script_errorwarning_sub_pre; int HP_script_errorwarning_sub_post; + int HP_script_is_permanent_variable_pre; + int HP_script_is_permanent_variable_post; int HP_script_set_reg_pre; int HP_script_set_reg_post; int HP_script_set_reg_ref_str_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index c9b673a1f..6b89841ad 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -2825,6 +2825,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(script->load_parameters, HP_script_load_parameters) }, { HP_POP(script->print_line, HP_script_print_line) }, { HP_POP(script->errorwarning_sub, HP_script_errorwarning_sub) }, + { HP_POP(script->is_permanent_variable, HP_script_is_permanent_variable) }, { HP_POP(script->set_reg, HP_script_set_reg) }, { HP_POP(script->set_reg_ref_str, HP_script_set_reg_ref_str) }, { HP_POP(script->set_reg_pc_ref_str, HP_script_set_reg_pc_ref_str) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 599cbfdfd..02d55228e 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -73473,6 +73473,33 @@ void HP_script_errorwarning_sub(StringBuf *buf, const char *src, const char *fil } return; } +bool HP_script_is_permanent_variable(const char *name) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_script_is_permanent_variable_pre > 0) { + bool (*preHookFunc) (const char **name); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_script_is_permanent_variable_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_script_is_permanent_variable_pre[hIndex].func; + retVal___ = preHookFunc(&name); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.script.is_permanent_variable(name); + } + if (HPMHooks.count.HP_script_is_permanent_variable_post > 0) { + bool (*postHookFunc) (bool retVal___, const char *name); + for (hIndex = 0; hIndex < HPMHooks.count.HP_script_is_permanent_variable_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_script_is_permanent_variable_post[hIndex].func; + retVal___ = postHookFunc(retVal___, name); + } + } + return retVal___; +} int HP_script_set_reg(struct script_state *st, struct map_session_data *sd, int64 num, const char *name, const void *value, struct reg_db *ref) { int hIndex = 0; int retVal___ = 0; -- cgit v1.2.3-60-g2f50