Fandom

Fire Emblem Wiki

Module:Weapon

5,310pages on
this wiki
Add New Page
Talk0

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

-- This module is invoked by Template:Weapon.
-- To edit the weapons mapped by game, go to Module:Weapon/Map.
 
local weapon = {}
local getArgs = require('Module:Arguments').getArgs
local map = require('Module:Weapon/Map')
 
function getWeapon(weapon, game)
    if     game == '4'   then return map.fe4[weapon]
    elseif game == '5'   then return map.fe5[weapon] 
    elseif game == '6' or game == '7' or game == '8' then return map.gba[weapon]
    elseif game == '9'   then return map.fe9[weapon] 
    elseif game == '10'  then return map.fe10[weapon] 
    elseif game == '11' or game == '12' then return map.ds[weapon] 
    elseif game == '13'  then return map.fe13[weapon]
    elseif game == '14'  then return map.fe14[weapon]
    elseif game == '0'   then return map.fe0[weapon]
    elseif game == 'ts'  then return map.ts[weapon] 
    elseif game == 'ts2' then return map.ts2[weapon]
    elseif game == 'tms'   then return map.tms[weapon]
    end
end
 
function weapon.main(frame)
	local args = getArgs(frame)
	if(pcall(weapon._main, args)) then
        return weapon._main(args)
    else
	    return '<span style="color:red">Invalid inputs. See [[Template:Weapon/doc]] for more info.</span>'
    end
end
 
function weapon._main(args)
    local game = string.lower(args[1]) -- game input
    local wtype = string.lower(args[2]) -- weapon type input
    local result
 
    if game == '1' or game =='2' or game == '3' then
        result = '<span style="color:orange">This game doesn\'t have a weapon icon.</span>'
    else
        result = getWeapon(wtype, game)
    end
 
    if result == nil then
        return '<span style="color:red">Invalid inputs. See [[Template:Weapon/doc]] for more info.</span>'
    else
        return result
    end
end
 
return weapon
--[[Category:Modules]]

Also on Fandom

Random Wiki