Module:Pets: Difference between revisions

Add expansion icon as dlc column to pet table
(Update for v1.3)
(Add expansion icon as dlc column to pet table)
Line 163: Line 163:
end
end


local resultPart = {}
local html = mw.html.create('table')
table.insert(resultPart, '{| class="wikitable"\r\n!Pet!!Name!!Effect')
:addClass('wikitable')
html:tag('tr')
:tag('th'):wikitext('Pet')
:tag('th'):wikitext('Name')
:tag('th'):wikitext('[[DLC]]')
:tag('th'):wikitext('Effect')


for i, pet in ipairs(pets) do
for i, pet in ipairs(pets) do
table.insert(resultPart, '|-')
html:tag('tr')
table.insert(resultPart, '|style="text-align: center;"|' .. Icons.Icon({pet.name, type='pet', size=60, notext=true}))
:tag('td'):wikitext(Icons.Icon({pet.name, type='pet', notext=true}))
table.insert(resultPart, '|' .. Icons.getExpansionIcon(pet.id) .. Icons.Icon({pet.name, type='pet', noicon=true}))
  :css('text-align', 'center')
table.insert(resultPart, '| ' .. p._getPetEffect(pet))
:tag('td'):wikitext('[[' .. pet.name .. ']]')
:tag('td'):wikitext(Icons.getExpansionIcon(pet.id))
:tag('td'):wikitext(p._getPetEffect(pet))
end
end
table.insert(resultPart, '|}')
 
return tostring(html)
return table.concat(resultPart, '\r\n')
end
end


Line 182: Line 189:


if skillID == nil then
if skillID == nil then
return ''
error("SkillID not found for skill: " .. skillName)
else
else
local pets = p.getPets(function(pet) return p._getPetSkill(pet) == skillID end)
local pets = p.getPets(function(pet) return p._getPetSkill(pet) == skillID end)
2,875

edits