Content added Content deleted
mNo edit summary |
mNo edit summary |
||
(76 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
-------------------------- |
-------------------------- |
||
-- Module for [[Template:Infobox |
-- Module for [[Template:Infobox card]] |
||
------------------------ |
------------------------ |
||
local getArgs = require('Module:Arguments').getArgs |
|||
local |
local QueryBuilder = require('Module:QueryBuilder') |
||
local InfoboxBuilder = require('Module:InfoboxBuilder') |
|||
local DisplayFns = require('Module:DisplayFunctions') |
|||
local ProcessingFns = require('Module:ProcessingFunctions') |
|||
local aicon = require('Module:Attribute icon')._main |
|||
local cicon = require('Module:Character icon')._main |
|||
local ricon = require('Module:Rarity icon')._main |
|||
local uicon = require('Module:Unit icon')._main |
|||
local VariablesLua = mw.ext.VariablesLua |
|||
local p = {} |
local p = {} |
||
local _frame |
|||
local width = '330px' |
|||
local root |
|||
local colors = { |
|||
cute = { bg = '#ff70a8', text = '#ffffff' }, |
|||
cool = { bg = '#435cff', text = '#ffffff'}, |
|||
pure = { bg = '#00bf51', text = '#ffffff'}, |
|||
happy = { bg = '#ff9821', text = '#ffffff'}, |
|||
mysterious = { bg = '#8651bc', text = '#ffffff' } |
|||
} |
|||
local palette = { bg = '#000000', text = '#FFFFFF' } |
|||
local units = { |
|||
vs = { image = 'Virtualsingerlogo.png', link = 'VIRTUAL SINGER' }, |
|||
ln = { image = 'Leoneedlogo.png', link = 'Leo/need' }, |
|||
mmj = { image = 'MMJ_logo.png', link = 'MORE MORE JUMP!'}, |
|||
vbs = { image = 'Vivid_logo.png', link = 'Vivid BAD SQUAD'}, |
|||
wxs = { image = 'Wonderlandsxswowtimelogo.png', link = 'Wonderlands×Showtime' }, |
|||
['25ji'] = { image = '25ji-logo.png', link = '25-ji, Night Code de.' } |
|||
} |
|||
local function |
local function formatAttribute(attribute) |
||
if attribute and attribute ~= '' then |
|||
root:tag('tr') |
|||
return string.format( |
|||
:tag('th') |
|||
"%s [[%s]]", |
|||
:attr('colspan', 30) |
|||
aicon({ attribute, size = '20px' }) or '', |
|||
:css({ |
|||
attribute |
|||
['text-align'] = 'center', |
|||
) |
|||
['background-color'] = palette.bg, |
|||
color = palette.text |
|||
}) |
|||
:wikitext(label) |
|||
end |
|||
local function addRow(label, data) |
|||
if data then |
|||
root:tag('tr') |
|||
:attr('id', label) |
|||
:tag('th') |
|||
:attr('colspan', 12) |
|||
:css('text-align', 'left') |
|||
:wikitext(label) |
|||
:done() |
|||
:tag('td') |
|||
:attr('colspan', 18) |
|||
:wikitext(data) |
|||
:done() |
|||
end |
end |
||
end |
|||
local function addCardArt(rarity, untrained, trained) |
|||
local image_size = 330 |
|||
return nil |
|||
if untrained and rarity then |
|||
local images = |
|||
string.format( |
|||
'Untrained=[[File:%s|%dpx]]', |
|||
untrained, |
|||
image_size) |
|||
if tonumber(rarity) > 2 then |
|||
images = |
|||
images |
|||
.. |
|||
string.format( |
|||
'|-|Trained=[[File:%s|%dpx]]', |
|||
trained, |
|||
image_size) |
|||
end |
|||
root:tag('tr') |
|||
:tag('td') |
|||
:attr('colspan', 30) |
|||
:css('text-align', 'center') |
|||
:wikitext(_frame:callParserFunction({ |
|||
name = '#tag', |
|||
args = { 'tabber', images } |
|||
})) |
|||
end |
|||
end |
end |
||
local function |
local function formatCharacter(character) |
||
if |
if character and charater ~= '' then |
||
return string.format( |
|||
local unit_info = units[unit] |
|||
"%s [[%s]]", |
|||
cicon({ character, size = '20px' }) or '', |
|||
root:tag('tr') |
|||
character |
|||
) |
|||
:attr('colspan', 30) |
|||
:css('text-align', 'center') |
|||
:wikitext( |
|||
string.format( |
|||
"[[File:%s|150px|link=%s]]", |
|||
unit_info.image, |
|||
unit_info.link |
|||
)) |
|||
end |
end |
||
return nil |
|||
if unit == 'vs' and subunit and units[subunit] then |
|||
local subunit_info = units[subunit] |
|||
root:tag('tr') |
|||
:tag('td') |
|||
:attr('colspan', 30) |
|||
:css('text-align', 'center') |
|||
:wikitext( |
|||
string.format( |
|||
"[[File:%s|100px|link=%s]]", |
|||
subunit_info.image, |
|||
subunit_info.link |
|||
)) |
|||
end |
|||
end |
end |
||
local function |
local function formatRarity(rarity) |
||
if |
if rarity and rarity ~= '' then |
||
return ricon({ rarity, '20px' }) |
|||
addRow( |
|||
'Attribute', |
|||
_frame:expandTemplate({ |
|||
title = 'Icons', |
|||
args = { attr, size='20px' } |
|||
}) .. ' ' .. attr:sub(1, 1):upper() .. attr:sub(2, -1) |
|||
) |
|||
end |
end |
||
return nil |
|||
end |
end |
||
local function |
local function formatUnit(unit) |
||
if |
if unit and unit ~= '' then |
||
return string.format( |
|||
addRow( |
|||
"%s [[%s]]", |
|||
uicon({ unit, size = '20px' }) or '', |
|||
_frame:expandTemplate({ |
|||
unit |
|||
title = 'Icons', |
|||
args = { string.format("%sstar", rarity), size = '20px'} |
|||
}) |
|||
) |
) |
||
end |
end |
||
return nil |
|||
end |
end |
||
local function |
local function formatEventId(id) |
||
local qb = QueryBuilder.new() |
|||
root:tag('tr') |
|||
qb |
|||
:tag('td') |
|||
:setTables('events') |
|||
:setFields([[ |
|||
:tag('div') |
|||
_pageName, |
|||
event_name, |
|||
['background-color'] = palette.bg, |
|||
]]) |
|||
['text-align'] = 'center', |
|||
:setGroupBy('_pageName') |
|||
padding = '5px', |
|||
:setLimit(1) |
|||
['border-radius'] = '5px', |
|||
:addWhere('event_id', '=', id) |
|||
margin = '2px' |
|||
}) |
|||
:wikitext(string.format( |
|||
'[[%s|<span style="color:%s">Side Story 1</span>]]', |
|||
story1 or '/Side Story 1', |
|||
palette.text)) |
|||
:done() |
|||
:done() |
|||
:tag('td') |
|||
:attr('colspan', 15) |
|||
:tag('div') |
|||
:css({ |
|||
['background-color'] = palette.bg, |
|||
['text-align'] = 'center', |
|||
padding = '5px', |
|||
['border-radius'] = '5px', |
|||
margin = '2px' |
|||
}) |
|||
:wikitext(string.format( |
|||
'[[%s|<span style="color:%s">Side Story 2</span>]]', |
|||
story2 or '/Side Story 2', |
|||
palette.text)) |
|||
:done() |
|||
:done() |
|||
local result = qb:query()[1] |
|||
if result then |
|||
return string.format('[[%s|%s]]', result._pageName, result.event_name) |
|||
end |
|||
return nil |
|||
end |
end |
||
function |
local function formatGachaId(id) |
||
local qb = QueryBuilder.new() |
|||
_frame = frame |
|||
qb |
|||
args = getArgs(frame) |
|||
:setTables('gachas') |
|||
:setFields([[ |
|||
_pageName, |
|||
gacha_name, |
|||
]]) |
|||
:setGroupBy('_pageName') |
|||
:setLimit(1) |
|||
:addWhere('gacha_id', '=', id) |
|||
local result = qb:query()[1] |
|||
if result then |
|||
if args['bg color'] or args['text color'] then |
|||
return string.format('[[%s|%s]]', result._pageName, result.gacha_name) |
|||
if args['bg color'] then |
|||
palette.bg = args['bg color'] |
|||
end |
|||
if args['text color'] then |
|||
palette.text = args['text color'] |
|||
end |
|||
elseif args['attribute'] and colors[args['attribute']] then |
|||
palette = colors[args['attribute']] |
|||
end |
end |
||
return nil |
|||
root = mw.html.create('table') |
|||
end |
|||
root |
|||
:addClass('infobox') |
|||
:css('width', width) |
|||
function p.main(frame) |
|||
local args = getArgs(frame, { wrappers = 'Template:Infobox card' }) |
|||
local infobox = InfoboxBuilder.new() |
|||
infobox:setName('Infobox card') |
|||
addHeader(args['title']) |
|||
:setParams{ |
|||
addCardArt(args['rarity'], args['untrained'], args['trained']) |
|||
{ name = 'card id' }, |
|||
addRow('Japanese', args['japanese']) |
|||
{ name = 'card name', default = mw.title.getCurrentTitle().text }, |
|||
addRow('Romaji', args['romaji']) |
|||
{ name = 'thumbnail' }, |
|||
{ name = 'thumbnail trained' }, |
|||
{ name = 'japanese' }, |
|||
{ name = 'romaji' }, |
|||
{ name = 'character' }, |
|||
{ name = 'attribute' }, |
|||
{ name = 'rarity' }, |
|||
{ name = 'unit' }, |
|||
{ name = 'support unit' }, |
|||
{ name = 'status' }, |
|||
{ name = 'date' }, |
|||
{ name = 'acquire', fn = ProcessingFns.stringToArray(',') }, |
|||
{ name = 'event id', dFunc = formatEventId }, |
|||
{ name = 'gacha id', dFunc = formatGachaId }, |
|||
-- Compatability args |
|||
{ name = 'obtain', fn = ProcessingFns.stringToArray(',') }, |
|||
{ name = 'event' }, |
|||
{ name = 'banner' }, |
|||
{ name = 'gacha' }, |
|||
} |
|||
:setArgs(args) |
|||
:processArgs() |
|||
:setCategoryMap({ |
|||
['character'] = { |
|||
-- VIRTUAL SINGER |
|||
['Hatsune Miku'] = 'Hatsune Miku cards', |
|||
['Kagamine Rin'] = 'Kagamine Rin cards', |
|||
['Kagamine Len'] = 'Kagamine Len cards', |
|||
['Megurine Luka'] = 'Megurine Luka cards', |
|||
['MEIKO'] = 'MEIKO cards', |
|||
['KAITO'] = 'KAITO cards', |
|||
-- Leo/need |
|||
['Hoshino Ichika'] = 'Hoshino Ichika cards', |
|||
['Tenma Saki'] = 'Tenma Saki cards', |
|||
['Mochizuki Honami'] = 'Mochizuki Honami cards', |
|||
['Hinomori Shiho'] = 'Hinomori Shiho cards', |
|||
-- MORE MORE JUMP! |
|||
['Hanasato Minori'] = 'Hanasato Minori cards', |
|||
['Kiritani Haruka'] = 'Kiritani Haruka cards', |
|||
['Momoi Airi'] = 'Momoi Airi cards', |
|||
['Hinomori Shizuku'] = 'Hinomori Shizuku cards', |
|||
-- Vivid BAD SQUAD |
|||
addHeader('Unit') |
|||
['Azusawa Kohane'] = 'Azusawa Kohane cards', |
|||
addUnit(args['unit'], args['subunit']) |
|||
['Shiraishi An'] = 'Shiraishi An cards', |
|||
['Shinonome Akito'] = 'Shinonome Akito cards', |
|||
['Aoyagi Toya'] = 'Aoyagi Toya cards', |
|||
-- Wonderlands×Showtime |
|||
addHeader('Card Information') |
|||
['Tenma Tsukasa'] = 'Tenma Tsukasa cards', |
|||
addRow('Character', args['character']) |
|||
['Otori Emu'] = 'Otori Emu cards', |
|||
addAttribute(args['attribute']) |
|||
['Kusanagi Nene'] = 'Kusanagi Nene cards', |
|||
addRarity(args['rarity']) |
|||
['Kamishiro Rui'] = 'Kamishiro Rui cards', |
|||
addRow('Status', args['status']) |
|||
addRow('Card Debut', args['debut']) |
|||
addRow('Release Date', args['date']) |
|||
-- 25-ji, Night Code de. |
|||
addHeader('Card Stats') |
|||
['Yoisaki Kanade'] = 'Yoisaki Kanade cards', |
|||
addRow('Performance', 0) |
|||
['Asahina Mafuyu'] = 'Asahina Mafuyu cards', |
|||
addRow('Technique', 0) |
|||
['Shinonome Ena'] = 'Shinonome Ena cards', |
|||
addRow('Stamina', 0) |
|||
['Akiyama Mizuki'] = 'Akiyama Mizuki cards', |
|||
addRow('Power', 0) |
|||
}, |
|||
['attribute'] = { |
|||
['Cool'] = 'Cool cards', |
|||
['Cute'] = 'Cute cards', |
|||
['Happy'] = 'Happy cards', |
|||
['Mysterious'] = 'Mysterious cards', |
|||
['Pure'] = 'Pure cards', |
|||
}, |
|||
['rarity'] = { |
|||
['1'] = '1☆ cards', |
|||
['2'] = '2☆ cards', |
|||
['3'] = '3☆ cards', |
|||
['4'] = '4☆ cards', |
|||
['Birthday'] = 'Birthday cards', |
|||
}, |
|||
['status'] = { |
|||
['Permanent'] = 'Permanent cards', |
|||
['Limited'] = 'Limited cards', |
|||
['Colorful Festival limited'] = 'Colorful Festival limited cards', |
|||
['Bloom Festival limited'] = 'Bloom Festival limited cards', |
|||
['Birthday limited'] = 'Birthday limited cards', |
|||
} |
|||
}) |
|||
infobox |
|||
:addHeader({ tag = 'argth', content = 'card name' }) |
|||
:addImage({ |
|||
{ |
|||
tag = 'argtd', |
|||
content = 'thumbnail', |
|||
tabName = 'Untrained', |
|||
fn = DisplayFns.image('156px') |
|||
}, |
|||
{ |
|||
tag = 'argtd', |
|||
content = 'thumbnail trained', |
|||
tabName = 'Trained', |
|||
fn = DisplayFns.image('156px') |
|||
} |
|||
}) |
|||
:addRow( |
|||
{ |
|||
{ tag = 'th', content = 'Japanese' }, |
|||
{ tag = 'argtd', content = 'japanese' } |
|||
}, |
|||
{ hideIfEmpty = { 'japanese' } } |
|||
) |
|||
:addRow( |
|||
{ |
|||
{ tag = 'th', content = 'Romaji' }, |
|||
{ tag = 'argtd', content = 'romaji' } |
|||
}, |
|||
{ hideIfEmpty = { 'romaji' } } |
|||
) |
|||
:addHeader({ tag = 'th', content = 'Card Information' }, { subheader = true }) |
|||
:addRow({ |
|||
{ tag = 'th', content = 'Card ID' }, |
|||
{ tag = 'argtd', content = 'card id' } |
|||
}) |
|||
:addRow({ |
|||
{ tag = 'th', content = 'Character' }, |
|||
{ tag = 'argtd', content = 'character', fn = formatCharacter } |
|||
}) |
|||
:addRow({ |
|||
{ tag = 'th', content = 'Attribute' }, |
|||
{ tag = 'argtd', content = 'attribute', fn = formatAttribute } |
|||
}) |
|||
:addRow({ |
|||
{ tag = 'th', content = 'Rarity' }, |
|||
{ tag = 'argtd', content = 'rarity', fn = formatRarity } |
|||
}) |
|||
:addRow({ |
|||
{ tag = 'th', content = 'Unit' }, |
|||
{ tag = 'argtd', content = 'unit', fn = formatUnit } |
|||
}) |
|||
:addRow( |
|||
{ |
|||
{ tag = 'th', content = 'Support unit' }, |
|||
{ tag = 'argtd', content = 'support unit', fn = formatUnit } |
|||
}, |
|||
{ hideIfEmpty = { 'support unit' } } |
|||
) |
|||
:addHeader({ tag = 'th', content = 'Acquisition Information' }, { subheader = true }) |
|||
:addRow({ |
|||
{ tag = 'th', content = 'Status' }, |
|||
{ tag = 'argtd', content = 'status' } |
|||
}) |
|||
:addRow({ |
|||
{ tag = 'th', content = 'Release date' }, |
|||
{ tag = 'argtd', content = 'date' } |
|||
}) |
|||
:addRow( |
|||
{ |
|||
{ tag = 'th', content = 'Acquisition method(s)' }, |
|||
{ tag = 'argtd', content = 'obtain', fn = DisplayFns.list('unbulleted') } |
|||
}, |
|||
{ hideIfEmpty = { 'obtain' } } |
|||
) |
|||
:addRow( |
|||
{ |
|||
{ |
|||
tag = 'argth', |
|||
content = 'acquire', |
|||
fn = DisplayFns.pluralHeader({ 'Acquisition method', 'Acquisition methods' }) |
|||
}, |
|||
{ |
|||
tag = 'argtd', |
|||
content = 'acquire', |
|||
fn = DisplayFns.list('unbulleted') |
|||
} |
|||
}, |
|||
{ hideIfEmpty = { 'acquire' } } |
|||
) |
|||
:addRow( |
|||
{ |
|||
{ tag = 'th', content = 'Associated event' }, |
|||
{ tag = 'argtd', content = 'event', fn = DisplayFns.link } |
|||
}, |
|||
{ hideIfEmpty = { 'event' } } |
|||
) |
|||
:addRow( |
|||
{ |
|||
{ tag = 'th', content = 'Debut gacha' }, |
|||
{ tag = 'argtd', content = 'banner', fn = DisplayFns.link } |
|||
}, |
|||
{ hideIfEmpty = { 'banner' } } |
|||
) |
|||
:addRow( |
|||
{ |
|||
{ tag = 'th', content = 'Debut gacha' }, |
|||
{ tag = 'argtd', content = 'gacha', fn = DisplayFns.link } |
|||
}, |
|||
{ hideIfEmpty = { 'gacha' } } |
|||
) |
|||
local categories = '' |
|||
addHeader('Side Stories') |
|||
if mw.title.getCurrentTitle().namespace == 0 then |
|||
addSideStories(args['story 1'], args['story 2']) |
|||
categories = '[[Category:Cards]]' .. infobox:getCategories() |
|||
local spacer = root:tag('tr') |
|||
local rawArgs = infobox:getRawArgs() |
|||
for i=1,30,1 do |
|||
VariablesLua.vardefine( 'card id', rawArgs['card id'] ) |
|||
spacer:tag('td') |
|||
VariablesLua.vardefine( 'rarity', rawArgs['rarity'] ) |
|||
:attr('colspan', 1) |
|||
VariablesLua.vardefine( 'character', rawArgs['character'] ) |
|||
:css('width', 'calc(100% / 30)') |
|||
VariablesLua.vardefine( 'support unit', rawArgs['support unit'] ) |
|||
VariablesLua.vardefine( 'attribute', rawArgs['attribute'] ) |
|||
VariablesLua.vardefine( 'date', rawArgs['date'] ) |
|||
VariablesLua.vardefine( 'event id', rawArgs['event id'] ) |
|||
end |
end |
||
return tostring( |
return infobox:tostring() .. categories |
||
end |
end |
||
Latest revision as of 14:47, 30 June 2024
This module depends on the following other modules: |
To generate {{Infobox card}}, invoke using the main function.
--------------------------
-- Module for [[Template:Infobox card]]
------------------------
local getArgs = require('Module:Arguments').getArgs
local QueryBuilder = require('Module:QueryBuilder')
local InfoboxBuilder = require('Module:InfoboxBuilder')
local DisplayFns = require('Module:DisplayFunctions')
local ProcessingFns = require('Module:ProcessingFunctions')
local aicon = require('Module:Attribute icon')._main
local cicon = require('Module:Character icon')._main
local ricon = require('Module:Rarity icon')._main
local uicon = require('Module:Unit icon')._main
local VariablesLua = mw.ext.VariablesLua
local p = {}
local function formatAttribute(attribute)
if attribute and attribute ~= '' then
return string.format(
"%s [[%s]]",
aicon({ attribute, size = '20px' }) or '',
attribute
)
end
return nil
end
local function formatCharacter(character)
if character and charater ~= '' then
return string.format(
"%s [[%s]]",
cicon({ character, size = '20px' }) or '',
character
)
end
return nil
end
local function formatRarity(rarity)
if rarity and rarity ~= '' then
return ricon({ rarity, '20px' })
end
return nil
end
local function formatUnit(unit)
if unit and unit ~= '' then
return string.format(
"%s [[%s]]",
uicon({ unit, size = '20px' }) or '',
unit
)
end
return nil
end
local function formatEventId(id)
local qb = QueryBuilder.new()
qb
:setTables('events')
:setFields([[
_pageName,
event_name,
]])
:setGroupBy('_pageName')
:setLimit(1)
:addWhere('event_id', '=', id)
local result = qb:query()[1]
if result then
return string.format('[[%s|%s]]', result._pageName, result.event_name)
end
return nil
end
local function formatGachaId(id)
local qb = QueryBuilder.new()
qb
:setTables('gachas')
:setFields([[
_pageName,
gacha_name,
]])
:setGroupBy('_pageName')
:setLimit(1)
:addWhere('gacha_id', '=', id)
local result = qb:query()[1]
if result then
return string.format('[[%s|%s]]', result._pageName, result.gacha_name)
end
return nil
end
function p.main(frame)
local args = getArgs(frame, { wrappers = 'Template:Infobox card' })
local infobox = InfoboxBuilder.new()
infobox:setName('Infobox card')
:setParams{
{ name = 'card id' },
{ name = 'card name', default = mw.title.getCurrentTitle().text },
{ name = 'thumbnail' },
{ name = 'thumbnail trained' },
{ name = 'japanese' },
{ name = 'romaji' },
{ name = 'character' },
{ name = 'attribute' },
{ name = 'rarity' },
{ name = 'unit' },
{ name = 'support unit' },
{ name = 'status' },
{ name = 'date' },
{ name = 'acquire', fn = ProcessingFns.stringToArray(',') },
{ name = 'event id', dFunc = formatEventId },
{ name = 'gacha id', dFunc = formatGachaId },
-- Compatability args
{ name = 'obtain', fn = ProcessingFns.stringToArray(',') },
{ name = 'event' },
{ name = 'banner' },
{ name = 'gacha' },
}
:setArgs(args)
:processArgs()
:setCategoryMap({
['character'] = {
-- VIRTUAL SINGER
['Hatsune Miku'] = 'Hatsune Miku cards',
['Kagamine Rin'] = 'Kagamine Rin cards',
['Kagamine Len'] = 'Kagamine Len cards',
['Megurine Luka'] = 'Megurine Luka cards',
['MEIKO'] = 'MEIKO cards',
['KAITO'] = 'KAITO cards',
-- Leo/need
['Hoshino Ichika'] = 'Hoshino Ichika cards',
['Tenma Saki'] = 'Tenma Saki cards',
['Mochizuki Honami'] = 'Mochizuki Honami cards',
['Hinomori Shiho'] = 'Hinomori Shiho cards',
-- MORE MORE JUMP!
['Hanasato Minori'] = 'Hanasato Minori cards',
['Kiritani Haruka'] = 'Kiritani Haruka cards',
['Momoi Airi'] = 'Momoi Airi cards',
['Hinomori Shizuku'] = 'Hinomori Shizuku cards',
-- Vivid BAD SQUAD
['Azusawa Kohane'] = 'Azusawa Kohane cards',
['Shiraishi An'] = 'Shiraishi An cards',
['Shinonome Akito'] = 'Shinonome Akito cards',
['Aoyagi Toya'] = 'Aoyagi Toya cards',
-- Wonderlands×Showtime
['Tenma Tsukasa'] = 'Tenma Tsukasa cards',
['Otori Emu'] = 'Otori Emu cards',
['Kusanagi Nene'] = 'Kusanagi Nene cards',
['Kamishiro Rui'] = 'Kamishiro Rui cards',
-- 25-ji, Night Code de.
['Yoisaki Kanade'] = 'Yoisaki Kanade cards',
['Asahina Mafuyu'] = 'Asahina Mafuyu cards',
['Shinonome Ena'] = 'Shinonome Ena cards',
['Akiyama Mizuki'] = 'Akiyama Mizuki cards',
},
['attribute'] = {
['Cool'] = 'Cool cards',
['Cute'] = 'Cute cards',
['Happy'] = 'Happy cards',
['Mysterious'] = 'Mysterious cards',
['Pure'] = 'Pure cards',
},
['rarity'] = {
['1'] = '1☆ cards',
['2'] = '2☆ cards',
['3'] = '3☆ cards',
['4'] = '4☆ cards',
['Birthday'] = 'Birthday cards',
},
['status'] = {
['Permanent'] = 'Permanent cards',
['Limited'] = 'Limited cards',
['Colorful Festival limited'] = 'Colorful Festival limited cards',
['Bloom Festival limited'] = 'Bloom Festival limited cards',
['Birthday limited'] = 'Birthday limited cards',
}
})
infobox
:addHeader({ tag = 'argth', content = 'card name' })
:addImage({
{
tag = 'argtd',
content = 'thumbnail',
tabName = 'Untrained',
fn = DisplayFns.image('156px')
},
{
tag = 'argtd',
content = 'thumbnail trained',
tabName = 'Trained',
fn = DisplayFns.image('156px')
}
})
:addRow(
{
{ tag = 'th', content = 'Japanese' },
{ tag = 'argtd', content = 'japanese' }
},
{ hideIfEmpty = { 'japanese' } }
)
:addRow(
{
{ tag = 'th', content = 'Romaji' },
{ tag = 'argtd', content = 'romaji' }
},
{ hideIfEmpty = { 'romaji' } }
)
:addHeader({ tag = 'th', content = 'Card Information' }, { subheader = true })
:addRow({
{ tag = 'th', content = 'Card ID' },
{ tag = 'argtd', content = 'card id' }
})
:addRow({
{ tag = 'th', content = 'Character' },
{ tag = 'argtd', content = 'character', fn = formatCharacter }
})
:addRow({
{ tag = 'th', content = 'Attribute' },
{ tag = 'argtd', content = 'attribute', fn = formatAttribute }
})
:addRow({
{ tag = 'th', content = 'Rarity' },
{ tag = 'argtd', content = 'rarity', fn = formatRarity }
})
:addRow({
{ tag = 'th', content = 'Unit' },
{ tag = 'argtd', content = 'unit', fn = formatUnit }
})
:addRow(
{
{ tag = 'th', content = 'Support unit' },
{ tag = 'argtd', content = 'support unit', fn = formatUnit }
},
{ hideIfEmpty = { 'support unit' } }
)
:addHeader({ tag = 'th', content = 'Acquisition Information' }, { subheader = true })
:addRow({
{ tag = 'th', content = 'Status' },
{ tag = 'argtd', content = 'status' }
})
:addRow({
{ tag = 'th', content = 'Release date' },
{ tag = 'argtd', content = 'date' }
})
:addRow(
{
{ tag = 'th', content = 'Acquisition method(s)' },
{ tag = 'argtd', content = 'obtain', fn = DisplayFns.list('unbulleted') }
},
{ hideIfEmpty = { 'obtain' } }
)
:addRow(
{
{
tag = 'argth',
content = 'acquire',
fn = DisplayFns.pluralHeader({ 'Acquisition method', 'Acquisition methods' })
},
{
tag = 'argtd',
content = 'acquire',
fn = DisplayFns.list('unbulleted')
}
},
{ hideIfEmpty = { 'acquire' } }
)
:addRow(
{
{ tag = 'th', content = 'Associated event' },
{ tag = 'argtd', content = 'event', fn = DisplayFns.link }
},
{ hideIfEmpty = { 'event' } }
)
:addRow(
{
{ tag = 'th', content = 'Debut gacha' },
{ tag = 'argtd', content = 'banner', fn = DisplayFns.link }
},
{ hideIfEmpty = { 'banner' } }
)
:addRow(
{
{ tag = 'th', content = 'Debut gacha' },
{ tag = 'argtd', content = 'gacha', fn = DisplayFns.link }
},
{ hideIfEmpty = { 'gacha' } }
)
local categories = ''
if mw.title.getCurrentTitle().namespace == 0 then
categories = '[[Category:Cards]]' .. infobox:getCategories()
local rawArgs = infobox:getRawArgs()
VariablesLua.vardefine( 'card id', rawArgs['card id'] )
VariablesLua.vardefine( 'rarity', rawArgs['rarity'] )
VariablesLua.vardefine( 'character', rawArgs['character'] )
VariablesLua.vardefine( 'support unit', rawArgs['support unit'] )
VariablesLua.vardefine( 'attribute', rawArgs['attribute'] )
VariablesLua.vardefine( 'date', rawArgs['date'] )
VariablesLua.vardefine( 'event id', rawArgs['event id'] )
end
return infobox:tostring() .. categories
end
return p