2012-08-09 12:05:47 +02:00
|
|
|
#ifndef GAME_MWBASE_DIALOGUEMANAGER_H
|
|
|
|
#define GAME_MWBASE_DIALOGUEMANAGER_H
|
2012-08-09 10:35:53 +02:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
#include <list>
|
2012-08-09 10:35:53 +02:00
|
|
|
#include <string>
|
2022-05-21 10:48:32 +02:00
|
|
|
#include <string_view>
|
2017-09-25 21:38:38 +02:00
|
|
|
#include <vector>
|
2012-08-09 10:35:53 +02:00
|
|
|
|
2022-01-22 22:44:02 +01:00
|
|
|
#include <cstdint>
|
2014-02-16 12:54:27 +01:00
|
|
|
|
2014-04-28 11:29:57 +02:00
|
|
|
namespace Loading
|
|
|
|
{
|
|
|
|
class Listener;
|
|
|
|
}
|
|
|
|
|
2014-02-16 12:54:27 +01:00
|
|
|
namespace ESM
|
|
|
|
{
|
|
|
|
class ESMReader;
|
|
|
|
class ESMWriter;
|
|
|
|
}
|
|
|
|
|
2012-08-09 10:35:53 +02:00
|
|
|
namespace MWWorld
|
|
|
|
{
|
|
|
|
class Ptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace MWBase
|
|
|
|
{
|
2012-08-09 12:05:47 +02:00
|
|
|
/// \brief Interface for dialogue manager (implemented in MWDialogue)
|
2012-08-09 10:35:53 +02:00
|
|
|
class DialogueManager
|
|
|
|
{
|
2022-09-22 21:26:05 +03:00
|
|
|
DialogueManager(const DialogueManager&);
|
|
|
|
///< not implemented
|
2012-08-09 10:35:53 +02:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
DialogueManager& operator=(const DialogueManager&);
|
|
|
|
///< not implemented
|
2012-08-09 10:35:53 +02:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
public:
|
|
|
|
class ResponseCallback
|
|
|
|
{
|
2012-08-09 10:35:53 +02:00
|
|
|
public:
|
2022-09-22 21:26:05 +03:00
|
|
|
virtual ~ResponseCallback() = default;
|
|
|
|
virtual void addResponse(const std::string& title, const std::string& text) = 0;
|
|
|
|
};
|
2012-08-09 10:35:53 +02:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
DialogueManager() {}
|
2012-08-09 10:35:53 +02:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
virtual void clear() = 0;
|
2013-05-15 17:54:18 +02:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
virtual ~DialogueManager() {}
|
2012-08-09 10:35:53 +02:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
virtual bool isInChoice() const = 0;
|
2013-03-31 13:13:46 +02:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
virtual bool startDialogue(const MWWorld::Ptr& actor, ResponseCallback* callback) = 0;
|
2012-08-09 10:35:53 +02:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
virtual bool inJournal(const std::string& topicId, const std::string& infoId) = 0;
|
2019-05-13 22:32:46 +02:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
virtual void addTopic(std::string_view topic) = 0;
|
2012-08-09 10:35:53 +02:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
virtual void addChoice(std::string_view text, int choice) = 0;
|
|
|
|
virtual const std::vector<std::pair<std::string, int>>& getChoices() = 0;
|
2017-09-25 21:38:38 +02:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
virtual bool isGoodbye() = 0;
|
2012-08-09 10:35:53 +02:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
virtual void goodbye() = 0;
|
2012-08-09 10:35:53 +02:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
virtual void say(const MWWorld::Ptr& actor, const std::string& topic) = 0;
|
2013-07-24 10:02:50 -07:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
virtual void keywordSelected(const std::string& keyword, ResponseCallback* callback) = 0;
|
|
|
|
virtual void goodbyeSelected() = 0;
|
|
|
|
virtual void questionAnswered(int answer, ResponseCallback* callback) = 0;
|
2017-09-25 21:38:38 +02:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
enum TopicType
|
|
|
|
{
|
|
|
|
Specific = 1,
|
|
|
|
Exhausted = 2
|
|
|
|
};
|
2019-05-13 22:32:46 +02:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
enum ServiceType
|
|
|
|
{
|
|
|
|
Any = -1,
|
|
|
|
Barter = 1,
|
|
|
|
Repair = 2,
|
|
|
|
Spells = 3,
|
|
|
|
Training = 4,
|
|
|
|
Travel = 5,
|
|
|
|
Spellmaking = 6,
|
|
|
|
Enchanting = 7
|
|
|
|
};
|
2020-08-21 17:18:39 +04:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
virtual std::list<std::string> getAvailableTopics() = 0;
|
|
|
|
virtual int getTopicFlag(const std::string&) = 0;
|
2012-11-10 00:29:36 +01:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
virtual bool checkServiceRefused(ResponseCallback* callback, ServiceType service = ServiceType::Any) = 0;
|
2013-03-16 20:32:21 +01:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
virtual void persuade(int type, ResponseCallback* callback) = 0;
|
2014-05-31 13:57:07 +02:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
/// @note Controlled by an option, gets discarded when dialogue ends by default
|
|
|
|
virtual void applyBarterDispositionChange(int delta) = 0;
|
2014-02-16 12:54:27 +01:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
virtual int countSavedGameRecords() const = 0;
|
2014-02-16 12:54:27 +01:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
virtual void write(ESM::ESMWriter& writer, Loading::Listener& progress) const = 0;
|
2014-02-16 12:54:27 +01:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
virtual void readRecord(ESM::ESMReader& reader, uint32_t type) = 0;
|
2014-05-27 14:54:29 +02:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
/// Changes faction1's opinion of faction2 by \a diff.
|
|
|
|
virtual void modFactionReaction(std::string_view faction1, std::string_view faction2, int diff) = 0;
|
2014-05-27 14:54:29 +02:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
virtual void setFactionReaction(std::string_view faction1, std::string_view faction2, int absolute) = 0;
|
2015-01-19 23:55:17 +01:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
/// @return faction1's opinion of faction2
|
|
|
|
virtual int getFactionReaction(std::string_view faction1, std::string_view faction2) const = 0;
|
2014-06-10 16:36:22 +02:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
/// Removes the last added topic response for the given actor from the journal
|
|
|
|
virtual void clearInfoActor(const MWWorld::Ptr& actor) const = 0;
|
2012-08-09 10:35:53 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|