mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-03 16:49:54 +00:00
Merge pull request #913
This commit is contained in:
commit
bc5adfa4fe
6 changed files with 11 additions and 12 deletions
|
@ -97,7 +97,7 @@ namespace MWBase
|
||||||
virtual int getBarterOffer(const MWWorld::Ptr& ptr,int basePrice, bool buying) = 0;
|
virtual int getBarterOffer(const MWWorld::Ptr& ptr,int basePrice, bool buying) = 0;
|
||||||
///< This is used by every service to determine the price of objects given the trading skills of the player and NPC.
|
///< This is used by every service to determine the price of objects given the trading skills of the player and NPC.
|
||||||
|
|
||||||
virtual int getDerivedDisposition(const MWWorld::Ptr& ptr) = 0;
|
virtual int getDerivedDisposition(const MWWorld::Ptr& ptr, bool addTemporaryDispositionChange = false) = 0;
|
||||||
///< Calculate the diposition of an NPC toward the player.
|
///< Calculate the diposition of an NPC toward the player.
|
||||||
|
|
||||||
virtual int countDeaths (const std::string& id) const = 0;
|
virtual int countDeaths (const std::string& id) const = 0;
|
||||||
|
|
|
@ -145,8 +145,7 @@ bool MWDialogue::Filter::testDisposition (const ESM::DialInfo& info, bool invert
|
||||||
if (isCreature)
|
if (isCreature)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
int actorDisposition = MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mActor)
|
int actorDisposition = MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mActor, true);
|
||||||
+ MWBase::Environment::get().getDialogueManager()->getTemporaryDispositionChange();
|
|
||||||
// For service refusal, the disposition check is inverted. However, a value of 0 still means "always succeed".
|
// For service refusal, the disposition check is inverted. However, a value of 0 still means "always succeed".
|
||||||
return invert ? (info.mData.mDisposition == 0 || actorDisposition < info.mData.mDisposition)
|
return invert ? (info.mData.mDisposition == 0 || actorDisposition < info.mData.mDisposition)
|
||||||
: (actorDisposition >= info.mData.mDisposition);
|
: (actorDisposition >= info.mData.mDisposition);
|
||||||
|
|
|
@ -640,8 +640,7 @@ namespace MWGui
|
||||||
if(mMainWidget->getVisible() && mEnabled && mPtr.getTypeName() == typeid(ESM::NPC).name())
|
if(mMainWidget->getVisible() && mEnabled && mPtr.getTypeName() == typeid(ESM::NPC).name())
|
||||||
{
|
{
|
||||||
int disp = std::max(0, std::min(100,
|
int disp = std::max(0, std::min(100,
|
||||||
MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr)
|
MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr, true)));
|
||||||
+ MWBase::Environment::get().getDialogueManager()->getTemporaryDispositionChange()));
|
|
||||||
mDispositionBar->setProgressRange(100);
|
mDispositionBar->setProgressRange(100);
|
||||||
mDispositionBar->setProgressPosition(disp);
|
mDispositionBar->setProgressPosition(disp);
|
||||||
mDispositionText->setCaption(MyGUI::utility::toString(disp)+std::string("/100"));
|
mDispositionText->setCaption(MyGUI::utility::toString(disp)+std::string("/100"));
|
||||||
|
|
|
@ -346,8 +346,7 @@ namespace MWGui
|
||||||
else
|
else
|
||||||
d = int(100 * (b - a) / a);
|
d = int(100 * (b - a) / a);
|
||||||
|
|
||||||
int clampedDisposition = std::max(0, std::min(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr)
|
int clampedDisposition = std::max(0, std::min(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr, true),100));
|
||||||
+ MWBase::Environment::get().getDialogueManager()->getTemporaryDispositionChange(),100));
|
|
||||||
|
|
||||||
const MWMechanics::CreatureStats &sellerStats = mPtr.getClass().getCreatureStats(mPtr);
|
const MWMechanics::CreatureStats &sellerStats = mPtr.getClass().getCreatureStats(mPtr);
|
||||||
const MWMechanics::CreatureStats &playerStats = player.getClass().getCreatureStats(player);
|
const MWMechanics::CreatureStats &playerStats = player.getClass().getCreatureStats(player);
|
||||||
|
|
|
@ -581,7 +581,7 @@ namespace MWMechanics
|
||||||
mUpdatePlayer = true;
|
mUpdatePlayer = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MechanicsManager::getDerivedDisposition(const MWWorld::Ptr& ptr)
|
int MechanicsManager::getDerivedDisposition(const MWWorld::Ptr& ptr, bool addTemporaryDispositionChange/* = false */)
|
||||||
{
|
{
|
||||||
const MWMechanics::NpcStats& npcSkill = ptr.getClass().getNpcStats(ptr);
|
const MWMechanics::NpcStats& npcSkill = ptr.getClass().getNpcStats(ptr);
|
||||||
float x = static_cast<float>(npcSkill.getBaseDisposition());
|
float x = static_cast<float>(npcSkill.getBaseDisposition());
|
||||||
|
@ -653,6 +653,9 @@ namespace MWMechanics
|
||||||
|
|
||||||
x += ptr.getClass().getCreatureStats(ptr).getMagicEffects().get(ESM::MagicEffect::Charm).getMagnitude();
|
x += ptr.getClass().getCreatureStats(ptr).getMagicEffects().get(ESM::MagicEffect::Charm).getMagnitude();
|
||||||
|
|
||||||
|
if(addTemporaryDispositionChange)
|
||||||
|
x += MWBase::Environment::get().getDialogueManager()->getTemporaryDispositionChange();
|
||||||
|
|
||||||
int effective_disposition = std::max(0,std::min(int(x),100));//, normally clamped to [0..100] when used
|
int effective_disposition = std::max(0,std::min(int(x),100));//, normally clamped to [0..100] when used
|
||||||
return effective_disposition;
|
return effective_disposition;
|
||||||
}
|
}
|
||||||
|
@ -667,10 +670,9 @@ namespace MWMechanics
|
||||||
MWWorld::Ptr playerPtr = getPlayer();
|
MWWorld::Ptr playerPtr = getPlayer();
|
||||||
const MWMechanics::NpcStats &playerStats = playerPtr.getClass().getNpcStats(playerPtr);
|
const MWMechanics::NpcStats &playerStats = playerPtr.getClass().getNpcStats(playerPtr);
|
||||||
|
|
||||||
// I suppose the temporary disposition change _has_ to be considered here,
|
// I suppose the temporary disposition change (second param to getDerivedDisposition()) _has_ to be considered here,
|
||||||
// otherwise one would get different prices when exiting and re-entering the dialogue window...
|
// otherwise one would get different prices when exiting and re-entering the dialogue window...
|
||||||
int clampedDisposition = std::max(0, std::min(getDerivedDisposition(ptr)
|
int clampedDisposition = std::max(0, std::min(getDerivedDisposition(ptr, true),100));
|
||||||
+ MWBase::Environment::get().getDialogueManager()->getTemporaryDispositionChange(),100));
|
|
||||||
float a = static_cast<float>(std::min(playerStats.getSkill(ESM::Skill::Mercantile).getModified(), 100));
|
float a = static_cast<float>(std::min(playerStats.getSkill(ESM::Skill::Mercantile).getModified(), 100));
|
||||||
float b = std::min(0.1f * playerStats.getAttribute(ESM::Attribute::Luck).getModified(), 10.f);
|
float b = std::min(0.1f * playerStats.getAttribute(ESM::Attribute::Luck).getModified(), 10.f);
|
||||||
float c = std::min(0.2f * playerStats.getAttribute(ESM::Attribute::Personality).getModified(), 10.f);
|
float c = std::min(0.2f * playerStats.getAttribute(ESM::Attribute::Personality).getModified(), 10.f);
|
||||||
|
|
|
@ -92,7 +92,7 @@ namespace MWMechanics
|
||||||
virtual int getBarterOffer(const MWWorld::Ptr& ptr,int basePrice, bool buying);
|
virtual int getBarterOffer(const MWWorld::Ptr& ptr,int basePrice, bool buying);
|
||||||
///< This is used by every service to determine the price of objects given the trading skills of the player and NPC.
|
///< This is used by every service to determine the price of objects given the trading skills of the player and NPC.
|
||||||
|
|
||||||
virtual int getDerivedDisposition(const MWWorld::Ptr& ptr);
|
virtual int getDerivedDisposition(const MWWorld::Ptr& ptr, bool addTemporaryDispositionChange = false);
|
||||||
///< Calculate the diposition of an NPC toward the player.
|
///< Calculate the diposition of an NPC toward the player.
|
||||||
|
|
||||||
virtual int countDeaths (const std::string& id) const;
|
virtual int countDeaths (const std::string& id) const;
|
||||||
|
|
Loading…
Reference in a new issue