Add support for service-specific refusals (feature #5580)

pull/593/head
Andrei Kortunov 4 years ago
parent 69b52cd702
commit 6c591c190b

@ -72,6 +72,7 @@
Feature #5545: Option to allow stealing from an unconscious NPC during combat
Feature #5563: Run physics update in background thread
Feature #5579: MCP SetAngle enhancement
Feature #5580: Service refusal filtering
Feature #5610: Actors movement should be smoother
Feature #5642: Ability to attach arrows to actor skeleton instead of bow mesh
Feature #5649: Skyrim SE compressed BSA format support

@ -76,10 +76,22 @@ namespace MWBase
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) = 0;
virtual bool checkServiceRefused (ResponseCallback* callback, ServiceType service = ServiceType::Any) = 0;
virtual void persuade (int type, ResponseCallback* callback) = 0;
virtual int getTemporaryDispositionChange () const = 0;

@ -551,9 +551,9 @@ namespace MWDialogue
mPermanentDispositionChange += delta;
}
bool DialogueManager::checkServiceRefused(ResponseCallback* callback)
bool DialogueManager::checkServiceRefused(ResponseCallback* callback, ServiceType service)
{
Filter filter (mActor, mChoice, mTalkedTo);
Filter filter (mActor, service, mTalkedTo);
const MWWorld::Store<ESM::Dialogue> &dialogues =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>();

@ -86,7 +86,7 @@ namespace MWDialogue
void goodbye() override;
bool checkServiceRefused (ResponseCallback* callback) override;
bool checkServiceRefused (ResponseCallback* callback, ServiceType service = ServiceType::Any) override;
void say(const MWWorld::Ptr &actor, const std::string &topic) override;

@ -362,7 +362,9 @@ namespace MWGui
void DialogueWindow::onSelectListItem(const std::string& topic, int id)
{
if (mGoodbye || MWBase::Environment::get().getDialogueManager()->isInChoice())
MWBase::DialogueManager* dialogueManager = MWBase::Environment::get().getDialogueManager();
if (mGoodbye || dialogueManager->isInChoice())
return;
const MWWorld::Store<ESM::GameSetting> &gmst = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
@ -389,21 +391,21 @@ namespace MWGui
mPersuasionDialog.setVisible(true);
else if (topic == sCompanionShare)
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Companion, mPtr);
else if (!MWBase::Environment::get().getDialogueManager()->checkServiceRefused(mCallback.get()))
else if (!dialogueManager->checkServiceRefused(mCallback.get()))
{
if (topic == sBarter)
if (topic == sBarter && !dialogueManager->checkServiceRefused(mCallback.get(), MWBase::DialogueManager::Barter))
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Barter, mPtr);
else if (topic == sSpells)
else if (topic == sSpells && !dialogueManager->checkServiceRefused(mCallback.get(), MWBase::DialogueManager::Spells))
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_SpellBuying, mPtr);
else if (topic == sTravel)
else if (topic == sTravel && !dialogueManager->checkServiceRefused(mCallback.get(), MWBase::DialogueManager::Travel))
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Travel, mPtr);
else if (topic == sSpellMakingMenuTitle)
else if (topic == sSpellMakingMenuTitle && !dialogueManager->checkServiceRefused(mCallback.get(), MWBase::DialogueManager::Spellmaking))
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_SpellCreation, mPtr);
else if (topic == sEnchanting)
else if (topic == sEnchanting && !dialogueManager->checkServiceRefused(mCallback.get(), MWBase::DialogueManager::Enchanting))
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Enchanting, mPtr);
else if (topic == sServiceTrainingTitle)
else if (topic == sServiceTrainingTitle && !dialogueManager->checkServiceRefused(mCallback.get(), MWBase::DialogueManager::Training))
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Training, mPtr);
else if (topic == sRepair)
else if (topic == sRepair && !dialogueManager->checkServiceRefused(mCallback.get(), MWBase::DialogueManager::Repair))
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_MerchantRepair, mPtr);
}
else

Loading…
Cancel
Save