summaryrefslogtreecommitdiff
path: root/apps/openmw/mwbase/dialoguemanager.hpp
blob: dc1f6f96675a36450982e66a39fade902995342a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#ifndef GAME_MWBASE_DIALOGUEMANAGER_H
#define GAME_MWBASE_DIALOGUEMANAGER_H

#include <string>
#include <vector>
#include <list>

#include <stdint.h>

namespace Loading
{
    class Listener;
}

namespace ESM
{
    class ESMReader;
    class ESMWriter;
}

namespace MWWorld
{
    class Ptr;
}

namespace MWBase
{
    /// \brief Interface for dialogue manager (implemented in MWDialogue)
    class DialogueManager
    {
            DialogueManager (const DialogueManager&);
            ///< not implemented

            DialogueManager& operator= (const DialogueManager&);
            ///< not implemented

        public:

            class ResponseCallback
            {
            public:
                virtual ~ResponseCallback() = default;
                virtual void addResponse(const std::string& title, const std::string& text) = 0;
            };

            DialogueManager() {}

            virtual void clear() = 0;

            virtual ~DialogueManager() {}

            virtual bool isInChoice() const = 0;

            virtual bool startDialogue (const MWWorld::Ptr& actor, ResponseCallback* callback) = 0;

            virtual bool inJournal (const std::string& topicId, const std::string& infoId) = 0;

            virtual void addTopic (const std::string& topic) = 0;

            virtual void addChoice (const std::string& text,int choice) = 0;
            virtual const std::vector<std::pair<std::string, int> >& getChoices() = 0;

            virtual bool isGoodbye() = 0;

            virtual void goodbye() = 0;

            virtual void say(const MWWorld::Ptr &actor, const std::string &topic) = 0;

            virtual void keywordSelected (const std::string& keyword, ResponseCallback* callback) = 0;
            virtual void goodbyeSelected() = 0;
            virtual void questionAnswered (int answer, ResponseCallback* callback) = 0;

            enum TopicType
            {
                Specific = 1,
                Exhausted = 2
            };

            enum ServiceType
            {
                Any = -1,
                Barter = 1,
                Repair = 2,
                Spells = 3,
                Training = 4,
                Travel = 5,
                Spellmaking = 6,
                Enchanting = 7
            };

            virtual std::list<std::string> getAvailableTopics() = 0;
            virtual int getTopicFlag(const std::string&) = 0;

            virtual bool checkServiceRefused (ResponseCallback* callback, ServiceType service = ServiceType::Any) = 0;

            virtual void persuade (int type, ResponseCallback* callback) = 0;

            /// @note Controlled by an option, gets discarded when dialogue ends by default
            virtual void applyBarterDispositionChange (int delta) = 0;

            virtual int countSavedGameRecords() const = 0;

            virtual void write (ESM::ESMWriter& writer, Loading::Listener& progress) const = 0;

            virtual void readRecord (ESM::ESMReader& reader, uint32_t type) = 0;

            /// Changes faction1's opinion of faction2 by \a diff.
            virtual void modFactionReaction (const std::string& faction1, const std::string& faction2, int diff) = 0;

            virtual void setFactionReaction (const std::string& faction1, const std::string& faction2, int absolute) = 0;

            /// @return faction1's opinion of faction2
            virtual int getFactionReaction (const std::string& faction1, const std::string& faction2) const = 0;

            /// Removes the last added topic response for the given actor from the journal
            virtual void clearInfoActor (const MWWorld::Ptr& actor) const = 0;
    };
}

#endif