FANDOM


-- <nowiki>
 
local p = {}
 
local coins = require('Module:Coins')
 
local runes = {'Air', 'Mind', 'Water', 'Earth', 'Fire', 'Body', 'Cosmic', 'Chaos', 'Astral', 'Nature', 'Law', 'Death', 'Blood', 'Soul'}
local rune_levels = {1, 1, 5, 9, 14, 20, 27, 35, 40, 44, 54, 65, 77, 90}
local multiple_runes = {11, 14, 19, 26, 35, 46, 59, 74, 82, 91, 1/0, 1/0, 1/0, 1/0}
 
function requires_pure_ess(rune_index)
	return rune_index >= 6
end
 
function rune_amount(rune_index, level)	
	return math.floor(level / multiple_runes[rune_index]) + 1
end
 
function get_capacity(level)
	c = 28
	if level >= 9 then
		c = c + 2
	end
 
	if level >= 25 then
		c = c + 5
	end
 
	if level >= 50 then
		c = c + 8
	end
 
	if level >= 75 then
		c = c + 11
	end
 
	if level >= 90 then
		c = c + 17
	end
 
	return c
end
 
function get_prices(frame)
	local prices = {}
 
	for _, r in pairs(runes) do
		table.insert(prices, tonumber(frame:expandTemplate{ title = 'GEP', args = { r .. " rune" } }))
	end
 
	return prices
end
 
function p.main(frame)
	local t = mw.html.create('table')
	          :addClass('wikitable')
 
	local header = t:tag('tr')
	                   :tag('th'):wikitext('Level'):done()
	                   :tag('th'):wikitext('Capacity'):done()
 
	for _, r in pairs(runes) do
		header:tag('th'):wikitext(r)
	end
 
	local rune_prices = get_prices(frame)
	local ess_price = tonumber(frame:expandTemplate{ title = 'GEP', args = { "Rune essence" } })
	local pure_price = tonumber(frame:expandTemplate{ title = 'GEP', args = { "Pure essence" } })
	local cheapest_price = math.min(ess_price, pure_price)
 
	for level=1, 105 do
		local c = get_capacity(level)
		local row = t:tag('tr')
		                :tag('td'):wikitext(level):done()
		                :tag('td'):wikitext(c):done()
 
		for i, r in pairs(runes) do
			local ess
			if requires_pure_ess(i) then
				ess = pure_price
			else
				ess = cheapest_price
			end
			if rune_levels[i] > level then
				row:tag('td'):wikitext('-')
			else
				row:tag('td'):wikitext(coins._amount(c * (rune_prices[i] * rune_amount(i, level) - ess)))
			end
		end
	end
 
	return t
end
 
return p

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.