summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db/pre-re/refine_db.conf131
-rw-r--r--db/pre-re/refine_db.txt39
-rw-r--r--db/re/refine_db.conf330
-rw-r--r--db/re/refine_db.txt40
-rw-r--r--src/map/status.c143
-rw-r--r--src/map/status.h3
-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.inc53
9 files changed, 625 insertions, 129 deletions
diff --git a/db/pre-re/refine_db.conf b/db/pre-re/refine_db.conf
new file mode 100644
index 000000000..46f660834
--- /dev/null
+++ b/db/pre-re/refine_db.conf
@@ -0,0 +1,131 @@
+/********************************************************************************
+ * Pre-Renewal Refine Database *
+ ********************************************************************************
+Refine Database Structure -
+
+Armor/WeaponLevel1~4: { (0 - Armors, 1 - Level 1 Weapons, 2 - Level 2 Weapons, 3 - Level 3 Weapons, 4 - Level 4 Weapons)
+ - For armors, values of 100 add 1 armor defense.
+ - For weapons, values of 100 add 1 ATK.
+ StatsPerLevel: (int) This value is applied for ever level.
+ RandomBonusStartLevel: (int) This value specifies the start point for those levels that give a random bonus value (usually the first unsafe upgrade).
+ RandomBonusValue: (int) A random number between 0 and (Random bonus start level - Upgrade level + 1) * this value is applied for all upgrades past.
+ Random bonus start level. This is only applied for weapons, and not displayed client-side.
+ Rates: { Per level configuration of the refine rates.
+ Lv1~10: { Level of refine
+ Chance: (int) Chance of successful refine (100 = 100% success).
+ Note: If not mentioned, defaults to 100.
+ Bonus: (int) Bonus for this level of refine (Optional Field) defaults to 0.
+ Note: If not mentioned, defaults to 0.
+ }
+ }
+}
+
+* -- Refine levels that use default values need not be listed. (Example: Lv1: Chance: 100 Bonus: 0)
+******************************************************************************/
+Armors: {
+ StatsPerLevel: 66
+ RandomBonusStartLevel: 0
+ RandomBonusValue: 0
+ Rates: {
+ Lv5: {
+ Chance: 60
+ }
+ Lv6: {
+ Chance: 40
+ }
+ Lv7: {
+ Chance: 40
+ }
+ Lv8: {
+ Chance: 20
+ }
+ Lv9: {
+ Chance: 20
+ }
+ Lv10: {
+ Chance: 10
+ }
+ }
+}
+WeaponLevel1: {
+ StatsPerLevel: 200
+ RandomBonusStartLevel: 8
+ RandomBonusValue: 300
+ Rates: {
+ Lv8: {
+ Chance: 60
+ }
+ Lv9: {
+ Chance: 40
+ }
+ Lv10: {
+ Chance: 20
+ }
+ }
+}
+WeaponLevel2: {
+ StatsPerLevel: 300
+ RandomBonusStartLevel: 7
+ RandomBonusValue: 500
+ Rates: {
+ Lv7: {
+ Chance: 60
+ }
+ Lv8: {
+ Chance: 40
+ }
+ Lv9: {
+ Chance: 20
+ }
+ Lv10: {
+ Chance: 20
+ }
+ }
+}
+WeaponLevel3: {
+ StatsPerLevel: 500
+ RandomBonusStartLevel: 6
+ RandomBonusValue: 800
+ Rates: {
+ Lv6: {
+ Chance: 60
+ }
+ Lv7: {
+ Chance: 50
+ }
+ Lv8: {
+ Chance: 20
+ }
+ Lv9: {
+ Chance: 20
+ }
+ Lv10: {
+ Chance: 20
+ }
+ }
+}
+WeaponLevel4: {
+ StatsPerLevel: 700
+ RandomBonusStartLevel: 5
+ RandomBonusValue: 1300
+ Rates: {
+ Lv5: {
+ Chance: 60
+ }
+ Lv6: {
+ Chance: 40
+ }
+ Lv7: {
+ Chance: 40
+ }
+ Lv8: {
+ Chance: 20
+ }
+ Lv9: {
+ Chance: 20
+ }
+ Lv10: {
+ Chance: 10
+ }
+ }
+}
diff --git a/db/pre-re/refine_db.txt b/db/pre-re/refine_db.txt
deleted file mode 100644
index 457fd370f..000000000
--- a/db/pre-re/refine_db.txt
+++ /dev/null
@@ -1,39 +0,0 @@
-// Pre-renewal Version
-//
-// Type,Stats per level,Random bonus start level,Random bonus value,Chance+1:Bonus+1,Chance+2:Bonus+2,Chance+3:Bonus+3,...
-//
-// IMPORTANT: changing the number of upgrade levels requires modifying MAX_REFINE in status.h
-//
-// For armors, values of 100 add 1 armor defense.
-// For weapons, values of 100 add 1 ATK.
-//
-// Type:
-// 0 - Armors
-// 1 - Level 1 weapons
-// 2 - Level 2 weapons
-// 3 - Level 3 weapons
-// 4 - Level 4 weapons
-//
-// Stats per level:
-// This value is applied for every upgrade level.
-//
-// Random bonus start level:
-// This value specifies the start point for those levels that give a random bonus value.
-//
-// Random bonus value:
-// A random number between 0 and (Random bonus start level - Upgrade level + 1) * this value is applied for all upgrades past
-// Random bonus start level (usually the first unsafe upgrade). This is only applied for weapons, and not displayed client-side.
-//
-// Chance:
-// 100 = 100%
-
-// Armors
-0,66,0,0,100:0,100:0,100:0,100:0,60:0,40:0,40:0,20:0,20:0,10:0
-// Level 1 weapons
-1,200,8,300,100:0,100:0,100:0,100:0,100:0,100:0,100:0,60:0,40:0,20:0
-// Level 2 weapons
-2,300,7,500,100:0,100:0,100:0,100:0,100:0,100:0,60:0,40:0,20:0,20:0
-// Level 3 weapons
-3,500,6,800,100:0,100:0,100:0,100:0,100:0,60:0,50:0,20:0,20:0,20:0
-// Level 4 weapons
-4,700,5,1300,100:0,100:0,100:0,100:0,60:0,40:0,40:0,20:0,20:0,10:0
diff --git a/db/re/refine_db.conf b/db/re/refine_db.conf
new file mode 100644
index 000000000..5a6bdfe24
--- /dev/null
+++ b/db/re/refine_db.conf
@@ -0,0 +1,330 @@
+/********************************************************************************
+ * Renewal Refine Database *
+ ********************************************************************************
+Refine Database Structure -
+
+Armors/WeaponLevel1~4: { (0 - Armors, 1 - Level 1 Weapons, 2 - Level 2 Weapons, 3 - Level 3 Weapons, 4 - Level 4 Weapons)
+ - For armors, values of 100 add 1 armor defense.
+ - For weapons, values of 100 add 1 ATK&MATK.
+ StatsPerLevel: (int) This value is applied for ever level.
+ RandomBonusStartLevel: (int) This value specifies the start point for those levels that give a random bonus value (usually the first unsafe upgrade).
+ RandomBonusValue: (int) A random number between 0 and (Random bonus start level - Upgrade level + 1) * this value is applied for all upgrades past.
+ Random bonus start level. This is only applied for weapons, and not displayed client-side.
+ Rates: { Per level configuration of the refine rates.
+ Lv1~10: { Level of refine
+ Chance: (int) Chance of successful refine (100 = 100%)
+ Note: If not mentioned, defaults to 100.
+ Bonus: (int) Bonus for this level of refine (Optional Field)
+ Note: If not mentioned, defaults to 0.
+ }
+ }
+}
+
+* -- Refine levels that use default values need not be listed. (Example: Lv1: Chance: 100 Bonus: 0)
+* -- A note about renewal Armors, there may or may not be another bonus, according to iRO wiki: Every upgrade gives floor[( 3 + current upgrade ) / 4]
+******************************************************************************/
+Armors: {
+ StatsPerLevel: 0
+ RandomBonusStartLevel: 0
+ RandomBonusValue: 0
+ Rates: {
+ Lv1: {
+ Bonus: 100
+ }
+ Lv2: {
+ Bonus: 100
+ }
+ Lv3: {
+ Bonus: 100
+ }
+ Lv4: {
+ Bonus: 100
+ }
+ Lv5: {
+ Chance: 60
+ Bonus: 200
+ }
+ Lv6: {
+ Chance: 40
+ Bonus: 200
+ }
+ Lv7: {
+ Chance: 40
+ Bonus: 200
+ }
+ Lv8: {
+ Chance: 20
+ Bonus: 200
+ }
+ Lv9: {
+ Chance: 20
+ Bonus: 300
+ }
+ Lv10: {
+ Chance: 10
+ Bonus: 300
+ }
+ Lv11: {
+ Chance: 8
+ Bonus: 300
+ }
+ Lv12: {
+ Chance: 8
+ Bonus: 300
+ }
+ Lv13: {
+ Chance: 8
+ Bonus: 400
+ }
+ Lv14: {
+ Chance: 8
+ Bonus: 400
+ }
+ Lv15: {
+ Chance: 7
+ Bonus: 400
+ }
+ Lv16: {
+ Chance: 7
+ Bonus: 400
+ }
+ Lv17: {
+ Chance: 7
+ Bonus: 500
+ }
+ Lv18: {
+ Chance: 7
+ Bonus: 500
+ }
+ Lv19: {
+ Chance: 5
+ Bonus: 500
+ }
+ Lv20: {
+ Chance: 5
+ Bonus: 500
+ }
+ }
+}
+WeaponLevel1: {
+ StatsPerLevel: 200
+ RandomBonusStartLevel: 8
+ RandomBonusValue: 300
+ Rates: {
+ Lv8: {
+ Chance: 60
+ }
+ Lv9: {
+ Chance: 40
+ }
+ Lv10: {
+ Chance: 20
+ }
+ Lv11: {
+ Chance: 18
+ }
+ Lv12: {
+ Chance: 18
+ }
+ Lv13: {
+ Chance: 18
+ }
+ Lv14: {
+ Chance: 18
+ }
+ Lv15: {
+ Chance: 18
+ }
+ Lv16: {
+ Chance: 17
+ Bonus: 300
+ }
+ Lv17: {
+ Chance: 17
+ Bonus: 300
+ }
+ Lv18: {
+ Chance: 17
+ Bonus: 300
+ }
+ Lv19: {
+ Chance: 15
+ Bonus: 300
+ }
+ Lv20: {
+ Chance: 15
+ Bonus: 300
+ }
+ }
+}
+WeaponLevel2: {
+ StatsPerLevel: 300
+ RandomBonusStartLevel: 7
+ RandomBonusValue: 500
+ Rates: {
+ Lv7: {
+ Chance: 60
+ }
+ Lv8: {
+ Chance: 40
+ }
+ Lv9: {
+ Chance: 20
+ }
+ Lv10: {
+ Chance: 20
+ }
+ Lv11: {
+ Chance: 18
+ }
+ Lv12: {
+ Chance: 18
+ }
+ Lv13: {
+ Chance: 18
+ }
+ Lv14: {
+ Chance: 18
+ }
+ Lv15: {
+ Chance:18
+ }
+ Lv16: {
+ Chance: 17
+ Bonus: 600
+ }
+ Lv17: {
+ Chance: 17
+ Bonus: 600
+ }
+ Lv18: {
+ Chance: 17
+ Bonus: 600
+ }
+ Lv19: {
+ Chance: 15
+ Bonus: 600
+ }
+ Lv20: {
+ Chance: 15
+ Bonus: 600
+ }
+ }
+}
+WeaponLevel3: {
+ StatsPerLevel: 500
+ RandomBonusStartLevel: 6
+ RandomBonusValue: 800
+ Rates: {
+ Lv6: {
+ Chance: 60
+ }
+ Lv7: {
+ Chance: 50
+ }
+ Lv8: {
+ Chance: 20
+ }
+ Lv9: {
+ Chance: 20
+ }
+ Lv10: {
+ Chance: 20
+ }
+ Lv11: {
+ Chance: 18
+ }
+ Lv12: {
+ Chance: 18
+ }
+ Lv13: {
+ Chance: 18
+ }
+ Lv14: {
+ Chance: 18
+ }
+ Lv15: {
+ Chance: 18
+ }
+ Lv16: {
+ Chance: 17
+ Bonus: 900
+ }
+ Lv17: {
+ Chance: 17
+ Bonus: 900
+ }
+ Lv18: {
+ Chance: 17
+ Bonus: 900
+ }
+ Lv19: {
+ Chance: 15
+ Bonus: 900
+ }
+ Lv20: {
+ Chance: 15
+ Bonus: 900
+ }
+ }
+}
+WeaponLevel4: {
+ StatsPerLevel: 700
+ RandomBonusStartLevel: 5
+ RandomBonusValue: 1400
+ Rates: {
+ Lv5: {
+ Chance: 60
+ }
+ Lv6: {
+ Chance: 40
+ }
+ Lv7: {
+ Chance: 40
+ }
+ Lv8: {
+ Chance: 20
+ }
+ Lv9: {
+ Chance: 20
+ }
+ Lv10: {
+ Chance: 10
+ }
+ Lv11: {
+ Chance: 8
+ }
+ Lv12: {
+ Chance: 8
+ }
+ Lv13: {
+ Chance: 8
+ }
+ Lv14: {
+ Chance: 8
+ }
+ Lv15: {
+ Chance: 7
+ }
+ Lv16: {
+ Chance: 7
+ Bonus: 1200
+ }
+ Lv17: {
+ Chance: 7
+ Bonus: 1200
+ }
+ Lv18: {
+ Chance: 7
+ Bonus: 1200
+ }
+ Lv19: {
+ Chance: 5
+ Bonus: 1200
+ }
+ Lv20: {
+ Chance: 5
+ Bonus: 1200
+ }
+ }
+}
diff --git a/db/re/refine_db.txt b/db/re/refine_db.txt
deleted file mode 100644
index 2b78a9d44..000000000
--- a/db/re/refine_db.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-// Renewal Version
-//
-// Type,Stats per level,Random bonus start level,Random bonus value,Chance+1:Bonus+1,Chance+2:Bonus+2,Chance+3:Bonus+3,...
-//
-// IMPORTANT: changing the number of upgrade levels requires modifying MAX_REFINE in status.h
-//
-// For armors, values of 100 add 1 armor defense.
-// For weapons, values of 100 add 1 ATK&MATK.
-//
-// Type:
-// 0 - Armors
-// 1 - Level 1 weapons
-// 2 - Level 2 weapons
-// 3 - Level 3 weapons
-// 4 - Level 4 weapons
-//
-// Stats per level:
-// This value is applied for every upgrade level.
-//
-// Random bonus start level:
-// This value specifies the start point for those levels that give a random bonus value (usually the first unsafe upgrade).
-//
-// Random bonus value:
-// A random number between 0 and (Random bonus start level - Upgrade level + 1) * this value is applied for all upgrades past
-// Random bonus start level. This is only applied for weapons, and not displayed client-side.
-//
-// Chance:
-// 100 = 100%
-//
-// A note about renewal Armors, there may or may not be another bonus, according to iRO wiki: Every upgrade gives floor[( 3 + current upgrade ) / 4] equipment DEF)
-
-0,0,0,0,100:100,100:100,100:100,100:100,60:200,40:200,40:200,20:200,20:300,10:300,8:300,8:300,8:400,8:400,7:400,7:400,7:500,7:500,5:500,5:500
-// Level 1 weapons
-1,200,8,300,100:0,100:0,100:0,100:0,100:0,100:0,100:0,60:0,40:0,20:0,18:0,18:0,18:0,18:0,18:0,17:300,17:300,17:300,15:300,15:300
-// Level 2 weapons
-2,300,7,500,100:0,100:0,100:0,100:0,100:0,100:0,60:0,40:0,20:0,20:0,18:0,18:0,18:0,18:0,18:0,17:600,17:600,17:600,15:600,15:600
-// Level 3 weapons
-3,500,6,800,100:0,100:0,100:0,100:0,100:0,60:0,50:0,20:0,20:0,20:0,18:0,18:0,18:0,18:0,18:0,17:900,17:900,17:900,15:900,15:900
-// Level 4 weapons
-4,700,5,1400,100:0,100:0,100:0,100:0,60:0,40:0,40:0,20:0,20:0,10:0,8:0,8:0,8:0,8:0,8:0,7:1200,7:1200,7:1200,5:1200,5:1200
diff --git a/src/map/status.c b/src/map/status.c
index c815eeaff..25c7e13dc 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -35,6 +35,7 @@
#include "common/strlib.h"
#include "common/timer.h"
#include "common/utils.h"
+#include "common/conf.h"
#include <math.h>
#include <memory.h>
@@ -12266,38 +12267,117 @@ bool status_readdb_sizefix(char* fields[], int columns, int current)
return true;
}
-bool status_readdb_refine(char* fields[], int columns, int current)
-{
- int i, bonus_per_level, random_bonus, random_bonus_start_level;
-
- current = atoi(fields[0]);
-
- if (current < 0 || current >= REFINE_TYPE_MAX)
- return false;
-
- bonus_per_level = atoi(fields[1]);
- random_bonus_start_level = atoi(fields[2]);
- random_bonus = atoi(fields[3]);
-
- for(i = 0; i < MAX_REFINE; i++)
- {
- char* delim;
-
- if (!(delim = strchr(fields[4+i], ':')))
- return false;
-
- *delim = '\0';
-
- status->dbs->refine_info[current].chance[i] = atoi(fields[4+i]);
+/**
+ * Processes a refine_db.conf entry.
+ *
+ * @param *r Libconfig setting entry. It is expected to be valid and it
+ * won't be freed (it is care of the caller to do so if
+ * necessary)
+ * @param n Ordinal number of the entry, to be displayed in case of
+ * validation errors.
+ * @param *source Source of the entry (file name), to be displayed in case of
+ * validation errors.
+ * @return # of the validated entry, or 0 in case of failure.
+ */
+int status_readdb_refine_libconfig_sub(config_setting_t *r, const char *name, const char *source) {
+ config_setting_t *rate = NULL;
+ int i=0, type=0, bonus_per_level=0, rnd_bonus_v=0, rnd_bonus_lv=0;
+ char lv[4];
+
+ if(!strncmp(name, "Armors", 6)) {
+ type = 0;
+ } else if(strncmp(name, "WeaponLevel", 11) || !strspn(&name[strlen(name)-1], "0123456789") || !(type = atoi(strncpy(lv, name+11, 2)))) {
+ ShowError("status_readdb_refine_libconfig_sub: Invalid key name for entry '%s' in \"%s\", skipping.\n", name, source);
+ return 0;
+ }
+ if(type < REFINE_TYPE_ARMOR || type >= REFINE_TYPE_MAX) {
+ ShowError("status_readdb_refine_libconfig_sub: Out of range level for entry '%s' in \"%s\", skipping.\n", name, source);
+ return 0;
+ } else if(!libconfig->setting_lookup_int(r, "StatsPerLevel", &bonus_per_level)) {
+ ShowWarning("status_readdb_refine_libconfig_sub: Missing StatsPerLevel for entry '%s' in \"%s\", skipping.\n", name, source);
+ return 0;
+ } else if(!libconfig->setting_lookup_int(r, "RandomBonusStartLevel", &rnd_bonus_lv)) {
+ ShowWarning("status_readdb_refine_libconfig_sub: Missing RandomBonusStartLevel for entry '%s' in \"%s\", skipping.\n", name, source);
+ return 0;
+ } else if(!libconfig->setting_lookup_int(r, "RandomBonusValue", &rnd_bonus_v)) {
+ ShowWarning("status_readdb_refine_libconfig_sub: Missing RandomBonusValue for entry '%s' in \"%s\", skipping.\n", name, source);
+ return 0;
+ }
- if (i >= random_bonus_start_level - 1)
- status->dbs->refine_info[current].randombonus_max[i] = random_bonus * (i - random_bonus_start_level + 2);
+ if((rate=libconfig->setting_get_member(r, "Rates")) && config_setting_is_group(rate)) {
+ config_setting_t *t = NULL;
+ bool duplicate[MAX_REFINE];
+ int bonus_[MAX_REFINE], rnd_bonus[MAX_REFINE], chance_[MAX_REFINE];
+
+ memset(&duplicate,0,sizeof(duplicate));
+ memset(&bonus_,0,sizeof(bonus_));
+ memset(&rnd_bonus,0,sizeof(rnd_bonus));
+ memset(&chance_,0,sizeof(chance_));
+ i=0;
+ while( (t = libconfig->setting_get_elem(rate,i++)) && config_setting_is_group(t) ) {
+ int level=0, chance=0, bonus=0;
+ char *rlvl = config_setting_name(t);
+ memset(&lv,0, sizeof(lv));
+ if(!strspn(&rlvl[strlen(rlvl)-1], "0123456789") || (level = atoi(strncpy(lv, rlvl+2, 3))) <= 0) {
+ ShowError("status_readdb_refine_libconfig_sub: Invalid refine level format '%s' for entry %s in \"%s\"... skipping.\n", rlvl, name, source);
+ continue;
+ } else if(level <= 0 || level > MAX_REFINE) {
+ ShowError("status_readdb_refine_libconfig_sub: Out of range refine level '%s' for entry %s in \"%s\"... skipping.\n", rlvl, name, source);
+ continue;
+ } else if(duplicate[level-1]) {
+ ShowWarning("status_readdb_refine_libconfig_sub: duplicate rate '%s' for entry %s in \"%s\", overwriting previous entry...\n", rlvl, name, source);
+ } else duplicate[level-1] = true;
+ level--;
+ chance_[level] = libconfig->setting_lookup_int(t, "Chance", &chance)?chance:100;
+ bonus_[level] = bonus_per_level + libconfig->setting_lookup_int(t, "Bonus", &bonus)?bonus:0;
+ if ( level >= rnd_bonus_lv - 1 ) rnd_bonus[level] = rnd_bonus_v * (level - rnd_bonus_lv + 2);
+ }
+ for(i=0; i < MAX_REFINE; i++) {
+ status->dbs->refine_info[type].chance[i] = chance_[i]?chance_[i]:100;
+ status->dbs->refine_info[type].randombonus_max[i] = rnd_bonus[i];
+ bonus_[i] += i?bonus_[i-1]:0;
+ status->dbs->refine_info[type].bonus[i] = bonus_[i]?bonus_[i]:0;
+ }
+ } else {
+ ShowWarning("status_readdb_refine_libconfig_sub: Missing refine rates for entry '%s' in \"%s\", skipping.\n", name, source);
+ return 0;
+ }
+ return type+1;
+}
- status->dbs->refine_info[current].bonus[i] = bonus_per_level + atoi(delim+1);
- if (i > 0)
- status->dbs->refine_info[current].bonus[i] += status->dbs->refine_info[current].bonus[i-1];
+/**
+ * Reads from a libconfig-formatted refine_db.conf file.
+ *
+ * @param *filename File name, relative to the database path.
+ * @return The number of found entries.
+ */
+int status_readdb_refine_libconfig(const char *filename) {
+ bool duplicate[REFINE_TYPE_MAX];
+ config_t refine_db_conf;
+ config_setting_t *r;
+ char filepath[256];
+ int i = 0, count = 0,type = 0;
+
+ sprintf(filepath, "%s/%s", map->db_path, filename);
+ memset(&duplicate,0,sizeof(duplicate));
+ if( libconfig->read_file(&refine_db_conf, filepath) ) {
+ ShowError("can't read %s\n", filepath);
+ return 0;
}
- return true;
+
+ while((r = libconfig->setting_get_elem(refine_db_conf.root,i++))) {
+ char *name = config_setting_name(r);
+ if((type=status->readdb_refine_libconfig_sub(r, name, filename))) {
+ if( duplicate[type-1] ) {
+ ShowWarning("status_readdb_refine_libconfig: duplicate entry for %s in \"%s\", overwriting previous entry...\n", name, filename);
+ } else duplicate[type-1] = true;
+ count++;
+ }
+ }
+ libconfig->destroy(&refine_db_conf);
+ ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, filename);
+
+ return count;
}
bool status_readdb_scconfig(char* fields[], int columns, int current) {
@@ -12360,7 +12440,7 @@ int status_readdb(void)
//
sv->readdb(map->db_path, "job_db2.txt", ',', 1, 1+MAX_LEVEL, -1, status->readdb_job2);
sv->readdb(map->db_path, DBPATH"size_fix.txt", ',', MAX_WEAPON_TYPE, MAX_WEAPON_TYPE, ARRAYLENGTH(status->dbs->atkmods), status->readdb_sizefix);
- sv->readdb(map->db_path, DBPATH"refine_db.txt", ',', 4+MAX_REFINE, 4+MAX_REFINE, ARRAYLENGTH(status->dbs->refine_info), status->readdb_refine);
+ status->readdb_refine_libconfig(DBPATH"refine_db.conf");
sv->readdb(map->db_path, "sc_config.txt", ',', 2, 2, SC_MAX, status->readdb_scconfig);
status->read_job_db();
@@ -12535,7 +12615,8 @@ void status_defaults(void) {
status->natural_heal_timer = status_natural_heal_timer;
status->readdb_job2 = status_readdb_job2;
status->readdb_sizefix = status_readdb_sizefix;
- status->readdb_refine = status_readdb_refine;
+ status->readdb_refine_libconfig = status_readdb_refine_libconfig;
+ status->readdb_refine_libconfig_sub = status_readdb_refine_libconfig_sub;
status->readdb_scconfig = status_readdb_scconfig;
status->read_job_db = status_read_job_db;
status->read_job_db_sub = status_read_job_db_sub;
diff --git a/src/map/status.h b/src/map/status.h
index 274c64c5b..d49bca8b4 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -2077,7 +2077,8 @@ struct status_interface {
int (*natural_heal_timer) (int tid, int64 tick, int id, intptr_t data);
bool (*readdb_job2) (char *fields[], int columns, int current);
bool (*readdb_sizefix) (char *fields[], int columns, int current);
- bool (*readdb_refine) (char *fields[], int columns, int current);
+ int (*readdb_refine_libconfig) (const char *filename);
+ int (*readdb_refine_libconfig_sub) (config_setting_t *r, const char *name, const char *source);
bool (*readdb_scconfig) (char *fields[], int columns, int current);
void (*read_job_db) (void);
void (*read_job_db_sub) (int idx, const char *name, config_setting_t *jdb);
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
index bb0f05cff..f36d91718 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
@@ -5471,8 +5471,10 @@ struct {
struct HPMHookPoint *HP_status_readdb_job2_post;
struct HPMHookPoint *HP_status_readdb_sizefix_pre;
struct HPMHookPoint *HP_status_readdb_sizefix_post;
- struct HPMHookPoint *HP_status_readdb_refine_pre;
- struct HPMHookPoint *HP_status_readdb_refine_post;
+ struct HPMHookPoint *HP_status_readdb_refine_libconfig_pre;
+ struct HPMHookPoint *HP_status_readdb_refine_libconfig_post;
+ struct HPMHookPoint *HP_status_readdb_refine_libconfig_sub_pre;
+ struct HPMHookPoint *HP_status_readdb_refine_libconfig_sub_post;
struct HPMHookPoint *HP_status_readdb_scconfig_pre;
struct HPMHookPoint *HP_status_readdb_scconfig_post;
struct HPMHookPoint *HP_status_read_job_db_pre;
@@ -11228,8 +11230,10 @@ struct {
int HP_status_readdb_job2_post;
int HP_status_readdb_sizefix_pre;
int HP_status_readdb_sizefix_post;
- int HP_status_readdb_refine_pre;
- int HP_status_readdb_refine_post;
+ int HP_status_readdb_refine_libconfig_pre;
+ int HP_status_readdb_refine_libconfig_post;
+ int HP_status_readdb_refine_libconfig_sub_pre;
+ int HP_status_readdb_refine_libconfig_sub_post;
int HP_status_readdb_scconfig_pre;
int HP_status_readdb_scconfig_post;
int HP_status_read_job_db_pre;
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
index a73e70c33..dacb51580 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
@@ -2785,7 +2785,8 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(status->natural_heal_timer, HP_status_natural_heal_timer) },
{ HP_POP(status->readdb_job2, HP_status_readdb_job2) },
{ HP_POP(status->readdb_sizefix, HP_status_readdb_sizefix) },
- { HP_POP(status->readdb_refine, HP_status_readdb_refine) },
+ { HP_POP(status->readdb_refine_libconfig, HP_status_readdb_refine_libconfig) },
+ { HP_POP(status->readdb_refine_libconfig_sub, HP_status_readdb_refine_libconfig_sub) },
{ HP_POP(status->readdb_scconfig, HP_status_readdb_scconfig) },
{ HP_POP(status->read_job_db, HP_status_read_job_db) },
{ HP_POP(status->read_job_db_sub, HP_status_read_job_db_sub) },
diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
index cd88ee6bd..0dd8fbadc 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
@@ -73582,15 +73582,15 @@ bool HP_status_readdb_sizefix(char *fields[], int columns, int current) {
}
return retVal___;
}
-bool HP_status_readdb_refine(char *fields[], int columns, int current) {
+int HP_status_readdb_refine_libconfig_sub(config_setting_t *r, const char *name, const char *source) {
int hIndex = 0;
- bool retVal___ = false;
- if( HPMHooks.count.HP_status_readdb_refine_pre ) {
- bool (*preHookFunc) (char *fields[], int *columns, int *current);
+ int retVal___ = 0;
+ if( HPMHooks.count.HP_status_readdb_refine_libconfig_sub_pre ) {
+ int (*preHookFunc) (config_setting_t *r, const char *name, const char *source);
*HPMforce_return = false;
- for(hIndex = 0; hIndex < HPMHooks.count.HP_status_readdb_refine_pre; hIndex++ ) {
- preHookFunc = HPMHooks.list.HP_status_readdb_refine_pre[hIndex].func;
- retVal___ = preHookFunc(fields, &columns, &current);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_status_readdb_refine_libconfig_sub_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_status_readdb_refine_libconfig_sub_pre[hIndex].func;
+ retVal___ = preHookFunc(r, name, source);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -73598,13 +73598,40 @@ bool HP_status_readdb_refine(char *fields[], int columns, int current) {
}
}
{
- retVal___ = HPMHooks.source.status.readdb_refine(fields, columns, current);
+ retVal___ = HPMHooks.source.status.readdb_refine_libconfig_sub(r, name, source);
}
- if( HPMHooks.count.HP_status_readdb_refine_post ) {
- bool (*postHookFunc) (bool retVal___, char *fields[], int *columns, int *current);
- for(hIndex = 0; hIndex < HPMHooks.count.HP_status_readdb_refine_post; hIndex++ ) {
- postHookFunc = HPMHooks.list.HP_status_readdb_refine_post[hIndex].func;
- retVal___ = postHookFunc(retVal___, fields, &columns, &current);
+ if( HPMHooks.count.HP_status_readdb_refine_libconfig_sub_post ) {
+ int (*postHookFunc) (int retVal___, config_setting_t *r, const char *name, const char *source);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_status_readdb_refine_libconfig_sub_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_status_readdb_refine_libconfig_sub_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, r, name, source);
+ }
+ }
+ return retVal___;
+}
+int HP_status_readdb_refine_libconfig(const char *filename) {
+ int hIndex = 0;
+ int retVal___ = 0;
+ if( HPMHooks.count.HP_status_readdb_refine_libconfig_pre ) {
+ int (*preHookFunc) (const char *filename);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_status_readdb_refine_libconfig_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_status_readdb_refine_libconfig_pre[hIndex].func;
+ retVal___ = preHookFunc(filename);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.status.readdb_refine_libconfig(filename);
+ }
+ if( HPMHooks.count.HP_status_readdb_refine_libconfig_post ) {
+ int (*postHookFunc) (int retVal___, const char *filename);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_status_readdb_refine_libconfig_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_status_readdb_refine_libconfig_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, filename);
}
}
return retVal___;