Converted Magic Mushroom Database to YAML (#4482)

* Split database into pre-renewal and renewal.
* Left pre-renewal database empty.
This commit is contained in:
Aleos
2019-12-17 16:07:17 -05:00
committed by GitHub
parent c4c31d418a
commit d56553775a
11 changed files with 246 additions and 79 deletions

View File

@@ -69,6 +69,7 @@ int getch( void ){
// Forward declaration of conversion functions
static bool guild_read_guildskill_tree_db( char* split[], int columns, int current );
static size_t pet_read_db( const char* file );
static bool skill_parse_row_magicmushroomdb(char* split[], int column, int current);
// Constants for conversion
std::unordered_map<uint16, std::string> aegis_itemnames;
@@ -234,6 +235,12 @@ int do_init( int argc, char** argv ){
return 0;
}
if (!process("MAGIC_MUSHROOM_DB", 1, root_paths, "magicmushroom_db", [](const std::string& path, const std::string& name_ext) -> bool {
return sv_readdb(path.c_str(), name_ext.c_str(), ',', 1, 1, -1, &skill_parse_row_magicmushroomdb, false);
})) {
return 0;
}
// TODO: add implementations ;-)
return 0;
@@ -646,3 +653,20 @@ static size_t pet_read_db( const char* file ){
return entries;
}
static bool skill_parse_row_magicmushroomdb(char* split[], int column, 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 Magic Mushroom skill ID %hu is not known.\n", skill_id);
return false;
}
body << YAML::BeginMap;
body << YAML::Key << "Skill" << YAML::Value << *skill_name;
body << YAML::EndMap;
return true;
}