Module:Gamebox

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 data = { ['mt1'] = { colorb = 'f00', name = 'Megami Tensei', },	['mt2'] = { colorb = 'c0b37c', name = 'Megami Tensei II', },	['giten'] = { colorb = '091F92', name = 'Giten Megami Tensei: Tokyo Mokushiroku', },	['smt1'] = { colorb = '608341', name = 'Shin Megami Tensei', },	['smt2'] = { colorb = '2F4F4F', name = 'Shin Megami Tensei II', },	['smtif'] = { colorb = '8FBC8F', name = 'Shin Megami Tensei: if...', },	['smt3'] = { colorb = 'CC1100', name = 'Shin Megami Tensei III: Nocturne', },	['smtsj'] = { colorb = '200470', name = 'Shin Megami Tensei: Strange Journey', },	['smt4'] = { colorb = 'fff', name = 'Shin Megami Tensei IV', },	['smtim'] = { colorb = '009d96', name = 'Shin Megami Tensei IMAGINE', },	['smtim'] = { colorb = '009d96', name = 'Shin Megami Tensei IMAGINE', },	['majin1'] = { colorb = '002446', name = 'Majin Tensei', },	['majin2'] = { colorb = '514F7E', name = 'Majin Tensei II: Spiral Nemesis', },	['smtds'] = { colorb = '4372AA', name = 'Shin Megami Tensei: Devil Summoner', },	['sh'] = { colorb = '302878', name = 'Devil Summoner: Soul Hackers', },	['raidou1'] = { colorb = '856363', name = 'Devil Summoner: Raidou Kuzunoha vs. The Soulless Army', },	['raidou2'] = { colorb = '8e283d', name = 'Devil Summoner: Raidou Kuzunoha vs. King Abaddon', },	['childred'] = { colorb = 'c00', name = 'Devil Children Red/Black Book', },	['childblack'] = { colorb = 'c00', name = 'Devil Children Red/Black Book', },	['childwhite'] = { colorb = 'fff', name = 'Devil Children White Book', },	['childlight'] = { colorb = '60c', name = 'DemiKids', },	['childfire'] = { colorb = 'f93', name = 'Devil Children Fire/Ice Book', },	['childice'] = { colorb = 'f93', name = 'Devil Children Fire/Ice Book', },	['childmessiah'] = { colorb = 'c30', name = 'Devil Children Messiah Riser', },	['p1'] = { colorb = 'A9A9A9', name = 'Persona', },	['p2is'] = { colorb = '8B668B', name = 'Persona 2: Innocent Sin', },	['p2ep'] = { colorb = 'B3668B', name = 'Persona 2: Eternal Punishment', },	['p3'] = { colorb = '4372AA', name = 'Persona 3', },	['pts'] = { colorb = '26466D', name = 'Persona -trinity soul-', },	['p4'] = { colorb = 'FFE600', name = 'Persona 4', },	['pq'] = { colorb = 'AA1CA9', name = 'Persona Q: Shadow of the Labyrinth', },	['p5'] = { colorb = 'f00', name = 'Persona 5', },	['ddsaga1'] = { colorb = '66CD00', name = 'Digital Devil Saga: Avatar Tuner', },	['ddsaga2'] = { colorb = 'EC8A05', name = 'Digital Devil Saga: Avatar Tuner 2', },	['desu1'] = { colorb = 'e83145', name = 'Devil Survivor', },	['desu2'] = { colorb = '0078e8', name = 'Devil Survivor 2', },	['mx'] = { colorb = 'f00', name = 'Maken', },	[''] = {		colorb = '000', name = '', }, } local stylet = '\n|-\n|style="font-size:100%; text-align:center;background:#222;" colspan=2|' local styleh = '\n|-\n!style="background:#111;color:#fff"|' local stylec = '\n|-\n!colspan=2|'

