Converted Reading Spellbook Database to YAML (#4440)
* Split database between pre-renewal and renewal. Co-authored-by: Lemongrass3110 <lemongrass@kstp.at>
This commit is contained in:
@@ -72,6 +72,7 @@ static size_t pet_read_db( const char* file );
|
||||
static bool skill_parse_row_magicmushroomdb(char* split[], int column, int current);
|
||||
static bool skill_parse_row_abradb(char* split[], int columns, int current);
|
||||
static bool skill_parse_row_improvisedb(char* split[], int columns, int current);
|
||||
static bool skill_parse_row_spellbookdb(char* split[], int columns, int current);
|
||||
|
||||
// Constants for conversion
|
||||
std::unordered_map<uint16, std::string> aegis_itemnames;
|
||||
@@ -255,6 +256,12 @@ int do_init( int argc, char** argv ){
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!process("READING_SPELLBOOK_DB", 1, root_paths, "spellbook_db", [](const std::string& path, const std::string& name_ext) -> bool {
|
||||
return sv_readdb(path.c_str(), name_ext.c_str(), ',', 3, 3, -1, &skill_parse_row_spellbookdb, false);
|
||||
})) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TODO: add implementations ;-)
|
||||
|
||||
return 0;
|
||||
@@ -749,11 +756,13 @@ static bool skill_parse_row_abradb(char* split[], int columns, int current)
|
||||
|
||||
body << YAML::EndSeq;
|
||||
}
|
||||
|
||||
body << YAML::EndMap;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Copied and adjusted from skill.cpp
|
||||
static bool skill_parse_row_improvisedb(char* split[], int columns, int current)
|
||||
{
|
||||
uint16 skill_id = atoi(split[0]);
|
||||
@@ -771,3 +780,31 @@ static bool skill_parse_row_improvisedb(char* split[], int columns, int current)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Copied and adjusted from skill.cpp
|
||||
static bool skill_parse_row_spellbookdb(char* split[], int columns, int current)
|
||||
{
|
||||
uint16 skill_id = atoi(split[0]);
|
||||
std::string *skill_name = util::umap_find(aegis_skillnames, skill_id);
|
||||
|
||||
if (skill_name == nullptr) {
|
||||
ShowError("Skill name for Spell Book skill ID %hu is not known.\n", skill_id);
|
||||
return false;
|
||||
}
|
||||
|
||||
uint16 nameid = atoi(split[2]);
|
||||
std::string *book_name = util::umap_find(aegis_itemnames, nameid);
|
||||
|
||||
if (book_name == nullptr) {
|
||||
ShowError("Book name for item ID %hu is not known.\n", nameid);
|
||||
return false;
|
||||
}
|
||||
|
||||
body << YAML::BeginMap;
|
||||
body << YAML::Key << "Skill" << YAML::Value << *skill_name;
|
||||
body << YAML::Key << "Book" << YAML::Value << *book_name;
|
||||
body << YAML::Key << "PreservePoints" << YAML::Value << atoi(split[1]);
|
||||
body << YAML::EndMap;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user