2,875
edits
Tag: Undo |
Tag: Undo |
||
Line 1,123: | Line 1,123: | ||
function p._buildAstrologyConstellationTable(realmID) | function p._buildAstrologyConstellationTable(realmID) | ||
local modTypes = { | |||
{ | |||
["name"] = 'Standard', | |||
["modKey"] = 'standardModifiers', | |||
["levels"] = SkillData.Astrology.standardModifierLevels, | |||
["inUse"] = false | |||
}, | |||
{ | |||
["name"] = 'Unique', | |||
["modKey"] = 'uniqueModifiers', | |||
["levels"] = SkillData.Astrology.uniqueModifierLevels, | |||
["inUse"] = false | |||
}, | |||
{ | |||
["name"] = 'Abyssal', | |||
["modKey"] = 'abyssalModifiers', | |||
["levels"] = SkillData.Astrology.abyssalModifierLevels, | |||
["inUse"] = false | |||
}, | |||
} | |||
local recipes = GameData.getEntities(SkillData.Astrology.recipes, | |||
function(cons) | |||
return Skills.getRecipeRealm(cons) == realmID | |||
end | |||
) | |||
table.sort(recipes, | |||
function(a, b) | |||
return Skills.getRecipeLevel('Astrology', a) < Skills.getRecipeLevel('Astrology', b) | |||
end | |||
) | |||
-- Figure out which mod types are to be displayed | |||
for _, recipe in ipairs(recipes) do | |||
for _, modType in ipairs(modTypes) do | |||
if not modType.inUse then | |||
local recipeMods = recipe[modType.modKey] | |||
if recipeMods ~= nil and not Shared.tableIsEmpty(recipeMods) then | |||
modType.inUse = true | |||
end | |||
end | |||
end | |||
end | |||
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') | |||
local repCount = 0 | |||
for _, modType in ipairs(modTypes) do | |||
if modType.inUse then | |||
repCount = repCount + 1 | |||
table.insert(resultPart, '!!colspan="2"| ' .. modType.name .. ' Stars') | |||
end | |||
end | |||
table.insert(resultPart, '\n|- class="headerRow-1"') | |||
table.insert(resultPart, string.rep('\n! ' .. Icons.Icon({'Mastery', notext=true}) .. 'Level\n! Modifiers', repCount)) | |||
for i, cons in ipairs(recipes) do | |||
local modData = Skills._getConstellationModifiers(cons) | |||
local name = cons.name | |||
local skillIconArray = {} | |||
for j, skillID in ipairs(cons.skillIDs) do | |||
table.insert(skillIconArray, Icons.Icon({Constants.getSkillName(skillID), type='skill'})) | |||
end | |||
local maxRows = 1 | |||
for _, modTypeData in pairs(modData) do | |||
maxRows = math.max(maxRows, Shared.tableCount(modTypeData)) | |||
end | |||
local rowSpan = (maxRows > 1 and 'rowspan="' .. maxRows .. '"') or '' | |||
table.insert(resultPart, '\n|-') | |||
table.insert(resultPart, '\n|' .. rowSpan .. ' data-sort-value="' .. name .. '" id="'..name..'"| ') | |||
table.insert(resultPart, Icons.Icon({name, type='constellation', notext=true})) | |||
table.insert(resultPart, '\n|' .. rowSpan .. '| ' .. Icons.getDLCColumnIcon(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) | |||
table.insert(resultPart, '\n|' .. rowSpan .. '| ' .. table.concat(skillIconArray, '<br/>')) | |||
-- Generate table text for modifiers | |||
for row = 1, maxRows, 1 do | |||
for _, modType in ipairs(modTypes) do | |||
if modType.inUse then | |||
local masteryLevel = modType.levels[row] | |||
local rowModData = modData[modType.modKey][row] | |||
if masteryLevel == nil or rowModData == nil then | |||
table.insert(resultPart, '\n|colspan="2" class="table-na"| ') | |||
else | |||
table.insert(resultPart, '\n|style="text-align:right"| ' .. masteryLevel) | |||
table.insert(resultPart, '\n| ' .. Modifiers.getModifiersText(rowModData, false, false, 10)) | |||
end | |||
end | |||
end | |||
if row < maxRows then | |||
table.insert(resultPart, '\n|-') | |||
end | |||
end | |||
end | |||
table.insert(resultPart, '\n|}') | |||
return table.concat(resultPart) | |||
end | end | ||
function p.buildAstrologyConstellationTable(frame) | function p.buildAstrologyConstellationTable(frame) |
edits