diff options
author | Haru <haru@dotalux.com> | 2019-07-28 22:37:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-28 22:37:07 +0200 |
commit | 893a01ab14ad56579a4c280ac7a302e4e6d7c755 (patch) | |
tree | b4e40b659924f9f0a08a9ab63be79307ddbab699 /src/plugins/HPMHooking | |
parent | cd04fd96954ccb9fbbe33d05ad1eb3e2f7ce98c5 (diff) | |
parent | c67015a13bd6ed0e3be7fcbb0db525fa482c9bda (diff) | |
download | hercules-893a01ab14ad56579a4c280ac7a302e4e6d7c755.tar.gz hercules-893a01ab14ad56579a4c280ac7a302e4e6d7c755.tar.bz2 hercules-893a01ab14ad56579a4c280ac7a302e4e6d7c755.tar.xz hercules-893a01ab14ad56579a4c280ac7a302e4e6d7c755.zip |
Merge pull request #2506 from Asheraf/castledb_update
Convert guild castle database to use libconfig
Diffstat (limited to 'src/plugins/HPMHooking')
4 files changed, 53 insertions, 19 deletions
diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index 2f3642a18..24958711e 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -3054,8 +3054,10 @@ typedef struct map_session_data* (*HPMHOOK_pre_guild_sd_check) (int *guild_id, i typedef struct map_session_data* (*HPMHOOK_post_guild_sd_check) (struct map_session_data* retVal___, int guild_id, int account_id, int char_id); typedef bool (*HPMHOOK_pre_guild_read_guildskill_tree_db) (char **split[], int *columns, int *current); typedef bool (*HPMHOOK_post_guild_read_guildskill_tree_db) (bool retVal___, char *split[], int columns, int current); -typedef bool (*HPMHOOK_pre_guild_read_castledb) (char **str[], int *columns, int *current); -typedef bool (*HPMHOOK_post_guild_read_castledb) (bool retVal___, char *str[], int columns, int current); +typedef bool (*HPMHOOK_pre_guild_read_castledb_libconfig) (void); +typedef bool (*HPMHOOK_post_guild_read_castledb_libconfig) (bool retVal___); +typedef bool (*HPMHOOK_pre_guild_read_castledb_libconfig_sub) (struct config_setting_t **it, int *idx, const char **source); +typedef bool (*HPMHOOK_post_guild_read_castledb_libconfig_sub) (bool retVal___, struct config_setting_t *it, int idx, const char *source); typedef int (*HPMHOOK_pre_guild_payexp_timer_sub) (union DBKey *key, struct DBData **data, va_list ap); typedef int (*HPMHOOK_post_guild_payexp_timer_sub) (int retVal___, union DBKey key, struct DBData *data, va_list ap); typedef int (*HPMHOOK_pre_guild_send_xy_timer_sub) (union DBKey *key, struct DBData **data, va_list ap); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index fa5bb7cc2..ad49bacb4 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -2618,8 +2618,10 @@ struct { struct HPMHookPoint *HP_guild_sd_check_post; struct HPMHookPoint *HP_guild_read_guildskill_tree_db_pre; struct HPMHookPoint *HP_guild_read_guildskill_tree_db_post; - struct HPMHookPoint *HP_guild_read_castledb_pre; - struct HPMHookPoint *HP_guild_read_castledb_post; + struct HPMHookPoint *HP_guild_read_castledb_libconfig_pre; + struct HPMHookPoint *HP_guild_read_castledb_libconfig_post; + struct HPMHookPoint *HP_guild_read_castledb_libconfig_sub_pre; + struct HPMHookPoint *HP_guild_read_castledb_libconfig_sub_post; struct HPMHookPoint *HP_guild_payexp_timer_sub_pre; struct HPMHookPoint *HP_guild_payexp_timer_sub_post; struct HPMHookPoint *HP_guild_send_xy_timer_sub_pre; @@ -9411,8 +9413,10 @@ struct { int HP_guild_sd_check_post; int HP_guild_read_guildskill_tree_db_pre; int HP_guild_read_guildskill_tree_db_post; - int HP_guild_read_castledb_pre; - int HP_guild_read_castledb_post; + int HP_guild_read_castledb_libconfig_pre; + int HP_guild_read_castledb_libconfig_post; + int HP_guild_read_castledb_libconfig_sub_pre; + int HP_guild_read_castledb_libconfig_sub_post; int HP_guild_payexp_timer_sub_pre; int HP_guild_payexp_timer_sub_post; int HP_guild_send_xy_timer_sub_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 07bbbb4d8..474bcfb14 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -1342,7 +1342,8 @@ struct HookingPointData HookingPoints[] = { { HP_POP(guild->payexp_timer, HP_guild_payexp_timer) }, { HP_POP(guild->sd_check, HP_guild_sd_check) }, { HP_POP(guild->read_guildskill_tree_db, HP_guild_read_guildskill_tree_db) }, - { HP_POP(guild->read_castledb, HP_guild_read_castledb) }, + { HP_POP(guild->read_castledb_libconfig, HP_guild_read_castledb_libconfig) }, + { HP_POP(guild->read_castledb_libconfig_sub, HP_guild_read_castledb_libconfig_sub) }, { HP_POP(guild->payexp_timer_sub, HP_guild_payexp_timer_sub) }, { HP_POP(guild->send_xy_timer_sub, HP_guild_send_xy_timer_sub) }, { HP_POP(guild->send_xy_timer, HP_guild_send_xy_timer) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 30bc8b8ca..8817c34cc 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -34251,15 +34251,15 @@ bool HP_guild_read_guildskill_tree_db(char *split[], int columns, int current) { } return retVal___; } -bool HP_guild_read_castledb(char *str[], int columns, int current) { +bool HP_guild_read_castledb_libconfig(void) { int hIndex = 0; bool retVal___ = false; - if (HPMHooks.count.HP_guild_read_castledb_pre > 0) { - bool (*preHookFunc) (char **str[], int *columns, int *current); + if (HPMHooks.count.HP_guild_read_castledb_libconfig_pre > 0) { + bool (*preHookFunc) (void); *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_guild_read_castledb_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_guild_read_castledb_pre[hIndex].func; - retVal___ = preHookFunc(&str, &columns, ¤t); + for (hIndex = 0; hIndex < HPMHooks.count.HP_guild_read_castledb_libconfig_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_guild_read_castledb_libconfig_pre[hIndex].func; + retVal___ = preHookFunc(); } if (*HPMforce_return) { *HPMforce_return = false; @@ -34267,13 +34267,40 @@ bool HP_guild_read_castledb(char *str[], int columns, int current) { } } { - retVal___ = HPMHooks.source.guild.read_castledb(str, columns, current); + retVal___ = HPMHooks.source.guild.read_castledb_libconfig(); } - if (HPMHooks.count.HP_guild_read_castledb_post > 0) { - bool (*postHookFunc) (bool retVal___, char *str[], int columns, int current); - for (hIndex = 0; hIndex < HPMHooks.count.HP_guild_read_castledb_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_guild_read_castledb_post[hIndex].func; - retVal___ = postHookFunc(retVal___, str, columns, current); + if (HPMHooks.count.HP_guild_read_castledb_libconfig_post > 0) { + bool (*postHookFunc) (bool retVal___); + for (hIndex = 0; hIndex < HPMHooks.count.HP_guild_read_castledb_libconfig_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_guild_read_castledb_libconfig_post[hIndex].func; + retVal___ = postHookFunc(retVal___); + } + } + return retVal___; +} +bool HP_guild_read_castledb_libconfig_sub(struct config_setting_t *it, int idx, const char *source) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_guild_read_castledb_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_guild_read_castledb_libconfig_sub_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_guild_read_castledb_libconfig_sub_pre[hIndex].func; + retVal___ = preHookFunc(&it, &idx, &source); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.guild.read_castledb_libconfig_sub(it, idx, source); + } + if (HPMHooks.count.HP_guild_read_castledb_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_guild_read_castledb_libconfig_sub_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_guild_read_castledb_libconfig_sub_post[hIndex].func; + retVal___ = postHookFunc(retVal___, it, idx, source); } } return retVal___; |