Module:Pokemon/Fishing

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

local p = {}

function p.row( frame ) local args = getArgs( frame, { wrappers = 'Template:Pokemon/Fishing row' } ) local pokedex = mw.loadJsonData( 'Module:Pokemon/Pokedex.json' ) local game = args[1] or 'red' local monNum = args[2] or '001' local level = args[3] or 'n/a' local rates = {}

for i = 1, 3 do		rates[i] = args[3 + i] or '' if rates[i] == '' or rates[i] == '0' then rates[i] = '-' else rates[i] = rates[i] .. "%"		end end if tonumber(monNum) >= 100 then monNum = tonumber(monNum) end local monName = pokedex[monNum] local bpLink = monName

if args['bp'] then bpLink = frame:expandTemplate{ title = 'bp', args = { monName } } end local row = { "|-\n", '| class="t_pkmn_wild_img" data-sort-value="', monNum, '" | ', '', '\n', '| class="t_pkmn_wild_name" | ', bpLink, '\n', '| ', level, '\n', '| ', table.concat(rates, ' || ') }

return table.concat( row ) end

return p