mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-27 21:35:24 +00:00
Merge pull request #3003 from akortunov/min_cost
Set a minimum 1gp cost for services
This commit is contained in:
commit
673f0f4f77
@ -63,6 +63,7 @@ void MerchantRepair::setPtr(const MWWorld::Ptr &actor)
|
|||||||
|
|
||||||
int x = static_cast<int>((maxDurability - durability) / r);
|
int x = static_cast<int>((maxDurability - durability) / r);
|
||||||
x = static_cast<int>(fRepairMult * x);
|
x = static_cast<int>(fRepairMult * x);
|
||||||
|
x = std::max(1, x);
|
||||||
|
|
||||||
int price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mActor, x, true);
|
int price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mActor, x, true);
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ namespace MWGui
|
|||||||
const MWWorld::ESMStore &store =
|
const MWWorld::ESMStore &store =
|
||||||
MWBase::Environment::get().getWorld()->getStore();
|
MWBase::Environment::get().getWorld()->getStore();
|
||||||
|
|
||||||
int price = static_cast<int>(spell.mData.mCost*store.get<ESM::GameSetting>().find("fSpellValueMult")->mValue.getFloat());
|
int price = std::max(1, static_cast<int>(spell.mData.mCost*store.get<ESM::GameSetting>().find("fSpellValueMult")->mValue.getFloat()));
|
||||||
price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr,price,true);
|
price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr,price,true);
|
||||||
|
|
||||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||||
|
@ -475,7 +475,8 @@ namespace MWGui
|
|||||||
float fSpellMakingValueMult =
|
float fSpellMakingValueMult =
|
||||||
store.get<ESM::GameSetting>().find("fSpellMakingValueMult")->mValue.getFloat();
|
store.get<ESM::GameSetting>().find("fSpellMakingValueMult")->mValue.getFloat();
|
||||||
|
|
||||||
int price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr, static_cast<int>(y * fSpellMakingValueMult),true);
|
int price = std::max(1, static_cast<int>(y * fSpellMakingValueMult));
|
||||||
|
price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr, price, true);
|
||||||
|
|
||||||
mPriceLabel->setCaption(MyGUI::utility::toString(int(price)));
|
mPriceLabel->setCaption(MyGUI::utility::toString(int(price)));
|
||||||
|
|
||||||
|
@ -99,8 +99,9 @@ namespace MWGui
|
|||||||
|
|
||||||
for (int i=0; i<3; ++i)
|
for (int i=0; i<3; ++i)
|
||||||
{
|
{
|
||||||
int price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer
|
int price = static_cast<int>(pcStats.getSkill (skills[i].first).getBase() * gmst.find("iTrainingMod")->mValue.getInteger());
|
||||||
(mPtr,pcStats.getSkill (skills[i].first).getBase() * gmst.find("iTrainingMod")->mValue.getInteger(),true);
|
price = std::max(1, price);
|
||||||
|
price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr, price, true);
|
||||||
|
|
||||||
MyGUI::Button* button = mTrainingOptions->createWidget<MyGUI::Button>(price <= playerGold ? "SandTextButton" : "SandTextButtonDisabled", // can't use setEnabled since that removes tooltip
|
MyGUI::Button* button = mTrainingOptions->createWidget<MyGUI::Button>(price <= playerGold ? "SandTextButton" : "SandTextButtonDisabled", // can't use setEnabled since that removes tooltip
|
||||||
MyGUI::IntCoord(5, 5+i*18, mTrainingOptions->getWidth()-10, 18), MyGUI::Align::Default);
|
MyGUI::IntCoord(5, 5+i*18, mTrainingOptions->getWidth()-10, 18), MyGUI::Align::Default);
|
||||||
|
@ -62,9 +62,14 @@ namespace MWGui
|
|||||||
{
|
{
|
||||||
ESM::Position PlayerPos = player.getRefData().getPosition();
|
ESM::Position PlayerPos = player.getRefData().getPosition();
|
||||||
float d = sqrt(pow(pos.pos[0] - PlayerPos.pos[0], 2) + pow(pos.pos[1] - PlayerPos.pos[1], 2) + pow(pos.pos[2] - PlayerPos.pos[2], 2));
|
float d = sqrt(pow(pos.pos[0] - PlayerPos.pos[0], 2) + pow(pos.pos[1] - PlayerPos.pos[1], 2) + pow(pos.pos[2] - PlayerPos.pos[2], 2));
|
||||||
price = static_cast<int>(d / gmst.find("fTravelMult")->mValue.getFloat());
|
float fTravelMult = gmst.find("fTravelMult")->mValue.getFloat();
|
||||||
|
if (fTravelMult != 0)
|
||||||
|
price = static_cast<int>(d / fTravelMult);
|
||||||
|
else
|
||||||
|
price = static_cast<int>(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
price = std::max(1, price);
|
||||||
price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr, price, true);
|
price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr, price, true);
|
||||||
|
|
||||||
// Add price for the travelling followers
|
// Add price for the travelling followers
|
||||||
|
@ -281,7 +281,7 @@ namespace MWMechanics
|
|||||||
float priceMultipler = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find ("fEnchantmentValueMult")->mValue.getFloat();
|
float priceMultipler = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find ("fEnchantmentValueMult")->mValue.getFloat();
|
||||||
int price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mEnchanter, static_cast<int>(getEnchantPoints() * priceMultipler), true);
|
int price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mEnchanter, static_cast<int>(getEnchantPoints() * priceMultipler), true);
|
||||||
price *= getEnchantItemsCount() * getTypeMultiplier();
|
price *= getEnchantItemsCount() * getTypeMultiplier();
|
||||||
return price;
|
return std::max(1, price);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Enchanting::getGemCharge() const
|
int Enchanting::getGemCharge() const
|
||||||
|
Loading…
x
Reference in New Issue
Block a user