Jump to navigation
Jump to search
Documentation for this module may be created at Module:Pokemon/Trainer/Documentation
local getArgs = require('Module:Arguments').getArgs
local p = {}
function p.mon( frame )
local args = getArgs( frame, { wrappers = 'Template:Pokemon/Trainer mon' } )
local pokedex = mw.loadJsonData( 'Module:Pokemon/Pokedex.json' )
local game = args[1] or 'RB'
local monNum = args[2] or '001'
local level = args[3] or ''
local gender = args['gender'] or ''
local form = args['form'] and ' ' .. args['form'] or ''
local formText = args['form'] and " (" .. args['form'] .. ")" or ''
local item = args['item'] or ''
local shadow = args['shadow'] or ''
if tonumber(monNum) >= 100 then monNum = tonumber(monNum) end
local monName = pokedex[monNum]
local dexLink = frame:expandTemplate{ title = 'Pokedex', args = { monName } }
if gender == "F" then
gender = "♀"
elseif gender == "M" then
gender = "♂"
end
if item ~= '' then
item = "<br />Held item: ''" .. item .. "''"
end
local entry = {
'[[File:Pokemon ', game, ' ', monName, gender, form, '.png|40x40px|', monName, ']] ',
dexLink, formText, ' Lv. ', level, item
}
local row = mw.html.create('li'):wikitext(table.concat(entry))
return tostring(row)
end
return p