mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 15:35:23 +00:00
fixed creatures
This commit is contained in:
parent
4634227f1c
commit
bf4e855260
@ -795,7 +795,7 @@ namespace MWDialogue
|
||||
|| services & ESM::NPC::Misc)
|
||||
windowServices |= MWGui::DialogueWindow::Service_Trade;
|
||||
|
||||
if( !mActor.get<ESM::NPC>()->base->mTransport.empty())
|
||||
if(mActor.getTypeName() == typeid(ESM::NPC).name() && !mActor.get<ESM::NPC>()->base->mTransport.empty())
|
||||
windowServices |= MWGui::DialogueWindow::Service_Travel;
|
||||
|
||||
if (services & ESM::NPC::Spells)
|
||||
|
@ -294,10 +294,13 @@ void DialogueWindow::updateOptions()
|
||||
mTopicsList->clear();
|
||||
mHistory->eraseText(0, mHistory->getTextLength());
|
||||
|
||||
mDispositionBar->setProgressRange(100);
|
||||
mDispositionBar->setProgressPosition(MWBase::Environment::get().getMechanicsManager()->disposition(mPtr));
|
||||
mDispositionText->eraseText(0, mDispositionText->getTextLength());
|
||||
mDispositionText->addText("#B29154"+boost::lexical_cast<std::string>(MWBase::Environment::get().getMechanicsManager()->disposition(mPtr))+std::string("/100")+"#B29154");
|
||||
if (mPtr.getTypeName() == typeid(ESM::NPC).name())
|
||||
{
|
||||
mDispositionBar->setProgressRange(100);
|
||||
mDispositionBar->setProgressPosition(MWBase::Environment::get().getMechanicsManager()->disposition(mPtr));
|
||||
mDispositionText->eraseText(0, mDispositionText->getTextLength());
|
||||
mDispositionText->addText("#B29154"+boost::lexical_cast<std::string>(MWBase::Environment::get().getMechanicsManager()->disposition(mPtr))+std::string("/100")+"#B29154");
|
||||
}
|
||||
}
|
||||
|
||||
void DialogueWindow::goodbye()
|
||||
@ -314,7 +317,7 @@ void DialogueWindow::onReferenceUnavailable()
|
||||
|
||||
void DialogueWindow::onFrame()
|
||||
{
|
||||
if(mEnabled)
|
||||
if(mEnabled && mPtr.getTypeName() == typeid(ESM::NPC).name())
|
||||
{
|
||||
mDispositionBar->setProgressRange(100);
|
||||
mDispositionBar->setProgressPosition(MWBase::Environment::get().getMechanicsManager()->disposition(mPtr));
|
||||
|
@ -185,8 +185,13 @@ namespace MWGui
|
||||
|
||||
if(mCurrentBalance > mCurrentMerchantOffer)
|
||||
{
|
||||
/// \todo : if creature....
|
||||
//if npc is a creature: reject (no haggle)
|
||||
if (mPtr.getTypeName() != typeid(ESM::NPC).name())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->
|
||||
messageBox("#{sNotifyMessage9}", std::vector<std::string>());
|
||||
return;
|
||||
}
|
||||
|
||||
int a = abs(mCurrentMerchantOffer);
|
||||
int b = abs(mCurrentBalance);
|
||||
@ -202,12 +207,12 @@ namespace MWGui
|
||||
MWMechanics::NpcStats playerSkill = MWWorld::Class::get(playerPtr).getNpcStats(playerPtr);
|
||||
MWMechanics::CreatureStats playerStats = MWWorld::Class::get(playerPtr).getCreatureStats(playerPtr);
|
||||
|
||||
float a1 = std::min<float>(playerSkill.getSkill(ESM::Skill::Mercantile).getModified(), 100);
|
||||
float b1 = std::min<float>(0.1 * playerStats.getAttribute(ESM::Attribute::Luck).getModified(), 10);
|
||||
float c1 = std::min<float>(0.2 * playerStats.getAttribute(ESM::Attribute::Personality).getModified(), 10);
|
||||
float d1 = std::min<float>(sellerSkill.getSkill(ESM::Skill::Mercantile).getModified(), 100);
|
||||
float e1 = std::min<float>(0.1 * sellerStats.getAttribute(ESM::Attribute::Luck).getModified(), 10);
|
||||
float f1 = std::min<float>(0.2 * sellerStats.getAttribute(ESM::Attribute::Personality).getModified(), 10);
|
||||
float a1 = std::min(playerSkill.getSkill(ESM::Skill::Mercantile).getModified(), 100.f);
|
||||
float b1 = std::min(0.1f * playerStats.getAttribute(ESM::Attribute::Luck).getModified(), 10.f);
|
||||
float c1 = std::min(0.2f * playerStats.getAttribute(ESM::Attribute::Personality).getModified(), 10.f);
|
||||
float d1 = std::min(sellerSkill.getSkill(ESM::Skill::Mercantile).getModified(), 100.f);
|
||||
float e1 = std::min(0.1f * sellerStats.getAttribute(ESM::Attribute::Luck).getModified(), 10.f);
|
||||
float f1 = std::min(0.2f * sellerStats.getAttribute(ESM::Attribute::Personality).getModified(), 10.f);
|
||||
|
||||
float pcTerm = (clampedDisposition - 50 + a1 + b1 + c1) * playerStats.getFatigueTerm();
|
||||
float npcTerm = (d1 + e1 + f1) * sellerStats.getFatigueTerm();
|
||||
|
@ -396,6 +396,9 @@ namespace MWMechanics
|
||||
|
||||
int MechanicsManager::barterOffer(const MWWorld::Ptr& ptr,int basePrice, bool buying)
|
||||
{
|
||||
if (ptr.getTypeName() == typeid(ESM::Creature).name())
|
||||
return basePrice;
|
||||
|
||||
MWMechanics::NpcStats sellerSkill = MWWorld::Class::get(ptr).getNpcStats(ptr);
|
||||
MWMechanics::CreatureStats sellerStats = MWWorld::Class::get(ptr).getCreatureStats(ptr);
|
||||
|
||||
@ -419,12 +422,10 @@ namespace MWMechanics
|
||||
float x;
|
||||
if(buying) x = buyTerm;
|
||||
else x = std::min(buyTerm, sellTerm);
|
||||
//std::cout << "x" << x;
|
||||
int offerPrice;
|
||||
if (x < 1) offerPrice = int(x * basePrice);
|
||||
if (x >= 1) offerPrice = basePrice + int((x - 1) * basePrice);
|
||||
offerPrice = std::max(1, offerPrice);
|
||||
//std::cout <<"barteroffer"<< offerPrice << " " << basePrice << "\n";
|
||||
return offerPrice;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user