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 reforges = loader.require('Module:Reforge/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 reforge = args[4] or args['reforge'] or nil return p._getArmorData(armor, growth, protection, hpb + fpb, reforge) end

function p._getArmorData(armorname, growth, protection, hpb, reforge) local armor = armorData[armorname] -- D for Data because these abbreviations come from the Armor/Data module local statsD = {'hp', 'def', 'cc', 'cd', 'str', 'int', 'spd', 'scc', 'td'} local piecesD = {'head', 'chest', 'legs', 'boots', 'total'} -- R for reforge because these abbreviations come from the Reforge/Data module local statsR = {'bas', 'cc', 'cd', 'def', 'fer', 'hp', 'int', 'mf', 'mnf', 'mns', 'scc', 'spd', 'str'} local armorstats = {helmet = {}, chestplate = {}, leggings = {}, boots = {}, total = {}} for i = 1,4,1 do 		local piece = piecesD[i] local piecestats = {hp={}, def={}, cc={}, cd={}, str={}, int={}, spd={}, scc={}, td={}} for a = 1,9,1 do			if armor['stats'][piece][statsD[a]] then piecestats[statsD[a]]['base'] = armor['stats'][piece][statsD[a]] end end if growth ~= 0 then piecestats['hp']['enchants'] = 15*growth end if protection ~= 0 then piecestats['def']['enchants'] = 3*protection end if hpb ~= 0 then piecestats['hp']['hpb'] = 4*hpb piecestats['def']['hpb'] = 2*hpb end if reforge and reforges['Armor'][reforge] then for a = 1,#statsR,1 do 				if reforges['Armor'][reforge]['stats'][armor['rarity']][statsR[a]] then piecestats[statsR[a]]['reforge'] = reforges['Armor'][reforge]['stats'][armor['rarity']][statsR[a]] end end end armorstats[i] = piecestats end local armornames = {'helmet', 'chestplate', 'leggings', 'boots', 'total'} -- O for Ordered, because this is the order in which the stats show up in-game (too many stats variables I know) local statsO = {'str', 'cc', 'cd', 'bas', 'hp', 'def', 'spd', 'int', 'fer', 'mf', 'td', 'mns', 'mnf', 'scc'} for a = 1,5,1 do		local piece = armorstats[a] for i = 1,#statsO,1 do		end end end

return p