FANDOM


local pokedex = {}
local getArgs = getArgs or require( 'Module:Arguments' ).getArgs
local dex = dex or mw.loadData( 'Module:Pokedex/Data' )
local dexSize = dexSize or dex.size
local dexData = dexData or dex.data
local forms = forms or mw.loadData( 'Module:Pokedex/Forms' )
 
-- [[틀:번2포]]
function pokedex.getName ( index )
    return dexData[index] or '없는 번호입니다.'
end
 
-- [[틀:포번앞]]
function pokedex.getPrevIndex ( index )
    local currentIndex = tonumber( index )
    local prevIndex = ( currentIndex > 1 ) and ( currentIndex - 1 ) or dexSize
    return string.format( '%03d', prevIndex )
end
 
-- [[틀:포번뒤]]
function pokedex.getNextIndex ( index )
    local currentIndex = tonumber( index )
    local nextIndex = ( currentIndex < dexSize ) and ( currentIndex + 1 ) or 1
    return string.format( '%03d', nextIndex )
end
 
-- [[틀:폼문자]]
function pokedex.getFormLetter ( name )
    local ret = forms[name] and forms[name][2] or '없는 폼입니다.'
    return ret
end
 
-- [[틀:폼이름]]
function pokedex.getFormName ( name )
    local ret = forms[name] and forms[name][1] or '없는 폼입니다.'
    return ret
end
 
function pokedex.main( frame )
    local args = getArgs( frame )
    local requested = args['request']
    local result = pokedex[requested] and pokedex[requested]( args[1] )
 
    return result
end
 
return pokedex