1 #ifndef GAME_MWBASE_DIALOGUEMANAGER_H
2 #define GAME_MWBASE_DIALOGUEMANAGER_H
3 
4 #include <string>
5 #include <vector>
6 #include <list>
7 
8 #include <stdint.h>
9 
10 namespace Loading
11 {
12     class Listener;
13 }
14 
15 namespace ESM
16 {
17     class ESMReader;
18     class ESMWriter;
19 }
20 
21 namespace MWWorld
22 {
23     class Ptr;
24 }
25 
26 namespace MWBase
27 {
28     /// \brief Interface for dialogue manager (implemented in MWDialogue)
29     class DialogueManager
30     {
31             DialogueManager (const DialogueManager&);
32             ///< not implemented
33 
34             DialogueManager& operator= (const DialogueManager&);
35             ///< not implemented
36 
37         public:
38 
39             class ResponseCallback
40             {
41             public:
42                 virtual ~ResponseCallback() = default;
43                 virtual void addResponse(const std::string& title, const std::string& text) = 0;
44             };
45 
DialogueManager()46             DialogueManager() {}
47 
48             virtual void clear() = 0;
49 
~DialogueManager()50             virtual ~DialogueManager() {}
51 
52             virtual bool isInChoice() const = 0;
53 
54             virtual bool startDialogue (const MWWorld::Ptr& actor, ResponseCallback* callback) = 0;
55 
56             virtual bool inJournal (const std::string& topicId, const std::string& infoId) = 0;
57 
58             virtual void addTopic (const std::string& topic) = 0;
59 
60             virtual void addChoice (const std::string& text,int choice) = 0;
61             virtual const std::vector<std::pair<std::string, int> >& getChoices() = 0;
62 
63             virtual bool isGoodbye() = 0;
64 
65             virtual void goodbye() = 0;
66 
67             virtual void say(const MWWorld::Ptr &actor, const std::string &topic) = 0;
68 
69             virtual void keywordSelected (const std::string& keyword, ResponseCallback* callback) = 0;
70             virtual void goodbyeSelected() = 0;
71             virtual void questionAnswered (int answer, ResponseCallback* callback) = 0;
72 
73             enum TopicType
74             {
75                 Specific = 1,
76                 Exhausted = 2
77             };
78 
79             enum ServiceType
80             {
81                 Any = -1,
82                 Barter = 1,
83                 Repair = 2,
84                 Spells = 3,
85                 Training = 4,
86                 Travel = 5,
87                 Spellmaking = 6,
88                 Enchanting = 7
89             };
90 
91             virtual std::list<std::string> getAvailableTopics() = 0;
92             virtual int getTopicFlag(const std::string&) = 0;
93 
94             virtual bool checkServiceRefused (ResponseCallback* callback, ServiceType service = ServiceType::Any) = 0;
95 
96             virtual void persuade (int type, ResponseCallback* callback) = 0;
97             virtual int getTemporaryDispositionChange () const = 0;
98 
99             /// @note Controlled by an option, gets discarded when dialogue ends by default
100             virtual void applyBarterDispositionChange (int delta) = 0;
101 
102             virtual int countSavedGameRecords() const = 0;
103 
104             virtual void write (ESM::ESMWriter& writer, Loading::Listener& progress) const = 0;
105 
106             virtual void readRecord (ESM::ESMReader& reader, uint32_t type) = 0;
107 
108             /// Changes faction1's opinion of faction2 by \a diff.
109             virtual void modFactionReaction (const std::string& faction1, const std::string& faction2, int diff) = 0;
110 
111             virtual void setFactionReaction (const std::string& faction1, const std::string& faction2, int absolute) = 0;
112 
113             /// @return faction1's opinion of faction2
114             virtual int getFactionReaction (const std::string& faction1, const std::string& faction2) const = 0;
115 
116             /// Removes the last added topic response for the given actor from the journal
117             virtual void clearInfoActor (const MWWorld::Ptr& actor) const = 0;
118     };
119 }
120 
121 #endif
122