method names, disposition uint->int

actorid
scrawl 12 years ago
parent ae78eaeb28
commit d53a7ade1e

@ -77,10 +77,10 @@ namespace MWBase
virtual void restoreDynamicStats() = 0;
///< If the player is sleeping, this should be called every hour.
virtual int barterOffer(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.
virtual int disposition(const MWWorld::Ptr& ptr) = 0;
virtual int getDerivedDisposition(const MWWorld::Ptr& ptr) = 0;
///< Calculate the diposition of an NPC toward the player.
virtual int countDeaths (const std::string& id) const = 0;

@ -303,9 +303,9 @@ void DialogueWindow::updateOptions()
if (mPtr.getTypeName() == typeid(ESM::NPC).name())
{
mDispositionBar->setProgressRange(100);
mDispositionBar->setProgressPosition(MWBase::Environment::get().getMechanicsManager()->disposition(mPtr));
mDispositionBar->setProgressPosition(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr));
mDispositionText->eraseText(0, mDispositionText->getTextLength());
mDispositionText->addText("#B29154"+boost::lexical_cast<std::string>(MWBase::Environment::get().getMechanicsManager()->disposition(mPtr))+std::string("/100")+"#B29154");
mDispositionText->addText("#B29154"+boost::lexical_cast<std::string>(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr))+std::string("/100")+"#B29154");
}
}
@ -326,8 +326,8 @@ void DialogueWindow::onFrame()
if(mEnabled && mPtr.getTypeName() == typeid(ESM::NPC).name())
{
mDispositionBar->setProgressRange(100);
mDispositionBar->setProgressPosition(MWBase::Environment::get().getMechanicsManager()->disposition(mPtr));
mDispositionBar->setProgressPosition(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr));
mDispositionText->eraseText(0, mDispositionText->getTextLength());
mDispositionText->addText("#B29154"+boost::lexical_cast<std::string>(MWBase::Environment::get().getMechanicsManager()->disposition(mPtr))+std::string("/100")+"#B29154");
mDispositionText->addText("#B29154"+boost::lexical_cast<std::string>(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr))+std::string("/100")+"#B29154");
}
}

@ -55,7 +55,7 @@ namespace MWGui
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(spellId);
int price = spell->mData.mCost*store.get<ESM::GameSetting>().find("fSpellValueMult")->getFloat();
price = MWBase::Environment::get().getMechanicsManager()->barterOffer(mPtr,price,true);
price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr,price,true);
MyGUI::Button* toAdd =
mSpellsView->createWidget<MyGUI::Button>(

@ -400,7 +400,7 @@ namespace MWGui
float fSpellMakingValueMult =
store.get<ESM::GameSetting>().find("fSpellMakingValueMult")->getFloat();
int price = MWBase::Environment::get().getMechanicsManager()->barterOffer(mPtr,int(y) * fSpellMakingValueMult,true);
int price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr,int(y) * fSpellMakingValueMult,true);
mPriceLabel->setCaption(boost::lexical_cast<std::string>(int(price)));

@ -206,7 +206,7 @@ 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()->disposition(mPtr)),100));
float clampedDisposition = std::max<int>(0,std::min<int>(int(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr)),100));
MWMechanics::NpcStats sellerSkill = MWWorld::Class::get(mPtr).getNpcStats(mPtr);
MWMechanics::CreatureStats sellerStats = MWWorld::Class::get(mPtr).getCreatureStats(mPtr);
@ -397,16 +397,16 @@ namespace MWGui
void TradeWindow::sellToNpc(MWWorld::Ptr item, int count)
{
mCurrentBalance -= MWBase::Environment::get().getMechanicsManager()->barterOffer(mPtr, MWWorld::Class::get(item).getValue(item) * count,true);
mCurrentMerchantOffer -= MWBase::Environment::get().getMechanicsManager()->barterOffer(mPtr, MWWorld::Class::get(item).getValue(item) * count,true);
mCurrentBalance -= MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr, MWWorld::Class::get(item).getValue(item) * count,true);
mCurrentMerchantOffer -= MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr, MWWorld::Class::get(item).getValue(item) * count,true);
updateLabels();
}
void TradeWindow::buyFromNpc(MWWorld::Ptr item, int count)
{
mCurrentBalance += MWBase::Environment::get().getMechanicsManager()->barterOffer(mPtr, MWWorld::Class::get(item).getValue(item) * count,false);
mCurrentMerchantOffer += MWBase::Environment::get().getMechanicsManager()->barterOffer(mPtr, MWWorld::Class::get(item).getValue(item) * count,false);
mCurrentBalance += MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr, MWWorld::Class::get(item).getValue(item) * count,false);
mCurrentMerchantOffer += MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr, MWWorld::Class::get(item).getValue(item) * count,false);
updateLabels();
}

