Module:KarmaCheck
Jump to navigation
Jump to search
Documentation for this module may be created at Module:KarmaCheck/doc
local p = {}
local cargo = mw.ext.cargo
function p.main(frame)
local karma = cargo.query('Karma', 'Name,Rarity,IconImage1,IconImage2,PortraitImage1,PortraitImage2', {limit=999})
local tbl = mw.html.create('table'):addClass('wikitable')
for k, row in ipairs(karma) do
tbl:tag('tr')
tbl:tag('td'):wikitext(row["Rarity"])
tbl:tag('td'):wikitext('[[:File:' .. row["IconImage1"] .. ']]<br/>[[:File:' .. string.gsub(row["Name"], ':', '') .. ' Base.png]]')
if ( row["Rarity"] == 'N' or row["Rarity"] == 'NH' or row["Rarity"] == 'R' ) then
tbl:tag('td'):wikitext('-')
tbl:tag('td'):wikitext('-')
tbl:tag('td'):wikitext('-')
elseif (row["Rarity"] == 'SP') then
tbl:tag('td'):wikitext('[[:File:' .. row["PortraitImage1"] .. ']]<br/>[[:File:' .. string.gsub(row["Name"], ':', '') .. ' Base Full.png]]')
tbl:tag('td'):wikitext('[[:File:' .. string.gsub(row["Name"], ':', '') .. ' LG1 Full.mp4]]')
tbl:tag('td'):wikitext('[[:File:' .. string.gsub(row["Name"], ':', '') .. ' LG2 Full.mp4]]')
elseif (row["Rarity"] == 'ER') then
tbl:tag('td'):wikitext('[[:File:' .. row["PortraitImage1"] .. ']]<br/>[[:File:' .. string.gsub(row["Name"], ':', '') .. ' Base Full.png]]')
tbl:tag('td'):wikitext('-')
tbl:tag('td'):wikitext('-')
else
tbl:tag('td'):wikitext('[[:File:' .. row["PortraitImage1"] .. ']]<br/>[[:File:' .. string.gsub(row["Name"], ':', '') .. ' Base Full.png]]')
tbl:tag('td'):wikitext('[[:File:' .. row["IconImage2"] .. ']]<br/>[[:File:' .. string.gsub(row["Name"], ':', '') .. ' Evolved.png]]')
tbl:tag('td'):wikitext('[[:File:' .. row["PortraitImage2"] .. ']]<br/>[[:File:' .. string.gsub(row["Name"], ':', '') .. ' Evolved Full.png]]')
end
end
-- now we return a table that prints all the formatted data
return tostring(tbl)
end
return p