local cate1 = ' [[Category:' local cate2 = ']] ' p.game = makeInvokeFunction('_game') function p._game(args) local class = args.class if not class then class = '' end local image = args.image local image_width = args.image_width if not image_width then image_width = '240px' end local image_bg = args.image_bg if not image_bg then image_bg = '#333' end local japan = args.japan local romaji = args.romaji local developer = args.developer local publisher = args.publisher local genre = args.genre local platform = args['platform(s)'] or args.platform local releasej = args['release-date-japan'] or args.releasej local releasena = args['release-date-north-america'] or args.releasena local releaseeu = args['release-date-europe'] or args.releaseeu local releaseau = args['release-date-australasia'] or args.releaseau local result local game = data[class] local colorbc = game.colorb if colorbc == nil then colorbc = '' end if image then image = '\n|-\n| style="border-radius:3.5px; background:' .. image_bg .. '" colspan="2" align="center" | ' else image = '' end result = '{|class="customtable ' .. class .. '" style="background: #333; width:250px; font-size:90%; border:3px solid #' .. colorbc .. '; border-radius:7px; float: right; padding: 0px; margin-left:10px" |\n! colspan="2" style="padding:2px 15px"| ''' .. tostring(mw.title.getCurrentTitle) ..  .. image if japan then japan = stylet .. japan else japan = '' end if romaji then romaji = stylet .. romaji else romaji = '' end result = result .. japan .. romaji .. stylec .. 'Game Information' if developer then developer = styleh .. 'Developer\n|' .. developer else developer = '' end if publisher then publisher = styleh .. 'Publisher\n|' .. publisher else publisher = '' end if genre then genre = styleh .. 'Genre\n|' .. genre else genre = '' end if platform then platform = styleh .. 'Platform\n|' .. platform else platform = '' end result = result .. developer .. publisher .. genre .. platform .. stylec .. 'Release Dates' if releasej then releasej = styleh .. '\n|' .. releasej else releasej = '' end if releasena then releasena = styleh .. '\n|' .. releasena else releasena = '' end if releaseeu then releaseeu = styleh .. '\n|' .. releaseeu else releaseeu = '' end if releaseau then releaseau = styleh .. '\n|' .. releaseau else releaseau = '' end result = result .. releasej .. releasena .. releaseeu .. releaseau .. '\n|}' return result end p.char = makeInvokeFunction('_char') function p._char(args) local class = args[1] or args.class if not class then class = '' end local cname = args.name if not cname then cname = tostring(mw.title.getCurrentTitle) end local image = args.image local image_bg = args.image_bg if not image_bg then image_bg = '#222' end local aka = args.aka local japan = args.japan or args.kana local romaji = args.romaji local rpname = args.RPname local first = args['first appearance'] or args.first local affiliation = args.affiliation local alignment = args.alignment local team = args.team local occupation = args.job or args.occupation local rank = args.rank local ship = args.ship local country = args.country local reason = args.reason local sponsor = args['demonic sponsor'] or args.sponsor local origin = args.origin local weapon = args.weapon local demonpartner = args.demonpartner local tribe = args.tribe local gun = args.gun local avatar = args.avatar local brand = args.brand -- DDSaga atma brand local location = args.location -- DDSaga atma brand location local birthday = args.birthday or args.dob local age = args.age local zodiac = args.zodiac local height = args.height local weight = args.weight local cell = args.cell local home = args.home local fatedemon = args.fatedemon local animedemon = args.animedemon local comp = args.comp local blood = args.blood or args['blood type'] local melee = args.melee local ranged = args.ranged local arcana = args.arcana local arcana2 = args.arcana2 local persona = args.persona local japaneseva = args.japaneseva or args['Japanese VA'] local englishva = args.englishva or args['English VA'] local part = args.Part -- for Persona 2 local game = data[class] local colorbc = game.colorb if colorbc == nil then colorbc = '' end local name = game.name local result = '{| class="customtable ' .. class .. '" style="background:#000; border: 3px #' .. colorbc .. ' solid; float: right; border-radius:7px; font-size:90%; padding: 0px; width:290px; margin-left:10px"\n!colspan="2"|' .. cname if image then result = result .. '\n|-\n!colspan=2 style="background:#' .. image_bg .. '"|' .. image end if aka then result = result .. '\n|-\n!Also known as\n|' .. aka end if japan then result = result .. '\n|-\n!Japanese Name\n|' .. japan end if romaji then result = result .. '\n|-\n!Romaji\n|' .. romaji end if rpname then result = result .. '\n|-\n!Revelations Name \n|' .. rpname end if first then result = result .. '\n|-\n!First Appearance\n|' .. first end if affiliation then result = result .. '\n|-\n!Affiliation\n|' .. affiliation end if alignment then result = result .. '\n|-\n!Alignment\n|' .. alignment end if team then result = result .. '\n|-\n!Team\n|' .. team end if occupation then result = result .. '\n|-\n!Occupation\n|' .. occupation end if rank then result = result .. '\n|-\n!rank\n|' .. rank end if ship then result = result .. '\n|-\n!Ship\n|' .. ship end if country then result = result .. '\n|-\n!Country\n|' .. country end if reason then result = result .. '\n|-\n!Reason\n|' .. reason end if sponsor then result = result .. '\n|-\n!Demonic Sponsor\n|' .. sponsor end if origin then result = result .. '\n|-\n!Origin\n|' .. origin end if weapon then result = result .. '\n|-\n!Weapon\n|' .. weapon end if demonpartner then result = result .. '\n|-\n!Demon Partner\n|' .. demonpartner end if tribe then result = result .. '\n|-\n!Tribe\n|' .. tribe end if gun then result = result .. '\n|-\n!Firearm Type\n|' .. gun end if avatar then result = result .. '\n|-\n!Atma Avatar\n|' .. avatar end if brand then result = result .. '\n|-\n!Atma Brand\n|' .. brand end if location then result = result .. '\n|-\n!Brand Location\n|' .. location end if birthday then result = result .. '\n|-\n!Date of Birth\n|' .. birthday end if age then result = result .. '\n|-\n!Age\n|' .. age end if zodiac then result = result .. '\n|-\n!Zodiac\n|' .. zodiac end if height then result = result .. '\n|-\n!Height\n|' .. height end if weight then result = result .. '\n|-\n!Weight\n|' .. weight end if cell then result = result .. '\n|-\n!Cell Phone Color\n|' .. cell end if home then result = result .. '\n|-\n!Residency\n|' .. home end if fatedemon then result = result .. '\n|-\n!Fate Demon\n|' .. fatedemon end if animedemon then result = result .. '\n|-\n!Anime Demon \n|' .. animedemon end if comp then result = result .. '\n|-\n!COMP Color\n|' .. comp end if blood then result = result .. '\n|-\n!Blood Type\n|' .. blood end if melee then result = result .. '\n|-\n!Melee Weapon\n|' .. melee end if ranged then result = result .. '\n|-\n!Ranged Weapon\n|' .. ranged end if arcana then result = result .. '\n|-\n!Arcana\n|' .. arcana end if arcana2 then result = result .. '\n|-\n!Secondary Arcana \n|' .. arcana2 end if persona then result = result .. '\n|-\n!Persona\n|' .. persona end if japaneseva then result = result .. '\n|-\n!Japanese VA \n|' .. japaneseva end if englishva then result = result .. '\n|-\n!English VA \n|' .. englishva end result = result .. '\n|}' if part == 'both' or part == 'Both' then result = result .. cate1 .. data.p2is.name .. ' Characters' .. cate2 .. cate1 .. data.p2ep.name .. ' Characters' .. cate2 elseif name ~= nil then result = result .. cate1 .. name .. ' Characters' .. cate2 else result = result end return result end return p -- --