17,101
edits
(_buildAstrologyConstellationTable: Temporary fix following change to Skills._buildAstrologyModifierArray until this function's output is modified) |
(_buildAstrologyConstellationTable: Include mastery level requirements against each star/set of modifiers) |
||
Line 641: | Line 641: | ||
function p._buildAstrologyConstellationTable() | function p._buildAstrologyConstellationTable() | ||
local | local resultPart = {} | ||
table.insert(resultPart, '{|class="wikitable sortable stickyHeader"') | |||
table.insert(resultPart, '\n|- class="headerRow-0"') | |||
table.insert(resultPart, '\n!rowspan="2" colspan="2"|Constellation!!rowspan="2"| ' .. Icons.Icon({"Astrology", type='skill', notext='true'}) .. ' Level') | |||
table.insert(resultPart, '!!rowspan="2"| XP!!rowspan="2"| Skills!!colspan="2"| Standard Stars!!colspan="2"| Unique Stars') | |||
table.insert(resultPart, '\n|- class="headerRow-1"') | |||
table.insert(resultPart, string.rep('\n! ' .. Icons.Icon({'Mastery', notext=true}) .. 'Level\n! Modifiers', 2)) | |||
for i, cons in ipairs(SkillData.Astrology.recipes) do | for i, cons in ipairs(SkillData.Astrology.recipes) do | ||
-- Generate the list of modifiers first for the purpose of determining the | |||
-- the number of rows required to display all stars | |||
local modTypes = { 'standard', 'unique' } | |||
local modsRaw = { | |||
["standard"] = Skills._buildAstrologyModifierArray(cons, nil, true, false, false, false), | |||
["unique"] = Skills._buildAstrologyModifierArray(cons, nil, false, true, false, false) | |||
} | |||
-- Building the list of standard & unique modifiers | |||
local mods = {} | |||
local modLevels = {} | |||
local maxRows = 1 | |||
for j, modType in ipairs(modTypes) do | |||
mods[modType] = {} | |||
modLevels[modType] = {} | |||
for k, modifier in ipairs(modsRaw[modType]) do | |||
local masteryLevel = modifier.group | |||
if mods[modType][masteryLevel] == nil then | |||
mods[modType][masteryLevel] = {} | |||
table.insert(modLevels[modType], masteryLevel) | |||
end | |||
local modMagnitude = type(modifier[2]) == 'table' and {modifier[2]} or modifier[2] | |||
table.insert(mods[modType][masteryLevel], Constants._getModifierText(modifier[1], modMagnitude, false)) | |||
end | |||
table.sort(modLevels[modType]) | |||
local typeCount = Shared.tableCount(modLevels[modType]) | |||
if typeCount > maxRows then | |||
maxRows = typeCount | |||
end | |||
end | |||
local name = cons.name | local name = cons.name | ||
local rowSpan = (maxRows > 1 and 'rowspan="' .. maxRows .. '"') or '' | |||
table.insert(resultPart, '\n|-') | |||
table.insert(resultPart, '\n|' .. rowSpan .. ' data-sort-value="' .. name .. '"| ' .. Icons.Icon({name, type='constellation', size='50', notext=true})) | |||
table.insert(resultPart, '\n|' .. rowSpan .. '| ' .. Icons.getExpansionIcon(cons.id) .. name) | |||
table.insert(resultPart, '\n|' .. rowSpan .. ' style="text-align:right"| ' .. cons.level) | |||
table.insert(resultPart, '\n|' .. rowSpan .. ' style="text-align:right"| ' .. cons.baseExperience) | |||
local skillIconArray = {} | local skillIconArray = {} | ||
Line 657: | Line 692: | ||
table.insert(skillIconArray, Icons.Icon({Constants.getSkillName(skillID), type='skill'})) | table.insert(skillIconArray, Icons.Icon({Constants.getSkillName(skillID), type='skill'})) | ||
end | end | ||
table.insert(resultPart, '\n|' .. rowSpan .. '| ' .. table.concat(skillIconArray, '<br/>')) | |||
-- | -- Generate table text for standard & unique modifiers | ||
for row = 1, maxRows, 1 do | |||
local | for j, modType in ipairs(modTypes) do | ||
local masteryLevel = (modLevels[modType] ~= nil and modLevels[modType][row]) or nil | |||
if masteryLevel ~= nil then | |||
table.insert( | table.insert(resultPart, '\n|style="text-align:right"| ' .. masteryLevel) | ||
table.insert(resultPart, '\n| ' .. table.concat(mods[modType][masteryLevel], '<br/>')) | |||
else | |||
table.insert(resultPart, '\n|colspan="2" class="table-na"| ') | |||
end | end | ||
end | end | ||
if row < maxRows then | |||
table.insert(resultPart, '\n|-') | |||
end | |||
if | |||
end | end | ||
end | end | ||
table.insert(resultPart, '\n|}') | |||
return | return table.concat(resultPart) | ||
end | end | ||