From 1b596933b1a6662be7e1692df00bf1122abc031f Mon Sep 17 00:00:00 2001 From: "Hercules.ws" Date: Tue, 3 Apr 2018 00:05:02 +0200 Subject: HPM Hooks Update Signed-off-by: HerculesWSAPI --- src/plugins/HPMHooking/HPMHooking.Defs.inc | 4 ++ .../HPMHooking/HPMHooking_map.HPMHooksCore.inc | 8 ++++ .../HPMHooking/HPMHooking_map.HookingPoints.inc | 2 + src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 52 ++++++++++++++++++++++ 4 files changed, 66 insertions(+) diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index bd17dc7fe..a71ab3ebf 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -2404,6 +2404,10 @@ typedef void (*HPMHOOK_pre_clif_clan_message) (struct clan **c, const char **mes typedef void (*HPMHOOK_post_clif_clan_message) (struct clan *c, const char *mes, int len); typedef void (*HPMHOOK_pre_clif_pClanMessage) (int *fd, struct map_session_data **sd); typedef void (*HPMHOOK_post_clif_pClanMessage) (int fd, struct map_session_data *sd); +typedef void (*HPMHOOK_pre_clif_hat_effect) (struct block_list **bl, struct block_list **tbl, enum send_target *target); +typedef void (*HPMHOOK_post_clif_hat_effect) (struct block_list *bl, struct block_list *tbl, enum send_target target); +typedef void (*HPMHOOK_pre_clif_hat_effect_single) (struct block_list **bl, uint16 *effectId, bool *enable); +typedef void (*HPMHOOK_post_clif_hat_effect_single) (struct block_list *bl, uint16 effectId, bool enable); #endif // MAP_CLIF_H #ifdef COMMON_CORE_H /* cmdline */ typedef void (*HPMHOOK_pre_cmdline_init) (void); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 9d531e370..905f6a65d 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -1998,6 +1998,10 @@ struct { struct HPMHookPoint *HP_clif_clan_message_post; struct HPMHookPoint *HP_clif_pClanMessage_pre; struct HPMHookPoint *HP_clif_pClanMessage_post; + struct HPMHookPoint *HP_clif_hat_effect_pre; + struct HPMHookPoint *HP_clif_hat_effect_post; + struct HPMHookPoint *HP_clif_hat_effect_single_pre; + struct HPMHookPoint *HP_clif_hat_effect_single_post; struct HPMHookPoint *HP_cmdline_init_pre; struct HPMHookPoint *HP_cmdline_init_post; struct HPMHookPoint *HP_cmdline_final_pre; @@ -8279,6 +8283,10 @@ struct { int HP_clif_clan_message_post; int HP_clif_pClanMessage_pre; int HP_clif_pClanMessage_post; + int HP_clif_hat_effect_pre; + int HP_clif_hat_effect_post; + int HP_clif_hat_effect_single_pre; + int HP_clif_hat_effect_single_post; int HP_cmdline_init_pre; int HP_cmdline_init_post; int HP_cmdline_final_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 5551668d2..39bca48e9 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -1022,6 +1022,8 @@ struct HookingPointData HookingPoints[] = { { HP_POP(clif->clan_leave, HP_clif_clan_leave) }, { HP_POP(clif->clan_message, HP_clif_clan_message) }, { HP_POP(clif->pClanMessage, HP_clif_pClanMessage) }, + { HP_POP(clif->hat_effect, HP_clif_hat_effect) }, + { HP_POP(clif->hat_effect_single, HP_clif_hat_effect_single) }, /* cmdline_interface */ { HP_POP(cmdline->init, HP_cmdline_init) }, { HP_POP(cmdline->final, HP_cmdline_final) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 2e20ab157..8fe407aab 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -26018,6 +26018,58 @@ void HP_clif_pClanMessage(int fd, struct map_session_data *sd) { } return; } +void HP_clif_hat_effect(struct block_list *bl, struct block_list *tbl, enum send_target target) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_hat_effect_pre > 0) { + void (*preHookFunc) (struct block_list **bl, struct block_list **tbl, enum send_target *target); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_hat_effect_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_hat_effect_pre[hIndex].func; + preHookFunc(&bl, &tbl, &target); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.hat_effect(bl, tbl, target); + } + if (HPMHooks.count.HP_clif_hat_effect_post > 0) { + void (*postHookFunc) (struct block_list *bl, struct block_list *tbl, enum send_target target); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_hat_effect_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_hat_effect_post[hIndex].func; + postHookFunc(bl, tbl, target); + } + } + return; +} +void HP_clif_hat_effect_single(struct block_list *bl, uint16 effectId, bool enable) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_hat_effect_single_pre > 0) { + void (*preHookFunc) (struct block_list **bl, uint16 *effectId, bool *enable); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_hat_effect_single_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_hat_effect_single_pre[hIndex].func; + preHookFunc(&bl, &effectId, &enable); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.hat_effect_single(bl, effectId, enable); + } + if (HPMHooks.count.HP_clif_hat_effect_single_post > 0) { + void (*postHookFunc) (struct block_list *bl, uint16 effectId, bool enable); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_hat_effect_single_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_hat_effect_single_post[hIndex].func; + postHookFunc(bl, effectId, enable); + } + } + return; +} /* cmdline_interface */ void HP_cmdline_init(void) { int hIndex = 0; -- cgit v1.2.3-60-g2f50