Changes to npc trade module
This commit is contained in:
parent
71bed49f80
commit
df8dd52c25
|
@ -24,6 +24,7 @@ local tradeButton
|
||||||
local buyTab
|
local buyTab
|
||||||
local sellTab
|
local sellTab
|
||||||
|
|
||||||
|
local showCapacity = true
|
||||||
local buyWithBackpack
|
local buyWithBackpack
|
||||||
local ignoreCapacity
|
local ignoreCapacity
|
||||||
local ignoreEquipped
|
local ignoreEquipped
|
||||||
|
@ -149,10 +150,16 @@ local function refreshTradeItems()
|
||||||
local itemBox = g_ui.createWidget('NPCItemBox', itemsPanel)
|
local itemBox = g_ui.createWidget('NPCItemBox', itemsPanel)
|
||||||
itemBox.item = item
|
itemBox.item = item
|
||||||
|
|
||||||
|
local text = ''
|
||||||
local name = item.name
|
local name = item.name
|
||||||
|
text = text .. name
|
||||||
|
if showCapacity then
|
||||||
local weight = string.format('%.2f', item.weight) .. ' ' .. WEIGHT_UNIT
|
local weight = string.format('%.2f', item.weight) .. ' ' .. WEIGHT_UNIT
|
||||||
|
text = text .. '\n' .. weight
|
||||||
|
end
|
||||||
local price = item.price .. ' ' .. CURRENCY
|
local price = item.price .. ' ' .. CURRENCY
|
||||||
itemBox:setText(name .. '\n' .. weight .. '\n' .. price)
|
text = text .. '\n' .. price
|
||||||
|
itemBox:setText(text)
|
||||||
|
|
||||||
local itemWidget = itemBox:getChildById('item')
|
local itemWidget = itemBox:getChildById('item')
|
||||||
itemWidget:setItem(item.ptr)
|
itemWidget:setItem(item.ptr)
|
||||||
|
@ -428,3 +435,11 @@ end
|
||||||
function NPCTrade.onShowAllItemsChange()
|
function NPCTrade.onShowAllItemsChange()
|
||||||
refreshPlayerGoods()
|
refreshPlayerGoods()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function NPCTrade.setCurrency(currency)
|
||||||
|
CURRENCY = currency
|
||||||
|
end
|
||||||
|
|
||||||
|
function NPCTrade.showCapacity(state)
|
||||||
|
showCapacity = state
|
||||||
|
end
|
||||||
|
|
|
@ -247,6 +247,7 @@ MainWindow
|
||||||
margin-left: 5
|
margin-left: 5
|
||||||
margin-top: 5
|
margin-top: 5
|
||||||
visible: false
|
visible: false
|
||||||
|
checked: true
|
||||||
@onCheckChange: NPCTrade.onShowAllItemsChange()
|
@onCheckChange: NPCTrade.onShowAllItemsChange()
|
||||||
|
|
||||||
Button
|
Button
|
||||||
|
|
Loading…
Reference in New Issue