463
edits
(getAncientRelicsTable: Finish implementing this (accidentally committed too soon previously)) |
(Adjusted the appearance of the Lesser Relics table) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 514: | Line 514: | ||
local skillNameA, skillNameB = Constants.getSkillName(a.skillID), Constants.getSkillName(b.skillID) | local skillNameA, skillNameB = Constants.getSkillName(a.skillID), Constants.getSkillName(b.skillID) | ||
if skillNameA == skillNameB then | if skillNameA == skillNameB then | ||
return a. | -- Order by numbers at the end of relic IDs | ||
-- Relics have a 'number' property, but this appears to contain duplicates | |||
return string.sub(a.id, string.len(a.id)) < string.sub(b.id, string.len(b.id)) | |||
else | else | ||
return skillNameA < skillNameB | return skillNameA < skillNameB | ||
Line 548: | Line 550: | ||
return table.concat(resultPart) | return table.concat(resultPart) | ||
end | |||
function p.getLesserRelicsTable(frame) | |||
local lesserRelics = {} | |||
-- Iterate over each skill with a global rare drop then check | |||
-- if the skill has a Lesser Relic drop | |||
for skillLocalID, skill in pairs(SkillData) do | |||
if skill.rareDrops ~= nil then | |||
for i, drops in pairs(skill.rareDrops) do | |||
if string.match(drops.itemID, '_Lesser_Relic') then | |||
table.insert(lesserRelics, Items.getItemByID(drops.itemID)) | |||
end | |||
end | |||
end | |||
end | |||
table.sort(lesserRelics, function(a, b) return a.name < b.name end) | |||
-- Create the Table | |||
local resultTable = mw.html.create('table') | |||
resultTable:addClass('wikitable sortable') | |||
resultTable:tag('tr'):addClass('headerRow-0') | |||
:tag('th'):wikitext('Icon') | |||
:tag('th'):wikitext('Lesser Relic') | |||
:tag('th'):wikitext('Modifiers') | |||
for _, relic in ipairs(lesserRelics) do | |||
local tr = mw.html.create('tr') | |||
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(Constants.getModifiersText(relic.modifiers)) | |||
resultTable:node(tr) | |||
end | |||
return resultTable | |||
end | end | ||
return p | return p |
edits