Changes to npc trade module

This commit is contained in:
Henrique Santiago 2012-07-04 17:36:58 -03:00
parent 71bed49f80
commit df8dd52c25
2 changed files with 18 additions and 2 deletions

View File

@ -24,6 +24,7 @@ local tradeButton
local buyTab
local sellTab
local showCapacity = true
local buyWithBackpack
local ignoreCapacity
local ignoreEquipped
@ -149,10 +150,16 @@ local function refreshTradeItems()
local itemBox = g_ui.createWidget('NPCItemBox', itemsPanel)
itemBox.item = item
local text = ''
local name = item.name
local weight = string.format('%.2f', item.weight) .. ' ' .. WEIGHT_UNIT
text = text .. name
if showCapacity then
local weight = string.format('%.2f', item.weight) .. ' ' .. WEIGHT_UNIT
text = text .. '\n' .. weight
end
local price = item.price .. ' ' .. CURRENCY
itemBox:setText(name .. '\n' .. weight .. '\n' .. price)
text = text .. '\n' .. price
itemBox:setText(text)
local itemWidget = itemBox:getChildById('item')
itemWidget:setItem(item.ptr)
@ -428,3 +435,11 @@ end
function NPCTrade.onShowAllItemsChange()
refreshPlayerGoods()
end
function NPCTrade.setCurrency(currency)
CURRENCY = currency
end
function NPCTrade.showCapacity(state)
showCapacity = state
end

View File

@ -247,6 +247,7 @@ MainWindow
margin-left: 5
margin-top: 5
visible: false
checked: true
@onCheckChange: NPCTrade.onShowAllItemsChange()
Button