2,875
edits
No edit summary |
No edit summary |
||
Line 1,122: | Line 1,122: | ||
function | local function _buildAstrologyConstellationTable(realmID) | ||
local modTypes = { | local modTypes = { | ||
{ | { | ||
Line 1,149: | Line 1,149: | ||
end | end | ||
) | ) | ||
table.sort(recipes, | table.sort(recipes, | ||
function(a, b) | function(a, b) | ||
Line 1,155: | Line 1,156: | ||
) | ) | ||
-- Determine which mod types are | -- Determine which mod types are used | ||
for _, recipe in ipairs(recipes) do | for _, recipe in ipairs(recipes) do | ||
for _, modType in ipairs(modTypes) do | for _, modType in ipairs(modTypes) do | ||
if not modType.inUse then | if not modType.inUse then | ||
local recipeMods = recipe[modType.modKey] | local recipeMods = recipe[modType.modKey] | ||
if recipeMods and not Shared.tableIsEmpty(recipeMods) then | if recipeMods ~= nil and not Shared.tableIsEmpty(recipeMods) then | ||
modType.inUse = true | modType.inUse = true | ||
end | end | ||
Line 1,167: | Line 1,168: | ||
end | end | ||
local | local html = mw.html.create('table') | ||
html:addClass('wikitable sortable stickyHeader') | |||
-- Header | -- Header rows | ||
local | local headerRow0 = html:tag('tr') | ||
headerRow0:tag('th'):attr('rowspan', '2'):wikitext('Constellation') | |||
headerRow0:tag('th'):attr('rowspan', '2'):wikitext('Level') | |||
headerRow0:tag('th'):attr('rowspan', '2'):wikitext('XP') | |||
headerRow0:tag('th'):attr('rowspan', '2'):wikitext('Skills') | |||
local headerRow1 = html:tag('tr') | |||
local headerRow1 = | |||
for _, modType in ipairs(modTypes) do | for _, modType in ipairs(modTypes) do | ||
if modType.inUse then | if modType.inUse then | ||
headerRow1:tag('th'):attr('colspan', '2'):wikitext(modType.name .. ' Stars') | headerRow1:tag('th'):attr('colspan', '2'):wikitext(modType.name .. ' Stars') | ||
end | end | ||
end | end | ||
-- Data rows | -- Data rows | ||
for | for _, cons in ipairs(recipes) do | ||
local modData = Skills._getConstellationModifiers(cons) | local modData = Skills._getConstellationModifiers(cons) | ||
local name = cons.name | local name = cons.name | ||
local skillIconArray = {} | local skillIconArray = {} | ||
for | for _, skillID in ipairs(cons.skillIDs) do | ||
table.insert(skillIconArray, Icons.Icon({Constants.getSkillName(skillID), type='skill'})) | table.insert(skillIconArray, Icons.Icon({Constants.getSkillName(skillID), type='skill'})) | ||
end | end | ||
Line 1,208: | Line 1,198: | ||
end | end | ||
local row = | local rowSpan = (maxRows > 1 and 'rowspan="' .. maxRows .. '"') or '' | ||
row:tag('td'):attr('rowspan', | |||
local row = html:tag('tr') | |||
row:tag('td'):attr('rowspan', rowSpan):attr('data-sort-value', name):attr('id', name):wikitext(' '):wikitext(Icons.Icon({name, type='constellation', notext=true})) | |||
row:tag('td'):attr('rowspan', rowSpan):wikitext(Icons.Icon({'Mastery', notext=true}) .. ' ' .. Icons.getDLCColumnIcon(cons.id) .. name) | |||
row:tag('td'):attr('rowspan', | row:tag('td'):attr('rowspan', rowSpan):attr('style', 'text-align:right;'):wikitext(cons.level) | ||
row:tag('td'):attr('rowspan', rowSpan):attr('style', 'text-align:right;'):wikitext(cons.baseExperience) | |||
row:tag('td'):attr('rowspan', rowSpan):wikitext(table.concat(skillIconArray, '<br/>')) | |||
row:tag('td'):attr('rowspan', | |||
row:tag('td'):attr('rowspan', | |||
-- | -- Modifier rows | ||
for | for row = 1, maxRows do | ||
for _, modType in ipairs(modTypes) do | for _, modType in ipairs(modTypes) do | ||
if modType.inUse then | if modType.inUse then | ||
local masteryLevel = modType.levels[ | local masteryLevel = modType.levels[row] | ||
local rowModData = modData[modType.modKey][ | local rowModData = modData[modType.modKey][row] | ||
if masteryLevel and rowModData then | local cell = html:tag('td') | ||
if masteryLevel ~= nil and rowModData ~= nil then | |||
cell:attr('style', 'text-align:right;'):wikitext(masteryLevel) | |||
cell:wikitext(Modifiers.getModifiersText(rowModData, false, false, 10)) | |||
else | else | ||
cell:attr('colspan', '2'):addClass('table-na'):wikitext(' ') | |||
end | end | ||
end | end | ||
end | end | ||
html:tag('tr') -- Insert an empty row for styling purposes | |||
end | end | ||
end | end | ||
return tostring(html) | |||
return tostring( | |||
end | end | ||
edits