From efc15c571e224df54b2696aaa501115fc9f23a01 Mon Sep 17 00:00:00 2001 From: "Hercules.ws" Date: Mon, 4 Jun 2018 01:53:04 +0200 Subject: HPM Hooks Update Signed-off-by: HerculesWSAPI --- src/common/HPMDataCheck.h | 3 + src/plugins/HPMHooking/HPMHooking.Defs.inc | 18 ++ .../HPMHooking/HPMHooking_map.HPMHooksCore.inc | 36 ++++ .../HPMHooking/HPMHooking_map.HookingPoints.inc | 9 + src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 237 +++++++++++++++++++++ 5 files changed, 303 insertions(+) (limited to 'src') diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h index e82f9fed3..8df39df02 100644 --- a/src/common/HPMDataCheck.h +++ b/src/common/HPMDataCheck.h @@ -432,6 +432,7 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { { "hCSData", sizeof(struct hCSData), SERVER_TYPE_MAP }, { "merge_item", sizeof(struct merge_item), SERVER_TYPE_MAP }, { "s_packet_db", sizeof(struct s_packet_db), SERVER_TYPE_MAP }, + { "stylist_data_entry", sizeof(struct stylist_data_entry), SERVER_TYPE_MAP }, #else #define MAP_CLIF_H #endif // MAP_CLIF_H @@ -596,6 +597,7 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { { "PACKET_CZ_REQ_READ_MAIL", sizeof(struct PACKET_CZ_REQ_READ_MAIL), SERVER_TYPE_MAP }, { "PACKET_CZ_REQ_REFRESH_MAIL_LIST", sizeof(struct PACKET_CZ_REQ_REFRESH_MAIL_LIST), SERVER_TYPE_MAP }, { "PACKET_CZ_REQ_REMOVE_ITEM_MAIL", sizeof(struct PACKET_CZ_REQ_REMOVE_ITEM_MAIL), SERVER_TYPE_MAP }, + { "PACKET_CZ_REQ_STYLE_CHANGE", sizeof(struct PACKET_CZ_REQ_STYLE_CHANGE), SERVER_TYPE_MAP }, { "PACKET_CZ_REQ_ZENY_FROM_MAIL", sizeof(struct PACKET_CZ_REQ_ZENY_FROM_MAIL), SERVER_TYPE_MAP }, { "PACKET_CZ_SEND_MAIL", sizeof(struct PACKET_CZ_SEND_MAIL), SERVER_TYPE_MAP }, { "PACKET_ZC_ACK_CLAN_LEAVE", sizeof(struct PACKET_ZC_ACK_CLAN_LEAVE), SERVER_TYPE_MAP }, @@ -620,6 +622,7 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { { "PACKET_ZC_PRIVATE_AIRSHIP_RESPONSE", sizeof(struct PACKET_ZC_PRIVATE_AIRSHIP_RESPONSE), SERVER_TYPE_MAP }, { "PACKET_ZC_READ_MAIL", sizeof(struct PACKET_ZC_READ_MAIL), SERVER_TYPE_MAP }, { "PACKET_ZC_SKILL_SCALE", sizeof(struct PACKET_ZC_SKILL_SCALE), SERVER_TYPE_MAP }, + { "PACKET_ZC_STYLE_CHANGE_RES", sizeof(struct PACKET_ZC_STYLE_CHANGE_RES), SERVER_TYPE_MAP }, { "PACKET_ZC_UI_ACTION", sizeof(struct PACKET_ZC_UI_ACTION), SERVER_TYPE_MAP }, { "PACKET_ZC_WRITE_MAIL_RESULT", sizeof(struct PACKET_ZC_WRITE_MAIL_RESULT), SERVER_TYPE_MAP }, { "ZC_PROGRESS_ACTOR", sizeof(struct ZC_PROGRESS_ACTOR), SERVER_TYPE_MAP }, diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index 1884507b2..8f4f181fb 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -2432,6 +2432,24 @@ typedef void (*HPMHOOK_pre_clif_pPrivateAirshipRequest) (int *fd, struct map_ses typedef void (*HPMHOOK_post_clif_pPrivateAirshipRequest) (int fd, struct map_session_data *sd); typedef void (*HPMHOOK_pre_clif_PrivateAirshipResponse) (struct map_session_data **sd, uint32 *flag); typedef void (*HPMHOOK_post_clif_PrivateAirshipResponse) (struct map_session_data *sd, uint32 flag); +typedef void (*HPMHOOK_pre_clif_stylist_vector_init) (void); +typedef void (*HPMHOOK_post_clif_stylist_vector_init) (void); +typedef void (*HPMHOOK_pre_clif_stylist_vector_clear) (void); +typedef void (*HPMHOOK_post_clif_stylist_vector_clear) (void); +typedef bool (*HPMHOOK_pre_clif_stylist_read_db_libconfig) (void); +typedef bool (*HPMHOOK_post_clif_stylist_read_db_libconfig) (bool retVal___); +typedef bool (*HPMHOOK_pre_clif_stylist_read_db_libconfig_sub) (struct config_setting_t **it, int *idx, const char **source); +typedef bool (*HPMHOOK_post_clif_stylist_read_db_libconfig_sub) (bool retVal___, struct config_setting_t *it, int idx, const char *source); +typedef bool (*HPMHOOK_pre_clif_style_change_validate_requirements) (struct map_session_data **sd, int *type, int16 *idx); +typedef bool (*HPMHOOK_post_clif_style_change_validate_requirements) (bool retVal___, struct map_session_data *sd, int type, int16 idx); +typedef void (*HPMHOOK_pre_clif_stylist_send_rodexitem) (struct map_session_data **sd, int16 *itemid); +typedef void (*HPMHOOK_post_clif_stylist_send_rodexitem) (struct map_session_data *sd, int16 itemid); +typedef void (*HPMHOOK_pre_clif_pReqStyleChange) (int *fd, struct map_session_data **sd); +typedef void (*HPMHOOK_post_clif_pReqStyleChange) (int fd, struct map_session_data *sd); +typedef void (*HPMHOOK_pre_clif_cz_req_style_change_sub) (struct map_session_data **sd, int *type, int16 *idx, bool *isitem); +typedef void (*HPMHOOK_post_clif_cz_req_style_change_sub) (struct map_session_data *sd, int type, int16 idx, bool isitem); +typedef void (*HPMHOOK_pre_clif_style_change_response) (struct map_session_data **sd, int8 *flag); +typedef void (*HPMHOOK_post_clif_style_change_response) (struct map_session_data *sd, int8 flag); #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 5c8fc9d68..d17955db7 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -2028,6 +2028,24 @@ struct { struct HPMHookPoint *HP_clif_pPrivateAirshipRequest_post; struct HPMHookPoint *HP_clif_PrivateAirshipResponse_pre; struct HPMHookPoint *HP_clif_PrivateAirshipResponse_post; + struct HPMHookPoint *HP_clif_stylist_vector_init_pre; + struct HPMHookPoint *HP_clif_stylist_vector_init_post; + struct HPMHookPoint *HP_clif_stylist_vector_clear_pre; + struct HPMHookPoint *HP_clif_stylist_vector_clear_post; + struct HPMHookPoint *HP_clif_stylist_read_db_libconfig_pre; + struct HPMHookPoint *HP_clif_stylist_read_db_libconfig_post; + struct HPMHookPoint *HP_clif_stylist_read_db_libconfig_sub_pre; + struct HPMHookPoint *HP_clif_stylist_read_db_libconfig_sub_post; + struct HPMHookPoint *HP_clif_style_change_validate_requirements_pre; + struct HPMHookPoint *HP_clif_style_change_validate_requirements_post; + struct HPMHookPoint *HP_clif_stylist_send_rodexitem_pre; + struct HPMHookPoint *HP_clif_stylist_send_rodexitem_post; + struct HPMHookPoint *HP_clif_pReqStyleChange_pre; + struct HPMHookPoint *HP_clif_pReqStyleChange_post; + struct HPMHookPoint *HP_clif_cz_req_style_change_sub_pre; + struct HPMHookPoint *HP_clif_cz_req_style_change_sub_post; + struct HPMHookPoint *HP_clif_style_change_response_pre; + struct HPMHookPoint *HP_clif_style_change_response_post; struct HPMHookPoint *HP_cmdline_init_pre; struct HPMHookPoint *HP_cmdline_init_post; struct HPMHookPoint *HP_cmdline_final_pre; @@ -8385,6 +8403,24 @@ struct { int HP_clif_pPrivateAirshipRequest_post; int HP_clif_PrivateAirshipResponse_pre; int HP_clif_PrivateAirshipResponse_post; + int HP_clif_stylist_vector_init_pre; + int HP_clif_stylist_vector_init_post; + int HP_clif_stylist_vector_clear_pre; + int HP_clif_stylist_vector_clear_post; + int HP_clif_stylist_read_db_libconfig_pre; + int HP_clif_stylist_read_db_libconfig_post; + int HP_clif_stylist_read_db_libconfig_sub_pre; + int HP_clif_stylist_read_db_libconfig_sub_post; + int HP_clif_style_change_validate_requirements_pre; + int HP_clif_style_change_validate_requirements_post; + int HP_clif_stylist_send_rodexitem_pre; + int HP_clif_stylist_send_rodexitem_post; + int HP_clif_pReqStyleChange_pre; + int HP_clif_pReqStyleChange_post; + int HP_clif_cz_req_style_change_sub_pre; + int HP_clif_cz_req_style_change_sub_post; + int HP_clif_style_change_response_pre; + int HP_clif_style_change_response_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 64f9a39e0..c9463b1b8 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -1037,6 +1037,15 @@ struct HookingPointData HookingPoints[] = { { HP_POP(clif->ui_action, HP_clif_ui_action) }, { HP_POP(clif->pPrivateAirshipRequest, HP_clif_pPrivateAirshipRequest) }, { HP_POP(clif->PrivateAirshipResponse, HP_clif_PrivateAirshipResponse) }, + { HP_POP(clif->stylist_vector_init, HP_clif_stylist_vector_init) }, + { HP_POP(clif->stylist_vector_clear, HP_clif_stylist_vector_clear) }, + { HP_POP(clif->stylist_read_db_libconfig, HP_clif_stylist_read_db_libconfig) }, + { HP_POP(clif->stylist_read_db_libconfig_sub, HP_clif_stylist_read_db_libconfig_sub) }, + { HP_POP(clif->style_change_validate_requirements, HP_clif_style_change_validate_requirements) }, + { HP_POP(clif->stylist_send_rodexitem, HP_clif_stylist_send_rodexitem) }, + { HP_POP(clif->pReqStyleChange, HP_clif_pReqStyleChange) }, + { HP_POP(clif->cz_req_style_change_sub, HP_clif_cz_req_style_change_sub) }, + { HP_POP(clif->style_change_response, HP_clif_style_change_response) }, /* 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 e39dc4c2c..d81042493 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -26412,6 +26412,243 @@ void HP_clif_PrivateAirshipResponse(struct map_session_data *sd, uint32 flag) { } return; } +void HP_clif_stylist_vector_init(void) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_stylist_vector_init_pre > 0) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_stylist_vector_init_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_stylist_vector_init_pre[hIndex].func; + preHookFunc(); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.stylist_vector_init(); + } + if (HPMHooks.count.HP_clif_stylist_vector_init_post > 0) { + void (*postHookFunc) (void); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_stylist_vector_init_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_stylist_vector_init_post[hIndex].func; + postHookFunc(); + } + } + return; +} +void HP_clif_stylist_vector_clear(void) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_stylist_vector_clear_pre > 0) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_stylist_vector_clear_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_stylist_vector_clear_pre[hIndex].func; + preHookFunc(); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.stylist_vector_clear(); + } + if (HPMHooks.count.HP_clif_stylist_vector_clear_post > 0) { + void (*postHookFunc) (void); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_stylist_vector_clear_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_stylist_vector_clear_post[hIndex].func; + postHookFunc(); + } + } + return; +} +bool HP_clif_stylist_read_db_libconfig(void) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_clif_stylist_read_db_libconfig_pre > 0) { + bool (*preHookFunc) (void); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_stylist_read_db_libconfig_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_stylist_read_db_libconfig_pre[hIndex].func; + retVal___ = preHookFunc(); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.clif.stylist_read_db_libconfig(); + } + if (HPMHooks.count.HP_clif_stylist_read_db_libconfig_post > 0) { + bool (*postHookFunc) (bool retVal___); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_stylist_read_db_libconfig_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_stylist_read_db_libconfig_post[hIndex].func; + retVal___ = postHookFunc(retVal___); + } + } + return retVal___; +} +bool HP_clif_stylist_read_db_libconfig_sub(struct config_setting_t *it, int idx, const char *source) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_clif_stylist_read_db_libconfig_sub_pre > 0) { + bool (*preHookFunc) (struct config_setting_t **it, int *idx, const char **source); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_stylist_read_db_libconfig_sub_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_stylist_read_db_libconfig_sub_pre[hIndex].func; + retVal___ = preHookFunc(&it, &idx, &source); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.clif.stylist_read_db_libconfig_sub(it, idx, source); + } + if (HPMHooks.count.HP_clif_stylist_read_db_libconfig_sub_post > 0) { + bool (*postHookFunc) (bool retVal___, struct config_setting_t *it, int idx, const char *source); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_stylist_read_db_libconfig_sub_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_stylist_read_db_libconfig_sub_post[hIndex].func; + retVal___ = postHookFunc(retVal___, it, idx, source); + } + } + return retVal___; +} +bool HP_clif_style_change_validate_requirements(struct map_session_data *sd, int type, int16 idx) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_clif_style_change_validate_requirements_pre > 0) { + bool (*preHookFunc) (struct map_session_data **sd, int *type, int16 *idx); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_style_change_validate_requirements_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_style_change_validate_requirements_pre[hIndex].func; + retVal___ = preHookFunc(&sd, &type, &idx); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.clif.style_change_validate_requirements(sd, type, idx); + } + if (HPMHooks.count.HP_clif_style_change_validate_requirements_post > 0) { + bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, int type, int16 idx); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_style_change_validate_requirements_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_style_change_validate_requirements_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd, type, idx); + } + } + return retVal___; +} +void HP_clif_stylist_send_rodexitem(struct map_session_data *sd, int16 itemid) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_stylist_send_rodexitem_pre > 0) { + void (*preHookFunc) (struct map_session_data **sd, int16 *itemid); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_stylist_send_rodexitem_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_stylist_send_rodexitem_pre[hIndex].func; + preHookFunc(&sd, &itemid); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.stylist_send_rodexitem(sd, itemid); + } + if (HPMHooks.count.HP_clif_stylist_send_rodexitem_post > 0) { + void (*postHookFunc) (struct map_session_data *sd, int16 itemid); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_stylist_send_rodexitem_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_stylist_send_rodexitem_post[hIndex].func; + postHookFunc(sd, itemid); + } + } + return; +} +void HP_clif_pReqStyleChange(int fd, struct map_session_data *sd) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_pReqStyleChange_pre > 0) { + void (*preHookFunc) (int *fd, struct map_session_data **sd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pReqStyleChange_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_pReqStyleChange_pre[hIndex].func; + preHookFunc(&fd, &sd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.pReqStyleChange(fd, sd); + } + if (HPMHooks.count.HP_clif_pReqStyleChange_post > 0) { + void (*postHookFunc) (int fd, struct map_session_data *sd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pReqStyleChange_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_pReqStyleChange_post[hIndex].func; + postHookFunc(fd, sd); + } + } + return; +} +void HP_clif_cz_req_style_change_sub(struct map_session_data *sd, int type, int16 idx, bool isitem) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_cz_req_style_change_sub_pre > 0) { + void (*preHookFunc) (struct map_session_data **sd, int *type, int16 *idx, bool *isitem); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_cz_req_style_change_sub_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_cz_req_style_change_sub_pre[hIndex].func; + preHookFunc(&sd, &type, &idx, &isitem); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.cz_req_style_change_sub(sd, type, idx, isitem); + } + if (HPMHooks.count.HP_clif_cz_req_style_change_sub_post > 0) { + void (*postHookFunc) (struct map_session_data *sd, int type, int16 idx, bool isitem); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_cz_req_style_change_sub_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_cz_req_style_change_sub_post[hIndex].func; + postHookFunc(sd, type, idx, isitem); + } + } + return; +} +void HP_clif_style_change_response(struct map_session_data *sd, int8 flag) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_style_change_response_pre > 0) { + void (*preHookFunc) (struct map_session_data **sd, int8 *flag); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_style_change_response_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_style_change_response_pre[hIndex].func; + preHookFunc(&sd, &flag); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.style_change_response(sd, flag); + } + if (HPMHooks.count.HP_clif_style_change_response_post > 0) { + void (*postHookFunc) (struct map_session_data *sd, int8 flag); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_style_change_response_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_style_change_response_post[hIndex].func; + postHookFunc(sd, flag); + } + } + return; +} /* cmdline_interface */ void HP_cmdline_init(void) { int hIndex = 0; -- cgit v1.2.3-60-g2f50