17,370
edits
(_getShopTable: Use game defined order when no custom sort defined) |
(_getShopSkillcapeTable: Fix sorting function & extend to include superior skillcapes) |
||
Line 615: | Line 615: | ||
end | end | ||
function p. | function p._getShopSkillcapeTable(showSuperior) | ||
local capeList = p.getPurchases(function(purch) return purch.category == | local categoryID = (showSuperior and 'melvorTotH:SuperiorSkillcapes') or 'melvorD:Skillcapes' | ||
local sortOrderFunc = function(a, b) | local capeList = p.getPurchases(function(purch) return purch.category == categoryID end) | ||
local sortOrderFunc = | |||
function(a, b) | |||
local costA, costB = p._getPurchaseSortValue(a), p._getPurchaseSortValue(b) | |||
if costA == costB then | |||
return p._getPurchaseName(a) < p._getPurchaseName(b) | |||
else | |||
return costA < costB | |||
end | |||
end | |||
return p._getShopTable(capeList, { | return p._getShopTable(capeList, { | ||
columns = { 'Purchase', 'Description', 'Cost' }, | columns = { 'Purchase', 'Description', 'Cost' }, | ||
Line 630: | Line 633: | ||
headerProps = {["Purchase"] = 'colspan="2" style="width:200px;"', ["Cost"] = 'style=width:120px;'} | headerProps = {["Purchase"] = 'colspan="2" style="width:200px;"', ["Cost"] = 'style=width:120px;'} | ||
}) | }) | ||
end | |||
function p.getShopSkillcapeTable(frame) | |||
local capeCategory = frame.args ~= nil and frame.args[1] or frame | |||
local showSuperior = string.lower(capeCategory) == 'superior' | |||
return p._getShopSkillcapeTable(showSuperior) | |||
end | end | ||