Module:WeaponForge

--This module is invoked by Template:WeaponStat/Forging

local p = {} local getArgs = require('Module:Arguments').getArgs local getColor = require('Module:Color').colorByGame local common = require('Module:Common')

function p.main(frame) local args = getArgs(frame) if(pcall(wps._main, args)) then return wps._main(args) else return ' Something went wrong, please see Template:WeaponStat/Forging. '   end end

local function pttnHandler(arg, spans) local rows = string.gsub(args, '%.', '\n|-\n|') local cols = string.gsub(rows, ',', '||') if(spans ~= nil) then cols = string.gsub(cols, '||', '||colspan=2|') end return cols end

function p._main(args) local game = 'fe15' local class = common.colorLinks(game) local color = getColor[game] local out = '{|class="statbox" style="text-align:center"' if(args.forge ~= nil) then out = out.. '\n! colspan=7 bgcolor='..color..' class='..class..'|Forging'.. '\n|-'.. '\n!Stars !!Silver !!Gold !!Mt !!Hit !!Crt !!Wt'.. '\n| '..pttnHandler(args.forge) end if(args.evo ~= nil) then out = out.. '\n|-'.. '\n! colspan=7 bgcolor='..color..' class='..class..'|Evolutions'.. '\n|-'.. '\n!colspan=3| New weapon !!colspan=2| Silver !!colspan=2| Gold'.. '\n|-'.. '\n|colspan=3|'..pttnHandler(args.evo, '') end return out..'\n|}' end

return p