More work on states, added bot
This commit is contained in:
1 parent
66e93d46f4
commit
5e9a663812
25 files changed
+1595
-740
No files matched your search
@@ -2,17 +2,29 @@
|
||||
|
||||
#include "dialogue/DialogueDatabase.h"
|
||||
#include "dialogue/TranslationDatabase.h"
|
||||
#include "quest/QuestJournal.h"
|
||||
#include "external/nlohmann/json.hpp"
|
||||
#include "ISaveable.h"
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
namespace FRG::Dialogue {
|
||||
|
||||
enum class QuestActionType {
|
||||
Unlock,
|
||||
Complete,
|
||||
Fail,
|
||||
CompleteObjective,
|
||||
ShowObjective
|
||||
};
|
||||
|
||||
struct QuestActionRequest {
|
||||
QuestActionType type;
|
||||
std::string questId;
|
||||
std::string objectiveId;
|
||||
};
|
||||
|
||||
class DialogueRuntime : public FRG::ISaveable {
|
||||
public:
|
||||
void setDatabase(const DialogueDatabase* value);
|
||||
@@ -41,8 +53,11 @@ public:
|
||||
|
||||
void setFlag(const std::string& name, int value);
|
||||
int getFlag(const std::string& name) const;
|
||||
void setGlobalFlagStore(std::unordered_map<std::string, int>* store);
|
||||
void setQuestJournal(Quest::QuestJournal* journal);
|
||||
void setGlobalFlagAccessors(
|
||||
std::function<int(const std::string&)> getter,
|
||||
std::function<void(const std::string&, int)> setter);
|
||||
void setQuestActionHandler(
|
||||
std::function<void(const QuestActionRequest&)> handler);
|
||||
|
||||
// Saves whether a dialogue is active, its id, and current node.
|
||||
// Cutscene state is not saved.
|
||||
@@ -62,13 +77,14 @@ private:
|
||||
std::function<void(const std::string&, const std::string&)> onCutsceneStartNeeded;
|
||||
std::function<void(const std::string&)> onDialogueLineStarted;
|
||||
std::function<void(const std::string&, bool)> onChatBubbleReady;
|
||||
std::function<void(const QuestActionRequest&)> onQuestAction;
|
||||
|
||||
const DialogueDatabase* database = nullptr;
|
||||
const TranslationDatabase* translations = nullptr;
|
||||
Quest::QuestJournal* questJournal = nullptr;
|
||||
const DialogueDefinition* activeDialogue = nullptr;
|
||||
|
||||
std::unordered_map<std::string, int>* flagStore = nullptr;
|
||||
std::function<int(const std::string&)> getGlobalFlag;
|
||||
std::function<void(const std::string&, int)> setGlobalFlag;
|
||||
std::unordered_set<std::string> consumedChoices;
|
||||
|
||||
std::string currentNodeId;
|
||||
|
||||
Reference in new issue
Block a user