Content added Content deleted
(added mr bonus for birthday cards) |
(added birthday max level) |
||
Line 39: | Line 39: | ||
['2'] = '30', |
['2'] = '30', |
||
['3'] = '50', |
['3'] = '50', |
||
['4'] = '60' |
['4'] = '60', |
||
['birthday'] = '50' |
|||
} |
} |
||
Revision as of 02:47, 9 October 2021
Documentation for this module may be created at Module:Card stats/doc
local getArgs = require('Module:Arguments').getArgs
local p = {}
local function editIfNil(value, func)
if value and value ~= '' then
if func then
return func(value)
end
return value
end
return string.format(
"<span class=\"plainlinks\">[%s?action=edit ? (edit)]</span>",
tostring(mw.uri.fullUrl(mw.title.getCurrentTitle().text))
)
end
function p.main(frame)
local args = getArgs(frame)
local rarity = args['rarity']
local min_performance = args['min performance']
local min_technique = args['min technique']
local min_stamina = args['min stamina']
local min_power = args['min power']
local max_performance = args['max performance']
local max_technique = args['max technique']
local max_stamina = args['max stamina']
local max_power = args['max power']
local max_level = '?'
local max_levels = {
['1'] = '20',
['2'] = '30',
['3'] = '50',
['4'] = '60',
['birthday'] = '50'
}
local side_story_bonuses = {
['1'] = { 300, 600 },
['2'] = { 450, 900 },
['3'] = { 600, 1500 },
['4'] = { 750, 1800 },
['birthday'] = { 720, 1650 }
}
local master_rank_bonuses = {
['1'] = 150,
['2'] = 300,
['3'] = 450,
['4'] = 600,
['birthday'] = 540
}
if args['rarity'] ~= nil then
max_level = max_levels[args['rarity']] or '?'
end
assert((tonumber(min_power) or 0) ==
(tonumber(min_performance) or 0) +
(tonumber(min_technique) or 0) +
(tonumber(min_stamina) or 0))
assert((tonumber(max_power) or 0) ==
(tonumber(max_performance) or 0) +
(tonumber(max_technique) or 0) +
(tonumber(max_stamina) or 0))
local root = mw.html.create('table'):addClass('wikitable')
root:tag('tr')
:tag('th')
:attr({
['width'] = '33%',
['height'] = '30px'
})
:done()
:tag('th')
:attr('width', '33%')
:wikitext('Level 1')
:done()
:tag('th')
:attr('width', '33%')
:wikitext('Level ' .. max_level)
:done()
:done()
:tag('tr')
:tag('td')
:attr('height', '30px')
:wikitext('[[File:Icon performance.png|25px|link=]] Performance')
:done()
:tag('td')
:wikitext(editIfNil(min_performance))
:done()
:tag('td')
:wikitext(editIfNil(max_performance))
:done()
:done()
:tag('tr')
:tag('td')
:attr('height', '30px')
:wikitext('[[File:Icon technique.png|25px|link=]] Technique')
:done()
:tag('td')
:wikitext(editIfNil(min_technique))
:done()
:tag('td')
:wikitext(editIfNil(max_technique))
:done()
:done()
:tag('tr')
:tag('td')
:attr('height', '30px')
:wikitext('[[File:Icon stamina.png|25px|link=]] Stamina')
:done()
:tag('td')
:wikitext(editIfNil(min_stamina))
:done()
:tag('td')
:wikitext(editIfNil(max_stamina))
:done()
:done()
:tag('tr')
:tag('td')
:attr('height', '30px')
:wikitext('Power')
:done()
:tag('td')
:wikitext(editIfNil(min_power))
:done()
:tag('td')
:wikitext(editIfNil(max_power))
:done()
:done()
:tag('tr')
:tag('td')
:attr('colspan', '3')
:done()
:done()
:tag('tr')
:tag('td')
:attr('height', '30px')
:wikitext('+ Side Story 1')
:done()
:tag('td')
:wikitext('')
:done()
:tag('td')
:wikitext('')
:done()
:done()
:tag('tr')
:tag('td')
:attr('height', '30px')
:wikitext('+ Side Story 2')
:done()
:tag('td')
:done()
:tag('td')
:wikitext('')
:done()
:done()
return tostring(root)
end
return p