Module:Skills: Difference between revisions

getAncientRelicsTable: Finish implementing this (accidentally committed too soon previously)
(mw.log(p.getAncientRelicsTable({args={}})))
(getAncientRelicsTable: Finish implementing this (accidentally committed too soon previously))
Line 494: Line 494:
local skillName = frame.args ~= nil and frame.args[1] or frame
local skillName = frame.args ~= nil and frame.args[1] or frame
local skillID = nil
local skillID = nil
if skillName ~= nil then
if skillName ~= nil and skillName ~= '' then
skillID = Constants.getSkillID(skillName)
skillID = Constants.getSkillID(skillName)
if skillID == nil then
if skillID == nil then
Line 502: Line 502:


local resultPart = {}
local resultPart = {}
table.insert(resultPart, '{| class="wikitable sortable stickyHeader"')
table.insert(resultPart, '{| class="wikitable sortable stickyHeader lighttable"')
table.insert(resultPart, '\n|-class="headerRow-0"')
table.insert(resultPart, '\n|-class="headerRow-0"')
table.insert(resultPart, '\n|-\n!colspan="2"|Skill\n!Relic\n!Modifiers')
table.insert(resultPart, '\n|-\n!colspan="2"|Skill\n!Relic\n!Modifiers')


local relics = GameData.getEntites('ancientRelics',
local relics = GameData.getEntities('ancientRelics',
function(relic)
function(relic)
return skillID == nil or relic.skillID == skillID
return skillID == nil or relic.skillID == skillID
Line 522: Line 522:
local function appendSkillRows(resultTable, rowTable, relicCount, skillID)
local function appendSkillRows(resultTable, rowTable, relicCount, skillID)
local skillName = Constants.getSkillName(skillID)
local skillName = Constants.getSkillName(skillID)
table.insert(resultTable, '\n|-\n|rowpsan="' .. relicCount .. '"| ' .. Icons.Icon({skillName, type='skill', notext=true, size=50}))
table.insert(resultTable, '\n|-\n|rowspan="' .. relicCount .. '"| ' .. Icons.Icon({skillName, type='skill', notext=true, size=50}))
table.insert(resultTable, '\n|rowpsan="' .. relicCount .. '"| ' .. Icons.Icon({skillName, type='skill', noicon=true}))
table.insert(resultTable, '\n|rowspan="' .. relicCount .. '"| ' .. Icons.Icon({skillName, type='skill', noicon=true}))
table.insert(resultTable, table.concat(rowTable))
table.insert(resultTable, table.concat(rowTable))
end
end
Line 538: Line 538:
end
end


skillRelicCount = relic.number
skillRelicCount = skillRelicCount + 1
table.insert(tablePart, '\n|-\n| ' .. skillRelicCount .. '\n| ' .. Constants.getModifiersText(relic.modifiers))
if skillRelicCount > 1 then
table.insert(tablePart, '\n|-')
end
table.insert(tablePart, '\n| ' .. skillRelicCount .. '\n| ' .. Constants.getModifiersText(relic.modifiers))
end
end
appendSkillRows(resultPart, tablePart, skillRelicCount, currentSkillID)
appendSkillRows(resultPart, tablePart, skillRelicCount, currentSkillID)