Module:Magic/Sandbox: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 632: Line 632:
:addClass('wikitable, sortable, stickyHeader')
:addClass('wikitable, sortable, stickyHeader')
local header = html.tag('tr')
local header = html:tag('tr')
header.tag('th'):wikitext('Spell')
header:tag('th'):wikitext('Spell')
:attr('colspan', 2)
:attr('colspan', 2)


if includeTypeColumn then
if includeTypeColumn then
header.tag('th'):wikitext('Spellbook')
header:tag('th'):wikitext('Spellbook')
end
end
header.tag('th'):wikitext('Requirements')
header:tag('th'):wikitext('Requirements')
header.tag('th'):wikitext('[[DLC]]')
header:tag('th'):wikitext('[[DLC]]')


if includeDamage then
if includeDamage then
header.tag('th'):wikitext('Spell Dmg')
header:tag('th'):wikitext('Spell Dmg')
end
end
header.tag('th'):wikitext('Description')
header:tag('th'):wikitext('Description')
--table.insert(resultPart, 'style="width:275px"| Description')
--table.insert(resultPart, 'style="width:275px"| Description')
if includeExperience then
if includeExperience then
header.tag('th'):wikitext('XP')
header:tag('th'):wikitext('XP')
end
end
header.tag('th'):wikitext('Runes')
header:tag('th'):wikitext('Runes')
:css('min-width', '90px')
:css('min-width', '90px')


if includeItems then
if includeItems then
header.tag('th'):wikitext('Item Cost')
header:tag('th'):wikitext('Item Cost')
end
end


Line 662: Line 662:
for i, spell in ipairs(spellListSorted) do
for i, spell in ipairs(spellListSorted) do
local spellBook = p.getSpellBookFromSpell(spell)
local spellBook = p.getSpellBookFromSpell(spell)
local row = html.tag('tr')
local row = html:tag('tr')
row.tag('td'):wikitext(Icons.Icon({spell.name, type=spellBook.imgType, notext=true}))
row:tag('td'):wikitext(Icons.Icon({spell.name, type=spellBook.imgType, notext=true}))
:css('text-align', 'center')
:css('text-align', 'center')
:attr('data-sort-value', spell.name)
:attr('data-sort-value', spell.name)
row.tag('td'):wikitext(Icons.Icon({spell.name, type=spellBook.imgType, noicon=true}))
row:tag('td'):wikitext(Icons.Icon({spell.name, type=spellBook.imgType, noicon=true}))


if includeTypeColumn then
if includeTypeColumn then
row.tag('td'):wikitext(p.getSpellTypeLink(spellBook.id))
row:tag('td'):wikitext(p.getSpellTypeLink(spellBook.id))
:attr('data-sort-value', spellBook.id)
:attr('data-sort-value', spellBook.id)
end
end
row.tag('td'):wikitext(Icons.getDLCColumnIcon(spell.id))
row:tag('td'):wikitext(Icons.getDLCColumnIcon(spell.id))
:attr('data-sort-value', Icons.getExpansionID(spell.id))
:attr('data-sort-value', Icons.getExpansionID(spell.id))
:css('text-align', 'center')
:css('text-align', 'center')
row.tag('td'):wikitext(p._getSpellRequirements(spell))
row:tag('td'):wikitext(p._getSpellRequirements(spell))
    :attr('data-sort-value', spell.level)
    :attr('data-sort-value', spell.level)


Line 682: Line 682:
local dmg = p._getSpellStat(spell, 'spellDamage')
local dmg = p._getSpellStat(spell, 'spellDamage')
if dmg > 0 then
if dmg > 0 then
row.tag('td'):wikitext(dmg)
row:tag('td'):wikitext(dmg)
:css('text-align', 'right')
:css('text-align', 'right')
else
else
row.tag('td'):wikitext('N/A')
row:tag('td'):wikitext('N/A')
:addClass('table-na')
:addClass('table-na')
end
end
Line 691: Line 691:
--8/20/21: Changed to just getting the spell's description outright
--8/20/21: Changed to just getting the spell's description outright
row.tag('td'):wikitext(p._getSpellStat(spell, 'description'))
row:tag('td'):wikitext(p._getSpellStat(spell, 'description'))


--1/4/22: haha just kidding. Now we're also getting delay between attacks for spells with special attacks
--1/4/22: haha just kidding. Now we're also getting delay between attacks for spells with special attacks
Line 706: Line 706:
end
end
table.insert(intervalTable, ')')
table.insert(intervalTable, ')')
row.tag('td'):wikitext(table.concat(intervalTable))
row:tag('td'):wikitext(table.concat(intervalTable))
end
end
end
end
Line 712: Line 712:
local xp = spell.baseExperience
local xp = spell.baseExperience
if xp == nil or xp == 0 then
if xp == nil or xp == 0 then
row.tag('td'):wikitext('N/A')
row:tag('td'):wikitext('N/A')
:addClass('table-na')
:addClass('table-na')
else
else
row.tag('td'):wikitext(xp)
row:tag('td'):wikitext(xp)
:addClass('text-align', 'right')
:addClass('text-align', 'right')
end
end
end
end
row.tag('td'):wikitext(p._getSpellRunes(spell))
row:tag('td'):wikitext(p._getSpellRunes(spell))
:css('text-align', 'center')
:css('text-align', 'center')
if includeItems then
if includeItems then
row.tag('td'):wikitext(p._getSpellItems(spell))
row:tag('td'):wikitext(p._getSpellItems(spell))
        :css('text-align', 'center')
        :css('text-align', 'center')
end
end
2,875

edits