diff options
-rw-r--r-- | src/common/HPMDataCheck.h | 2 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc | 20 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc | 5 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 104 |
4 files changed, 114 insertions, 17 deletions
diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h index e5f482686..86fcb671d 100644 --- a/src/common/HPMDataCheck.h +++ b/src/common/HPMDataCheck.h @@ -532,6 +532,7 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { { "packet_bgqueue_revoke_req", sizeof(struct packet_bgqueue_revoke_req), SERVER_TYPE_MAP }, { "packet_bgqueue_update_info", sizeof(struct packet_bgqueue_update_info), SERVER_TYPE_MAP }, { "packet_cart_additem_ack", sizeof(struct packet_cart_additem_ack), SERVER_TYPE_MAP }, + { "packet_chat_message", sizeof(struct packet_chat_message), SERVER_TYPE_MAP }, { "packet_damage", sizeof(struct packet_damage), SERVER_TYPE_MAP }, { "packet_dropflooritem", sizeof(struct packet_dropflooritem), SERVER_TYPE_MAP }, { "packet_equip_item", sizeof(struct packet_equip_item), SERVER_TYPE_MAP }, @@ -574,6 +575,7 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { { "packet_unequipitem_ack", sizeof(struct packet_unequipitem_ack), SERVER_TYPE_MAP }, { "packet_unit_walking", sizeof(struct packet_unit_walking), SERVER_TYPE_MAP }, { "packet_viewequip_ack", sizeof(struct packet_viewequip_ack), SERVER_TYPE_MAP }, + { "packet_whisper_message", sizeof(struct packet_whisper_message), SERVER_TYPE_MAP }, { "packet_wis_end", sizeof(struct packet_wis_end), SERVER_TYPE_MAP }, #else #define MAP_PACKETS_STRUCT_H diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index a11e964c2..a1efd6f16 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -984,8 +984,10 @@ struct { struct HPMHookPoint *HP_clif_message_post; struct HPMHookPoint *HP_clif_messageln_pre; struct HPMHookPoint *HP_clif_messageln_post; - struct HPMHookPoint *HP_clif_process_message_pre; - struct HPMHookPoint *HP_clif_process_message_post; + struct HPMHookPoint *HP_clif_process_chat_message_pre; + struct HPMHookPoint *HP_clif_process_chat_message_post; + struct HPMHookPoint *HP_clif_process_whisper_message_pre; + struct HPMHookPoint *HP_clif_process_whisper_message_post; struct HPMHookPoint *HP_clif_wisexin_pre; struct HPMHookPoint *HP_clif_wisexin_post; struct HPMHookPoint *HP_clif_wisall_pre; @@ -4338,6 +4340,10 @@ struct { struct HPMHookPoint *HP_pc_db_checkid_post; struct HPMHookPoint *HP_pc_validate_levels_pre; struct HPMHookPoint *HP_pc_validate_levels_post; + struct HPMHookPoint *HP_pc_process_chat_message_pre; + struct HPMHookPoint *HP_pc_process_chat_message_post; + struct HPMHookPoint *HP_pc_check_supernovice_call_pre; + struct HPMHookPoint *HP_pc_check_supernovice_call_post; struct HPMHookPoint *HP_pc_autotrade_load_pre; struct HPMHookPoint *HP_pc_autotrade_load_post; struct HPMHookPoint *HP_pc_autotrade_update_pre; @@ -6867,8 +6873,10 @@ struct { int HP_clif_message_post; int HP_clif_messageln_pre; int HP_clif_messageln_post; - int HP_clif_process_message_pre; - int HP_clif_process_message_post; + int HP_clif_process_chat_message_pre; + int HP_clif_process_chat_message_post; + int HP_clif_process_whisper_message_pre; + int HP_clif_process_whisper_message_post; int HP_clif_wisexin_pre; int HP_clif_wisexin_post; int HP_clif_wisall_pre; @@ -10221,6 +10229,10 @@ struct { int HP_pc_db_checkid_post; int HP_pc_validate_levels_pre; int HP_pc_validate_levels_post; + int HP_pc_process_chat_message_pre; + int HP_pc_process_chat_message_post; + int HP_pc_check_supernovice_call_pre; + int HP_pc_check_supernovice_call_post; int HP_pc_autotrade_load_pre; int HP_pc_autotrade_load_post; int HP_pc_autotrade_update_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 8d9752849..2b29d14bb 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -512,7 +512,8 @@ struct HookingPointData HookingPoints[] = { { HP_POP(clif->msgtable_skill, HP_clif_msgtable_skill) }, { HP_POP(clif->message, HP_clif_message) }, { HP_POP(clif->messageln, HP_clif_messageln) }, - { HP_POP(clif->process_message, HP_clif_process_message) }, + { HP_POP(clif->process_chat_message, HP_clif_process_chat_message) }, + { HP_POP(clif->process_whisper_message, HP_clif_process_whisper_message) }, { HP_POP(clif->wisexin, HP_clif_wisexin) }, { HP_POP(clif->wisall, HP_clif_wisall) }, { HP_POP(clif->PMIgnoreList, HP_clif_PMIgnoreList) }, @@ -2219,6 +2220,8 @@ struct HookingPointData HookingPoints[] = { { HP_POP(pc->expire_check, HP_pc_expire_check) }, { HP_POP(pc->db_checkid, HP_pc_db_checkid) }, { HP_POP(pc->validate_levels, HP_pc_validate_levels) }, + { HP_POP(pc->process_chat_message, HP_pc_process_chat_message) }, + { HP_POP(pc->check_supernovice_call, HP_pc_check_supernovice_call) }, { HP_POP(pc->autotrade_load, HP_pc_autotrade_load) }, { HP_POP(pc->autotrade_update, HP_pc_autotrade_update) }, { HP_POP(pc->autotrade_start, HP_pc_autotrade_start) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index fa7b192c6..d867c9ed0 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -12820,15 +12820,42 @@ void HP_clif_messageln(const int fd, const char *mes) { } return; } -bool HP_clif_process_message(struct map_session_data *sd, int format, const char **name_, size_t *namelen_, const char **message_, size_t *messagelen_) { +const char* HP_clif_process_chat_message(struct map_session_data *sd, const struct packet_chat_message *packet, char *out_buf, int out_buflen) { + int hIndex = 0; + const char* retVal___ = NULL; + if( HPMHooks.count.HP_clif_process_chat_message_pre ) { + const char* (*preHookFunc) (struct map_session_data *sd, const struct packet_chat_message *packet, char *out_buf, int *out_buflen); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_process_chat_message_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_clif_process_chat_message_pre[hIndex].func; + retVal___ = preHookFunc(sd, packet, out_buf, &out_buflen); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.clif.process_chat_message(sd, packet, out_buf, out_buflen); + } + if( HPMHooks.count.HP_clif_process_chat_message_post ) { + const char* (*postHookFunc) (const char* retVal___, struct map_session_data *sd, const struct packet_chat_message *packet, char *out_buf, int *out_buflen); + for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_process_chat_message_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_clif_process_chat_message_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd, packet, out_buf, &out_buflen); + } + } + return retVal___; +} +bool HP_clif_process_whisper_message(struct map_session_data *sd, const struct packet_whisper_message *packet, char *out_name, char *out_message, int out_messagelen) { int hIndex = 0; bool retVal___ = false; - if( HPMHooks.count.HP_clif_process_message_pre ) { - bool (*preHookFunc) (struct map_session_data *sd, int *format, const char **name_, size_t *namelen_, const char **message_, size_t *messagelen_); + if( HPMHooks.count.HP_clif_process_whisper_message_pre ) { + bool (*preHookFunc) (struct map_session_data *sd, const struct packet_whisper_message *packet, char *out_name, char *out_message, int *out_messagelen); *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_process_message_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_clif_process_message_pre[hIndex].func; - retVal___ = preHookFunc(sd, &format, name_, namelen_, message_, messagelen_); + for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_process_whisper_message_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_clif_process_whisper_message_pre[hIndex].func; + retVal___ = preHookFunc(sd, packet, out_name, out_message, &out_messagelen); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -12836,13 +12863,13 @@ bool HP_clif_process_message(struct map_session_data *sd, int format, const char } } { - retVal___ = HPMHooks.source.clif.process_message(sd, format, name_, namelen_, message_, messagelen_); + retVal___ = HPMHooks.source.clif.process_whisper_message(sd, packet, out_name, out_message, out_messagelen); } - if( HPMHooks.count.HP_clif_process_message_post ) { - bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, int *format, const char **name_, size_t *namelen_, const char **message_, size_t *messagelen_); - for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_process_message_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_clif_process_message_post[hIndex].func; - retVal___ = postHookFunc(retVal___, sd, &format, name_, namelen_, message_, messagelen_); + if( HPMHooks.count.HP_clif_process_whisper_message_post ) { + bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, const struct packet_whisper_message *packet, char *out_name, char *out_message, int *out_messagelen); + for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_process_whisper_message_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_clif_process_whisper_message_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd, packet, out_name, out_message, &out_messagelen); } } return retVal___; @@ -57836,6 +57863,59 @@ void HP_pc_validate_levels(void) { } return; } +bool HP_pc_process_chat_message(struct map_session_data *sd, const char *message) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_pc_process_chat_message_pre ) { + bool (*preHookFunc) (struct map_session_data *sd, const char *message); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_process_chat_message_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_pc_process_chat_message_pre[hIndex].func; + retVal___ = preHookFunc(sd, message); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.pc.process_chat_message(sd, message); + } + if( HPMHooks.count.HP_pc_process_chat_message_post ) { + bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, const char *message); + for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_process_chat_message_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_pc_process_chat_message_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd, message); + } + } + return retVal___; +} +void HP_pc_check_supernovice_call(struct map_session_data *sd, const char *message) { + int hIndex = 0; + if( HPMHooks.count.HP_pc_check_supernovice_call_pre ) { + void (*preHookFunc) (struct map_session_data *sd, const char *message); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_check_supernovice_call_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_pc_check_supernovice_call_pre[hIndex].func; + preHookFunc(sd, message); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.pc.check_supernovice_call(sd, message); + } + if( HPMHooks.count.HP_pc_check_supernovice_call_post ) { + void (*postHookFunc) (struct map_session_data *sd, const char *message); + for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_check_supernovice_call_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_pc_check_supernovice_call_post[hIndex].func; + postHookFunc(sd, message); + } + } + return; +} void HP_pc_autotrade_load(void) { int hIndex = 0; if( HPMHooks.count.HP_pc_autotrade_load_pre ) { |