Home
Random
Log in
Settings
About Brighter Shores Wiki
Disclaimers
Search
Editing
Module:Experience/table
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
require('strict') require('Module:Mw.html extension') local data = mw.loadData('Module:Experience/data') local yesno = require('Module:Yesno') local lang = mw.language.getContentLanguage() local p = {} function p.main(frame) local args = frame:getParent().args local default_collapsed = yesno(args.collapsed) local collapsed = {} for _, label in ipairs(data.labels) do local this_collapsed = yesno(args['collapsed-' .. label.name:lower()]) if this_collapsed == nil then this_collapsed = default_collapsed end collapsed[label.name] = this_collapsed end return p._main{ collapsed = collapsed } end --[[ Creates tables of expreience for {{Experience table}} args.collapsed = { Novice = boolean, Apprentice = boolean, ... }: Whether the corresponding table should automatically be collapsed ]] function p._main(args) args = args or {} local collapsed = args.collapsed or {} local result = {} for _, label in ipairs(data.labels) do local t = mw.html.create('table') :addClass('wikitable mw-collapsible') :addClass(collapsed[label.name] and 'mw-collapsed' or nil) :tag('caption') :wikitext((label.min == label.max and '%s (%s)' or '%s (%s-%s; %s XP)'):format(label.name, label.min, label.max, lang:formatNum((data.level[label.max + 1] or 0) - data.level[label.min]))) :done() :tag('tr') :tag('th') :wikitext('Level') :done() :tag('th') :wikitext('Experience') :done() :tag('th') :wikitext('XP to next level') :done() :IF(label.knowledge) :tag('th') :wikitext('Knowledge XP') :done() :END() :done() for level = label.min, label.max do local next_level_node if data.level[level+1] then next_level_node = mw.html.create('td') :wikitext(lang:formatNum(data.level[level+1] - data.level[level])) :done() else -- Max level next_level_node = mw.html.create('td') :addClass('table-na') :wikitext('N/A') :done() end t:tag('tr') :tag('td') :wikitext(level) :done() :tag('td') :wikitext(lang:formatNum(data.level[level])) :done() :node(next_level_node) :IF(label.knowledge) :tag('td') :wikitext(lang:formatNum(data.knowledge[level] or 0)) :done() :END() :done() end table.insert(result, tostring(t)) end return table.concat(result, '') end return p
Summary:
Please note that all contributions to Brighter Shores Wiki are considered to be released under the CC BY-NC-SA 3.0 (see
Brighter Shores:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Preview page with this template
Templates used on this page:
Template:Documentation
(
edit
)
Template:Experience table
(
edit
)
Template:Experience table/doc
(
edit
)
Template:Extension DPL
(
edit
)
Template:T
(
edit
)
Module:Array
(
edit
)
Module:DPLlua
(
edit
)
Module:DependencyList
(
edit
)
Module:Documentation
(
edit
)
Module:Experience/table
(
edit
)
Module:Experience/table/doc
(
edit
)
Module:Paramtest
(
edit
)
Module:T
(
edit
)
Module:Tooltip
(
edit
)
Module:Yesno
(
view source
) (semi-protected)
This page is a member of a hidden category:
Category:Pages using DynamicPageList3 parser function