1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-21 11:53:51 +00:00

handle persuasion records properly

This commit is contained in:
Marc Zinnschlag 2012-12-08 14:24:15 +01:00
parent a70a5282f4
commit caaffd1ec2
2 changed files with 53 additions and 36 deletions

View file

@ -238,6 +238,44 @@ namespace MWDialogue
} }
} }
void DialogueManager::executeTopic (const std::string& topic)
{
Filter filter (mActor, mChoice, mTalkedTo);
const MWWorld::Store<ESM::Dialogue> &dialogues =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>();
const ESM::Dialogue& dialogue = *dialogues.find (topic);
if (const ESM::DialInfo *info = filter.search (dialogue))
{
parseText (info->mResponse);
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
if (dialogue.mType==ESM::Dialogue::Persuasion)
{
std::string modifiedTopic = "s" + topic;
modifiedTopic.erase (std::remove (modifiedTopic.begin(), modifiedTopic.end(), ' '), modifiedTopic.end());
const MWWorld::Store<ESM::GameSetting>& gmsts =
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
win->addTitle (gmsts.find (modifiedTopic)->getString());
}
else
win->addTitle (topic);
win->addText (info->mResponse);
executeScript (info->mResultScript);
mLastTopic = topic;
mLastDialogue = *info;
}
}
void DialogueManager::updateTopics() void DialogueManager::updateTopics()
{ {
std::list<std::string> keywordList; std::list<std::string> keywordList;
@ -332,24 +370,7 @@ namespace MWDialogue
ESM::Dialogue ndialogue = mDialogueMap[keyword]; ESM::Dialogue ndialogue = mDialogueMap[keyword];
if (mDialogueMap[keyword].mType == ESM::Dialogue::Topic) if (mDialogueMap[keyword].mType == ESM::Dialogue::Topic)
{ {
Filter filter (mActor, mChoice, mTalkedTo); executeTopic (keyword);
if (const ESM::DialInfo *info = filter.search (mDialogueMap[keyword]))
{
std::string text = info->mResponse;
std::string script = info->mResultScript;
parseText (text);
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
win->addTitle (keyword);
win->addText (info->mResponse);
executeScript (script);
mLastTopic = keyword;
mLastDialogue = *info;
}
} }
} }
} }
@ -445,28 +466,22 @@ namespace MWDialogue
else if (curDisp + mTemporaryDispositionChange > 100) else if (curDisp + mTemporaryDispositionChange > 100)
mTemporaryDispositionChange = 100 - curDisp; mTemporaryDispositionChange = 100 - curDisp;
// add status message to dialogue window
std::string text;
if (type == MWBase::MechanicsManager::PT_Admire)
text = "sAdmire";
else if (type == MWBase::MechanicsManager::PT_Taunt)
text = "sTaunt";
else if (type == MWBase::MechanicsManager::PT_Intimidate)
text = "sIntimidate";
else{
text = "sBribe";
}
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
MWWorld::Class::get(player).skillUsageSucceeded(player, ESM::Skill::Speechcraft, success ? 0 : 1); MWWorld::Class::get(player).skillUsageSucceeded(player, ESM::Skill::Speechcraft, success ? 0 : 1);
text += (success ? "Success" : "Fail"); std::string text;
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow(); if (type == MWBase::MechanicsManager::PT_Admire)
win->addTitle(MyGUI::LanguageManager::getInstance().replaceTags("#{"+text+"}")); text = "Admire";
else if (type == MWBase::MechanicsManager::PT_Taunt)
text = "Taunt";
else if (type == MWBase::MechanicsManager::PT_Intimidate)
text = "Intimidate";
else{
text = "Bribe";
}
/// \todo text from INFO record, how to get the ID? executeTopic (text + (success ? " Success" : " Fail"));
} }
int DialogueManager::getTemporaryDispositionChange() const int DialogueManager::getTemporaryDispositionChange() const

View file

@ -46,6 +46,8 @@ namespace MWDialogue
void printError (const std::string& error); void printError (const std::string& error);
void executeTopic (const std::string& topic);
public: public:
DialogueManager (const Compiler::Extensions& extensions, bool scriptVerbose); DialogueManager (const Compiler::Extensions& extensions, bool scriptVerbose);