17,101
edits
(Update for v1.3) |
(getAncientRelicsTable: Support 'abyssal' parameter, for choosing display of abyssal or non-abyssal relics only) |
||
Line 567: | Line 567: | ||
function p.getAncientRelicsTable(frame) | function p.getAncientRelicsTable(frame) | ||
local | local args = (type(frame) == 'table' and frame.args ~= nil and frame.args) or frame | ||
local skillName, isAbyssalArg = args[1], args.abyssal | |||
local skillID = nil | local skillID = nil | ||
if skillName ~= nil and skillName ~= '' then | if skillName ~= nil and skillName ~= '' then | ||
Line 573: | Line 574: | ||
if skillID == nil then | if skillID == nil then | ||
return Shared.printError('Failed to find a skill ID for ' .. skillName) | return Shared.printError('Failed to find a skill ID for ' .. skillName) | ||
end | |||
end | |||
local isAbyssal = nil | |||
if isAbyssalArg ~= nil and isAbyssalArg ~= '' then | |||
if not Shared.contains({'TRUE', 'FALSE'}, string.upper(isAbyssalArg)) then | |||
return Shared.printError('Invalid value for parameter "abyssal", must be either "true" or "false"') | |||
else | |||
isAbyssal = string.upper(isAbyssalArg) == 'TRUE' | |||
end | end | ||
end | end | ||
Line 583: | Line 592: | ||
local relics = GameData.getEntities('ancientRelics', | local relics = GameData.getEntities('ancientRelics', | ||
function(relic) | function(relic) | ||
return skillID == nil or relic.skillID == skillID | local abyssalCheck = true | ||
if isAbyssal ~= nil then | |||
local relicNS, relicLocalID = Shared.getLocalID(relic.id) | |||
local isRelicAbyssal = string.match(relicLocalID, '^Abyssal') ~= nil | |||
abyssalCheck = (isAbyssal and isRelicAbyssal) or (not isAbyssal and not isRelicAbyssal) | |||
end | |||
return (skillID == nil or relic.skillID == skillID) and abyssalCheck | |||
end) | end) | ||
table.sort(relics, | table.sort(relics, | ||
Line 619: | Line 634: | ||
table.insert(tablePart, '\n|-') | table.insert(tablePart, '\n|-') | ||
end | end | ||
table.insert(tablePart, '\n| ' .. skillRelicCount .. '\n| ' .. | table.insert(tablePart, '\n| ' .. skillRelicCount .. '\n| ' .. Modifiers.getModifiersText(relic.modifiers)) | ||
end | end | ||
appendSkillRows(resultPart, tablePart, skillRelicCount, currentSkillID) | appendSkillRows(resultPart, tablePart, skillRelicCount, currentSkillID) | ||
Line 654: | Line 669: | ||
tr:tag('td'):wikitext(Icons.Icon({relic.name, type='item', size='50', notext=true})) | tr:tag('td'):wikitext(Icons.Icon({relic.name, type='item', size='50', notext=true})) | ||
tr:tag('td'):wikitext(Icons.Icon({relic.name, type='item', noicon=true})) | tr:tag('td'):wikitext(Icons.Icon({relic.name, type='item', noicon=true})) | ||
tr:tag('td'):wikitext( | tr:tag('td'):wikitext(Modifiers.getModifiersText(relic.modifiers)) | ||
resultTable:node(tr) | resultTable:node(tr) | ||
end | end |