Module:Pokemon/Trainer

local getArgs = require('Module:Arguments').getArgs

local p = {} local game function p.row ( frame ) local args = getArgs( frame, {wrappers = 'Template:Pokemon/Trainer row'} ) game = frame:getParent.args[1] or 'red' local trainerClass1 = frame:getParent.args[2] local trainerName1 = frame:getParent.args[3] local rowNum = frame:getParent.args[4] or 1 local reward = frame:getParent.args[5] or 0 local trainerClass2 = frame:getParent.args[6] local trainerName2 = frame:getParent.args[7] if tonumber(rowNum) > 6 then rowNum = 6 end local row = {} if trainerClass2 or trainerName2 then row={ "|-\n", '| rowspan="', rowNum, '" class="th_pkmn_trainer_row" | ', trainerClass1, trainerName1,  'OR ', ' ', trainerClass2, ' ', trainerName2 ' Reward: ', reward }	else row={ "|-\n", '| rowspan="', rowNum, '" class="th_pkmn_trainer_row" | ', ' ', trainerClass1, ' ', trainerName1, ' Reward: ', reward }	end end function p.pokemon( frame ) args = getArgs( frame {wrappers = 'Template:Pokemon/Trainer pokemon'} ) game = frame:getParent.args[1] or 'red' local monNum = frame:getParent.args[2] or '001' local gender = frame:getParent.args[3] or 'M'	local level = frame:getParent.args[4] local item = frame:getParent.args[5] or '' local shadow = frame:getParent.args[6] or '' local forms = frame:getParent.args['form'] local bp = frame:getParent.args['bp']

local pokedex = mw.loadJsonData( 'Module:Pokemon/Pokedex.json' )

if tonumber(monNum) >= 100 then monNum = tonumber(monNum) end local monName = pokedex[monNum] local bpLink = monName local entry = {} if bp then bpLink = frame:expandTemplate{ title = 'bp', args = { monName } } end if forms then if gender == "F" then entry = {' ', monName ' Lv. ', level }   else entry = {' ', monName, ' Lv. ', level }	end else if gender == "F" then entry = {' ', monName, ' Lv. ', level }   else entry = {' ', monName, ' Lv. ', level }	end end local item = mw.html.create('li'):wikitext(table.concat(entry)) return tostring(item) end

return p