Large diffs are not rendered by default.

@@ -25,9 +25,9 @@
# - Jobs: List of jobs associated to group.
# Job Job name.
# MaxWeight Base maximum weight. (Default: 20000)
# HPFactor HP increase per base level. Floor(HPFactor / 100) * BaseLv. Used when macro HP_SP_TABLES is disabled. (Default: 20000)
# HPMultiplicator Base HP value. 35 + BaseLv * (HPMultiplicator / 100). Used when macro HP_SP_TABLES is disabled. (Default: 500)
# SPFactor SP increase per job level. Floor(SPFactor / 100) * BaseLv. Used when macro HP_SP_TABLES is disabled. (Default: 100)
# HpFactor Exponential HP increase. Per base level: [HpFactor * BaseLv / 100]. Used when macro HP_SP_TABLES is disabled. (Default: 0)
# HpIncrease Linear HP increase. Per base level: [HpIncrease / 100]. Used when macro HP_SP_TABLES is disabled. (Default: 500)
# SpIncrease Linear SP increase. Per base level: [SpIncrease / 100)]. Used when macro HP_SP_TABLES is disabled. (Default: 100)
# BaseASPD: Base ASPD for each weapon type. (Default: 2000)
# Weapon Weapon type with associated ASPD.
# BonusStats: Job level bonus stats/traits.
@@ -78,7 +78,7 @@

Header:
Type: JOB_STATS
Version: 1
Version: 2

Body:
- Jobs:
@@ -25,9 +25,9 @@
# - Jobs: List of jobs associated to group.
# Job Job name.
# MaxWeight Base maximum weight. (Default: 20000)
# HPFactor HP increase per base level. Floor(HPFactor / 100) * BaseLv. Used when macro HP_SP_TABLES is disabled. (Default: 20000)
# HPMultiplicator Base HP value. 35 + BaseLv * (HPMultiplicator / 100). Used when macro HP_SP_TABLES is disabled. (Default: 500)
# SPFactor SP increase per job level. Floor(SPFactor / 100) * BaseLv. Used when macro HP_SP_TABLES is disabled. (Default: 100)
# HpFactor Exponential HP increase. Per base level: [HpFactor * BaseLv / 100]. Used when macro HP_SP_TABLES is disabled. (Default: 0)
# HpIncrease Linear HP increase. Per base level: [HpIncrease / 100]. Used when macro HP_SP_TABLES is disabled. (Default: 500)
# SpIncrease Linear SP increase. Per base level: [SpIncrease / 100)]. Used when macro HP_SP_TABLES is disabled. (Default: 100)
# BaseASPD: Base ASPD for each weapon type. (Default: 2000)
# Weapon Weapon type with associated ASPD.
# BonusStats: Job level bonus stats/traits.
@@ -78,7 +78,7 @@

Header:
Type: JOB_STATS
Version: 1
Version: 2

Body:
- Jobs:

Large diffs are not rendered by default.

