Module:Pokemon/Ranger: Difference between revisions

Jump to navigation Jump to search
Capture function now creates a table and shows all user inputs from the call
m (better)
(Capture function now creates a table and shows all user inputs from the call)
Tags: Mobile edit Mobile web edit
Line 9: Line 9:
}
}


local function _capture( args )
local function _capture( args, frame )
    local game = args[1] or 'Pokémon Ranger'
    local monNum = args[2] or '0'
 
    if monNum == '0' then return '' end
 
     local guide = "Pokémon Ranger"
     local guide = "Pokémon Ranger"
    local monData = data[guide][monNum]
local root = mw.html.create( 'table' )
:addClass( 'wikitable mid-table' )
:css( 'text-align', 'center' )


    local row = {
local row = root:tag( 'tr' )
        "|-\n",
row:tag( 'th' ):wikitext( "Pokémon" )
        '| class="t_ranger_wild_img" | ', '[[File:', shortname[ guide ], ' ', monData.name, '.png|40x40px|', monData.name, ']]', '\n',
row:tag( 'th' ):wikitext( "Field Move" )
        '| class="t_ranger_wild_name" | ', monData.name, '\n',
row:tag( 'th' ):wikitext( "Poké Assist" )
        '| ', monData.loops, '\n',
row:tag( 'th' ):wikitext( "Loops" )
        '| ', monData.move, '\n',
        '| ', monData.assist, '\n',
    }


     return table.concat( row )
     local monData = {}
    local rows = ""
    local row = {}
    for i,v in ipairs(args) do
        monData = data[guide][v]     
        row = root:tag( 'tr' )
row:tag( 'td' ):wikitext( "[[File:" .. shortname[ guide ] .. ' ' .. monData.name .. ".png|" .. monData.name .. "]]" .. " " .. frame:expandTemplate{ title = 'bp', args = { monData.name } } )
if monData.move == "None" then
move = "None"
elseif monData.rating == "1" then
move = monData.move
else
move = monData.move .. " " .. monData.rating
end
row:tag( 'td' ):wikitext( "[[File:" .. shortname[ guide ] .. ' ' .. move .. ' ' .. "Icon" .. ".png|" .. move .. "]]")
row:tag( 'td' ):wikitext( monData.assist )
row:tag( 'td' ):wikitext( monData.loops )
end
return tostring( root )
 
end
end


Line 78: Line 92:
     local args = getArgs( frame, { wrappers = 'Template:Pokemon Ranger/Capture row' } )
     local args = getArgs( frame, { wrappers = 'Template:Pokemon Ranger/Capture row' } )
      
      
     return _capture( args )
     return _capture( args, frame )
end
end


return p
return p
4,518

edits

Navigation menu