2012-08-11 10:02:51 +00:00
|
|
|
#ifndef GAME_MWDIALOG_DIALOGUEMANAGERIMP_H
|
2012-08-09 08:35:53 +00:00
|
|
|
#define GAME_MWDIALOG_DIALOGUEMANAGERIMP_H
|
2010-08-06 16:01:34 +00:00
|
|
|
|
2012-08-11 15:30:55 +00:00
|
|
|
#include "../mwbase/dialoguemanager.hpp"
|
|
|
|
|
2012-11-10 13:31:58 +00:00
|
|
|
#include <map>
|
2014-10-11 17:30:24 +00:00
|
|
|
#include <set>
|
2019-05-13 20:32:46 +00:00
|
|
|
#include <unordered_map>
|
2010-08-06 16:01:34 +00:00
|
|
|
|
2012-02-18 11:19:42 +00:00
|
|
|
#include <components/compiler/streamerrorhandler.hpp>
|
2012-12-31 00:15:47 +00:00
|
|
|
#include <components/translation/translation.hpp>
|
2017-10-22 17:06:47 +00:00
|
|
|
#include <components/misc/stringops.hpp>
|
2012-02-17 19:20:23 +00:00
|
|
|
|
2010-08-08 11:21:03 +00:00
|
|
|
#include "../mwworld/ptr.hpp"
|
2012-08-09 08:35:53 +00:00
|
|
|
|
2012-11-10 13:31:58 +00:00
|
|
|
#include "../mwscript/compilercontext.hpp"
|
2010-08-08 09:34:03 +00:00
|
|
|
|
2014-02-23 19:11:05 +00:00
|
|
|
namespace ESM
|
|
|
|
{
|
|
|
|
struct Dialogue;
|
|
|
|
}
|
|
|
|
|
2010-08-06 17:16:44 +00:00
|
|
|
namespace MWDialogue
|
2010-08-06 16:01:34 +00:00
|
|
|
{
|
2012-08-09 08:35:53 +00:00
|
|
|
class DialogueManager : public MWBase::DialogueManager
|
2010-08-06 16:01:34 +00:00
|
|
|
{
|
2017-10-22 17:06:47 +00:00
|
|
|
std::set<std::string, Misc::StringUtils::CiComp> mKnownTopics;// Those are the topics the player knows.
|
2014-05-27 12:54:29 +00:00
|
|
|
|
|
|
|
// Modified faction reactions. <Faction1, <Faction2, Difference> >
|
|
|
|
typedef std::map<std::string, std::map<std::string, int> > ModFactionReactionMap;
|
2015-01-19 22:55:17 +00:00
|
|
|
ModFactionReactionMap mChangedFactionReaction;
|
2014-05-27 12:54:29 +00:00
|
|
|
|
2017-10-22 17:06:47 +00:00
|
|
|
std::set<std::string, Misc::StringUtils::CiComp> mActorKnownTopics;
|
2019-05-13 20:32:46 +00:00
|
|
|
std::unordered_map<std::string, int> mActorKnownTopicsFlag;
|
2012-02-17 19:20:23 +00:00
|
|
|
|
2012-12-31 00:15:47 +00:00
|
|
|
Translation::Storage& mTranslationDataStorage;
|
2012-02-17 19:20:23 +00:00
|
|
|
MWScript::CompilerContext mCompilerContext;
|
2012-02-18 11:19:42 +00:00
|
|
|
Compiler::StreamErrorHandler mErrorHandler;
|
2012-12-08 13:24:15 +00:00
|
|
|
|
2012-02-17 19:20:23 +00:00
|
|
|
MWWorld::Ptr mActor;
|
2012-11-10 12:31:10 +00:00
|
|
|
bool mTalkedTo;
|
2012-02-17 19:20:23 +00:00
|
|
|
|
2012-03-14 17:47:29 +00:00
|
|
|
int mChoice;
|
2014-06-10 14:36:22 +00:00
|
|
|
std::string mLastTopic; // last topic ID, lowercase
|
2012-03-16 16:30:59 +00:00
|
|
|
bool mIsInChoice;
|
2017-09-25 19:38:38 +00:00
|
|
|
bool mGoodbye;
|
|
|
|
|
|
|
|
std::vector<std::pair<std::string, int> > mChoices;
|
2012-03-14 17:47:29 +00:00
|
|
|
|
2012-11-09 23:29:36 +00:00
|
|
|
float mTemporaryDispositionChange;
|
|
|
|
float mPermanentDispositionChange;
|
|
|
|
|
2012-11-10 13:31:58 +00:00
|
|
|
void parseText (const std::string& text);
|
|
|
|
|
2017-09-25 19:38:38 +00:00
|
|
|
void updateActorKnownTopics();
|
2014-01-08 23:40:25 +00:00
|
|
|
void updateGlobals();
|
2012-11-10 13:31:58 +00:00
|
|
|
|
2017-04-20 18:55:28 +00:00
|
|
|
bool compile (const std::string& cmd, std::vector<Interpreter::Type_Code>& code, const MWWorld::Ptr& actor);
|
|
|
|
void executeScript (const std::string& script, const MWWorld::Ptr& actor);
|
2012-11-10 13:31:58 +00:00
|
|
|
|
2017-10-23 22:25:41 +00:00
|
|
|
void executeTopic (const std::string& topic, ResponseCallback* callback);
|
2012-12-08 13:24:15 +00:00
|
|
|
|
2017-09-25 16:50:24 +00:00
|
|
|
const ESM::Dialogue* searchDialogue(const std::string& id);
|
2012-12-08 13:24:15 +00:00
|
|
|
|
2010-08-06 16:01:34 +00:00
|
|
|
public:
|
|
|
|
|
2017-02-20 20:09:15 +00:00
|
|
|
DialogueManager (const Compiler::Extensions& extensions, Translation::Storage& translationDataStorage);
|
2010-08-06 16:01:34 +00:00
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
void clear() override;
|
2013-05-15 15:54:18 +00:00
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
bool isInChoice() const override;
|
2013-03-31 11:13:46 +00:00
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
bool startDialogue (const MWWorld::Ptr& actor, ResponseCallback* callback) override;
|
2017-09-25 19:38:38 +00:00
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
std::list<std::string> getAvailableTopics() override;
|
2020-10-22 21:57:53 +00:00
|
|
|
int getTopicFlag(const std::string& topicId) override;
|
2019-05-13 20:32:46 +00:00
|
|
|
|
2020-10-22 21:57:53 +00:00
|
|
|
bool inJournal (const std::string& topicId, const std::string& infoId) override;
|
2010-08-06 16:01:34 +00:00
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
void addTopic (const std::string& topic) override;
|
2012-02-10 15:09:43 +00:00
|
|
|
|
2017-08-23 04:14:45 +00:00
|
|
|
/*
|
|
|
|
Start of tes3mp addition
|
|
|
|
|
|
|
|
Make it possible to check whether a topic is known by the player from elsewhere
|
|
|
|
in the code
|
|
|
|
*/
|
|
|
|
virtual bool isNewTopic(const std::string& topic);
|
|
|
|
/*
|
|
|
|
End of tes3mp addition
|
|
|
|
*/
|
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
void addChoice (const std::string& text,int choice) override;
|
|
|
|
const std::vector<std::pair<std::string, int> >& getChoices() override;
|
2017-09-25 19:38:38 +00:00
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
bool isGoodbye() override;
|
2012-03-07 17:44:09 +00:00
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
void goodbye() override;
|
2012-05-11 05:18:41 +00:00
|
|
|
|
2020-08-21 13:18:39 +00:00
|
|
|
bool checkServiceRefused (ResponseCallback* callback, ServiceType service = ServiceType::Any) override;
|
2013-03-16 19:32:21 +00:00
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
void say(const MWWorld::Ptr &actor, const std::string &topic) override;
|
2013-07-24 17:02:50 +00:00
|
|
|
|
2012-02-05 11:25:23 +00:00
|
|
|
//calbacks for the GUI
|
2020-10-16 18:18:54 +00:00
|
|
|
void keywordSelected (const std::string& keyword, ResponseCallback* callback) override;
|
|
|
|
void goodbyeSelected() override;
|
|
|
|
void questionAnswered (int answer, ResponseCallback* callback) override;
|
2012-02-05 11:25:23 +00:00
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
void persuade (int type, ResponseCallback* callback) override;
|
|
|
|
int getTemporaryDispositionChange () const override;
|
2014-05-31 11:57:07 +00:00
|
|
|
|
2018-08-01 14:31:35 +00:00
|
|
|
/// @note Controlled by an option, gets discarded when dialogue ends by default
|
2020-10-16 18:18:54 +00:00
|
|
|
void applyBarterDispositionChange (int delta) override;
|
2014-02-16 11:54:27 +00:00
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
int countSavedGameRecords() const override;
|
2014-02-16 11:54:27 +00:00
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
void write (ESM::ESMWriter& writer, Loading::Listener& progress) const override;
|
2014-02-16 11:54:27 +00:00
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
void readRecord (ESM::ESMReader& reader, uint32_t type) override;
|
2014-05-27 12:54:29 +00:00
|
|
|
|
|
|
|
/// Changes faction1's opinion of faction2 by \a diff.
|
2020-10-16 18:18:54 +00:00
|
|
|
void modFactionReaction (const std::string& faction1, const std::string& faction2, int diff) override;
|
2014-05-27 12:54:29 +00:00
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
void setFactionReaction (const std::string& faction1, const std::string& faction2, int absolute) override;
|
2015-01-19 22:55:17 +00:00
|
|
|
|
2014-05-27 12:54:29 +00:00
|
|
|
/// @return faction1's opinion of faction2
|
2020-10-16 18:18:54 +00:00
|
|
|
int getFactionReaction (const std::string& faction1, const std::string& faction2) const override;
|
2014-06-10 14:36:22 +00:00
|
|
|
|
|
|
|
/// Removes the last added topic response for the given actor from the journal
|
2020-11-01 21:17:59 +00:00
|
|
|
void clearInfoActor(const MWWorld::Ptr & actor) const override;
|
2017-10-30 09:06:09 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
Start of tes3mp addition
|
|
|
|
|
|
|
|
Make it possible to get the caption of a voice dialogue
|
|
|
|
*/
|
|
|
|
virtual std::string getVoiceCaption(const std::string& sound) const;
|
|
|
|
/*
|
|
|
|
End of tes3mp addition
|
|
|
|
*/
|
2010-08-06 16:01:34 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|