From d27eea4b5c112ab0209045ad65989697899dced0 Mon Sep 17 00:00:00 2001 From: "Hercules.ws" Date: Sat, 25 Apr 2015 19:13:46 +0200 Subject: HPM Hooks Update Signed-off-by: HerculesWSAPI --- .../HPMHooking/HPMHooking_char.HPMHooksCore.inc | 8 ++++ .../HPMHooking/HPMHooking_char.HookingPoints.inc | 2 + src/plugins/HPMHooking/HPMHooking_char.Hooks.inc | 54 ++++++++++++++++++++++ src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 12 ++--- 4 files changed, 70 insertions(+), 6 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc index e2838b610..09d6ce1b6 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc @@ -39,6 +39,8 @@ struct { struct HPMHookPoint *HP_chr_memitemdata_to_sql_post; struct HPMHookPoint *HP_chr_inventory_to_sql_pre; struct HPMHookPoint *HP_chr_inventory_to_sql_post; + struct HPMHookPoint *HP_chr_mmo_gender_pre; + struct HPMHookPoint *HP_chr_mmo_gender_post; struct HPMHookPoint *HP_chr_mmo_chars_fromsql_pre; struct HPMHookPoint *HP_chr_mmo_chars_fromsql_post; struct HPMHookPoint *HP_chr_mmo_char_fromsql_pre; @@ -173,6 +175,8 @@ struct { struct HPMHookPoint *HP_chr_unban_post; struct HPMHookPoint *HP_chr_ask_name_ack_pre; struct HPMHookPoint *HP_chr_ask_name_ack_post; + struct HPMHookPoint *HP_chr_changecharsex_pre; + struct HPMHookPoint *HP_chr_changecharsex_post; struct HPMHookPoint *HP_chr_parse_frommap_change_account_pre; struct HPMHookPoint *HP_chr_parse_frommap_change_account_post; struct HPMHookPoint *HP_chr_parse_frommap_fame_list_pre; @@ -934,6 +938,8 @@ struct { int HP_chr_memitemdata_to_sql_post; int HP_chr_inventory_to_sql_pre; int HP_chr_inventory_to_sql_post; + int HP_chr_mmo_gender_pre; + int HP_chr_mmo_gender_post; int HP_chr_mmo_chars_fromsql_pre; int HP_chr_mmo_chars_fromsql_post; int HP_chr_mmo_char_fromsql_pre; @@ -1068,6 +1074,8 @@ struct { int HP_chr_unban_post; int HP_chr_ask_name_ack_pre; int HP_chr_ask_name_ack_post; + int HP_chr_changecharsex_pre; + int HP_chr_changecharsex_post; int HP_chr_parse_frommap_change_account_pre; int HP_chr_parse_frommap_change_account_post; int HP_chr_parse_frommap_fame_list_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc index aa279dbb4..631544248 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc @@ -23,6 +23,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(chr->mmo_char_tosql, HP_chr_mmo_char_tosql) }, { HP_POP(chr->memitemdata_to_sql, HP_chr_memitemdata_to_sql) }, { HP_POP(chr->inventory_to_sql, HP_chr_inventory_to_sql) }, + { HP_POP(chr->mmo_gender, HP_chr_mmo_gender) }, { HP_POP(chr->mmo_chars_fromsql, HP_chr_mmo_chars_fromsql) }, { HP_POP(chr->mmo_char_fromsql, HP_chr_mmo_char_fromsql) }, { HP_POP(chr->mmo_char_sql_init, HP_chr_mmo_char_sql_init) }, @@ -90,6 +91,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(chr->ban, HP_chr_ban) }, { HP_POP(chr->unban, HP_chr_unban) }, { HP_POP(chr->ask_name_ack, HP_chr_ask_name_ack) }, + { HP_POP(chr->changecharsex, HP_chr_changecharsex) }, { HP_POP(chr->parse_frommap_change_account, HP_chr_parse_frommap_change_account) }, { HP_POP(chr->parse_frommap_fame_list, HP_chr_parse_frommap_fame_list) }, { HP_POP(chr->parse_frommap_divorce_char, HP_chr_parse_frommap_divorce_char) }, diff --git a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc index ffa2cd7e2..d1bff9280 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc @@ -482,6 +482,33 @@ int HP_chr_inventory_to_sql(const struct item items[], int max, int id) { } return retVal___; } +int HP_chr_mmo_gender(const struct char_session_data *sd, const struct mmo_charstatus *p, char sex) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_mmo_gender_pre ) { + int (*preHookFunc) (const struct char_session_data *sd, const struct mmo_charstatus *p, char *sex); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_mmo_gender_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_mmo_gender_pre[hIndex].func; + retVal___ = preHookFunc(sd, p, &sex); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.mmo_gender(sd, p, sex); + } + if( HPMHooks.count.HP_chr_mmo_gender_post ) { + int (*postHookFunc) (int retVal___, const struct char_session_data *sd, const struct mmo_charstatus *p, char *sex); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_mmo_gender_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_mmo_gender_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd, p, &sex); + } + } + return retVal___; +} int HP_chr_mmo_chars_fromsql(struct char_session_data *sd, uint8 *buf) { int hIndex = 0; int retVal___ = 0; @@ -2244,6 +2271,33 @@ void HP_chr_ask_name_ack(int fd, int acc, const char *name, int type, int result } return; } +int HP_chr_changecharsex(int char_id, int sex) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_chr_changecharsex_pre ) { + int (*preHookFunc) (int *char_id, int *sex); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_changecharsex_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chr_changecharsex_pre[hIndex].func; + retVal___ = preHookFunc(&char_id, &sex); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.chr.changecharsex(char_id, sex); + } + if( HPMHooks.count.HP_chr_changecharsex_post ) { + int (*postHookFunc) (int retVal___, int *char_id, int *sex); + for(hIndex = 0; hIndex < HPMHooks.count.HP_chr_changecharsex_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chr_changecharsex_post[hIndex].func; + retVal___ = postHookFunc(retVal___, &char_id, &sex); + } + } + return retVal___; +} void HP_chr_parse_frommap_change_account(int fd) { int hIndex = 0; if( HPMHooks.count.HP_chr_parse_frommap_change_account_pre ) { diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 42e6a574d..eddcad0d4 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -5187,15 +5187,15 @@ bool HP_chrif_char_online(struct map_session_data *sd) { } return retVal___; } -bool HP_chrif_changesex(struct map_session_data *sd) { +bool HP_chrif_changesex(struct map_session_data *sd, bool change_account) { int hIndex = 0; bool retVal___ = false; if( HPMHooks.count.HP_chrif_changesex_pre ) { - bool (*preHookFunc) (struct map_session_data *sd); + bool (*preHookFunc) (struct map_session_data *sd, bool *change_account); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_chrif_changesex_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_chrif_changesex_pre[hIndex].func; - retVal___ = preHookFunc(sd); + retVal___ = preHookFunc(sd, &change_account); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -5203,13 +5203,13 @@ bool HP_chrif_changesex(struct map_session_data *sd) { } } { - retVal___ = HPMHooks.source.chrif.changesex(sd); + retVal___ = HPMHooks.source.chrif.changesex(sd, change_account); } if( HPMHooks.count.HP_chrif_changesex_post ) { - bool (*postHookFunc) (bool retVal___, struct map_session_data *sd); + bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, bool *change_account); for(hIndex = 0; hIndex < HPMHooks.count.HP_chrif_changesex_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_chrif_changesex_post[hIndex].func; - retVal___ = postHookFunc(retVal___, sd); + retVal___ = postHookFunc(retVal___, sd, &change_account); } } return retVal___; -- cgit v1.2.3-60-g2f50