16,999
edits
(Fix various issues) |
(getSkillcapeNavbox: Add superior capes) |
||
Line 260: | Line 260: | ||
function p.getSkillcapeNavbox(frame) | function p.getSkillcapeNavbox(frame) | ||
local capeList = Shop.getPurchases(function(purch) return purch.category == 'melvorD:Skillcapes' end) | local capeList = { | ||
["Normal"] = Shop.getPurchases(function(purch) return purch.category == 'melvorD:Skillcapes' end), | |||
["Superior"] = Shop.getPurchases(function(purch) return purch.category == 'melvorTotH:SuperiorSkillcapes' end) | |||
} | |||
local capeNames = {} | local capeNames = {} | ||
for i, cape in ipairs( | for catName, subList in pairs(capeList) do | ||
for i, cape in ipairs(subList) do | |||
capeNames[cape.id] = Shop._getPurchaseName(cape) | |||
end | |||
table.sort(capeList[catName], function(a, b) | |||
local costA, costB = Shop._getPurchaseSortValue(a), Shop._getPurchaseSortValue(b) | |||
if costA == costB then | |||
return capeNames[a.id] < capeNames[b.id] | |||
else | |||
return costA < costB | |||
end | |||
end) | |||
end | end | ||
local capeText = {} | local capeText = {} | ||
Line 283: | Line 288: | ||
local resultPart = {} | local resultPart = {} | ||
table.insert(resultPart, '{| class="wikitable navigation-not-searchable" style="margin:auto; clear:both; width: 100%"') | table.insert(resultPart, '{| class="wikitable navigation-not-searchable" style="margin:auto; clear:both; width: 100%"') | ||
table.insert(resultPart, '\r\n!' .. Icons.Icon({'Skillcapes', type='item', img='Cape of Completion'})) | table.insert(resultPart, '\r\n!colspan="2"| ' .. Icons.Icon({'Skillcapes', type='item', img='Cape of Completion'})) | ||
table.insert(resultPart, '\r\n|-\r\n|style="text-align:center;"|'..table.concat(capeText, ' • ')) | for catName, subList in pairs(capeList) do | ||
local capeText = {} | |||
table.insert(resultPart, '\r\n|-\r\n!style="text-align:center;"| ' .. catName) | |||
for i, cape in ipairs(subList) do | |||
table.insert(capeText, Icons.Icon({capeNames[cape.id], type='item'})) | |||
end | |||
table.insert(resultPart, '\r\n|style="text-align:center;"| ' .. table.concat(capeText, ' • ')) | |||
end | |||
table.insert(resultPart, '\r\n|}') | table.insert(resultPart, '\r\n|}') | ||
Line 290: | Line 302: | ||
end | end | ||
function p.getSpellNavbox(frame) | function p.getSpellNavbox(frame) | ||
local spellTable = {} | local spellTable = {} |