diff options
author | Hercules.ws <dev@herc.ws> | 2019-01-14 18:17:48 +0100 |
---|---|---|
committer | HerculesWSAPI <dev@herc.ws> | 2019-01-14 18:17:48 +0100 |
commit | 21edafad0f74e85c408336274dd1e59db2fe3880 (patch) | |
tree | 715c19b69060be7fc82a3c427b5b1a1137335bdb /src | |
parent | 2a471f2f94cf31f3b36e33dcb438fc41754554da (diff) | |
download | hercules-21edafad0f74e85c408336274dd1e59db2fe3880.tar.gz hercules-21edafad0f74e85c408336274dd1e59db2fe3880.tar.bz2 hercules-21edafad0f74e85c408336274dd1e59db2fe3880.tar.xz hercules-21edafad0f74e85c408336274dd1e59db2fe3880.zip |
HPM Hooks Update
Signed-off-by: HerculesWSAPI <dev@herc.ws>
Diffstat (limited to 'src')
4 files changed, 40 insertions, 0 deletions
diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index e884c3c1d..4c706d652 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -4040,6 +4040,8 @@ typedef bool (*HPMHOOK_pre_itemdb_lookup_const) (const struct config_setting_t * typedef bool (*HPMHOOK_post_itemdb_lookup_const) (bool retVal___, const struct config_setting_t *it, const char *name, int *value); typedef bool (*HPMHOOK_pre_itemdb_lookup_const_mask) (const struct config_setting_t **it, const char **name, int **value); typedef bool (*HPMHOOK_post_itemdb_lookup_const_mask) (bool retVal___, const struct config_setting_t *it, const char *name, int *value); +typedef int (*HPMHOOK_pre_itemdb_addname_sub) (union DBKey *key, struct DBData **data, va_list ap); +typedef int (*HPMHOOK_post_itemdb_addname_sub) (int retVal___, union DBKey key, struct DBData *data, va_list ap); #endif // MAP_ITEMDB_H #ifdef LOGIN_LOGIN_H /* lchrif */ typedef void (*HPMHOOK_pre_lchrif_server_init) (int *id); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 115b45bc5..485b3d53e 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -3212,6 +3212,8 @@ struct { struct HPMHookPoint *HP_itemdb_lookup_const_post; struct HPMHookPoint *HP_itemdb_lookup_const_mask_pre; struct HPMHookPoint *HP_itemdb_lookup_const_mask_post; + struct HPMHookPoint *HP_itemdb_addname_sub_pre; + struct HPMHookPoint *HP_itemdb_addname_sub_post; struct HPMHookPoint *HP_libconfig_read_pre; struct HPMHookPoint *HP_libconfig_read_post; struct HPMHookPoint *HP_libconfig_write_pre; @@ -9861,6 +9863,8 @@ struct { int HP_itemdb_lookup_const_post; int HP_itemdb_lookup_const_mask_pre; int HP_itemdb_lookup_const_mask_post; + int HP_itemdb_addname_sub_pre; + int HP_itemdb_addname_sub_post; int HP_libconfig_read_pre; int HP_libconfig_read_post; int HP_libconfig_write_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 8f191889d..8a0ecfa97 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -1645,6 +1645,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(itemdb->is_item_usable, HP_itemdb_is_item_usable) }, { HP_POP(itemdb->lookup_const, HP_itemdb_lookup_const) }, { HP_POP(itemdb->lookup_const_mask, HP_itemdb_lookup_const_mask) }, + { HP_POP(itemdb->addname_sub, HP_itemdb_addname_sub) }, /* libconfig_interface */ { HP_POP(libconfig->read, HP_libconfig_read) }, { HP_POP(libconfig->write, HP_libconfig_write) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 0d36db0d2..3456af7cb 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -42265,6 +42265,39 @@ bool HP_itemdb_lookup_const_mask(const struct config_setting_t *it, const char * } return retVal___; } +int HP_itemdb_addname_sub(union DBKey key, struct DBData *data, va_list ap) { + int hIndex = 0; + int retVal___ = 0; + if (HPMHooks.count.HP_itemdb_addname_sub_pre > 0) { + int (*preHookFunc) (union DBKey *key, struct DBData **data, va_list ap); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_addname_sub_pre; hIndex++) { + va_list ap___copy; va_copy(ap___copy, ap); + preHookFunc = HPMHooks.list.HP_itemdb_addname_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.addname_sub(key, data, ap___copy); + va_end(ap___copy); + } + if (HPMHooks.count.HP_itemdb_addname_sub_post > 0) { + int (*postHookFunc) (int retVal___, union DBKey key, struct DBData *data, va_list ap); + for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_addname_sub_post; hIndex++) { + va_list ap___copy; va_copy(ap___copy, ap); + postHookFunc = HPMHooks.list.HP_itemdb_addname_sub_post[hIndex].func; + retVal___ = postHookFunc(retVal___, key, data, ap___copy); + va_end(ap___copy); + } + } + return retVal___; +} /* libconfig_interface */ int HP_libconfig_read(struct config_t *config, FILE *stream) { int hIndex = 0; |