Anonymous

Module:Sandbox/Shop: Difference between revisions

From Melvor Idle
no edit summary
mNo 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 216: Line 216:
local item = Items.getItemByID(itemLine.id)
local item = Items.getItemByID(itemLine.id)
local itemQty = itemLine.quantity
local itemQty = itemLine.quantity
if item.sellsForCurrency ~= nil then
currency = item.sellsForCurrency
end
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
currency = item.sellsForCurrency
end
local GPVal = item.sellsFor * itemQty
local GPVal = item.sellsFor * itemQty
GPTotal = GPTotal + GPVal
GPTotal = GPTotal + GPVal
Line 234: Line 234:
local chargeQty = purchase.contains.itemCharges.quantity
local chargeQty = purchase.contains.itemCharges.quantity
if gloveItem ~= nil then
if gloveItem ~= nil then
if gloveItem.sellsForCurrency ~= nil then
currency = gloveItem.sellsForCurrency
end
if asList then
if asList then
table.insert(containArray, ' +'..Num.formatnum(chargeQty)..' '..Icons.Icon({gloveItem.name, type='item'})..' Charges')
table.insert(containArray, ' +'..Num.formatnum(chargeQty)..' '..Icons.Icon({gloveItem.name, type='item'})..' Charges')
else
else
if gloveItem.sellsForCurrency ~= nil then
currency = gloveItem.sellsForCurrency
end
table.insert(containArray, '|-\r\n| class="table-img"| ' .. Icons.Icon({gloveItem.name, type='item', notext=true}))
table.insert(containArray, '|-\r\n| class="table-img"| ' .. Icons.Icon({gloveItem.name, type='item', notext=true}))
table.insert(containArray, '| ' .. Icons.Icon({gloveItem.name, type='item', noicon=true}) .. ' Charges\r\n| data-sort-value="' .. chargeQty .. '" style="text-align:right" | ' .. Num.formatnum(chargeQty))
table.insert(containArray, '| ' .. Icons.Icon({gloveItem.name, type='item', noicon=true}) .. ' Charges\r\n| data-sort-value="' .. chargeQty .. '" style="text-align:right" | ' .. Num.formatnum(chargeQty))
Line 582: Line 582:
['isAbyssal'] = namespace == 'melvorItA',
['isAbyssal'] = namespace == 'melvorItA',
['costs'] = p.getCostString(purchase.cost, false),
['costs'] = p.getCostString(purchase.cost, false),
['qty'] = p._getPurchaseContents(purchase, true),
['qty'] = p._getPurchaseContents(purchase, true, true),
['source'] = source,
['source'] = source,
})
})