#pragma once #include "defines.h" #include #include namespace creature { class Creature; } namespace entry { class Entry { public: static std::shared_ptr create(const nlohmann::json& data); virtual ~Entry() {} std::string getName(void) const {return name;} std::string getType(void) const {return type;} virtual std::string getText(void) const {return text;} void setText(std::string t) {text = t;} virtual void init(void) {} virtual nlohmann::json serialize(void) const { nlohmann::json ret; to_json(ret, *this); return ret; } virtual std::string getText(const creature::Creature& c) const { return getName() + " (" + getType() + "): " + getText(); } NLOHMANN_DEFINE_TYPE_INTRUSIVE(Entry, entry, name, type, text); private: std::string entry; std::string name; std::string type; std::string text; }; }