@@ -8,9 +8,9 @@
# - Jobs: List of jobs associated to group.
# Job Job name.
# MaxWeight Base maximum weight. (Default: 20000)
# HPFactor HP increase per base level. Floor(HPFactor / 100) * BaseLv. Used when macro HP_SP_TABLES is disabled. (Default: 20000)
# HPMultiplicator Base HP value. 35 + BaseLv * (HPMultiplicator / 100). Used when macro HP_SP_TABLES is disabled. (Default: 500)
# SPFactor SP increase per job level. Floor(SPFactor / 100) * BaseLv. Used when macro HP_SP_TABLES is disabled. (Default: 100)
# HpFactor Exponential HP increase. Per base level: [HpFactor * BaseLv / 100]. Used when macro HP_SP_TABLES is disabled. (Default: 0)
# HpIncrease Linear HP increase. Per base level: [HpIncrease / 100]. Used when macro HP_SP_TABLES is disabled. (Default: 500)
# SpIncrease Linear SP increase. Per base level: [SpIncrease / 100)]. Used when macro HP_SP_TABLES is disabled. (Default: 100)
# BaseASPD: Base ASPD for each weapon type. (Default: 2000)
# Weapon Weapon type with associated ASPD.
# BonusStats: Job level bonus stats/traits.
@@ -8,9 +8,9 @@
# - Jobs: List of jobs associated to group.
# Job Job name.
# MaxWeight Base maximum weight. (Default: 20000)
# HPFactor HP increase per base level. Floor(HPFactor / 100) * BaseLv. Used when macro HP_SP_TABLES is disabled. (Default: 20000)
# HPMultiplicator Base HP value. 35 + BaseLv * (HPMultiplicator / 100). Used when macro HP_SP_TABLES is disabled. (Default: 500)
# SPFactor SP increase per job level. Floor(SPFactor / 100) * BaseLv. Used when macro HP_SP_TABLES is disabled. (Default: 100)
# HpFactor Exponential HP increase. Per base level: [HpFactor * BaseLv / 100]. Used when macro HP_SP_TABLES is disabled. (Default: 0)
# HpIncrease Linear HP increase. Per base level: [HpIncrease / 100]. Used when macro HP_SP_TABLES is disabled. (Default: 500)
# SpIncrease Linear SP increase. Per base level: [SpIncrease / 100)]. Used when macro HP_SP_TABLES is disabled. (Default: 100)
# BaseASPD: Base ASPD for each weapon type. (Default: 2000)
# Weapon Weapon type with associated ASPD.
# BonusStats: Job level bonus stats/traits.
@@ -8,9 +8,9 @@
# - Jobs: List of jobs associated to group.
# Job Job name.
# MaxWeight Base maximum weight. (Default: 20000)
# HPFactor HP increase per base level. Floor(HPFactor / 100) * BaseLv. Used when macro HP_SP_TABLES is disabled. (Default: 20000)
# HPMultiplicator Base HP value. 35 + BaseLv * (HPMultiplicator / 100). Used when macro HP_SP_TABLES is disabled. (Default: 500)
# SPFactor SP increase per job level. Floor(SPFactor / 100) * BaseLv. Used when macro HP_SP_TABLES is disabled. (Default: 100)
# HpFactor Exponential HP increase. Per base level: [HpFactor * BaseLv / 100]. Used when macro HP_SP_TABLES is disabled. (Default: 0)
# HpIncrease Linear HP increase. Per base level: [HpIncrease / 100]. Used when macro HP_SP_TABLES is disabled. (Default: 500)
# SpIncrease Linear SP increase. Per base level: [SpIncrease / 100)]. Used when macro HP_SP_TABLES is disabled. (Default: 100)
# BaseASPD: Base ASPD for each weapon type. (Default: 2000)
# Weapon Weapon type with associated ASPD.
# BonusStats: Job level bonus stats/traits.
@@ -12999,7 +12999,7 @@ void SkillTreeDatabase::loadingFinished() {
*/
static unsigned int pc_calc_basehp(uint16 level, uint16 job_id) {
std::shared_ptr<s_job_info> job = job_db.find(job_id);
double base_hp = 35 + level * (job->hp_multiplicator / 100.);
double base_hp = 35 + level * (job->hp_increase / 100.);

#ifndef RENEWAL
if (level >= 10 && (job_id == JOB_NINJA || job_id == JOB_GUNSLINGER))
@@ -13021,7 +13021,7 @@ static unsigned int pc_calc_basehp(uint16 level, uint16 job_id) {
*/
static unsigned int pc_calc_basesp(uint16 level, uint16 job_id) {
std::shared_ptr<s_job_info> job = job_db.find(job_id);
double base_sp = 10 + floor(level * (job->sp_factor / 100.));
double base_sp = 10 + floor(level * (job->sp_increase / 100.));

switch (job_id) {
case JOB_NINJA:
@@ -13100,40 +13100,40 @@ uint64 JobDatabase::parseBodyNode(const ryml::NodeRef& node) {
job->max_weight_base = 20000;
}

if (this->nodeExists(node, "HPFactor")) {
if (this->nodeExists(node, "HpFactor")) {
uint32 hp;

if (!this->asUInt32(node, "HPFactor", hp))
if (!this->asUInt32(node, "HpFactor", hp))
return 0;

job->hp_factor = hp;
} else {
if (!exists)
job->hp_factor = 20000;
job->hp_factor = 0;
}

if (this->nodeExists(node, "HPMultiplicator")) {
if (this->nodeExists(node, "HpIncrease")) {
uint32 hp;

if (!this->asUInt32(node, "HPMultiplicator", hp))
if (!this->asUInt32(node, "HpIncrease", hp))
return 0;

job->hp_multiplicator = hp;
job->hp_increase = hp;
} else {
if (!exists)
job->hp_multiplicator = 500;
job->hp_increase = 500;
}

if (this->nodeExists(node, "SPFactor")) {
if (this->nodeExists(node, "SpIncrease")) {
uint32 sp;

if (!this->asUInt32(node, "SPFactor", sp))
if (!this->asUInt32(node, "SpIncrease", sp))
return 0;

job->sp_factor = sp;
job->sp_increase = sp;
} else {
if (!exists)
job->sp_factor = 100;
job->sp_increase = 100;
}

if (this->nodeExists(node, "BaseASPD")) {
@@ -1002,7 +1002,7 @@ class PenaltyDatabase : public TypesafeYamlDatabase<uint16, s_penalty> {

struct s_job_info {
std::vector<uint32> base_hp, base_sp, base_ap; //Storage for the first calculation with hp/sp/ap factor and multiplicator
uint32 hp_factor, hp_multiplicator, sp_factor, max_weight_base;
uint32 hp_factor, hp_increase, sp_increase, max_weight_base;
std::vector<std::array<uint16,PARAM_MAX>> job_bonus;
std::vector<int16> aspd_base;
t_exp base_exp[MAX_LEVEL], job_exp[MAX_LEVEL];
@@ -1016,7 +1016,7 @@ struct s_job_info {

class JobDatabase : public TypesafeCachedYamlDatabase<uint16, s_job_info> {
public:
JobDatabase() : TypesafeCachedYamlDatabase("JOB_STATS", 1) {
JobDatabase() : TypesafeCachedYamlDatabase("JOB_STATS", 2) {

}

@@ -464,20 +464,20 @@ int do_init( int argc, char** argv ){
return 0;
}

if (!process("JOB_STATS", 1, root_paths, "job_exp", [](const std::string& path, const std::string& name_ext) -> bool {
if (!process("JOB_STATS", 2, root_paths, "job_exp", [](const std::string& path, const std::string& name_ext) -> bool {
return sv_readdb(path.c_str(), name_ext.c_str(), ',', 4, 1000 + 3, CLASS_COUNT * 2, &pc_readdb_job_exp, false);
}, "job_exp")) {
return 0;
}

if (!process("JOB_STATS", 1, root_paths, "job_basehpsp_db", [](const std::string& path, const std::string& name_ext) -> bool {
if (!process("JOB_STATS", 2, root_paths, "job_basehpsp_db", [](const std::string& path, const std::string& name_ext) -> bool {
return sv_readdb(path.c_str(), name_ext.c_str(), ',', 4, 4 + 500, CLASS_COUNT * 2, &pc_readdb_job_basehpsp, false);
}, "job_basepoints")) {
return 0;
}

job_txt_data(path_db_mode, path_db);
if (!process("JOB_STATS", 1, { path_db_mode }, "job_db1", [](const std::string& path, const std::string& name_ext) -> bool {
if (!process("JOB_STATS", 2, { path_db_mode }, "job_db1", [](const std::string& path, const std::string& name_ext) -> bool {
#ifdef RENEWAL_ASPD
return sv_readdb(path.c_str(), name_ext.c_str(), ',', 6 + MAX_WEAPON_TYPE, 6 + MAX_WEAPON_TYPE, CLASS_COUNT, &pc_readdb_job1, false);
#else
@@ -488,7 +488,7 @@ int do_init( int argc, char** argv ){
}

job_txt_data(path_db_import, path_db_import);
if (!process("JOB_STATS", 1, { path_db_import }, "job_db1", [](const std::string& path, const std::string& name_ext) -> bool {
if (!process("JOB_STATS", 2, { path_db_import }, "job_db1", [](const std::string& path, const std::string& name_ext) -> bool {
#ifdef RENEWAL_ASPD
return sv_readdb(path.c_str(), name_ext.c_str(), ',', 6 + MAX_WEAPON_TYPE, 6 + MAX_WEAPON_TYPE, CLASS_COUNT, &pc_readdb_job1, false);
#else
@@ -4390,9 +4390,9 @@ static bool pc_readdb_job1(char* fields[], int columns, int current) {
if (atoi(fields[2]) != 0)
body << YAML::Key << "HpFactor" << YAML::Value << atoi(fields[2]);
if (atoi(fields[3]) != 500)
body << YAML::Key << "HpMultiplicator" << YAML::Value << atoi(fields[3]);
body << YAML::Key << "HpIncrease" << YAML::Value << atoi(fields[3]);
if (atoi(fields[4]) != 100)
body << YAML::Key << "SpFactor" << YAML::Value << atoi(fields[4]);
body << YAML::Key << "SpIncrease" << YAML::Value << atoi(fields[4]);

body << YAML::Key << "BaseASPD";
body << YAML::BeginMap;
@@ -5,6 +5,7 @@

static bool upgrade_achievement_db(std::string file, const uint32 source_version);
static bool upgrade_item_db(std::string file, const uint32 source_version);
static bool upgrade_job_stats(std::string file, const uint32 source_version);

template<typename Func>
bool process(const std::string &type, uint32 version, const std::vector<std::string> &paths, const std::string &name, Func lambda) {
@@ -115,6 +116,12 @@ int do_init(int argc, char** argv) {
return 0;
}

if (!process("JOB_STATS", 2, root_paths, "job_stats", [](const std::string& path, const std::string& name_ext, uint32 source_version) -> bool {
return upgrade_job_stats(path + name_ext, source_version);
})) {
return 0;
}

return 0;
}

@@ -248,3 +255,41 @@ static bool upgrade_item_db(std::string file, const uint32 source_version) {

return true;
}

static bool upgrade_job_stats(std::string file, const uint32 source_version) {
size_t entries = 0;

for (auto input : inNode["Body"]) {
// If under version 2
if (source_version < 2) {
// Field name changes
if (input["HPFactor"].IsDefined()) {
input["HpFactor"] = input["HPFactor"].as<uint32>();
input.remove("HPFactor");
}
if (input["HpMultiplicator"].IsDefined()) {
input["HpIncrease"] = input["HpMultiplicator"].as<uint32>();
input.remove("HpMultiplicator");
}
if (input["HPMultiplicator"].IsDefined()) {
input["HpIncrease"] = input["HPMultiplicator"].as<uint32>();
input.remove("HPMultiplicator");
}
if (input["SpFactor"].IsDefined()) {
input["SpIncrease"] = input["SpFactor"].as<uint32>();
input.remove("SpFactor");
}
if (input["SPFactor"].IsDefined()) {
input["SpIncrease"] = input["SPFactor"].as<uint32>();
input.remove("SPFactor");
}
}

body << input;
entries++;
}

ShowStatus("Done converting/upgrading '" CL_WHITE "%zu" CL_RESET "' job stats in '" CL_WHITE "%s" CL_RESET "'.\n", entries, file.c_str());

return true;
}