diff options
Diffstat (limited to 'src/plugins/HPMHooking')
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking.Defs.inc | 12 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc | 24 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc | 6 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 141 |
4 files changed, 162 insertions, 21 deletions
diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index 57abf25e0..74af2f26d 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -2222,8 +2222,8 @@ typedef void (*HPMHOOK_pre_clif_pNPCMarketClosed) (int *fd, struct map_session_d typedef void (*HPMHOOK_post_clif_pNPCMarketClosed) (int fd, struct map_session_data *sd); typedef void (*HPMHOOK_pre_clif_pNPCMarketPurchase) (int *fd, struct map_session_data **sd); typedef void (*HPMHOOK_post_clif_pNPCMarketPurchase) (int fd, struct map_session_data *sd); -typedef void (*HPMHOOK_pre_clif_add_random_options) (unsigned char **buf, struct item **item); -typedef void (*HPMHOOK_post_clif_add_random_options) (unsigned char *buf, struct item *item); +typedef int (*HPMHOOK_pre_clif_add_random_options) (struct ItemOptions **buf, const struct item **it); +typedef int (*HPMHOOK_post_clif_add_random_options) (int retVal___, struct ItemOptions *buf, const struct item *it); typedef void (*HPMHOOK_pre_clif_pHotkeyRowShift) (int *fd, struct map_session_data **sd); typedef void (*HPMHOOK_post_clif_pHotkeyRowShift) (int fd, struct map_session_data *sd); typedef void (*HPMHOOK_pre_clif_dressroom_open) (struct map_session_data **sd, int *view); @@ -3300,6 +3300,8 @@ typedef void (*HPMHOOK_pre_itemdb_read_chains) (void); typedef void (*HPMHOOK_post_itemdb_read_chains) (void); typedef void (*HPMHOOK_pre_itemdb_read_packages) (void); typedef void (*HPMHOOK_post_itemdb_read_packages) (void); +typedef void (*HPMHOOK_pre_itemdb_read_options) (void); +typedef void (*HPMHOOK_post_itemdb_read_options) (void); typedef void (*HPMHOOK_pre_itemdb_write_cached_packages) (const char **config_filename); typedef void (*HPMHOOK_post_itemdb_write_cached_packages) (const char *config_filename); typedef bool (*HPMHOOK_pre_itemdb_read_cached_packages) (const char **config_filename); @@ -3316,6 +3318,8 @@ typedef struct item_data* (*HPMHOOK_pre_itemdb_search) (int *nameid); typedef struct item_data* (*HPMHOOK_post_itemdb_search) (struct item_data* retVal___, int nameid); typedef struct item_data* (*HPMHOOK_pre_itemdb_exists) (int *nameid); typedef struct item_data* (*HPMHOOK_post_itemdb_exists) (struct item_data* retVal___, int nameid); +typedef struct item_option* (*HPMHOOK_pre_itemdb_option_exists) (int *idx); +typedef struct item_option* (*HPMHOOK_post_itemdb_option_exists) (struct item_option* retVal___, int idx); typedef bool (*HPMHOOK_pre_itemdb_in_group) (struct item_group **group, int *nameid); typedef bool (*HPMHOOK_post_itemdb_in_group) (bool retVal___, struct item_group *group, int nameid); typedef int (*HPMHOOK_pre_itemdb_group_item) (struct item_group **group); @@ -3380,6 +3384,8 @@ typedef int (*HPMHOOK_pre_itemdb_gendercheck) (struct item_data **id); typedef int (*HPMHOOK_post_itemdb_gendercheck) (int retVal___, struct item_data *id); typedef int (*HPMHOOK_pre_itemdb_validate_entry) (struct item_data **entry, int *n, const char **source); typedef int (*HPMHOOK_post_itemdb_validate_entry) (int retVal___, struct item_data *entry, int n, const char *source); +typedef void (*HPMHOOK_pre_itemdb_readdb_options_additional_fields) (struct item_option **ito, struct config_setting_t **t, int *n, const char **source); +typedef void (*HPMHOOK_post_itemdb_readdb_options_additional_fields) (struct item_option *ito, struct config_setting_t *t, int n, const char *source); typedef void (*HPMHOOK_pre_itemdb_readdb_additional_fields) (int *itemid, struct config_setting_t **it, int *n, const char **source); typedef void (*HPMHOOK_post_itemdb_readdb_additional_fields) (int itemid, struct config_setting_t *it, int n, const char *source); typedef void (*HPMHOOK_pre_itemdb_readdb_job_sub) (struct item_data **id, struct config_setting_t **t); @@ -3396,6 +3402,8 @@ typedef void (*HPMHOOK_pre_itemdb_destroy_item_data) (struct item_data **self, i typedef void (*HPMHOOK_post_itemdb_destroy_item_data) (struct item_data *self, int free_self); typedef int (*HPMHOOK_pre_itemdb_final_sub) (union DBKey *key, struct DBData **data, va_list ap); typedef int (*HPMHOOK_post_itemdb_final_sub) (int retVal___, union DBKey key, struct DBData *data, va_list ap); +typedef int (*HPMHOOK_pre_itemdb_options_final_sub) (union DBKey *key, struct DBData **data, va_list ap); +typedef int (*HPMHOOK_post_itemdb_options_final_sub) (int retVal___, union DBKey key, struct DBData *data, va_list ap); typedef void (*HPMHOOK_pre_itemdb_clear) (bool *total); typedef void (*HPMHOOK_post_itemdb_clear) (bool total); typedef struct item_combo* (*HPMHOOK_pre_itemdb_id2combo) (unsigned short *id); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index bd055cac2..cdd2386a6 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -1860,8 +1860,8 @@ struct { struct HPMHookPoint *HP_clif_pNPCMarketClosed_post; struct HPMHookPoint *HP_clif_pNPCMarketPurchase_pre; struct HPMHookPoint *HP_clif_pNPCMarketPurchase_post; - struct HPMHookPoint *HP_clif_add_random_options_pre; - struct HPMHookPoint *HP_clif_add_random_options_post; + struct HPMHookPoint *HP_clif_add_item_options_pre; + struct HPMHookPoint *HP_clif_add_item_options_post; struct HPMHookPoint *HP_clif_pHotkeyRowShift_pre; struct HPMHookPoint *HP_clif_pHotkeyRowShift_post; struct HPMHookPoint *HP_clif_dressroom_open_pre; @@ -2682,6 +2682,8 @@ struct { struct HPMHookPoint *HP_itemdb_read_chains_post; struct HPMHookPoint *HP_itemdb_read_packages_pre; struct HPMHookPoint *HP_itemdb_read_packages_post; + struct HPMHookPoint *HP_itemdb_read_options_pre; + struct HPMHookPoint *HP_itemdb_read_options_post; struct HPMHookPoint *HP_itemdb_write_cached_packages_pre; struct HPMHookPoint *HP_itemdb_write_cached_packages_post; struct HPMHookPoint *HP_itemdb_read_cached_packages_pre; @@ -2698,6 +2700,8 @@ struct { struct HPMHookPoint *HP_itemdb_search_post; struct HPMHookPoint *HP_itemdb_exists_pre; struct HPMHookPoint *HP_itemdb_exists_post; + struct HPMHookPoint *HP_itemdb_option_exists_pre; + struct HPMHookPoint *HP_itemdb_option_exists_post; struct HPMHookPoint *HP_itemdb_in_group_pre; struct HPMHookPoint *HP_itemdb_in_group_post; struct HPMHookPoint *HP_itemdb_group_item_pre; @@ -2762,6 +2766,8 @@ struct { struct HPMHookPoint *HP_itemdb_gendercheck_post; struct HPMHookPoint *HP_itemdb_validate_entry_pre; struct HPMHookPoint *HP_itemdb_validate_entry_post; + struct HPMHookPoint *HP_itemdb_readdb_options_additional_fields_pre; + struct HPMHookPoint *HP_itemdb_readdb_options_additional_fields_post; struct HPMHookPoint *HP_itemdb_readdb_additional_fields_pre; struct HPMHookPoint *HP_itemdb_readdb_additional_fields_post; struct HPMHookPoint *HP_itemdb_readdb_job_sub_pre; @@ -2778,6 +2784,8 @@ struct { struct HPMHookPoint *HP_itemdb_destroy_item_data_post; struct HPMHookPoint *HP_itemdb_final_sub_pre; struct HPMHookPoint *HP_itemdb_final_sub_post; + struct HPMHookPoint *HP_itemdb_options_final_sub_pre; + struct HPMHookPoint *HP_itemdb_options_final_sub_post; struct HPMHookPoint *HP_itemdb_clear_pre; struct HPMHookPoint *HP_itemdb_clear_post; struct HPMHookPoint *HP_itemdb_id2combo_pre; @@ -7899,8 +7907,8 @@ struct { int HP_clif_pNPCMarketClosed_post; int HP_clif_pNPCMarketPurchase_pre; int HP_clif_pNPCMarketPurchase_post; - int HP_clif_add_random_options_pre; - int HP_clif_add_random_options_post; + int HP_clif_add_item_options_pre; + int HP_clif_add_item_options_post; int HP_clif_pHotkeyRowShift_pre; int HP_clif_pHotkeyRowShift_post; int HP_clif_dressroom_open_pre; @@ -8721,6 +8729,8 @@ struct { int HP_itemdb_read_chains_post; int HP_itemdb_read_packages_pre; int HP_itemdb_read_packages_post; + int HP_itemdb_read_options_pre; + int HP_itemdb_read_options_post; int HP_itemdb_write_cached_packages_pre; int HP_itemdb_write_cached_packages_post; int HP_itemdb_read_cached_packages_pre; @@ -8737,6 +8747,8 @@ struct { int HP_itemdb_search_post; int HP_itemdb_exists_pre; int HP_itemdb_exists_post; + int HP_itemdb_option_exists_pre; + int HP_itemdb_option_exists_post; int HP_itemdb_in_group_pre; int HP_itemdb_in_group_post; int HP_itemdb_group_item_pre; @@ -8801,6 +8813,8 @@ struct { int HP_itemdb_gendercheck_post; int HP_itemdb_validate_entry_pre; int HP_itemdb_validate_entry_post; + int HP_itemdb_readdb_options_additional_fields_pre; + int HP_itemdb_readdb_options_additional_fields_post; int HP_itemdb_readdb_additional_fields_pre; int HP_itemdb_readdb_additional_fields_post; int HP_itemdb_readdb_job_sub_pre; @@ -8817,6 +8831,8 @@ struct { int HP_itemdb_destroy_item_data_post; int HP_itemdb_final_sub_pre; int HP_itemdb_final_sub_post; + int HP_itemdb_options_final_sub_pre; + int HP_itemdb_options_final_sub_post; int HP_itemdb_clear_pre; int HP_itemdb_clear_post; int HP_itemdb_id2combo_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 53f65bcd3..9075901c4 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -952,7 +952,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(clif->pNPCShopClosed, HP_clif_pNPCShopClosed) }, { HP_POP(clif->pNPCMarketClosed, HP_clif_pNPCMarketClosed) }, { HP_POP(clif->pNPCMarketPurchase, HP_clif_pNPCMarketPurchase) }, - { HP_POP(clif->add_random_options, HP_clif_add_random_options) }, + { HP_POP(clif->add_item_options, HP_clif_add_item_options) }, { HP_POP(clif->pHotkeyRowShift, HP_clif_pHotkeyRowShift) }, { HP_POP(clif->dressroom_open, HP_clif_dressroom_open) }, { HP_POP(clif->pOneClick_ItemIdentify, HP_clif_pOneClick_ItemIdentify) }, @@ -1378,6 +1378,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(itemdb->read_groups, HP_itemdb_read_groups) }, { HP_POP(itemdb->read_chains, HP_itemdb_read_chains) }, { HP_POP(itemdb->read_packages, HP_itemdb_read_packages) }, + { HP_POP(itemdb->read_options, HP_itemdb_read_options) }, { HP_POP(itemdb->write_cached_packages, HP_itemdb_write_cached_packages) }, { HP_POP(itemdb->read_cached_packages, HP_itemdb_read_cached_packages) }, { HP_POP(itemdb->name2id, HP_itemdb_name2id) }, @@ -1386,6 +1387,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(itemdb->load, HP_itemdb_load) }, { HP_POP(itemdb->search, HP_itemdb_search) }, { HP_POP(itemdb->exists, HP_itemdb_exists) }, + { HP_POP(itemdb->option_exists, HP_itemdb_option_exists) }, { HP_POP(itemdb->in_group, HP_itemdb_in_group) }, { HP_POP(itemdb->group_item, HP_itemdb_group_item) }, { HP_POP(itemdb->chain_item, HP_itemdb_chain_item) }, @@ -1418,6 +1420,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(itemdb->read_combos, HP_itemdb_read_combos) }, { HP_POP(itemdb->gendercheck, HP_itemdb_gendercheck) }, { HP_POP(itemdb->validate_entry, HP_itemdb_validate_entry) }, + { HP_POP(itemdb->readdb_options_additional_fields, HP_itemdb_readdb_options_additional_fields) }, { HP_POP(itemdb->readdb_additional_fields, HP_itemdb_readdb_additional_fields) }, { HP_POP(itemdb->readdb_job_sub, HP_itemdb_readdb_job_sub) }, { HP_POP(itemdb->readdb_libconfig_sub, HP_itemdb_readdb_libconfig_sub) }, @@ -1426,6 +1429,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(itemdb->read, HP_itemdb_read) }, { HP_POP(itemdb->destroy_item_data, HP_itemdb_destroy_item_data) }, { HP_POP(itemdb->final_sub, HP_itemdb_final_sub) }, + { HP_POP(itemdb->options_final_sub, HP_itemdb_options_final_sub) }, { HP_POP(itemdb->clear, HP_itemdb_clear) }, { HP_POP(itemdb->id2combo, HP_itemdb_id2combo) }, { HP_POP(itemdb->is_item_usable, HP_itemdb_is_item_usable) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 654c902d8..b24c7d315 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -24201,31 +24201,32 @@ void HP_clif_pNPCMarketPurchase(int fd, struct map_session_data *sd) { } return; } -void HP_clif_add_random_options(unsigned char *buf, struct item *item) { +int HP_clif_add_item_options(struct ItemOptions *buf, const struct item *it) { int hIndex = 0; - if( HPMHooks.count.HP_clif_add_random_options_pre ) { - void (*preHookFunc) (unsigned char **buf, struct item **item); + int retVal___ = 0; + if( HPMHooks.count.HP_clif_add_item_options_pre ) { + int (*preHookFunc) (struct ItemOptions **buf, const struct item **it); *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_add_random_options_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_clif_add_random_options_pre[hIndex].func; - preHookFunc(&buf, &item); + for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_add_item_options_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_clif_add_item_options_pre[hIndex].func; + retVal___ = preHookFunc(&buf, &it); } if( *HPMforce_return ) { *HPMforce_return = false; - return; + return retVal___; } } { - HPMHooks.source.clif.add_random_options(buf, item); + retVal___ = HPMHooks.source.clif.add_item_options(buf, it); } - if( HPMHooks.count.HP_clif_add_random_options_post ) { - void (*postHookFunc) (unsigned char *buf, struct item *item); - for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_add_random_options_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_clif_add_random_options_post[hIndex].func; - postHookFunc(buf, item); + if( HPMHooks.count.HP_clif_add_item_options_post ) { + int (*postHookFunc) (int retVal___, struct ItemOptions *buf, const struct item *it); + for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_add_item_options_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_clif_add_item_options_post[hIndex].func; + retVal___ = postHookFunc(retVal___, buf, it); } } - return; + return retVal___; } void HP_clif_pHotkeyRowShift(int fd, struct map_session_data *sd) { int hIndex = 0; @@ -35242,6 +35243,32 @@ void HP_itemdb_read_packages(void) { } return; } +void HP_itemdb_read_options(void) { + int hIndex = 0; + if( HPMHooks.count.HP_itemdb_read_options_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_read_options_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_itemdb_read_options_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.itemdb.read_options(); + } + if( HPMHooks.count.HP_itemdb_read_options_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_read_options_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_itemdb_read_options_post[hIndex].func; + postHookFunc(); + } + } + return; +} void HP_itemdb_write_cached_packages(const char *config_filename) { int hIndex = 0; if( HPMHooks.count.HP_itemdb_write_cached_packages_pre ) { @@ -35457,6 +35484,33 @@ struct item_data* HP_itemdb_exists(int nameid) { } return retVal___; } +struct item_option* HP_itemdb_option_exists(int idx) { + int hIndex = 0; + struct item_option* retVal___ = NULL; + if( HPMHooks.count.HP_itemdb_option_exists_pre ) { + struct item_option* (*preHookFunc) (int *idx); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_option_exists_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_itemdb_option_exists_pre[hIndex].func; + retVal___ = preHookFunc(&idx); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.itemdb.option_exists(idx); + } + if( HPMHooks.count.HP_itemdb_option_exists_post ) { + struct item_option* (*postHookFunc) (struct item_option* retVal___, int idx); + for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_option_exists_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_itemdb_option_exists_post[hIndex].func; + retVal___ = postHookFunc(retVal___, idx); + } + } + return retVal___; +} bool HP_itemdb_in_group(struct item_group *group, int nameid) { int hIndex = 0; bool retVal___ = false; @@ -36328,6 +36382,32 @@ int HP_itemdb_validate_entry(struct item_data *entry, int n, const char *source) } return retVal___; } +void HP_itemdb_readdb_options_additional_fields(struct item_option *ito, struct config_setting_t *t, const char *source) { + int hIndex = 0; + if( HPMHooks.count.HP_itemdb_readdb_options_additional_fields_pre ) { + void (*preHookFunc) (struct item_option **ito, struct config_setting_t **t, const char **source); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_readdb_options_additional_fields_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_itemdb_readdb_options_additional_fields_pre[hIndex].func; + preHookFunc(&ito, &t, &source); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.itemdb.readdb_options_additional_fields(ito, t, source); + } + if( HPMHooks.count.HP_itemdb_readdb_options_additional_fields_post ) { + void (*postHookFunc) (struct item_option *ito, struct config_setting_t *t, const char *source); + for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_readdb_options_additional_fields_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_itemdb_readdb_options_additional_fields_post[hIndex].func; + postHookFunc(ito, t, source); + } + } + return; +} void HP_itemdb_readdb_additional_fields(int itemid, struct config_setting_t *it, int n, const char *source) { int hIndex = 0; if( HPMHooks.count.HP_itemdb_readdb_additional_fields_pre ) { @@ -36546,6 +36626,39 @@ int HP_itemdb_final_sub(union DBKey key, struct DBData *data, va_list ap) { } return retVal___; } +int HP_itemdb_options_final_sub(union DBKey key, struct DBData *data, va_list ap) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_itemdb_options_final_sub_pre ) { + int (*preHookFunc) (union DBKey *key, struct DBData **data, va_list ap); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_options_final_sub_pre; hIndex++ ) { + va_list ap___copy; va_copy(ap___copy, ap); + preHookFunc = HPMHooks.list.HP_itemdb_options_final_sub_pre[hIndex].func; + retVal___ = preHookFunc(&key, &data, ap___copy); + va_end(ap___copy); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + va_list ap___copy; va_copy(ap___copy, ap); + retVal___ = HPMHooks.source.itemdb.options_final_sub(key, data, ap___copy); + va_end(ap___copy); + } + if( HPMHooks.count.HP_itemdb_options_final_sub_post ) { + int (*postHookFunc) (int retVal___, union DBKey key, struct DBData *data, va_list ap); + for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_options_final_sub_post; hIndex++ ) { + va_list ap___copy; va_copy(ap___copy, ap); + postHookFunc = HPMHooks.list.HP_itemdb_options_final_sub_post[hIndex].func; + retVal___ = postHookFunc(retVal___, key, data, ap___copy); + va_end(ap___copy); + } + } + return retVal___; +} void HP_itemdb_clear(bool total) { int hIndex = 0; if( HPMHooks.count.HP_itemdb_clear_pre ) { |