Jump to navigation
Jump to search
(Got rid of bp parameter to use Pokedex template) Tags: Reverted Mobile edit Mobile web edit |
(Need to fix other all Pokédex pages before implementing this) Tag: Undo |
||
Line 29: | Line 29: | ||
if tonumber(monNum) >= 100 then monNum = tonumber(monNum) end | if tonumber(monNum) >= 100 then monNum = tonumber(monNum) end | ||
local monName = pokedex[monNum] | local monName = pokedex[monNum] | ||
local | local bpLink = monName | ||
if args['bp'] then | |||
bpLink = frame:expandTemplate{ title = 'bp', args = { monName } } | |||
end | |||
local row = { | local row = { | ||
"|-\n", | "|-\n", | ||
'| class="t_pkmn_wild_img" data-sort-value="', monNum, '" | ', '[[File:Pokemon ', game, ' ', monName, '.png|40x40px|', monName, ']]', '\n', | '| class="t_pkmn_wild_img" data-sort-value="', monNum, '" | ', '[[File:Pokemon ', game, ' ', monName, '.png|40x40px|', monName, ']]', '\n', | ||
'| class="t_pkmn_wild_name" | ', | '| class="t_pkmn_wild_name" | ', bpLink, '\n', | ||
'| ', level, '\n', | '| ', level, '\n', | ||
'| ', table.concat(rates, ' || ') | '| ', table.concat(rates, ' || ') |
Latest revision as of 16:33, 20 April 2024
Documentation for this module may be created at Module:Pokemon/Fishing/Documentation
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 '0'
local level = args[3] or 'n/a'
local rates = {}
if monNum == '0' then
return '|- class="t_pkmn_wild_blank sortbottom"\n| colspan="6" | \n'
end
for i = 1, 3 do
rates[i] = args[3 + i] or ''
if rates[i] == '' then
rates[i] = nil
elseif 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, '" | ', '[[File:Pokemon ', game, ' ', monName, '.png|40x40px|', monName, ']]', '\n',
'| class="t_pkmn_wild_name" | ', bpLink, '\n',
'| ', level, '\n',
'| ', table.concat(rates, ' || ')
}
return table.concat( row )
end
return p