Module:WeaponStat

local wps = {} local getArgs = require('Module:Arguments').getArgs local getColor = require('Module:Color').colorByGame local cols = { wlv = '\n!WLv', rank = '\n!Rank', uses = '\n!Uses', whp = '\n!WHp', mt = '\n!Mt', power = '\n!Power', hit = '\n!Hit', crt = '\n!Crt', rng = '\n!Rng', wt = '\n!Wt', wex = '\n!WEx', worth = '\n!Worth', avoid = '\n!Avoid' }

function wps.main(frame) local args = getArgs(frame) return wps._main(args) end

function wps._main(args) local game = string.lower(args['game']) local class = '' local color, out, columns, colspan1, colspan2, maxcnt if(string.match(game, 'fe')) then --       - Fire Emblem games -- --       i = tonumber(string.sub(game, 3)) color = getColor[tostring(i)] if (i==6 or i==8 or i==9 or i==12 or i==13 or i==14) then class = 'light' end if (i==1 or i==3) then colspan1 = 4 colspan2 = 4 columns = cols.wlv.. cols.uses.. cols.mt.. cols.hit.. cols.crt.. cols.rng.. cols.wt.. cols.worth.. '\n|-' for cnt = 3, 10 do               columns = columns..'\n|'..args[tonumber(cnt)] maxcnt = cnt + 1 end elseif (i == 2) then colspan1 = 3 colspan2 = 2 columns = cols.mt.. cols.hit.. cols.crt.. cols.rng.. cols.wt.. '\n|-' for cnt = 3, 7 do               columns = columns..'\n|'..args[tonumber(cnt)] maxcnt = cnt + 1 end elseif (i == 4) then colspan1 = 4 colspan2 = 3 columns = cols.rank.. cols.uses.. cols.mt.. cols.hit.. cols.rng.. cols.wt.. cols.worth.. '\n|-' for cnt = 3, 9 do               columns = columns..'\n|'..args[tonumber(cnt)] maxcnt = cnt + 1 end elseif (i >= 5 and i <= 11) then colspan1 = 5 colspan2 = 4 columns = cols.rank.. cols.uses.. cols.mt.. cols.hit.. cols.crt.. cols.rng.. cols.wt.. cols.wex.. cols.worth.. '\n|-' for cnt = 3, 11 do               columns = columns..'\n|'..args[tonumber(cnt)] maxcnt = cnt + 1 end elseif (i == 12 or i == 13) then colspan1 = 4 colspan2 = 4 columns = cols.rank.. cols.uses.. cols.mt.. cols.hit.. cols.crt.. cols.rng.. cols.wex.. cols.worth.. '\n|-' for cnt = 3, 10 do               columns = columns..'\n|'..args[tonumber(cnt)] maxcnt = cnt + 1 end else colspan1 = 5 colspan2 = 4 columns = cols.rank.. cols.uses.. cols.mt.. cols.hit.. cols.crt.. cols.avoid.. cols.rng.. cols.wex.. cols.worth.. '\n|-' for cnt = 3, 11 do               columns = columns..'\n|'..args[tonumber(cnt)] maxcnt = cnt + 1 end end else -- Non-Fire Emblem games --- colspan1 = 4 colspan2 = 4 columns = cols.wlv.. cols.whp.. cols.power.. cols.hit.. cols.crt.. cols.rng.. cols.wt.. cols.worth.. '\n|-' for cnt = 3, 10 do               columns = columns..'\n|'..args[tonumber(cnt)] maxcnt = cnt + 1 end color = getColor[game] end out = '{| border="1" style="min-width: 50%; max-width: 70%; text-align: center"'.. '\n|-bgcolor='..color..' class='..class.. '\n!colspan='..colspan1..'|Name'.. '\n!colspan='..colspan2..'|Type'.. '\n|-'.. '\n|colspan='..colspan1..'|'..args[1].. '\n|colspan='..colspan2..'|'..args[2].. '\n|-bgcolor='..color..' class='..class.. columns.. '\n|-bgcolor='..color..' class='..class.. '\n!colspan='..colspan1 + colspan2..'|Effect(s)'.. '\n|-style="text-align: initial"'.. '\n|colspan='..colspan1 + colspan2..'|'..args[maxcnt]..'\n|}' return out end

return wps --