mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-01 11:15:36 +00:00
NPC now doesn't buy items of types that he shouldn't accept.
This commit is contained in:
parent
50a8eb05d9
commit
342a244e31
2 changed files with 17 additions and 4 deletions
|
@ -123,6 +123,18 @@ void ContainerBase::onSelectedItem(MyGUI::Widget* _sender)
|
|||
MWWorld::Ptr object = (*_sender->getUserData<MWWorld::Ptr>());
|
||||
int count = object.getRefData().getCount();
|
||||
|
||||
if (isInventory())
|
||||
{
|
||||
// the player is trying to sell an item, check if the merchant accepts it
|
||||
if (!MWBase::Environment::get().getWindowManager()->getTradeWindow()->npcAcceptsItem(object))
|
||||
{
|
||||
// user notification "i don't buy this item"
|
||||
MWBase::Environment::get().getWindowManager()->
|
||||
messageBox(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sBarterDialog4")->str, std::vector<std::string>());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (std::find(mBoughtItems.begin(), mBoughtItems.end(), object) != mBoughtItems.end())
|
||||
{
|
||||
if (MyGUI::InputManager::getInstance().isShiftPressed() || count == 1)
|
||||
|
|
|
@ -92,11 +92,14 @@ namespace MWGui
|
|||
|
||||
void InventoryWindow::openInventory()
|
||||
{
|
||||
onWindowResize(static_cast<MyGUI::Window*>(mMainWidget));
|
||||
|
||||
updateEncumbranceBar();
|
||||
|
||||
mTrading = false;
|
||||
|
||||
mBoughtItems.clear();
|
||||
mSoldItems.clear();
|
||||
|
||||
onWindowResize(static_cast<MyGUI::Window*>(mMainWidget));
|
||||
}
|
||||
|
||||
void InventoryWindow::onWindowResize(MyGUI::Window* _sender)
|
||||
|
@ -252,7 +255,5 @@ namespace MWGui
|
|||
void InventoryWindow::startTrade()
|
||||
{
|
||||
mTrading = true;
|
||||
mBoughtItems.clear();
|
||||
mSoldItems.clear();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue