Anonymous

Module:Sandbox/Shop: Difference between revisions

From Melvor Idle
no edit summary
No edit summary
No edit summary
Line 201: Line 201:
end
end


function p._getPurchaseContents(purchase, asList)
function p._getPurchaseContents(purchase, asList, notext)
if asList == nil then asList = true end
if asList == nil then asList = true end
local containArray = {}
local containArray = {}
Line 217: Line 217:
local itemQty = itemLine.quantity
local itemQty = itemLine.quantity
if asList then
if asList then
table.insert(containArray, Icons.Icon({item.name, type='item', qty=itemQty}))
table.insert(containArray, Icons.Icon({item.name, type='item', qty=itemQty, notext=notext}))
else
else
if item.sellsForCurrency ~= nil then
if item.sellsForCurrency ~= nil then
Line 571: Line 571:
local namespace, localID = Shared.getLocalID(purchase.id)
local namespace, localID = Shared.getLocalID(purchase.id)
local source = nil
local source = nil
local outputs = nil
local showText = false


if purchase.contains.items ~= nil and Shared.tableCount(purchase.contains.items) > 1 then
if purchase.contains.items ~= nil and Shared.tableCount(purchase.contains.items) > 1 then
source = p._getPurchaseExpansionIcon(purchase) .. Common.getPurchaseIcon({purchase})
source = p._getPurchaseExpansionIcon(purchase) .. Common.getPurchaseIcon({purchase})
-- If there's > 1 item then always show the item's icon text
showText = true
outputs = p._getPurchaseContents(purchase, true)
else
else
source = Icons.Icon({'Shop'}) .. ' Purchase'
source = Icons.Icon({'Shop'}) .. ' Purchase'
Line 585: Line 584:
['isAbyssal'] = namespace == 'melvorItA',
['isAbyssal'] = namespace == 'melvorItA',
['costs'] = p.getCostString(purchase.cost, false),
['costs'] = p.getCostString(purchase.cost, false),
['qty'] = outputs,
['qty'] = p._getPurchaseContents(purchase, true, true),
['source'] = source,
['source'] = source,
['showText'] = showText
})
})
end
end