Module:Sandbox/User:Artoire: Difference between revisions

From Brighter Shores Wiki
Jump to navigation Jump to search
Content added Content deleted
(Created page with "local data = require('Module:Experience/data') local last_seen = 0 for i = 0, 500 do if data.album[i] ~= nil then if data.album[i] <= last_seen then error(('Level %s is not strictly greater than the previous value (%s <= %s)'):format(i, data.album[i], last_seen)) end last_seen = data.album[i] end end local output = mw.html.create('table') :addClass('wikitable sortable') :tag('tr') :tag('th'):wikitext('L'):done() :tag('th'):wikitext('XP'):done() :tag(...")
 
No edit summary
 
Line 11: Line 11:
end
end


local output = mw.html.create('table')
local output = mw.html.create()
:wikitext('L = level; A = Album XP; K = Knowledge XP; D = floor(K / 10) - A')
:addClass('wikitable sortable')
:tag('tr')
:tag('table')
:addClass('wikitable sortable')
:tag('th'):wikitext('L'):done()
:tag('th'):wikitext('XP'):done()
:tag('tr')
:tag('th'):wikitext('Album'):done()
:tag('th'):wikitext('L'):done()
:tag('th'):wikitext('Ratio'):done()
:tag('th'):wikitext('A'):done()
:done()
:tag('th'):wikitext('K'):done()
:tag('th'):wikitext('D'):done()
:done()


for i = 0, 499 do
for i = 0, 499 do
if data.album[i] ~= nil then
if data.album[i] ~= nil then
local needed = data.level[i+1]-data.level[i]
local needed = data.level[i+1]-data.level[i]
local k = data.knowledge[i]
output:tag('tr')
output:tag('tr')
:tag('td'):wikitext(i):done()
:tag('td'):wikitext(i):done()
:tag('td'):wikitext(needed):done()
:tag('td'):wikitext(data.album[i]):done()
:tag('td'):wikitext(data.album[i]):done()
:tag('td'):wikitext(needed / data.album[i]):done()
:tag('td'):wikitext(data.knowledge[i]):done()
:tag('td'):wikitext(data.knowledge[i] and math.floor(data.knowledge[i] / 10) - data.album[i]):done()
:done()
:done()
end
end
end
end


return { main = function() return output end }
return { main = function() return output:done() end }

Latest revision as of 15:23, 29 November 2024

Documentation for this module may be created at Module:Sandbox/User:Artoire/doc

local data = require('Module:Experience/data')

local last_seen = 0
for i = 0, 500 do
	if data.album[i] ~= nil then
		if data.album[i] <= last_seen then
			error(('Level %s is not strictly greater than the previous value (%s <= %s)'):format(i, data.album[i], last_seen))
		end
		last_seen = data.album[i]
	end
end

local output = mw.html.create()
	:wikitext('L = level; A = Album XP; K = Knowledge XP; D = floor(K / 10) - A')
	:tag('table')
		:addClass('wikitable sortable')
		:tag('tr')
			:tag('th'):wikitext('L'):done()
			:tag('th'):wikitext('A'):done()
			:tag('th'):wikitext('K'):done()
			:tag('th'):wikitext('D'):done()
		:done()

for i = 0, 499 do
	if data.album[i] ~= nil then
		local needed = data.level[i+1]-data.level[i]
		local k = data.knowledge[i]
		output:tag('tr')
			:tag('td'):wikitext(i):done()
			:tag('td'):wikitext(data.album[i]):done()
			:tag('td'):wikitext(data.knowledge[i]):done()
			:tag('td'):wikitext(data.knowledge[i] and math.floor(data.knowledge[i] / 10) - data.album[i]):done()
		:done()
	end
end

return { main = function() return output:done() end }