fixing npc items on both lists
This commit is contained in:
parent
5425d344ba
commit
b4940a6b33
|
@ -201,7 +201,7 @@ function NPCTrade.onOpenNpcTrade(items)
|
||||||
NPCTrade.show()
|
NPCTrade.show()
|
||||||
end
|
end
|
||||||
|
|
||||||
function NPCTrade.swithBuyWithBackpack()
|
function NPCTrade.switchBuyWithBackpack()
|
||||||
buyWithBackpack = not buyWithBackpack
|
buyWithBackpack = not buyWithBackpack
|
||||||
if offerSelected then
|
if offerSelected then
|
||||||
priceLabel:setText(NPCTrade.getOfferPrice(offerSelected) .. " gold")
|
priceLabel:setText(NPCTrade.getOfferPrice(offerSelected) .. " gold")
|
||||||
|
@ -215,7 +215,7 @@ function NPCTrade.itemPopup(self, mousePosition, mouseButton)
|
||||||
menu:addOption('Look', function() return g_game.inspectNpcTrade(self.offer[1]) end)
|
menu:addOption('Look', function() return g_game.inspectNpcTrade(self.offer[1]) end)
|
||||||
menu:addSeparator()
|
menu:addSeparator()
|
||||||
if setupButton:getText() == 'Buy' then
|
if setupButton:getText() == 'Buy' then
|
||||||
menu:addOption((buyWithBackpack and 'Buy no backpack' or 'Buy with backpack'), NPCTrade.swithBuyWithBackpack)
|
menu:addOption((buyWithBackpack and 'Buy no backpack' or 'Buy with backpack'), NPCTrade.switchBuyWithBackpack)
|
||||||
menu:addOption((ignoreCapacity and 'Consider capacity' or 'Ignore capacity'), function() ignoreCapacity = not ignoreCapacity return true end)
|
menu:addOption((ignoreCapacity and 'Consider capacity' or 'Ignore capacity'), function() ignoreCapacity = not ignoreCapacity return true end)
|
||||||
else
|
else
|
||||||
menu:addOption((ignoreEquipped and 'Consider equipped' or 'Ignore equipped'), function() ignoreEquipped = not ignoreEquipped return true end)
|
menu:addOption((ignoreEquipped and 'Consider equipped' or 'Ignore equipped'), function() ignoreEquipped = not ignoreEquipped return true end)
|
||||||
|
@ -227,6 +227,9 @@ end
|
||||||
function NPCTrade.createItemsOnPanel()
|
function NPCTrade.createItemsOnPanel()
|
||||||
NPCTrade.resetSetup()
|
NPCTrade.resetSetup()
|
||||||
|
|
||||||
|
local layout = itemsPanel:getLayout()
|
||||||
|
layout:disableUpdates()
|
||||||
|
|
||||||
offerSelected = nil
|
offerSelected = nil
|
||||||
itemsPanel:destroyChildren()
|
itemsPanel:destroyChildren()
|
||||||
|
|
||||||
|
@ -237,7 +240,7 @@ function NPCTrade.createItemsOnPanel()
|
||||||
|
|
||||||
for i, v in pairs(cacheItems) do
|
for i, v in pairs(cacheItems) do
|
||||||
local price = NPCTrade.getOfferPrice(v)
|
local price = NPCTrade.getOfferPrice(v)
|
||||||
if price >= 0 then
|
if price > 0 then
|
||||||
local itemBox = createWidget('NPCItemBox', itemsPanel)
|
local itemBox = createWidget('NPCItemBox', itemsPanel)
|
||||||
itemBox.offer = v
|
itemBox.offer = v
|
||||||
itemBox:getChildById('item'):setItem(v[1])
|
itemBox:getChildById('item'):setItem(v[1])
|
||||||
|
@ -251,6 +254,9 @@ function NPCTrade.createItemsOnPanel()
|
||||||
radioItems:addWidget(itemBox)
|
radioItems:addWidget(itemBox)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
layout:enableUpdates()
|
||||||
|
layout:update()
|
||||||
end
|
end
|
||||||
|
|
||||||
function NPCTrade.searchFilter(filter)
|
function NPCTrade.searchFilter(filter)
|
||||||
|
@ -312,8 +318,3 @@ end
|
||||||
function NPCTrade.onCloseNpcTrade()
|
function NPCTrade.onCloseNpcTrade()
|
||||||
NPCTrade.hide()
|
NPCTrade.hide()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- void inspectNpcTrade(const ItemPtr& item);
|
|
||||||
-- void buyItem(const ItemPtr& item, int amount, bool ignoreCapacity, bool buyWithBackpack);
|
|
||||||
-- void sellItem(const ItemPtr& item, int amount, bool ignoreEquipped);
|
|
||||||
-- void closeNpcTrade();
|
|
Loading…
Reference in New Issue