此模块的文档可以在Module:Weapon/doc创建
-- 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 == 'feh' then return map.feh[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]]