#pragma once #include "dialogue/DialogueTypes.h" #include "external/nlohmann/json.hpp" #include #include namespace ZL::Dialogue { class DialogueDatabase { public: using json = nlohmann::json; bool loadFromFile(const std::string& path); const DialogueDefinition* findDialogue(const std::string& id) const; const StaticCutsceneDefinition* findCutscene(const std::string& id) const; private: std::unordered_map dialogues; std::unordered_map cutscenes; static NodeType parseNodeType(const std::string& value); static ChoiceKind parseChoiceKind(const std::string& value); static ComparisonOp parseComparisonOp(const std::string& value); static Condition parseCondition(const json& j); static Effect parseEffect(const json& j); static Choice parseChoice(const json& j); static Node parseNode(const json& j); static DialogueDefinition parseDialogue(const json& j); static CutsceneLine parseCutsceneLine(const json& j); static StaticCutsceneDefinition parseCutscene(const json& j); }; } // namespace ZL::Dialogue