4,687
edits
(_getPurchaseTable: Fix header row purchase icon) |
(Fixed purchaseContents being hardcoded to GP) |
||
Line 204: | Line 204: | ||
local containArray = {} | local containArray = {} | ||
local GPTotal = 0 | local GPTotal = 0 | ||
local currency = 'melvorD:GP' | |||
if purchase.contains ~= nil then | if purchase.contains ~= nil then | ||
if purchase.contains.items ~= nil and not Shared.tableIsEmpty(purchase.contains.items) then | if purchase.contains.items ~= nil and not Shared.tableIsEmpty(purchase.contains.items) then | ||
Line 214: | Line 215: | ||
local item = Items.getItemByID(itemLine.id) | local item = Items.getItemByID(itemLine.id) | ||
local itemQty = itemLine.quantity | local itemQty = itemLine.quantity | ||
currency = item.sellsForCurrency | |||
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})) | ||
Line 221: | Line 223: | ||
table.insert(containArray, '|-\r\n| class="table-img"| ' .. Icons.Icon({item.name, type='item', notext=true})) | table.insert(containArray, '|-\r\n| class="table-img"| ' .. Icons.Icon({item.name, type='item', notext=true})) | ||
table.insert(containArray, '|data-sort-value="'..item.name..'"|'.. Icons.getExpansionIcon(item.id) .. Icons.Icon({item.name, type='item', noicon=true}) .. '\r\n| data-sort-value="' .. itemQty .. '" style="text-align:right" | ' .. Shared.formatnum(itemQty)) | table.insert(containArray, '|data-sort-value="'..item.name..'"|'.. Icons.getExpansionIcon(item.id) .. Icons.Icon({item.name, type='item', noicon=true}) .. '\r\n| data-sort-value="' .. itemQty .. '" style="text-align:right" | ' .. Shared.formatnum(itemQty)) | ||
table.insert(containArray, '| data-sort-value="' .. GPVal .. '"| ' .. Icons._Currency( | table.insert(containArray, '| data-sort-value="' .. GPVal .. '"| ' .. Icons._Currency(currency, GPVal)) | ||
end | end | ||
end | end | ||
Line 228: | Line 230: | ||
local gloveItem = Items.getItemByID(purchase.contains.itemCharges.id) | local gloveItem = Items.getItemByID(purchase.contains.itemCharges.id) | ||
local chargeQty = purchase.contains.itemCharges.quantity | local chargeQty = purchase.contains.itemCharges.quantity | ||
currency = gloveItem.sellsForCurrency | |||
if gloveItem ~= nil then | if gloveItem ~= nil then | ||
if asList then | if asList then | ||
Line 234: | Line 237: | ||
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" | ' .. Shared.formatnum(chargeQty)) | table.insert(containArray, '| ' .. Icons.Icon({gloveItem.name, type='item', noicon=true}) .. ' Charges\r\n| data-sort-value="' .. chargeQty .. '" style="text-align:right" | ' .. Shared.formatnum(chargeQty)) | ||
table.insert(containArray, '| data-sort-value="0"| ' .. Icons._Currency( | table.insert(containArray, '| data-sort-value="0"| ' .. Icons._Currency(currency, 0)) | ||
end | end | ||
end | end | ||
Line 240: | Line 243: | ||
end | end | ||
if not asList and not Shared.tableIsEmpty(containArray) then | if not asList and not Shared.tableIsEmpty(containArray) then | ||
table.insert(containArray, '|- class="sortbottom"\r\n! colspan="3"| Total\r\n| ' .. Icons._Currency( | table.insert(containArray, '|- class="sortbottom"\r\n! colspan="3"| Total\r\n| ' .. Icons._Currency(currency, GPTotal) .. '\r\n|}') | ||
end | end | ||