Merge remote-tracking branch 'lazydev/master'

actorid
Marc Zinnschlag 12 years ago
commit ff74f687fb

@ -195,13 +195,13 @@ void ContainerBase::sellAlreadyBoughtItem(MyGUI::Widget* _sender, int count)
if (isInventory())
{
MWBase::Environment::get().getWindowManager()->getTradeWindow()->addItem(object, count);
MWBase::Environment::get().getWindowManager()->getTradeWindow()->buyFromNpc(object, count);
MWBase::Environment::get().getWindowManager()->getTradeWindow()->sellToNpc(object, count, true);
MWBase::Environment::get().getWindowManager()->getTradeWindow()->drawItems();
}
else
{
MWBase::Environment::get().getWindowManager()->getInventoryWindow()->addItem(object, count);
MWBase::Environment::get().getWindowManager()->getTradeWindow()->sellToNpc(object, count);
MWBase::Environment::get().getWindowManager()->getTradeWindow()->buyFromNpc(object, count, true);
MWBase::Environment::get().getWindowManager()->getInventoryWindow()->drawItems();
}
@ -218,13 +218,13 @@ void ContainerBase::sellItem(MyGUI::Widget* _sender, int count)
if (isInventory())
{
MWBase::Environment::get().getWindowManager()->getTradeWindow()->addBarteredItem(object, count);
MWBase::Environment::get().getWindowManager()->getTradeWindow()->buyFromNpc(object, count);
MWBase::Environment::get().getWindowManager()->getTradeWindow()->sellToNpc(object, count, false);
MWBase::Environment::get().getWindowManager()->getTradeWindow()->drawItems();
}
else
{
MWBase::Environment::get().getWindowManager()->getInventoryWindow()->addBarteredItem(object, count);
MWBase::Environment::get().getWindowManager()->getTradeWindow()->sellToNpc(object, count);
MWBase::Environment::get().getWindowManager()->getTradeWindow()->buyFromNpc(object, count, false);
MWBase::Environment::get().getWindowManager()->getInventoryWindow()->drawItems();
}

@ -401,19 +401,23 @@ namespace MWGui
return items;
}
void TradeWindow::sellToNpc(MWWorld::Ptr item, int count)
void TradeWindow::sellToNpc(MWWorld::Ptr item, int count, bool boughtItem)
{
int diff = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr, MWWorld::Class::get(item).getValue(item) * count, boughtItem);
mCurrentBalance += diff;
mCurrentMerchantOffer += diff;
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)
void TradeWindow::buyFromNpc(MWWorld::Ptr item, int count, bool soldItem)
{
int diff = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr, MWWorld::Class::get(item).getValue(item) * count, !soldItem);
mCurrentBalance -= diff;
mCurrentMerchantOffer -= diff;
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();
}

@ -27,8 +27,8 @@ namespace MWGui
void startTrade(MWWorld::Ptr actor);
void sellToNpc(MWWorld::Ptr item, int count); ///< only used for adjusting the gold balance
void buyFromNpc(MWWorld::Ptr item, int count); ///< only used for adjusting the gold balance
void sellToNpc(MWWorld::Ptr item, int count, bool boughtItem); ///< only used for adjusting the gold balance
void buyFromNpc(MWWorld::Ptr item, int count, bool soldItem); ///< only used for adjusting the gold balance
bool npcAcceptsItem(MWWorld::Ptr item);

Loading…
Cancel
Save