Anonymous

Module:Skills/Summoning: Difference between revisions

From Melvor Idle
no edit summary
(Default icon size)
No edit summary
Line 299: Line 299:
end
end


local resultPart = {}
local html = mw.html.create('table')
table.insert(resultPart, '{| class="wikitable sortable stickyHeader"')
:addClass('wikitable, sortable, stickyHeader')
  table.insert(resultPart, '\r\n|- class="headerRow-0"')
table.insert(resultPart, '\r\n!colspan="2"|Familiar 1!!colspan="2"|Familiar 2!!Effect')
html:tag('tr'):addClass('headerRow-0')
:tag('th'):wikitext('Familiar 1')
  :attr('colspan', 2)
:tag('th'):wikitext('Familiar 2')
  :attr('colspan', 2)
:tag('th'):wikitext('DLC')
:tag('th'):wikitext('Effect')


for i, rowItem in ipairs(rowArray) do
for i, rowItem in ipairs(rowArray) do
table.insert(resultPart, '\r\n|-')
local DLCIcon = Icons.getExpansionIcon(rowItem.FamID1)
    table.insert(resultPart, '\r\n|data-sort-value="'..rowItem.Fam1..'"|'..Icons.Icon({rowItem.Fam1, type='item', notext=true}))
local row = html:tag('tr')
table.insert(resultPart, '||' .. Icons.getExpansionIcon(rowItem.FamID1) .. Icons.Icon({rowItem.Fam1, type='item', noicon=true}))
row:tag('td'):wikitext(Icons.Icon({rowItem.Fam1, type='item', notext=true}))
:attr('data-sort-value', rowItem.Fam1)
row:tag('td'):wikitext(Icons.Icon({rowItem.Fam1, type='item', noicon=true}))
if rowItem.Fam2 ~= nil then
if rowItem.Fam2 ~= nil then
table.insert(resultPart, '||data-sort-value="'..rowItem.Fam2..'"|'..Icons.Icon({rowItem.Fam2, type='item', notext=true}))
-- If Fam1 has no DLC, try setting it for Fam2
table.insert(resultPart, '||' .. Icons.getExpansionIcon(rowItem.FamID2) .. Icons.Icon({rowItem.Fam2, type='item', noicon=true}))
if DLCIcon == nil or DLCIcon == '' then
DLCIcon = Icons.getExpansionIcon(rowItem.FamID2)
end
row:tag('td'):wikitext(Icons.Icon({rowItem.Fam2, type='item', notext=true}))
:attr('data-sort-value', rowItem.Fam2)
row:tag('td'):wikitext(Icons.Icon({rowItem.Fam2, type='item', noicon=true}))
else
else
table.insert(resultPart, '|| || ')
row:tag('td'):tag('td')
end
end
table.insert(resultPart, '||'..(rowItem.Descrip or ' '))
 
-- If both familiars have no DLC, default to melvor icon.
if DLCIcon == nil or DLCIcon == '' then
DLCIcon = Icons.Melvor()
end
-- As of 06/07/2024, no synergies exist that use two DLCs
row:tag('td'):wikitext(DLCIcon)
:css('text-align', 'center')
 
row:tag('td'):wikitext(rowItem.Descrip or ' ')
end
end
return tostring(html)


table.insert(resultPart, '\r\n|}')
return table.concat(resultPart)
end
end


2,875

edits