Module:Sandbox/TheTrueShaman

local p = {} local getArgs = require('Module:Arguments').getArgs local loader = require('Module:Loader')

local string, table, yesno = loader.require('String', 'Table', 'Yesno')

local armorData = loader.require('Module:Armor/Data') local getArgs = require('Module:Arguments').getArgs

function p.getArmorData(frame) local args = getArgs(frame) local armor = (args[1] or args['armor']):lower local growth = args['growth'] or 5 local protection = args['protection'] or 5 local hpb = args[2] or args['hpb'] local fpb = args[3] or args['fpb'] local fragged = yesno(args['fragged'], false) local reforge = args[4] or args['reforge'] or nil return p._getArmorData(armor, growth, protection, hpb + fpb, reforge, fragged) end

function p._getArmorData(armorname, growth, protection, hpb, reforge, fragged) local armor = armorData[armorname] local data = "{{ArmorStats \n" -- D for Data because these abbreviations come from the Armor/Data module local statsD = {'hp', 'def', 'cc', 'cd', 'str', 'int', 'spd', 'td'} -- T for Template because these abbreviations come from the ArmorStats Template local statsT = {'hp', 'def', 'critchance', 'critdmg', 'str', 'int', 'spd', 'trudef'} local piecesD = {'head', 'chest', 'legs', 'boots', 'total'} local piecesT = {'helmet', 'chest', 'legs', 'boots', 'total'}

for i = 1,5,1 do 		local piece = piecesD[i] data = data..piece.."\n" for a = 1,8,1 do			if armor['stats'][piece][statsD[a]] then data = data..'|'..piecesT[a]..'_'..statsT[a]..' = '..armor['stats'][piece][statsD[a]]..'\n' end end data = data.."\n" end data = data.."" return data end

return p