This module depends on the following other modules: |
The above documentation is transcluded from Module:NPCMaster/doc.
Editors can experiment in this module's sandbox and testcases pages.
Subpages of this module.
Editors can experiment in this module's sandbox and testcases pages.
Subpages of this module.
local xtable = require('Module:Table')
local m_util = require('Module:Util')
local getArgs = require('Module:Arguments').getArgs
local p = {}
function p.infobox(frame)
box = mw.html.create('table')
return tostring(box)
end
-- =p.experience_progression{lv1_rep=1, lv1_rep_total=1, lv2_rep=1, lv2_rep_total=1, lv3_rep=1, lv3_rep_total=1, lv4_rep=1, lv4_rep_total=1, lv5_rep=1, lv5_rep_total=1, lv6_rep=1, lv6_rep_total=1, lv7_rep=1, lv7_rep_total=1, lv8_rep=1, lv8_rep_total=1}
function p.experience_progression(frame)
-- data
local smw_prefix = 'Has master level '
local lang = mw.getContentLanguage()
-- get args/frameQQD
tpl_args = getArgs(frame, {
parentFirst = true
})
frame = m_util.misc.get_frame(frame)
-- Argument validation
local lv
local lv_n
for i=1, 8 do
lv = 'lv' .. i
for _, arg in ipairs({lv .. '_rep', lv .. '_rep_total'}) do
lv_n = tonumber(tpl_args[arg])
if lv_n == nil then
error(arg .. ' must be a valid number')
else
tpl_args[arg] = lv_n
end
end
tpl_args[lv .. '_unlocks'] = tpl_args[lv .. '_unlocks'] or '?'
end
-- display & properties
exptable = mw.html.create('table')
exptable
:attr('class', 'wikitable sortable MasterLevelTable')
:tag('tr')
:tag('th')
:wikitext('Level')
:done()
:tag('th')
:wikitext(m_util.html.abbr('Rep.', 'Reputation needed to level up'))
:done()
:tag('th')
:wikitext(m_util.html.abbr('Rep. total', 'Total reputation needed to level up'))
:done()
:tag('th')
:wikitext(m_util.html.abbr('Unlocks', 'Features first unlocked on this level'))
:done()
:done()
:done()
for i=1, 8 do
--local property = {}
local hr
local row = exptable:tag('tr')
row
:tag('th')
:wikitext(i)
:done()
--property['is level'] = i
lv = 'lv' .. i
hr = lang:formatNum(tpl_args[lv .. '_rep'])
row
:tag('td')
:attr('data-sort-value', tpl_args[lv .. '_rep'])
:wikitext(hr)
:done()
--property['has experience'] = hr
hr = lang:formatNum(tpl_args[lv .. '_rep_total'])
row
:tag('td')
:attr('data-sort-value', tpl_args[lv .. '_rep_total'])
:wikitext(hr)
:done()
--property['has total experience'] = hr
row
:tag('td')
:wikitext(tpl_args[lv .. '_unlocks'])
:done()
--property['has unlocks'] = tpl_args[lv .. '_unlocks']
--frame:callParserFunction('#subobject:', property)
end
return tostring(exptable)
end
return p