From a7f67d0513cc6f55056a37d2f6ae55bcf58af174 Mon Sep 17 00:00:00 2001 From: "Hercules.ws" Date: Sat, 19 Oct 2019 16:47:07 +0200 Subject: [PATCH] HPM Hooks Update Signed-off-by: HerculesWSAPI --- src/plugins/HPMHooking/HPMHooking.Defs.inc | 2 ++ .../HPMHooking_map.HPMHooksCore.inc | 4 +++ .../HPMHooking_map.HookingPoints.inc | 1 + .../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 0f76ba4b044..31e0ca5366c 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -5348,6 +5348,8 @@ typedef int (*HPMHOOK_pre_mob_ai_sub_hard_lootsearch) (struct block_list **bl, v typedef int (*HPMHOOK_post_mob_ai_sub_hard_lootsearch) (int retVal___, struct block_list *bl, va_list ap); typedef int (*HPMHOOK_pre_mob_warpchase_sub) (struct block_list **bl, va_list ap); typedef int (*HPMHOOK_post_mob_warpchase_sub) (int retVal___, struct block_list *bl, va_list ap); +typedef bool (*HPMHOOK_pre_mob_is_in_battle_state) (const struct mob_data **md); +typedef bool (*HPMHOOK_post_mob_is_in_battle_state) (bool retVal___, const struct mob_data *md); typedef int (*HPMHOOK_pre_mob_ai_sub_hard_slavemob) (struct mob_data **md, int64 *tick); typedef int (*HPMHOOK_post_mob_ai_sub_hard_slavemob) (int retVal___, struct mob_data *md, int64 tick); typedef int (*HPMHOOK_pre_mob_unlocktarget) (struct mob_data **md, int64 *tick); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 266ca74f3c8..42ab189f1ca 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -3950,6 +3950,8 @@ struct { struct HPMHookPoint *HP_mob_ai_sub_hard_lootsearch_post; struct HPMHookPoint *HP_mob_warpchase_sub_pre; struct HPMHookPoint *HP_mob_warpchase_sub_post; + struct HPMHookPoint *HP_mob_is_in_battle_state_pre; + struct HPMHookPoint *HP_mob_is_in_battle_state_post; struct HPMHookPoint *HP_mob_ai_sub_hard_slavemob_pre; struct HPMHookPoint *HP_mob_ai_sub_hard_slavemob_post; struct HPMHookPoint *HP_mob_unlocktarget_pre; @@ -10769,6 +10771,8 @@ struct { int HP_mob_ai_sub_hard_lootsearch_post; int HP_mob_warpchase_sub_pre; int HP_mob_warpchase_sub_post; + int HP_mob_is_in_battle_state_pre; + int HP_mob_is_in_battle_state_post; int HP_mob_ai_sub_hard_slavemob_pre; int HP_mob_ai_sub_hard_slavemob_post; int HP_mob_unlocktarget_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 712cd4168ef..e6dcdec4263 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -2024,6 +2024,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(mob->ai_sub_hard_bg_ally, HP_mob_ai_sub_hard_bg_ally) }, { HP_POP(mob->ai_sub_hard_lootsearch, HP_mob_ai_sub_hard_lootsearch) }, { HP_POP(mob->warpchase_sub, HP_mob_warpchase_sub) }, + { HP_POP(mob->is_in_battle_state, HP_mob_is_in_battle_state) }, { HP_POP(mob->ai_sub_hard_slavemob, HP_mob_ai_sub_hard_slavemob) }, { HP_POP(mob->unlocktarget, HP_mob_unlocktarget) }, { HP_POP(mob->randomwalk, HP_mob_randomwalk) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 7a817f45d82..8eefa292aeb 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -52322,6 +52322,33 @@ int HP_mob_warpchase_sub(struct block_list *bl, va_list ap) { } return retVal___; } +bool HP_mob_is_in_battle_state(const struct mob_data *md) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_mob_is_in_battle_state_pre > 0) { + bool (*preHookFunc) (const struct mob_data **md); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_mob_is_in_battle_state_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_mob_is_in_battle_state_pre[hIndex].func; + retVal___ = preHookFunc(&md); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mob.is_in_battle_state(md); + } + if (HPMHooks.count.HP_mob_is_in_battle_state_post > 0) { + bool (*postHookFunc) (bool retVal___, const struct mob_data *md); + for (hIndex = 0; hIndex < HPMHooks.count.HP_mob_is_in_battle_state_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_mob_is_in_battle_state_post[hIndex].func; + retVal___ = postHookFunc(retVal___, md); + } + } + return retVal___; +} int HP_mob_ai_sub_hard_slavemob(struct mob_data *md, int64 tick) { int hIndex = 0; int retVal___ = 0;