@ -79,7 +79,7 @@ namespace MWGui
for (int i=0; i<3; ++i)
{
int price = MWBase::Environment::get().getMechanicsManager()->barterOffer
int price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer
(mPtr,pcStats.getSkill (bestSkills[i].first).getBase() * gmst.find("iTrainingMod")->getInt (),true);
std::string skin = (price > mWindowManager.getInventoryWindow ()->getPlayerGold ()) ? "SandTextGreyedOut" : "SandTextButton";
@ -121,7 +121,7 @@ namespace MWGui
MWBase::Environment::get().getWorld()->getStore();
int price = pcStats.getSkill (skillId).getBase() * store.get<ESM::GameSetting>().find("iTrainingMod")->getInt ();
price = MWBase::Environment::get().getMechanicsManager()->barterOffer(mPtr,price,true);
price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr,price,true);
if (mWindowManager.getInventoryWindow()->getPlayerGold()<price)
return;

@ -69,7 +69,7 @@ namespace MWGui
price = d/gmst.find("fTravelMult")->getFloat();
}
price = MWBase::Environment::get().getMechanicsManager()->barterOffer(mPtr,price,true);
price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr,price,true);
MyGUI::Button* toAdd = mDestinationsView->createWidget<MyGUI::Button>((price>mWindowManager.getInventoryWindow()->getPlayerGold()) ? "SandTextGreyedOut" : "SandTextButton", 0, mCurrentY, 200, sLineHeight, MyGUI::Align::Default);
mCurrentY += sLineHeight;

@ -388,7 +388,7 @@ namespace MWMechanics
return lowerCase;
}
int MechanicsManager::disposition(const MWWorld::Ptr& ptr)
int MechanicsManager::getDerivedDisposition(const MWWorld::Ptr& ptr)
{
MWMechanics::NpcStats npcSkill = MWWorld::Class::get(ptr).getNpcStats(ptr);
float x = npcSkill.getDisposition();
@ -448,7 +448,7 @@ namespace MWMechanics
return effective_disposition;
}
int MechanicsManager::barterOffer(const MWWorld::Ptr& ptr,int basePrice, bool buying)
int MechanicsManager::getBarterOffer(const MWWorld::Ptr& ptr,int basePrice, bool buying)
{
if (ptr.getTypeName() == typeid(ESM::Creature).name())
return basePrice;
@ -460,7 +460,7 @@ namespace MWMechanics
MWMechanics::NpcStats playerSkill = MWWorld::Class::get(playerPtr).getNpcStats(playerPtr);
MWMechanics::CreatureStats playerStats = MWWorld::Class::get(playerPtr).getCreatureStats(playerPtr);
int clampedDisposition = std::min(disposition(ptr),100);
int clampedDisposition = std::min(getDerivedDisposition(ptr),100);
float a = std::min(playerSkill.getSkill(ESM::Skill::Mercantile).getModified(), 100.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);

@ -79,10 +79,10 @@ namespace MWMechanics
virtual void restoreDynamicStats();
///< If the player is sleeping, this should be called every hour.
virtual int barterOffer(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.
virtual int disposition(const MWWorld::Ptr& ptr);
virtual int getDerivedDisposition(const MWWorld::Ptr& ptr);
///< Calculate the diposition of an NPC toward the player.
virtual int countDeaths (const std::string& id) const;

@ -36,12 +36,12 @@ void MWMechanics::NpcStats::setDrawState (DrawState_ state)
mDrawState = state;
}
unsigned int MWMechanics::NpcStats::getDisposition() const
int MWMechanics::NpcStats::getDisposition() const
{
return mDisposition;
}
void MWMechanics::NpcStats::setDisposition(unsigned int disposition)
void MWMechanics::NpcStats::setDisposition(int disposition)
{
mDisposition = disposition;
}

@ -43,7 +43,7 @@ namespace MWMechanics
std::map<std::string, int> mFactionRank;
DrawState_ mDrawState;
unsigned int mDisposition;
int mDisposition;
unsigned int mMovementFlags;
Stat<float> mSkill[27];
@ -61,9 +61,9 @@ namespace MWMechanics
void setDrawState (DrawState_ state);
unsigned int getDisposition() const;
int getDisposition() const;
void setDisposition(unsigned int disposition);
void setDisposition(int disposition);
bool getMovementFlag (Flag flag) const;

Loading…
Cancel
Save