17,097
edits
(getAutoEatTable: Initial implementation; getPurchases: Pass category to check function) |
(getShopSkillcapeTable: Rework to generate from shop data) |
||
Line 260: | Line 260: | ||
function p.getShopSkillcapeTable() | function p.getShopSkillcapeTable() | ||
local | local resultPart = {} | ||
local capeList = | local capeList = p.getPurchases(function(cat, purch) return cat == 'Skillcapes' end) | ||
table.insert(resultPart, '{|class="wikitable sortable stickyHeader"') | |||
table.insert(resultPart, '|- class="headerRow-0"') | |||
table.insert(resultPart, '!colspan="2" style="width:200px"|Cape!!Description!!style="width:120px"|Price') | |||
--Sort the table by cost and then name | --Sort the table by cost and then name | ||
table.sort(capeList, function(a, b) | table.sort(capeList, function(a, b) | ||
if a. | if a.cost.gp == b.cost.gp then | ||
return a.name < b.name | return a.name < b.name | ||
else | else | ||
return a. | return a.cost.gp < b.cost.gp | ||
end | end | ||
end) | end) | ||
for i, thisItem in | for i, thisItem in ipairs(capeList) do | ||
local sortValue = p._getPurchaseSortValue(thisItem) | |||
table.insert(resultPart, '|-\r\n|style="min-width:25px; text-align:center;"| ' .. Icons.Icon({thisItem.name, type='item', size=50, notext=true})) | |||
table.insert(resultPart, '| [[' .. thisItem.name .. ']]') | |||
table.insert(resultPart, '| ' .. thisItem.description) | |||
table.insert(resultPart, '|style="text-align:right;" data-sort-value="' .. sortValue .. '"| ' .. p.getCostString(thisItem.cost)) | |||
end | end | ||
table.insert(resultPart, '|}') | |||
return | return table.concat(resultPart, '\r\n') | ||
end | end | ||