1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-30 23:06:44 +00:00

BarterOffer is used in other trading services too

This commit is contained in:
gugus 2012-11-05 19:53:55 +01:00
parent f72f898bd9
commit aaf1b66c7e
4 changed files with 11 additions and 5 deletions

View file

@ -8,6 +8,7 @@
#include "../mwbase/world.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwbase/mechanicsmanager.hpp"
#include "../mwworld/player.hpp"
#include "../mwworld/manualref.hpp"
@ -51,6 +52,7 @@ namespace MWGui
{
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId);
int price = spell->mData.mCost*MWBase::Environment::get().getWorld()->getStore().gameSettings.find("fSpellValueMult")->getFloat();
price = MWBase::Environment::get().getMechanicsManager()->barterOffer(mPtr,price,true);
MyGUI::Button* toAdd =
mSpellsView->createWidget<MyGUI::Button>(

View file

@ -9,6 +9,7 @@
#include "../mwbase/world.hpp"
#include "../mwbase/environment.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/mechanicsmanager.hpp"
#include "../mwworld/player.hpp"
#include "../mwworld/class.hpp"
@ -388,7 +389,7 @@ namespace MWGui
float fSpellMakingValueMult = MWBase::Environment::get().getWorld()->getStore().gameSettings.find("fSpellMakingValueMult")->getFloat();
/// \todo mercantile
int price = int(y) * fSpellMakingValueMult;
int price = MWBase::Environment::get().getMechanicsManager()->barterOffer(mPtr,int(y) * fSpellMakingValueMult,true);
mPriceLabel->setCaption(boost::lexical_cast<std::string>(int(price)));

View file

@ -6,6 +6,7 @@
#include "../mwbase/world.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwbase/mechanicsmanager.hpp"
#include "../mwworld/inventorystore.hpp"
#include "../mwworld/manualref.hpp"
@ -318,16 +319,17 @@ namespace MWGui
{
/// \todo price adjustment depending on merchantile skill
mCurrentBalance -= MWWorld::Class::get(item).getValue(item) * count;
mCurrentBalance -= MWWorld::Class::get(item).getValue(item) * count
+ MWBase::Environment::get().getMechanicsManager()->barterOffer(mPtr, MWWorld::Class::get(item).getValue(item) * count,false);
updateLabels();
}
void TradeWindow::buyFromNpc(MWWorld::Ptr item, int count)
{
/// \todo price adjustment depending on merchantile skill
mCurrentBalance += MWWorld::Class::get(item).getValue(item) * count;
mCurrentBalance += MWWorld::Class::get(item).getValue(item) * count
- MWBase::Environment::get().getMechanicsManager()->barterOffer(mPtr, MWWorld::Class::get(item).getValue(item) * count,true);
updateLabels();
}

View file

@ -7,6 +7,7 @@
#include "../mwbase/windowmanager.hpp"
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwbase/mechanicsmanager.hpp"
#include "../mwworld/player.hpp"
@ -76,7 +77,7 @@ namespace MWGui
for (int i=0; i<3; ++i)
{
/// \todo mercantile skill
int price = pcStats.getSkill (bestSkills[i].first).getBase() * MWBase::Environment::get().getWorld ()->getStore ().gameSettings.find("iTrainingMod")->getInt ();
int price = MWBase::Environment::get().getMechanicsManager()->barterOffer(mPtr,pcStats.getSkill (bestSkills[i].first).getBase() * MWBase::Environment::get().getWorld ()->getStore ().gameSettings.find("iTrainingMod")->getInt (),true);
std::string skin = (price > mWindowManager.getInventoryWindow ()->getPlayerGold ()) ? "SandTextGreyedOut" : "SandTextButton";