#include "json.hpp" #include "item.h" #include "weapon.h" #include "armor.h" #include "utils.h" #include #include #include using namespace std; typedef nlohmann::json json; namespace entry { shared_ptr Item::create(const json& data) { if(data["type"] == "weapon") { return utils::loadDFromJson(data); } else if(data["type"] == "armor") { return utils::loadDFromJson(data); } return shared_ptr(new Item(data)); } string genText(const Substantial& s) { stringstream text; text << "Cost: " << s.getCost() << " cp, i.e., " << utils::getCostString(s.getCost()); text << ". Weight: " << s.getWeight() << " lbs."; return text.str(); } }