diff options
author | Haru <haru@dotalux.com> | 2016-04-17 03:10:29 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2016-08-19 21:32:27 +0200 |
commit | 67a84ce174851ed866b99737eec6bd0adfca6617 (patch) | |
tree | f906854216534af8ebb16ad7838fba32b9fabc14 /src/plugins | |
parent | 6cdb1e5ec2daa295b388d6c3a920b6cffe4193ce (diff) | |
download | hercules-67a84ce174851ed866b99737eec6bd0adfca6617.tar.gz hercules-67a84ce174851ed866b99737eec6bd0adfca6617.tar.bz2 hercules-67a84ce174851ed866b99737eec6bd0adfca6617.tar.xz hercules-67a84ce174851ed866b99737eec6bd0adfca6617.zip |
HPM Hooks Update
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/plugins')
4 files changed, 52 insertions, 18 deletions
diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index 5726bb010..4061bd4d4 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -198,12 +198,14 @@ typedef int64 (*HPMHOOK_pre_battle_add_mastery) (struct map_session_data **sd, s typedef int64 (*HPMHOOK_post_battle_add_mastery) (int64 retVal___, struct map_session_data *sd, struct block_list *target, int64 dmg, int type); typedef int (*HPMHOOK_pre_battle_calc_drain) (int64 *damage, int *rate, int *per); typedef int (*HPMHOOK_post_battle_calc_drain) (int retVal___, int64 damage, int rate, int per); -typedef int (*HPMHOOK_pre_battle_config_read) (const char **cfgName); -typedef int (*HPMHOOK_post_battle_config_read) (int retVal___, const char *cfgName); +typedef bool (*HPMHOOK_pre_battle_config_read) (const char **filename, bool *imported); +typedef bool (*HPMHOOK_post_battle_config_read) (bool retVal___, const char *filename, bool imported); typedef void (*HPMHOOK_pre_battle_config_set_defaults) (void); typedef void (*HPMHOOK_post_battle_config_set_defaults) (void); -typedef int (*HPMHOOK_pre_battle_config_set_value) (const char **w1, const char **w2); -typedef int (*HPMHOOK_post_battle_config_set_value) (int retVal___, const char *w1, const char *w2); +typedef bool (*HPMHOOK_pre_battle_config_set_value_sub) (int *index, int *value); +typedef bool (*HPMHOOK_post_battle_config_set_value_sub) (bool retVal___, int index, int value); +typedef bool (*HPMHOOK_pre_battle_config_set_value) (const char **param, const char **value); +typedef bool (*HPMHOOK_post_battle_config_set_value) (bool retVal___, const char *param, const char *value); typedef bool (*HPMHOOK_pre_battle_config_get_value) (const char **w1, int **value); typedef bool (*HPMHOOK_post_battle_config_get_value) (bool retVal___, const char *w1, int *value); typedef void (*HPMHOOK_pre_battle_config_adjust) (void); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 4f8e2a7e0..0845d8cdd 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -198,6 +198,8 @@ struct { struct HPMHookPoint *HP_battle_config_read_post; struct HPMHookPoint *HP_battle_config_set_defaults_pre; struct HPMHookPoint *HP_battle_config_set_defaults_post; + struct HPMHookPoint *HP_battle_config_set_value_sub_pre; + struct HPMHookPoint *HP_battle_config_set_value_sub_post; struct HPMHookPoint *HP_battle_config_set_value_pre; struct HPMHookPoint *HP_battle_config_set_value_post; struct HPMHookPoint *HP_battle_config_get_value_pre; @@ -6251,6 +6253,8 @@ struct { int HP_battle_config_read_post; int HP_battle_config_set_defaults_pre; int HP_battle_config_set_defaults_post; + int HP_battle_config_set_value_sub_pre; + int HP_battle_config_set_value_sub_post; int HP_battle_config_set_value_pre; int HP_battle_config_set_value_post; int HP_battle_config_get_value_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 7e164f800..30ede196a 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -115,6 +115,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(battle->calc_drain, HP_battle_calc_drain) }, { HP_POP(battle->config_read, HP_battle_config_read) }, { HP_POP(battle->config_set_defaults, HP_battle_config_set_defaults) }, + { HP_POP(battle->config_set_value_sub, HP_battle_config_set_value_sub) }, { HP_POP(battle->config_set_value, HP_battle_config_set_value) }, { HP_POP(battle->config_get_value, HP_battle_config_get_value) }, { HP_POP(battle->config_adjust, HP_battle_config_adjust) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 6b4f97f53..819c3b28c 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -2335,15 +2335,15 @@ int HP_battle_calc_drain(int64 damage, int rate, int per) { } return retVal___; } -int HP_battle_config_read(const char *cfgName) { +bool HP_battle_config_read(const char *filename, bool imported) { int hIndex = 0; - int retVal___ = 0; + bool retVal___ = false; if( HPMHooks.count.HP_battle_config_read_pre ) { - int (*preHookFunc) (const char **cfgName); + bool (*preHookFunc) (const char **filename, bool *imported); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_battle_config_read_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_battle_config_read_pre[hIndex].func; - retVal___ = preHookFunc(&cfgName); + retVal___ = preHookFunc(&filename, &imported); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -2351,13 +2351,13 @@ int HP_battle_config_read(const char *cfgName) { } } { - retVal___ = HPMHooks.source.battle.config_read(cfgName); + retVal___ = HPMHooks.source.battle.config_read(filename, imported); } if( HPMHooks.count.HP_battle_config_read_post ) { - int (*postHookFunc) (int retVal___, const char *cfgName); + bool (*postHookFunc) (bool retVal___, const char *filename, bool imported); for(hIndex = 0; hIndex < HPMHooks.count.HP_battle_config_read_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_battle_config_read_post[hIndex].func; - retVal___ = postHookFunc(retVal___, cfgName); + retVal___ = postHookFunc(retVal___, filename, imported); } } return retVal___; @@ -2388,15 +2388,42 @@ void HP_battle_config_set_defaults(void) { } return; } -int HP_battle_config_set_value(const char *w1, const char *w2) { +bool HP_battle_config_set_value_sub(int index, int value) { int hIndex = 0; - int retVal___ = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_battle_config_set_value_sub_pre ) { + bool (*preHookFunc) (int *index, int *value); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_battle_config_set_value_sub_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_battle_config_set_value_sub_pre[hIndex].func; + retVal___ = preHookFunc(&index, &value); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.battle.config_set_value_sub(index, value); + } + if( HPMHooks.count.HP_battle_config_set_value_sub_post ) { + bool (*postHookFunc) (bool retVal___, int index, int value); + for(hIndex = 0; hIndex < HPMHooks.count.HP_battle_config_set_value_sub_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_battle_config_set_value_sub_post[hIndex].func; + retVal___ = postHookFunc(retVal___, index, value); + } + } + return retVal___; +} +bool HP_battle_config_set_value(const char *param, const char *value) { + int hIndex = 0; + bool retVal___ = false; if( HPMHooks.count.HP_battle_config_set_value_pre ) { - int (*preHookFunc) (const char **w1, const char **w2); + bool (*preHookFunc) (const char **param, const char **value); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_battle_config_set_value_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_battle_config_set_value_pre[hIndex].func; - retVal___ = preHookFunc(&w1, &w2); + retVal___ = preHookFunc(¶m, &value); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -2404,13 +2431,13 @@ int HP_battle_config_set_value(const char *w1, const char *w2) { } } { - retVal___ = HPMHooks.source.battle.config_set_value(w1, w2); + retVal___ = HPMHooks.source.battle.config_set_value(param, value); } if( HPMHooks.count.HP_battle_config_set_value_post ) { - int (*postHookFunc) (int retVal___, const char *w1, const char *w2); + bool (*postHookFunc) (bool retVal___, const char *param, const char *value); for(hIndex = 0; hIndex < HPMHooks.count.HP_battle_config_set_value_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_battle_config_set_value_post[hIndex].func; - retVal___ = postHookFunc(retVal___, w1, w2); + retVal___ = postHookFunc(retVal___, param, value); } } return retVal___; |