Module:Skills/sandbox

local getArgs = require('Module:Arguments').getArgs local p = {} local function makeInvokeFunction(funcName) -- makes a function that can be returned from #invoke, using -- Module:Arguments. return function (frame) local args = getArgs(frame, {parentOnly = true}) return p[funcName](args) end end local styles = { ['skill'] = '\n|-\n!style="background:#000;color:#fff;"|', ['skillc'] = '\n!style="background:#000;color:#fff;"|', ['cost2'] = '\n|style="background:#282828"|', ['effect1'] = '\n|style="text-align:left"|', ['effect2'] = '\n|style="background:#282828;text-align:left"|', ['effect1p'] = '\n|colspan=2 style="text-align:left"|', ['effect2p'] = '\n|colspan=2 style="background:#282828;text-align:left"|', ['order'] = '\n|style="background:#000;text-align:left"|', ['smt1table'] = '\n{|class="customtable smt1" width="100%"', ['statlow'] = '\n|style="background:#000;color:#fff"|', }

p.row = makeInvokeFunction('_row') function p._row(args) local row = args[1] or args.row local game = args[2] or args.game local code = args[3] or args.code or args.Skill1 or args.Skill2 or args.Skill3 or args.Skill4 or args.Skill5 or args.Skill6 or args.Skill7 or args.Skill8 or args.Skill9 or args.Skill10 or args.Skill11 or args.Skill12 or args.Skill13 or args.Skill14 or args.Skill15 or args.Skill16 or args.Skill17 or args.Skill18 or args.Skill19 or args.Skill20 or args.Skill21 or args.Skill22 or args.Skill23 or args.Skill24 or args.Skill25 or args.Skill26 or args.Skill27 or args.Skill28 or args.Skill29 or args.Skill30 if not code or code ==  then return  end local level = args[4] or args.Level1 or args.Level2 or args.Level3 or args.Level4 or args.Level5 or args.Level6 or args.Level7 or args.Level8 or args.Level9 or args.Level10 or args.Level11 or args.Level12 or args.Level13 or args.Level14 or args.Level15 or args.Level16 or args.Level17 or args.Level18 or args.Level19 or args.Level20 or args.Level21 or args.Level22 or args.Level23 or args.Level24 or args.Level25 or args.Level26 or args.Level27 or args.Level28 or args.Level29 or args.Level30 if level == 'innate' or level == 'default' or level == 'Default' then level = 'Innate' end local data = require('Module:Skills/' .. game) local skill = data.skills[code] if not skill then local alias = data.aliases[code] if alias then code = alias skill = data.skills[code] else return 'Invalid parameter 3 of ' .. '"' .. code .. '". You may correct the skill name or modify module:Skills/' .. game .. ' if needed. '		end end if skill.name then code = skill.name end local skillcell = styles['skill'] .. code local cost = skill.cost if game == 'SMT3' then if cost == 'Convo' then cost = 'Convo ' elseif cost == 'Interrupt' then cost = 'Interrupt ' end end local cost1 = '\n||' .. cost local cost2 = styles['cost2'] .. cost local effect1 = styles['effect1'] .. skill.effect local effect2 = styles['effect2'] .. skill.effect local order = styles['order'] .. skill.cost local element1, element2 if skill.element then element1 = '\n||' .. skill.element or '' element2 = styles['cost2'] .. skill.element or '' end local level1, level2 if level then level1 = '\n||' .. level or '' level2 = styles['cost2'] .. level or '' elseif skill.pre then level1 = '\n||' .. skill.pre level2 = styles['cost2'] .. skill.pre end local result if row == 'r01' then result = skillcell .. effect1 -- Odd number row for enemy whose skill cost is irrelevant. elseif row == 'r02' then result = skillcell .. effect2 -- Even number row for enemy whose skill cost is irrelevant. elseif row == 'r11' then if game == 'SMT3' and skill.phy then result = skillcell .. styles['effect1p'] .. skill.effect -- Odd number row for enemy whose physical skills cost no HP. else result = skillcell .. cost1 .. effect1 -- Odd number row for demon which does not learn new skill on level gain. end elseif row == 'r12' then if game == 'SMT3' and skill.phy then result = skillcell .. styles['effect2p'] .. skill.effect -- Even number row for enemy whose physical skills cost no HP. else result = skillcell .. cost2 .. effect2 -- Even number row for demon which does not learn new skill on level gain. end result = skillcell .. cost2 .. effect2 -- Even number row for demon which does not learn new skill on level gain. elseif row == 'r21' then result = skillcell .. cost1 .. effect1 .. level1 -- Odd number row for demon/persona which learn new skill on level gain. elseif row == 'r22' then result = skillcell .. cost2 .. effect2 .. level2 -- Even number row for demon/persona which learn new skill on level gain. elseif row == 'r31' then result = skillcell .. effect1 .. level1 -- Odd number row for guest who learn new skill on level gain. elseif row == 'r32' then result = skillcell .. effect2 .. level2 -- Even number row for guest who learn new skill on level gain. elseif row == 'p12' then result = styles['skill'] .. level .. styles['skillc'] .. code .. effect1 -- Row for Persona 1 and 2 persona elseif row == 'rf' then result = skillcell .. effect1 .. order -- Row for Persona-specific fusion spell. elseif row == 'dk1' then result = skillcell .. element1 .. cost1 .. effect1 -- Odd number row for DemiKids stats skill list. elseif row == 'dk2' then result = skillcell .. element2 .. cost2 .. effect2 -- Odd number row for DemiKids stats skill list. elseif row == 'dkc1' then result = skillcell .. level1 .. element1 .. cost1 .. effect1 -- Odd number row for DemiKids stats combo skill list. elseif row == 'dkc2' then result = skillcell .. level2 .. element2 .. cost2 .. effect2 -- Odd number row for DemiKids stats combo skill list. else result = 'Invalid parameter 1 of ' .. '"' .. row .. '". '	end return result end p.SMTstats = makeInvokeFunction('_SMTstats') function p._SMTstats(args) local image = args[1] or args.Image or '' local magdrop = args[2] or args['Mag Drop'] or '' local mag = args[3] or args.MAG or '' local cp = args[4] or args.CP or '' local race = args[5] or args.Race or args.Clan or '' local alignment = args[6]or args.Alignment or args.Align or '' local level = args[7] or args.Level or '' local hp = args[8] or args.HP or '' local mp = args[9] or args.MP or '' local noa = args[10] or args.NOA or args.NOH or '' local str = args[11] or args.STR or args.st or '' local int = args[12] or args.INT or args['in'] or '' local mgc = args[13] or args.MGC or args.ma or '' local stm = args[14] or args.STM or args.vi or '' local agl = args[15] or args.AGL or args.ag or '' local lck = args[16] or args.LCK or args.lu or '' local atk = args[17] or args.Atk or '' local hit = args[18] or args.Hit or '' local def = args[19] or args.Def or '' local avd = args[20] or args.Avd or args.Eva or '' local mpw = args[21] or args.Mpw or '' local mef = args[22] or args.Mef or '' local drop = args[23] or args.Drop or '' local resist = args[24] or args.Resist or args.Affinity local skills = args[25] or args.Skills if image then image = styles['skill'] .. image elseif image ==  then image =  end local magt if mag~= or cp~= then magt = 'CP ' elseif magdrop~='' then magt = '| MAG ' end if race == 'Seraph' then race = 'Seraph' elseif race == 'Ghost' then race = 'Ghost' elseif race == 'Gaean' or race == 'Gaian' then race = 'Gaean' elseif race == 'Messian' then race = 'Messian' elseif race == mw.title.getCurrentTitle(race) then race =  .. race ..  else race = race end if resist then resist = styles['smt1table'] .. '\n!width=100|Resistances\n|style="background:#000;text-align:left;padding:0 5px"|' .. resist .. '\n|}' else resist = '' end local skillt if skills ~= '' then skillt = '\n!colspan="3"| List of Skills \n|-\n' else skillt = '' end local los = '' for k, v in pairs(skills) do		skills = mw.text.split(skills, '\n') local code = v		local data = require('Module:Skills/SMT1') local skill = data.skills[code] if not skill then local alias = data.aliases[code] if alias then code = alias skill = data.skills[code] else return 'Invalid parameter 3 of ' .. '"' .. code .. '". You may correct the skill name or modify module:Skills/' .. game .. ' if needed. '			end end if skill.name then code = skill.name end local skillcell = styles['skill'] .. code local cost = skill.cost local effect = skill.effect if magdrop ~= '' then if (k % 2 == 0) then los = los .. skillcell .. styles['effect1'] .. effect else los = los .. skillcell .. styles['effect2'] .. effect end else if (k % 2 == 0) then los = los .. skillcell .. styles['cost1'] .. cost .. styles['effect1'] .. effect else los = los .. skillcell .. styles['cost2'] .. cost .. styles['effect2'] .. effect end end end local categoryb, categoryd, categorya if magdrop then categoryb =  else categoryb =  end if mag then categoryd =  else categoryd =  end if alignment == 'Law' or alignment == 'Light-Law' or alignment == 'Neutral-Law' or alignment == 'Dark-Law' then categorya = '' elseif alignment == 'Neutral' or alignment == 'Light-Neutral' or alignment == 'Neutral-Neutral' or alignment == 'Dark-Neutral' then categorya = '' elseif alignment == 'Chaos' or alignment == 'Light-Chaos' or alignment == 'Neutral-Chaos' or alignment == 'Dark-Chaos' then categorya = '' elseif not alignment or alignment ==  or '-' then categorya =  end if cp then cp = ' / ' .. cp elseif cp ==  then cp =  end if not magdrop or magdrop == '' then magdrop = mag .. cp end local costt if magdrop=='' then costt = styles['skillc'] .. 'Cost' else costt = '' end local result result = '{|align="center" style="min-width:650px;text-align:center; background: #222222; border:2px solid #608341;border-radius:7px; clear:both; font-size:75%; font-family:verdana;"\n|-\n|\n{|width=100% cellpadding=0 cellspacing=0\n' .. image .. '\n|' .. styles['smt1table'] .. '\n! Race \n! Alignment \n!Level\n!HP\n!MP\n!' .. magt .. '\n|-' .. styles['statlow'] .. race .. styles['statlow'] .. alignment .. styles['statlow'] .. level .. styles['statlow'] .. hp .. styles['statlow'] .. mp .. styles['statlow'] .. magdrop .. '\n|}' .. styles['smt1table'] .. '\n!NOH \n!Strength\n!Intelligence\n!Magic\n!Vitality\n!Agility\n!Luck\n|-' .. styles['statlow'] .. noa .. styles['statlow'] .. str .. styles['statlow'] .. int .. styles['statlow'] .. mgc .. styles['statlow'] .. stm .. styles['statlow'] .. agl .. styles['statlow'] .. lck .. '\n|}' .. styles['smt1table'] .. '\n!Attack\n!Hit\n!Defense\n!Evasion\n!MPower \n!MEffect \n! Drop \n|-' .. styles['statlow'] .. atk .. styles['statlow'] .. hit .. styles['statlow'] .. def .. styles['statlow'] .. avd .. styles['statlow'] .. mpw .. styles['statlow'] .. mef .. styles['statlow'] .. drop .. '\n|}\n|}' .. resist .. styles['smt1table'] .. skillt .. styles['skillc'] .. 'Skill' .. costt .. styles['skillc'] .. 'Effect' .. skill1 .. skill2 .. skill3 .. '\n|}\n|}' .. categoryb .. categoryd .. categorya return result end return p --