Module:Sandbox/User:Artoire

From Brighter Shores Wiki
Jump to navigation Jump to search

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 }