61 lines
2.5 KiB
C++
61 lines
2.5 KiB
C++
#include <iostream>
|
|
#include "../extern/args.hpp"
|
|
#include "BuildData/BuildItems.hpp"
|
|
#include "BuildData/BuildMoves.hpp"
|
|
#include "BuildData/BuildNatures.hpp"
|
|
#include "BuildData/BuildSpecies.hpp"
|
|
#include "BuildData/BuildTypes.hpp"
|
|
#include "BuildData/GrowthRatesBuilder.hpp"
|
|
#include "Tools/ScriptHeadersExporter.hpp"
|
|
|
|
[[maybe_unused]] static PkmnLib::Library::PokemonLibrary* BuildDataLibrary() {
|
|
std::string typesFile = "Types.csv";
|
|
std::string naturesFile = "Natures.csv";
|
|
std::string pokemonFile = "Pokemon.json";
|
|
std::string moveFile = "Moves.json";
|
|
std::string itemsFile = "Items.json";
|
|
std::string growthRatesFile = "GrowthRates.json";
|
|
std::string scriptsPath = "Scripts";
|
|
|
|
auto typesLibrary = BuildTypes::Build(typesFile);
|
|
auto natureLibrary = BuildNatures::Build(naturesFile);
|
|
auto speciesLibrary = BuildSpecies::BuildLibrary(pokemonFile, typesLibrary);
|
|
auto movesLibrary = BuildMoves::Build(moveFile, typesLibrary);
|
|
auto itemsLibrary = BuildItems::Build(itemsFile);
|
|
auto growthRates = GrowthRatesBuilder::Build(growthRatesFile);
|
|
if (typesLibrary == nullptr || speciesLibrary == nullptr || natureLibrary == nullptr || movesLibrary == nullptr ||
|
|
itemsLibrary == nullptr || growthRates == nullptr)
|
|
return nullptr;
|
|
auto settings = new PkmnLib::Library::LibrarySettings(100, 4, 4096);
|
|
return new PkmnLib::Library::PokemonLibrary(settings, speciesLibrary, movesLibrary, itemsLibrary, growthRates,
|
|
typesLibrary, natureLibrary);
|
|
};
|
|
|
|
int main(int argc, const char* argv[]) {
|
|
args::ArgumentParser parser("PkmnLib tool executable.", "");
|
|
args::HelpFlag help(parser, "help", "Display this help menu", {'h', "help"});
|
|
args::Positional<std::string> tool(parser, "tool", "The tool to execute");
|
|
args::ValueFlag<std::string> outPath(parser, "outpath", "The path to output to.", {'o'});
|
|
try {
|
|
parser.ParseCLI(argc, argv);
|
|
} catch (const args::Help&) {
|
|
std::cout << parser;
|
|
return 0;
|
|
} catch (const args::ParseError& e) {
|
|
std::cerr << e.what() << std::endl;
|
|
std::cerr << parser;
|
|
return 1;
|
|
}
|
|
std::string toolValue = args::get(tool);
|
|
if (toolValue == "export-script-headers") {
|
|
std::string outPathValue = args::get(outPath);
|
|
ScriptHeadersExporter::Export(outPathValue);
|
|
} else {
|
|
std::stringstream ss;
|
|
ss << "Unknown tool called '" << toolValue << "'.";
|
|
throw std::logic_error(ss.str());
|
|
}
|
|
|
|
return 0;
|
|
}
|