Module:Pets: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 232: Line 232:
return result
return result
end
end
local mw = require('mw')
local p = {}


function p.getPetPageTable()
function p.getPetPageTable()
local result = ''
    local html = mw.html.create('table')
        :addClass('wikitable sortable lighttable stickyHeader')


result = '{|class="wikitable sortable lighttable stickyHeader"'
    html:tag('tr'):addClass('headerRow-0')
result = result..'\r\n|- class="headerRow-0"\r\n! colspan="2"| Pet !! Acquired From !! Effect'
        :tag('th'):attr('colspan', '2')
          :wikitext('Pet')
        :tag('th'):wikitext('Acquired From')
        :tag('th'):wikitext('Effect')


for i, thisPet in ipairs(GameData.rawData.pets) do
    for i, thisPet in ipairs(GameData.rawData.pets) do
result = result..'\r\n|-\r\n|class="table-img" data-sort-value="' .. thisPet.name .. '"| ' .. Icons.Icon({thisPet.name, size='60', type='pet', notext=true})
        html:tag('tr')
result = result..'||' .. Icons.getExpansionIcon(thisPet.id) ..Icons.Icon({thisPet.name, type='pet', noicon=true})
            :tag('td'):addClass('table-img')
result = result..'||'..p._getPetSourceText(thisPet)
                  :attr('data-sort-value', thisPet.name)
result = result..'||'..p._getPetEffect(thisPet)
                      :wikitext(Icons.Icon({thisPet.name, size='60', type='pet', notext=true}))
end
            :tag('td'):wikitext(Icons.getExpansionIcon(thisPet.id) .. Icons.Icon({thisPet.name, type='pet', noicon=true}))
result = result..'\r\n|}'
            :tag('td'):wikitext(p._getPetSourceText(thisPet))
            :tag('td'):wikitext(p._getPetEffect(thisPet))
    end


return result
    return tostring(html)
end
end


2,875

edits