Module:JobMaster

local p = {}

function p.jobMasterBonusTable(frame) local args = require('Module:Arguments').getArgs(frame, {       parentFirst = true,    }) -- for tracking inconsistent usage. if args[2] then error('Specify iname through args[1]') end

local iname = args[1] return p._jobMasterBonusTable(iname) end

function p._jobMasterBonusTable(iname) if iname == nil then return 'Invalid parameter' end local jobMasterList = mw.loadData("Module:Data/MasterParam/JobMaster") local statMap = { HpMax  = 'HP', Atk    = 'PATK', Def    = 'PDEF', Mag    = 'MATK', Mnd    = 'MDEF', Dex    = 'DEX', Spd    = 'AGI', Cri    = 'CRIT', Luk    = 'LUCK', AvoidRate = 'Evasion Rate', }   local masteryData = jobMasterList[iname] if not masteryData then return 'Mastery Data Not Found' end

local output = mw.html.create('table') :addClass('wikitable statmap') for i,entry in pairs( masteryData ) do       if statMap[entry['type']] then local tr = output:tag('tr') local th = tr:tag('th') :wikitext(statMap[entry['type']] or entry['type']) local td = tr:tag('td') :wikitext(entry['val']) if entry['calc'] == 1 then td:wikitext('%') end end end return tostring(output) end

return p