|
@@ -22993,9 +22993,9 @@ const std::string SkillDatabase::getDefaultLocation() {
|
|
return std::string(db_path) + "/skill_db.yml";
|
|
return std::string(db_path) + "/skill_db.yml";
|
|
}
|
|
}
|
|
|
|
|
|
-template<typename T, size_t S> bool SkillDatabase::parseNode(std::string nodeName, std::string subNodeName, ryml::NodeRef node, T (&arr)[S]) {
|
|
|
|
|
|
+template<typename T, size_t S> bool SkillDatabase::parseNode(const std::string& nodeName, const std::string& subNodeName, const ryml::NodeRef& node, T (&arr)[S]) {
|
|
int32 value;
|
|
int32 value;
|
|
- const auto skNode = node[c4::to_csubstr(nodeName)];
|
|
|
|
|
|
+ const auto& skNode = node[c4::to_csubstr(nodeName)];
|
|
if (!skNode.is_seq()) {
|
|
if (!skNode.is_seq()) {
|
|
if (!this->asInt32(node, nodeName, value))
|
|
if (!this->asInt32(node, nodeName, value))
|
|
return false;
|
|
return false;
|
|
@@ -23005,7 +23005,7 @@ template<typename T, size_t S> bool SkillDatabase::parseNode(std::string nodeNam
|
|
} else {
|
|
} else {
|
|
uint16 max_level = 0;
|
|
uint16 max_level = 0;
|
|
|
|
|
|
- for (const auto it : skNode.children()) {
|
|
|
|
|
|
+ for (const auto& it : skNode) {
|
|
uint16 skill_lv;
|
|
uint16 skill_lv;
|
|
|
|
|
|
if (!this->asUInt16(it, "Level", skill_lv))
|
|
if (!this->asUInt16(it, "Level", skill_lv))
|
|
@@ -23063,7 +23063,7 @@ template<typename T, size_t S> bool SkillDatabase::parseNode(std::string nodeNam
|
|
* @param node: YAML node containing the entry.
|
|
* @param node: YAML node containing the entry.
|
|
* @return count of successfully parsed rows
|
|
* @return count of successfully parsed rows
|
|
*/
|
|
*/
|
|
-uint64 SkillDatabase::parseBodyNode(const ryml::NodeRef node) {
|
|
|
|
|
|
+uint64 SkillDatabase::parseBodyNode(const ryml::NodeRef& node) {
|
|
uint16 skill_id;
|
|
uint16 skill_id;
|
|
|
|
|
|
if (!this->asUInt16(node, "Id", skill_id))
|
|
if (!this->asUInt16(node, "Id", skill_id))
|
|
@@ -23158,9 +23158,9 @@ uint64 SkillDatabase::parseBodyNode(const ryml::NodeRef node) {
|
|
}
|
|
}
|
|
|
|
|
|
if (this->nodeExists(node, "DamageFlags")) {
|
|
if (this->nodeExists(node, "DamageFlags")) {
|
|
- const auto damageNode = node["DamageFlags"];
|
|
|
|
|
|
+ const auto& damageNode = node["DamageFlags"];
|
|
|
|
|
|
- for (const auto it : damageNode.children()) {
|
|
|
|
|
|
+ for (const auto& it : damageNode) {
|
|
std::string nk;
|
|
std::string nk;
|
|
c4::from_chars(it.key(), &nk);
|
|
c4::from_chars(it.key(), &nk);
|
|
std::string nk_constant = "NK_" + nk;
|
|
std::string nk_constant = "NK_" + nk;
|
|
@@ -23184,9 +23184,9 @@ uint64 SkillDatabase::parseBodyNode(const ryml::NodeRef node) {
|
|
}
|
|
}
|
|
|
|
|
|
if (this->nodeExists(node, "Flags")) {
|
|
if (this->nodeExists(node, "Flags")) {
|
|
- const auto infoNode = node["Flags"];
|
|
|
|
|
|
+ const auto& infoNode = node["Flags"];
|
|
|
|
|
|
- for (const auto it : infoNode.children()) {
|
|
|
|
|
|
+ for (const auto& it : infoNode) {
|
|
std::string inf2;
|
|
std::string inf2;
|
|
c4::from_chars(it.key(), &inf2);
|
|
c4::from_chars(it.key(), &inf2);
|
|
std::string inf2_constant = "INF2_" + inf2;
|
|
std::string inf2_constant = "INF2_" + inf2;
|
|
@@ -23268,7 +23268,7 @@ uint64 SkillDatabase::parseBodyNode(const ryml::NodeRef node) {
|
|
|
|
|
|
memset(skill->element, static_cast<e_element>(constant), sizeof(skill->element));
|
|
memset(skill->element, static_cast<e_element>(constant), sizeof(skill->element));
|
|
} else {
|
|
} else {
|
|
- for (const auto it : elementNode.children()) {
|
|
|
|
|
|
+ for (const auto& it : elementNode) {
|
|
uint16 skill_lv;
|
|
uint16 skill_lv;
|
|
|
|
|
|
if (!this->asUInt16(it, "Level", skill_lv))
|
|
if (!this->asUInt16(it, "Level", skill_lv))
|
|
@@ -23328,10 +23328,10 @@ uint64 SkillDatabase::parseBodyNode(const ryml::NodeRef node) {
|
|
}
|
|
}
|
|
|
|
|
|
if (this->nodeExists(node, "CopyFlags")) {
|
|
if (this->nodeExists(node, "CopyFlags")) {
|
|
- const auto copyNode = node["CopyFlags"];
|
|
|
|
|
|
+ const auto& copyNode = node["CopyFlags"];
|
|
|
|
|
|
if (this->nodeExists(copyNode, "Skill")) {
|
|
if (this->nodeExists(copyNode, "Skill")) {
|
|
- const auto copyskillNode = copyNode["Skill"];
|
|
|
|
|
|
+ const auto& copyskillNode = copyNode["Skill"];
|
|
|
|
|
|
if (this->nodeExists(copyskillNode, "Plagiarism")) {
|
|
if (this->nodeExists(copyskillNode, "Plagiarism")) {
|
|
bool active;
|
|
bool active;
|
|
@@ -23362,9 +23362,9 @@ uint64 SkillDatabase::parseBodyNode(const ryml::NodeRef node) {
|
|
}
|
|
}
|
|
|
|
|
|
if (this->nodeExists(copyNode, "RemoveRequirement")) {
|
|
if (this->nodeExists(copyNode, "RemoveRequirement")) {
|
|
- const auto copyreqNode = copyNode["RemoveRequirement"];
|
|
|
|
|
|
+ const auto& copyreqNode = copyNode["RemoveRequirement"];
|
|
|
|
|
|
- for (const auto it : copyreqNode.children()) {
|
|
|
|
|
|
+ for (const auto& it : copyreqNode) {
|
|
std::string req;
|
|
std::string req;
|
|
c4::from_chars(it.key(), &req);
|
|
c4::from_chars(it.key(), &req);
|
|
std::string req_constant = "SKILL_REQ_" + req;
|
|
std::string req_constant = "SKILL_REQ_" + req;
|
|
@@ -23384,7 +23384,7 @@ uint64 SkillDatabase::parseBodyNode(const ryml::NodeRef node) {
|
|
}
|
|
}
|
|
|
|
|
|
if (this->nodeExists(node, "NoNearNpc")) {
|
|
if (this->nodeExists(node, "NoNearNpc")) {
|
|
- const auto npcNode = node["NoNearNpc"];
|
|
|
|
|
|
+ const auto& npcNode = node["NoNearNpc"];
|
|
|
|
|
|
if (this->nodeExists(npcNode, "AdditionalRange")) {
|
|
if (this->nodeExists(npcNode, "AdditionalRange")) {
|
|
uint16 range;
|
|
uint16 range;
|
|
@@ -23399,9 +23399,9 @@ uint64 SkillDatabase::parseBodyNode(const ryml::NodeRef node) {
|
|
}
|
|
}
|
|
|
|
|
|
if (this->nodeExists(npcNode, "Type")) {
|
|
if (this->nodeExists(npcNode, "Type")) {
|
|
- const auto npctypeNode = npcNode["Type"];
|
|
|
|
|
|
+ const auto& npctypeNode = npcNode["Type"];
|
|
|
|
|
|
- for (const auto it : npctypeNode.children()) {
|
|
|
|
|
|
+ for (const auto& it : npctypeNode) {
|
|
std::string type;
|
|
std::string type;
|
|
c4::from_chars(it.key(), &type);
|
|
c4::from_chars(it.key(), &type);
|
|
std::string type_constant = "SKILL_NONEAR_" + type;
|
|
std::string type_constant = "SKILL_NONEAR_" + type;
|
|
@@ -23511,9 +23511,9 @@ uint64 SkillDatabase::parseBodyNode(const ryml::NodeRef node) {
|
|
#endif
|
|
#endif
|
|
|
|
|
|
if (this->nodeExists(node, "CastTimeFlags")) {
|
|
if (this->nodeExists(node, "CastTimeFlags")) {
|
|
- const auto castNode = node["CastTimeFlags"];
|
|
|
|
|
|
+ const auto& castNode = node["CastTimeFlags"];
|
|
|
|
|
|
- for (const auto it : castNode.children()) {
|
|
|
|
|
|
+ for (const auto& it : castNode) {
|
|
std::string flag;
|
|
std::string flag;
|
|
c4::from_chars(it.key(), &flag);
|
|
c4::from_chars(it.key(), &flag);
|
|
std::string flag_constant = "SKILL_CAST_" + flag;
|
|
std::string flag_constant = "SKILL_CAST_" + flag;
|
|
@@ -23537,9 +23537,9 @@ uint64 SkillDatabase::parseBodyNode(const ryml::NodeRef node) {
|
|
}
|
|
}
|
|
|
|
|
|
if (this->nodeExists(node, "CastDelayFlags")) {
|
|
if (this->nodeExists(node, "CastDelayFlags")) {
|
|
- const auto castNode = node["CastDelayFlags"];
|
|
|
|
|
|
+ const auto& castNode = node["CastDelayFlags"];
|
|
|
|
|
|
- for (const auto it : castNode.children()) {
|
|
|
|
|
|
+ for (const auto& it : castNode) {
|
|
std::string flag;
|
|
std::string flag;
|
|
c4::from_chars(it.key(), &flag);
|
|
c4::from_chars(it.key(), &flag);
|
|
std::string flag_constant = "SKILL_CAST_" + flag;
|
|
std::string flag_constant = "SKILL_CAST_" + flag;
|
|
@@ -23563,7 +23563,7 @@ uint64 SkillDatabase::parseBodyNode(const ryml::NodeRef node) {
|
|
}
|
|
}
|
|
|
|
|
|
if (this->nodeExists(node, "Requires")) {
|
|
if (this->nodeExists(node, "Requires")) {
|
|
- const auto requireNode = node["Requires"];
|
|
|
|
|
|
+ const auto& requireNode = node["Requires"];
|
|
|
|
|
|
if (this->nodeExists(requireNode, "HpCost")) {
|
|
if (this->nodeExists(requireNode, "HpCost")) {
|
|
if (!this->parseNode("HpCost", "Amount", requireNode, skill->require.hp))
|
|
if (!this->parseNode("HpCost", "Amount", requireNode, skill->require.hp))
|
|
@@ -23630,7 +23630,7 @@ uint64 SkillDatabase::parseBodyNode(const ryml::NodeRef node) {
|
|
}
|
|
}
|
|
|
|
|
|
if (this->nodeExists(requireNode, "Weapon")) {
|
|
if (this->nodeExists(requireNode, "Weapon")) {
|
|
- const auto weaponNode = requireNode["Weapon"];
|
|
|
|
|
|
+ const auto& weaponNode = requireNode["Weapon"];
|
|
|
|
|
|
if (this->nodeExists(weaponNode, "All")) {
|
|
if (this->nodeExists(weaponNode, "All")) {
|
|
bool active;
|
|
bool active;
|
|
@@ -23641,7 +23641,7 @@ uint64 SkillDatabase::parseBodyNode(const ryml::NodeRef node) {
|
|
if (active)
|
|
if (active)
|
|
skill->require.weapon = 0;
|
|
skill->require.weapon = 0;
|
|
} else {
|
|
} else {
|
|
- for (const auto it : weaponNode.children()) {
|
|
|
|
|
|
+ for (const auto& it : weaponNode) {
|
|
std::string weapon;
|
|
std::string weapon;
|
|
c4::from_chars(it.key(), &weapon);
|
|
c4::from_chars(it.key(), &weapon);
|
|
std::string weapon_constant = "W_" + weapon;
|
|
std::string weapon_constant = "W_" + weapon;
|
|
@@ -23669,7 +23669,7 @@ uint64 SkillDatabase::parseBodyNode(const ryml::NodeRef node) {
|
|
}
|
|
}
|
|
|
|
|
|
if (this->nodeExists(requireNode, "Ammo")) {
|
|
if (this->nodeExists(requireNode, "Ammo")) {
|
|
- const auto ammoNode = requireNode["Ammo"];
|
|
|
|
|
|
+ const auto& ammoNode = requireNode["Ammo"];
|
|
|
|
|
|
if (this->nodeExists(ammoNode, "None")) {
|
|
if (this->nodeExists(ammoNode, "None")) {
|
|
bool active;
|
|
bool active;
|
|
@@ -23680,7 +23680,7 @@ uint64 SkillDatabase::parseBodyNode(const ryml::NodeRef node) {
|
|
if (active)
|
|
if (active)
|
|
skill->require.ammo = 0;
|
|
skill->require.ammo = 0;
|
|
} else {
|
|
} else {
|
|
- for (const auto it : ammoNode.children()) {
|
|
|
|
|
|
+ for (const auto& it : ammoNode) {
|
|
std::string ammo;
|
|
std::string ammo;
|
|
c4::from_chars(it.key(), &ammo);
|
|
c4::from_chars(it.key(), &ammo);
|
|
std::string ammo_constant = "AMMO_" + ammo;
|
|
std::string ammo_constant = "AMMO_" + ammo;
|
|
@@ -23738,9 +23738,9 @@ uint64 SkillDatabase::parseBodyNode(const ryml::NodeRef node) {
|
|
}
|
|
}
|
|
|
|
|
|
if (this->nodeExists(requireNode, "Status")) {
|
|
if (this->nodeExists(requireNode, "Status")) {
|
|
- const auto statusNode = requireNode["Status"];
|
|
|
|
|
|
+ const auto& statusNode = requireNode["Status"];
|
|
|
|
|
|
- for (const auto it : statusNode.children()) {
|
|
|
|
|
|
+ for (const auto& it : statusNode) {
|
|
std::string status;
|
|
std::string status;
|
|
c4::from_chars(it.key(), &status);
|
|
c4::from_chars(it.key(), &status);
|
|
std::string status_constant = "SC_" + status;
|
|
std::string status_constant = "SC_" + status;
|
|
@@ -23777,7 +23777,7 @@ uint64 SkillDatabase::parseBodyNode(const ryml::NodeRef node) {
|
|
const auto itemNode = requireNode["ItemCost"];
|
|
const auto itemNode = requireNode["ItemCost"];
|
|
int32 count = 0;
|
|
int32 count = 0;
|
|
|
|
|
|
- for (const auto it : itemNode.children()) {
|
|
|
|
|
|
+ for (const auto& it : itemNode) {
|
|
std::string item_name;
|
|
std::string item_name;
|
|
|
|
|
|
if (!this->asString(it, "Item", item_name))
|
|
if (!this->asString(it, "Item", item_name))
|
|
@@ -23819,9 +23819,9 @@ uint64 SkillDatabase::parseBodyNode(const ryml::NodeRef node) {
|
|
}
|
|
}
|
|
|
|
|
|
if (this->nodeExists(requireNode, "Equipment")) {
|
|
if (this->nodeExists(requireNode, "Equipment")) {
|
|
- const auto equipNode = requireNode["Equipment"];
|
|
|
|
|
|
+ const auto& equipNode = requireNode["Equipment"];
|
|
|
|
|
|
- for (const auto it : equipNode.children()) {
|
|
|
|
|
|
+ for (const auto& it : equipNode) {
|
|
std::string item_name;
|
|
std::string item_name;
|
|
c4::from_chars(it.key(), &item_name);
|
|
c4::from_chars(it.key(), &item_name);
|
|
|
|
|
|
@@ -23856,7 +23856,7 @@ uint64 SkillDatabase::parseBodyNode(const ryml::NodeRef node) {
|
|
}
|
|
}
|
|
|
|
|
|
if (this->nodeExists(node, "Unit")) {
|
|
if (this->nodeExists(node, "Unit")) {
|
|
- const auto unitNode = node["Unit"];
|
|
|
|
|
|
+ const auto& unitNode = node["Unit"];
|
|
|
|
|
|
if (this->nodeExists(unitNode, "Id")) {
|
|
if (this->nodeExists(unitNode, "Id")) {
|
|
std::string unit;
|
|
std::string unit;
|
|
@@ -23948,9 +23948,9 @@ uint64 SkillDatabase::parseBodyNode(const ryml::NodeRef node) {
|
|
}
|
|
}
|
|
|
|
|
|
if (this->nodeExists(unitNode, "Flag")) {
|
|
if (this->nodeExists(unitNode, "Flag")) {
|
|
- const auto flagNode = unitNode["Flag"];
|
|
|
|
|
|
+ const auto& flagNode = unitNode["Flag"];
|
|
|
|
|
|
- for (const auto it : flagNode.children()) {
|
|
|
|
|
|
+ for (const auto& it : flagNode) {
|
|
std::string flag;
|
|
std::string flag;
|
|
c4::from_chars(it.key(), &flag);
|
|
c4::from_chars(it.key(), &flag);
|
|
std::string flag_constant = "UF_" + flag;
|
|
std::string flag_constant = "UF_" + flag;
|
|
@@ -24064,7 +24064,7 @@ const std::string ReadingSpellbookDatabase::getDefaultLocation() {
|
|
* @param node: YAML node containing the entry.
|
|
* @param node: YAML node containing the entry.
|
|
* @return count of successfully parsed rows
|
|
* @return count of successfully parsed rows
|
|
*/
|
|
*/
|
|
-uint64 ReadingSpellbookDatabase::parseBodyNode(const ryml::NodeRef node) {
|
|
|
|
|
|
+uint64 ReadingSpellbookDatabase::parseBodyNode(const ryml::NodeRef& node) {
|
|
std::string skill_name;
|
|
std::string skill_name;
|
|
|
|
|
|
if (!this->asString(node, "Skill", skill_name))
|
|
if (!this->asString(node, "Skill", skill_name))
|
|
@@ -24130,7 +24130,7 @@ uint64 ReadingSpellbookDatabase::parseBodyNode(const ryml::NodeRef node) {
|
|
* @return Spell data or nullptr otherwise
|
|
* @return Spell data or nullptr otherwise
|
|
*/
|
|
*/
|
|
std::shared_ptr<s_skill_spellbook_db> ReadingSpellbookDatabase::findBook(t_itemid nameid) {
|
|
std::shared_ptr<s_skill_spellbook_db> ReadingSpellbookDatabase::findBook(t_itemid nameid) {
|
|
- if (nameid == 0 || !itemdb_exists(nameid) || reading_spellbook_db.size() == 0)
|
|
|
|
|
|
+ if (nameid == 0 || !itemdb_exists(nameid) || reading_spellbook_db.empty())
|
|
return nullptr;
|
|
return nullptr;
|
|
|
|
|
|
for (const auto &spell : reading_spellbook_db) {
|
|
for (const auto &spell : reading_spellbook_db) {
|
|
@@ -24150,7 +24150,7 @@ const std::string MagicMushroomDatabase::getDefaultLocation() {
|
|
* @param node: YAML node containing the entry.
|
|
* @param node: YAML node containing the entry.
|
|
* @return count of successfully parsed rows
|
|
* @return count of successfully parsed rows
|
|
*/
|
|
*/
|
|
-uint64 MagicMushroomDatabase::parseBodyNode(const ryml::NodeRef node) {
|
|
|
|
|
|
+uint64 MagicMushroomDatabase::parseBodyNode(const ryml::NodeRef& node) {
|
|
std::string skill_name;
|
|
std::string skill_name;
|
|
|
|
|
|
if (!this->asString(node, "Skill", skill_name))
|
|
if (!this->asString(node, "Skill", skill_name))
|
|
@@ -24249,7 +24249,7 @@ const std::string SkillArrowDatabase::getDefaultLocation() {
|
|
* @param node: YAML node containing the entry.
|
|
* @param node: YAML node containing the entry.
|
|
* @return count of successfully parsed rows
|
|
* @return count of successfully parsed rows
|
|
*/
|
|
*/
|
|
-uint64 SkillArrowDatabase::parseBodyNode(const ryml::NodeRef node) {
|
|
|
|
|
|
+uint64 SkillArrowDatabase::parseBodyNode(const ryml::NodeRef& node) {
|
|
std::string source_name;
|
|
std::string source_name;
|
|
|
|
|
|
if (!this->asString(node, "Source", source_name))
|
|
if (!this->asString(node, "Source", source_name))
|
|
@@ -24272,9 +24272,9 @@ uint64 SkillArrowDatabase::parseBodyNode(const ryml::NodeRef node) {
|
|
arrow->nameid = nameid;
|
|
arrow->nameid = nameid;
|
|
}
|
|
}
|
|
|
|
|
|
- const auto MakeNode = node["Make"];
|
|
|
|
|
|
+ const auto& MakeNode = node["Make"];
|
|
|
|
|
|
- for (const auto &it : MakeNode.children()) {
|
|
|
|
|
|
+ for (const auto &it : MakeNode) {
|
|
std::string item_name;
|
|
std::string item_name;
|
|
|
|
|
|
if (!this->asString(it, "Item", item_name))
|
|
if (!this->asString(it, "Item", item_name))
|
|
@@ -24320,7 +24320,7 @@ const std::string AbraDatabase::getDefaultLocation() {
|
|
* @param node: YAML node containing the entry.
|
|
* @param node: YAML node containing the entry.
|
|
* @return count of successfully parsed rows
|
|
* @return count of successfully parsed rows
|
|
*/
|
|
*/
|
|
-uint64 AbraDatabase::parseBodyNode(const ryml::NodeRef node) {
|
|
|
|
|
|
+uint64 AbraDatabase::parseBodyNode(const ryml::NodeRef& node) {
|
|
std::string skill_name;
|
|
std::string skill_name;
|
|
|
|
|
|
if (!this->asString(node, "Skill", skill_name))
|
|
if (!this->asString(node, "Skill", skill_name))
|
|
@@ -24347,7 +24347,7 @@ uint64 AbraDatabase::parseBodyNode(const ryml::NodeRef node) {
|
|
}
|
|
}
|
|
|
|
|
|
if (this->nodeExists(node, "Probability")) {
|
|
if (this->nodeExists(node, "Probability")) {
|
|
- const auto probNode = node["Probability"];
|
|
|
|
|
|
+ const auto& probNode = node["Probability"];
|
|
uint16 probability;
|
|
uint16 probability;
|
|
|
|
|
|
if (!probNode.is_seq()) {
|
|
if (!probNode.is_seq()) {
|
|
@@ -24358,7 +24358,7 @@ uint64 AbraDatabase::parseBodyNode(const ryml::NodeRef node) {
|
|
} else {
|
|
} else {
|
|
abra->per.fill(0);
|
|
abra->per.fill(0);
|
|
|
|
|
|
- for (const auto it : probNode.children()) {
|
|
|
|
|
|
+ for (const auto& it : probNode) {
|
|
uint16 skill_lv;
|
|
uint16 skill_lv;
|
|
|
|
|
|
if (!this->asUInt16(it, "Level", skill_lv))
|
|
if (!this->asUInt16(it, "Level", skill_lv))
|