summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2019-07-28 22:37:07 +0200
committerGitHub <noreply@github.com>2019-07-28 22:37:07 +0200
commit893a01ab14ad56579a4c280ac7a302e4e6d7c755 (patch)
treeb4e40b659924f9f0a08a9ab63be79307ddbab699
parentcd04fd96954ccb9fbbe33d05ad1eb3e2f7ce98c5 (diff)
parentc67015a13bd6ed0e3be7fcbb0db525fa482c9bda (diff)
downloadhercules-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
-rw-r--r--db/castle_db.conf269
-rw-r--r--db/castle_db.txt74
-rw-r--r--src/map/guild.c81
-rw-r--r--src/map/guild.h3
-rw-r--r--src/plugins/HPMHooking/HPMHooking.Defs.inc6
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc12
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc3
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.Hooks.inc51
8 files changed, 390 insertions, 109 deletions
diff --git a/db/castle_db.conf b/db/castle_db.conf
new file mode 100644
index 000000000..907754954
--- /dev/null
+++ b/db/castle_db.conf
@@ -0,0 +1,269 @@
+//================= Hercules Database =====================================
+//= _ _ _
+//= | | | | | |
+//= | |_| | ___ _ __ ___ _ _| | ___ ___
+//= | _ |/ _ \ '__/ __| | | | |/ _ \/ __|
+//= | | | | __/ | | (__| |_| | | __/\__ \
+//= \_| |_/\___|_| \___|\__,_|_|\___||___/
+//================= License ===============================================
+//= This file is part of Hercules.
+//= http://herc.ws - http://github.com/HerculesWS/Hercules
+//=
+//= Copyright (C) 2019 Hercules Dev Team
+//= Copyright (C) 2019 Asheraf
+//=
+//= Hercules is free software: you can redistribute it and/or modify
+//= it under the terms of the GNU General Public License as published by
+//= the Free Software Foundation, either version 3 of the License, or
+//= (at your option) any later version.
+//=
+//= This program is distributed in the hope that it will be useful,
+//= but WITHOUT ANY WARRANTY; without even the implied warranty of
+//= MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+//= GNU General Public License for more details.
+//=
+//= You should have received a copy of the GNU General Public License
+//= along with this program. If not, see <http://www.gnu.org/licenses/>.
+//=========================================================================
+//= Castle Database
+//=========================================================================
+
+castle_db: (
+/**************************************************************************
+ ************* Entry structure ********************************************
+ **************************************************************************
+{
+ // ================ Mandatory fields ==============================
+ CastleID: (int) Unique ID of the castle. Must remain unique across all map-servers.
+ MapName: (string) Map name to be considered as the castle map.
+ CastleName: (string) Name of the castle (used by scripts and guardian name tags)
+ OnGuildBreakEventName: (string) NPC unique name to invoke ::OnGuildBreak on, when a occupied
+ castle is abandoned during guild break.
+},
+**************************************************************************/
+//================
+// Al De Baran
+//================
+{
+ CastleID: 0
+ MapName: "aldeg_cas01"
+ CastleName: "Neuschwanstein" // kRO : Noisyubantian
+ OnGuildBreakEventName: "Agit#aldeg_cas01"
+},
+{
+ CastleID: 1
+ MapName: "aldeg_cas02"
+ CastleName: "Hohenschwangau" // kRO : Hohensyubangawoo
+ OnGuildBreakEventName: "Agit#aldeg_cas02"
+},
+{
+ CastleID: 2
+ MapName: "aldeg_cas03"
+ CastleName: "Nuernberg" // kRO : Nyirenverk
+ OnGuildBreakEventName: "Agit#aldeg_cas03"
+},
+{
+ CastleID: 3
+ MapName: "aldeg_cas04"
+ CastleName: "Wuerzburg" // kRO : Byirtsburi
+ OnGuildBreakEventName: "Agit#aldeg_cas04"
+},
+{
+ CastleID: 4
+ MapName: "aldeg_cas05"
+ CastleName: "Rothenburg" // kRO : Rotenburk
+ OnGuildBreakEventName: "Agit#aldeg_cas05"
+},
+//================
+// Geffen
+//================
+{
+ CastleID: 5
+ MapName: "gefg_cas01"
+ CastleName: "Repherion" // kRO : Reprion
+ OnGuildBreakEventName: "Agit#gefg_cas01"
+},
+{
+ CastleID: 6
+ MapName: "gefg_cas02"
+ CastleName: "Eeyolbriggar" // kRO : Yolbriger
+ OnGuildBreakEventName: "Agit#gefg_cas02"
+},
+{
+ CastleID: 7
+ MapName: "gefg_cas03"
+ CastleName: "Yesnelph" // kRO : Isinlife
+ OnGuildBreakEventName: "Agit#gefg_cas03"
+},
+{
+ CastleID: 8
+ MapName: "gefg_cas04"
+ CastleName: "Bergel" // kRO : Berigel
+ OnGuildBreakEventName: "Agit#gefg_cas04"
+},
+{
+ CastleID: 9
+ MapName: "gefg_cas05"
+ CastleName: "Mersetzdeitz" // kRO : Melsedetsu
+ OnGuildBreakEventName: "Agit#gefg_cas05"
+},
+//================
+// Payon
+//================
+{
+ CastleID: 10
+ MapName: "payg_cas01"
+ CastleName: "Bright Arbor" // kRO : Mingting
+ OnGuildBreakEventName: "Agit#payg_cas01"
+},
+{
+ CastleID: 11
+ MapName: "payg_cas02"
+ CastleName: "Scarlet Palace" // kRO : Tiantan
+ OnGuildBreakEventName: "Agit#payg_cas02"
+},
+{
+ CastleID: 12
+ MapName: "payg_cas03"
+ CastleName: "Holy Shadow" // kRO : Fuying
+ OnGuildBreakEventName: "Agit#payg_cas03"
+},
+{
+ CastleID: 13
+ MapName: "payg_cas04"
+ CastleName: "Sacred Altar" // kRO : Honglou
+ OnGuildBreakEventName: "Agit#payg_cas04"
+},
+{
+ CastleID: 14
+ MapName: "payg_cas05"
+ CastleName: "Bamboo Grove Hill" // kRO : Zhulinxian
+ OnGuildBreakEventName: "Agit#payg_cas05"
+},
+//================
+// Prontera
+//================
+{
+ CastleID: 15
+ MapName: "prtg_cas01"
+ CastleName: "Kriemhild" // kRO : Creamhilt
+ OnGuildBreakEventName: "Agit#prtg_cas01"
+},
+{
+ CastleID: 16
+ MapName: "prtg_cas02"
+ CastleName: "Swanhild" // kRO : Sbanhealt
+ OnGuildBreakEventName: "Agit#prtg_cas02"
+},
+{
+ CastleID: 17
+ MapName: "prtg_cas03"
+ CastleName: "Fadhgridh" // kRO : Lazrigees
+ OnGuildBreakEventName: "Agit#prtg_cas03"
+},
+{
+ CastleID: 18
+ MapName: "prtg_cas04"
+ CastleName: "Skoegul" // kRO : Squagul
+ OnGuildBreakEventName: "Agit#prtg_cas04"
+},
+{
+ CastleID: 19
+ MapName: "prtg_cas05"
+ CastleName: "Gondul" // kRO : Guindull
+ OnGuildBreakEventName: "Agit#prtg_cas05"
+},
+//================
+// Novice Guilds
+//================
+{
+ CastleID: 20
+ MapName: "nguild_alde"
+ CastleName: "Earth"
+ OnGuildBreakEventName: "Agit_N01"
+},
+{
+ CastleID: 21
+ MapName: "nguild_gef"
+ CastleName: "Air"
+ OnGuildBreakEventName: "Agit_N02"
+},
+{
+ CastleID: 22
+ MapName: "nguild_pay"
+ CastleName: "Water"
+ OnGuildBreakEventName: "Agit_N03"
+},
+{
+ CastleID: 23
+ MapName: "nguild_prt"
+ CastleName: "Fire"
+ OnGuildBreakEventName: "Agit_N04"
+},
+//================
+// Yuno
+//================
+{
+ CastleID: 24
+ MapName: "schg_cas01"
+ CastleName: "Himinn" // kRO : Himinn
+ OnGuildBreakEventName: "Manager#schg_cas01"
+},
+{
+ CastleID: 25
+ MapName: "schg_cas02"
+ CastleName: "Andlangr" // kRO : Andlangr
+ OnGuildBreakEventName: "Manager#schg_cas02"
+},
+{
+ CastleID: 26
+ MapName: "schg_cas03"
+ CastleName: "Viblainn" // kRO : Viblainn
+ OnGuildBreakEventName: "Manager#schg_cas03"
+},
+{
+ CastleID: 27
+ MapName: "schg_cas04"
+ CastleName: "Hljod" // kRO : Hljod
+ OnGuildBreakEventName: "Manager#schg_cas04"
+},
+{
+ CastleID: 28
+ MapName: "schg_cas05"
+ CastleName: "Skidbladnir" // kRO : Skidbladnir
+ OnGuildBreakEventName: "Manager#schg_cas05"
+},
+//================
+// Rachel
+//================
+{
+ CastleID: 29
+ MapName: "arug_cas01"
+ CastleName: "Mardol" // kRO : Mardol
+ OnGuildBreakEventName: "Manager#arug_cas01"
+},
+{
+ CastleID: 30
+ MapName: "arug_cas02"
+ CastleName: "Cyr" // kRO : Cyr
+ OnGuildBreakEventName: "Manager#arug_cas02"
+},
+{
+ CastleID: 31
+ MapName: "arug_cas03"
+ CastleName: "Horn" // kRO : Horn
+ OnGuildBreakEventName: "Manager#arug_cas03"
+},
+{
+ CastleID: 32
+ MapName: "arug_cas04"
+ CastleName: "Gefn" // kRO : Gefn
+ OnGuildBreakEventName: "Manager#arug_cas04"
+},
+{
+ CastleID: 33
+ MapName: "arug_cas05"
+ CastleName: "Bandis" // kRO : Bandis
+ OnGuildBreakEventName: "Manager#arug_cas05"
+},
+)
diff --git a/db/castle_db.txt b/db/castle_db.txt
deleted file mode 100644
index 12e222eb6..000000000
--- a/db/castle_db.txt
+++ /dev/null
@@ -1,74 +0,0 @@
-// Guild Castles Database
-//
-// Structure of Database:
-// CastleID,MapName,CastleName,OnGuildBreakEventName,Flag
-//
-// 01. CastleID Unique ID of the castle. Must remain unique across all map-servers.
-// 02. MapName Map name to be considered as the castle map.
-// 03. CastleName Name of the castle (used by scripts and guardian name tags).
-// 04. OnGuildBreakEventName NPC unique name to invoke ::OnGuildBreak on, when a occupied
-// castle is abandoned during guild break.
-// 05. Flag Switch flag (reserved as of athena-dev mod0796~0801, not used by server).
-
-
-//================
-// Al De Baran
-//================
-0,aldeg_cas01,Neuschwanstein,Agit#aldeg_cas01,1 // kRO : Noisyubantian
-1,aldeg_cas02,Hohenschwangau,Agit#aldeg_cas02,1 // kRO : Hohensyubangawoo
-2,aldeg_cas03,Nuernberg,Agit#aldeg_cas03,1 // kRO : Nyirenverk
-3,aldeg_cas04,Wuerzburg,Agit#aldeg_cas04,1 // kRO : Byirtsburi
-4,aldeg_cas05,Rothenburg,Agit#aldeg_cas05,1 // kRO : Rotenburk
-
-//================
-// Geffen
-//================
-5,gefg_cas01,Repherion,Agit#gefg_cas01,1 // kRO : Reprion
-6,gefg_cas02,Eeyolbriggar,Agit#gefg_cas02,1 // kRO : Yolbriger
-7,gefg_cas03,Yesnelph,Agit#gefg_cas03,1 // kRO : Isinlife
-8,gefg_cas04,Bergel,Agit#gefg_cas04,1 // kRO : Berigel
-9,gefg_cas05,Mersetzdeitz,Agit#gefg_cas05,1 // kRO : Melsedetsu
-
-//================
-// Payon
-//================
-10,payg_cas01,Bright Arbor,Agit#payg_cas01,1 // kRO : Mingting
-11,payg_cas02,Scarlet Palace,Agit#payg_cas02,1 // kRO : Tiantan
-12,payg_cas03,Holy Shadow,Agit#payg_cas03,1 // kRO : Fuying
-13,payg_cas04,Sacred Altar,Agit#payg_cas04,1 // kRO : Honglou
-14,payg_cas05,Bamboo Grove Hill,Agit#payg_cas05,1 // kRO : Zhulinxian
-
-//================
-// Prontera
-//================
-15,prtg_cas01,Kriemhild,Agit#prtg_cas01,1 // kRO : Creamhilt
-16,prtg_cas02,Swanhild,Agit#prtg_cas02,1 // kRO : Sbanhealt
-17,prtg_cas03,Fadhgridh,Agit#prtg_cas03,1 // kRO : Lazrigees
-18,prtg_cas04,Skoegul,Agit#prtg_cas04,1 // kRO : Squagul
-19,prtg_cas05,Gondul,Agit#prtg_cas05,1 // kRO : Guindull
-
-//================
-// Novice Guilds
-//================
-20,nguild_alde,Earth,Agit_N01,2
-21,nguild_gef,Air,Agit_N02,2
-22,nguild_pay,Water,Agit_N03,2
-23,nguild_prt,Fire,Agit_N04,2
-
-//================
-// Yuno
-//================
-24,schg_cas01,Himinn,Manager#schg_cas01,1 // kRO : Himinn
-25,schg_cas02,Andlangr,Manager#schg_cas02,1 // kRO : Andlangr
-26,schg_cas03,Viblainn,Manager#schg_cas03,1 // kRO : Viblainn
-27,schg_cas04,Hljod,Manager#schg_cas04,1 // kRO : Hljod
-28,schg_cas05,Skidbladnir,Manager#schg_cas05,1 // kRO : Skidbladnir
-
-//================
-// Rachel
-//================
-29,arug_cas01,Mardol,Manager#arug_cas01,1 // kRO : Mardol
-30,arug_cas02,Cyr,Manager#arug_cas02,1 // kRO : Cyr
-31,arug_cas03,Horn,Manager#arug_cas03,1 // kRO : Horn
-32,arug_cas04,Gefn,Manager#arug_cas04,1 // kRO : Gefn
-33,arug_cas05,Bandis,Manager#arug_cas05,1 // kRO : Bandis
diff --git a/src/map/guild.c b/src/map/guild.c
index ae76b22a3..aadb55c78 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -38,6 +38,7 @@
#include "map/storage.h"
#include "common/HPM.h"
#include "common/cbasetypes.h"
+#include "common/conf.h"
#include "common/ers.h"
#include "common/memmgr.h"
#include "common/mapindex.h"
@@ -147,26 +148,76 @@ static int guild_check_skill_require(struct guild *g, int id)
return 1;
}
-static bool guild_read_castledb(char *str[], int columns, int current)
-{// <castle id>,<map name>,<castle name>,<castle event>[,<reserved/unused switch flag>]
- struct guild_castle *gc;
- int index;
+static bool guild_read_castledb_libconfig(void)
+{
+ struct config_t castle_conf;
+ struct config_setting_t *castle_db = NULL, *it = NULL;
+ const char *config_filename = "db/castle_db.conf"; // FIXME hardcoded name
+ int i = 0;
+
+ if (libconfig->load_file(&castle_conf, config_filename) == 0)
+ return false;
- nullpo_retr(false, str);
- index = mapindex->name2id(str[1]);
- if (map->mapindex2mapid(index) < 0) // Map not found or on another map-server
+ if ((castle_db = libconfig->setting_get_member(castle_conf.root, "castle_db")) == NULL) {
+ libconfig->destroy(&castle_conf);
+ ShowError("guild_read_castledb_libconfig: can't read %s\n", config_filename);
return false;
+ }
+
+ while ((it = libconfig->setting_get_elem(castle_db, i++)) != NULL) {
+ guild->read_castledb_libconfig_sub(it, i - 1, config_filename);
+ }
+ libconfig->destroy(&castle_conf);
+ ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", i, config_filename);
+ return true;
+}
+
+static bool guild_read_castledb_libconfig_sub(struct config_setting_t *it, int idx, const char *source)
+{
+ nullpo_ret(it);
+ nullpo_ret(source);
+
+ struct guild_castle *gc = NULL;
+ const char *name = NULL;
+ int i32 = 0;
CREATE(gc, struct guild_castle, 1);
- gc->castle_id = atoi(str[0]);
+
+ if (libconfig->setting_lookup_int(it, "CastleID", &i32) == CONFIG_FALSE) {
+ aFree(gc);
+ ShowWarning("guild_read_castledb_libconfig_sub: Invalid or missing CastleID (%d) in \"%s\", entry #%d, skipping.\n", i32, source, idx);
+ return false;
+ }
+ gc->castle_id = i32;
+
+ if (libconfig->setting_lookup_string(it, "MapName", &name) == CONFIG_FALSE) {
+ aFree(gc);
+ ShowWarning("guild_read_castledb_libconfig_sub: Invalid or missing MapName in \"%s\", entry #%d, skipping.\n", source, idx);
+ return false;
+ }
+ int index = mapindex->name2id(name);
+ if (map->mapindex2mapid(index) < 0) {
+ aFree(gc);
+ ShowWarning("guild_read_castledb_libconfig_sub: Invalid MapName (%s) in \"%s\", entry #%d, skipping.\n", name, source, idx);
+ return false;
+ }
gc->mapindex = index;
- safestrncpy(gc->castle_name, str[2], sizeof(gc->castle_name));
- safestrncpy(gc->castle_event, str[3], sizeof(gc->castle_event));
- idb_put(guild->castle_db,gc->castle_id,gc);
+ if (libconfig->setting_lookup_string(it, "CastleName", &name) == CONFIG_FALSE) {
+ aFree(gc);
+ ShowWarning("guild_read_castledb_libconfig_sub: Invalid CastleName in \"%s\", entry #%d, skipping.\n", source, idx);
+ return false;
+ }
+ safestrncpy(gc->castle_name, name, sizeof(gc->castle_name));
- //intif->guild_castle_info(gc->castle_id);
+ if (libconfig->setting_lookup_string(it, "OnGuildBreakEventName", &name) == CONFIG_FALSE){
+ aFree(gc);
+ ShowWarning("guild_read_castledb_libconfig_sub: Invalid OnGuildBreakEventName in \"%s\", entry #%d, skipping.\n", source, idx);
+ return false;
+ }
+ safestrncpy(gc->castle_event, name, sizeof(gc->castle_event));
+ idb_put(guild->castle_db, gc->castle_id, gc);
return true;
}
@@ -2321,8 +2372,7 @@ static void do_init_guild(bool minimal)
guild->infoevent_db = idb_alloc(DB_OPT_BASE);
guild->expcache_ers = ers_new(sizeof(struct guild_expcache),"guild.c::expcache_ers",ERS_OPT_NONE);
- sv->readdb(map->db_path, "castle_db.txt", ',', 4, 5, -1, guild->read_castledb);
-
+ guild->read_castledb_libconfig();
sv->readdb(map->db_path, "guild_skill_tree.txt", ',', 2+MAX_GUILD_SKILL_REQUIRE*2, 2+MAX_GUILD_SKILL_REQUIRE*2, -1, guild->read_guildskill_tree_db); //guild skill tree [Komurka]
timer->add_func_list(guild->payexp_timer,"guild_payexp_timer");
@@ -2457,7 +2507,8 @@ void guild_defaults(void)
guild->payexp_timer = guild_payexp_timer;
guild->sd_check = guild_sd_check;
guild->read_guildskill_tree_db = guild_read_guildskill_tree_db;
- guild->read_castledb = guild_read_castledb;
+ guild->read_castledb_libconfig = guild_read_castledb_libconfig;
+ guild->read_castledb_libconfig_sub = guild_read_castledb_libconfig_sub;
guild->payexp_timer_sub = guild_payexp_timer_sub;
guild->send_xy_timer_sub = guild_send_xy_timer_sub;
guild->send_xy_timer = guild_send_xy_timer;
diff --git a/src/map/guild.h b/src/map/guild.h
index 396cbda86..40209b988 100644
--- a/src/map/guild.h
+++ b/src/map/guild.h
@@ -165,7 +165,8 @@ struct guild_interface {
int (*payexp_timer) (int tid, int64 tick, int id, intptr_t data);
struct map_session_data *(*sd_check) (int guild_id, int account_id, int char_id);
bool (*read_guildskill_tree_db) (char* split[], int columns, int current);
- bool (*read_castledb) (char* str[], int columns, int current);
+ bool (*read_castledb_libconfig) (void);
+ bool (*read_castledb_libconfig_sub) (struct config_setting_t *it, int idx, const char *source);
int (*payexp_timer_sub) (union DBKey key, struct DBData *data, va_list ap);
int (*send_xy_timer_sub) (union DBKey key, struct DBData *data, va_list ap);
int (*send_xy_timer) (int tid, int64 tick, int id, intptr_t data);
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, &current);
+ 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___;