mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:23:52 +00:00
bartering disposition change
This commit is contained in:
parent
33b4b29fbc
commit
94aeb15220
4 changed files with 21 additions and 7 deletions
|
@ -43,6 +43,7 @@ namespace MWBase
|
|||
|
||||
virtual void persuade (int type) = 0;
|
||||
virtual int getTemporaryDispositionChange () const = 0;
|
||||
virtual void applyTemporaryDispositionChange (int delta) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -873,8 +873,11 @@ namespace MWDialogue
|
|||
MWBase::Environment::get().getWindowManager()->removeGuiMode(MWGui::GM_Dialogue);
|
||||
|
||||
// Apply disposition change to NPC's base disposition
|
||||
MWMechanics::NpcStats npcStats = MWWorld::Class::get(mActor).getNpcStats(mActor);
|
||||
npcStats.setBaseDisposition(npcStats.getBaseDisposition() + mPermanentDispositionChange);
|
||||
if (mActor.getTypeName() == typeid(ESM::NPC).name())
|
||||
{
|
||||
MWMechanics::NpcStats npcStats = MWWorld::Class::get(mActor).getNpcStats(mActor);
|
||||
npcStats.setBaseDisposition(npcStats.getBaseDisposition() + mPermanentDispositionChange);
|
||||
}
|
||||
mPermanentDispositionChange = 0;
|
||||
mTemporaryDispositionChange = 0;
|
||||
}
|
||||
|
@ -1001,4 +1004,9 @@ namespace MWDialogue
|
|||
{
|
||||
return mTemporaryDispositionChange;
|
||||
}
|
||||
|
||||
void DialogueManager::applyTemporaryDispositionChange(int delta)
|
||||
{
|
||||
mTemporaryDispositionChange += delta;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,6 +74,7 @@ namespace MWDialogue
|
|||
|
||||
virtual void persuade (int type);
|
||||
virtual int getTemporaryDispositionChange () const;
|
||||
virtual void applyTemporaryDispositionChange (int delta);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
#include "../mwbase/dialoguemanager.hpp"
|
||||
|
||||
#include "../mwworld/inventorystore.hpp"
|
||||
#include "../mwworld/manualref.hpp"
|
||||
|
@ -206,7 +207,8 @@ namespace MWGui
|
|||
if (mCurrentMerchantOffer<0) d = int(100 * (a - b) / a);
|
||||
else d = int(100 * (b - a) / a);
|
||||
|
||||
float clampedDisposition = std::max<int>(0,std::min<int>(int(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr)),100));
|
||||
float clampedDisposition = std::max<int>(0,std::min<int>(int(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr)
|
||||
+ MWBase::Environment::get().getDialogueManager()->getTemporaryDispositionChange()),100));
|
||||
|
||||
MWMechanics::NpcStats sellerSkill = MWWorld::Class::get(mPtr).getNpcStats(mPtr);
|
||||
MWMechanics::CreatureStats sellerStats = MWWorld::Class::get(mPtr).getCreatureStats(mPtr);
|
||||
|
@ -232,13 +234,15 @@ namespace MWGui
|
|||
{
|
||||
MWBase::Environment::get().getWindowManager()->
|
||||
messageBox("#{sNotifyMessage9}", std::vector<std::string>());
|
||||
/// \todo adjust npc temporary disposition by iBarterSuccessDisposition or iBarterFailDisposition
|
||||
return ;
|
||||
|
||||
int iBarterFailDisposition = gmst.find("iBarterFailDisposition")->getInt();
|
||||
MWBase::Environment::get().getDialogueManager()->applyTemporaryDispositionChange(iBarterFailDisposition);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// \todo adjust npc temporary disposition by iBarterSuccessDisposition or iBarterFailDisposition
|
||||
int iBarterSuccessDisposition = gmst.find("iBarterSuccessDisposition")->getInt();
|
||||
MWBase::Environment::get().getDialogueManager()->applyTemporaryDispositionChange(iBarterSuccessDisposition);
|
||||
|
||||
// success! make the item transfer.
|
||||
transferBoughtItems();
|
||||
|
|
Loading…
Reference in a new issue