diff --git a/modules/game_npctrade/npctrade.lua b/modules/game_npctrade/npctrade.lua index 3bed8559..be88f0aa 100644 --- a/modules/game_npctrade/npctrade.lua +++ b/modules/game_npctrade/npctrade.lua @@ -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 diff --git a/modules/game_npctrade/npctrade.otui b/modules/game_npctrade/npctrade.otui index 91fbc2a8..c9ad6754 100644 --- a/modules/game_npctrade/npctrade.otui +++ b/modules/game_npctrade/npctrade.otui @@ -247,6 +247,7 @@ MainWindow margin-left: 5 margin-top: 5 visible: false + checked: true @onCheckChange: NPCTrade.onShowAllItemsChange() Button