FANDOM


-- <pre>
-- 
 
local p = {}
 
local uclc = require('Module:Paramtest').ucflc
 
-- name = {max level, xp to fill}
local urns = {
	cooking = {
		cracked = {10, 2000},
		fragile = {25, 2750},
		normal = {40, 4750},
		strong = {55, 5250},
		decorated = {99, 7737.5}},
	fishing = {
		cracked = {10, 750},
		fragile = {30, 1750},
		normal = {50, 2500},
		strong = {70, 3000},
		decorated = {99, 9500}},
	mining = {
		cracked = {1, 437.5},
		fragile = {20, 1000},
		normal = {40, 1625},
		strong = {70, 2000},
		decorated = {99, 3125}},
	smelting = {
		cracked = {1, 200},
		fragile = {20, 312.5},
		normal = {50, 750},
		strong = {85, 1250}},
	woodcutting = {
		cracked = {10, 800},
		fragile = {35, 2125},
		normal = {58, 4125},
		strong = {75, 8312.5},
		decorated = {99, 9500}}
}
 
--
-- Fishing urns
--
function p.fishing(frame)
	local args = frame:getParent().args
	local urntype = string.lower(args[1] or '')
	local urndata = urns.fishing[urntype]
	local fishes = mw.loadData('Module:Fishing urn/Data')
	if urndata then
		return p._main(urndata,fishes,'Fish')
	else
		error('Unrecognized urn type. Use: "cracked", "fragile", "normal", "strong", or "decorated".')
	end
end
 
--
-- Mining urns
--
function p.mining(frame)
	local args = frame:getParent().args
	local urntype = string.lower(args[1] or '')
	local urndata = urns.mining[urntype]
	local ores = mw.loadData('Module:Mining urn/Data')
	if urndata then
		return p._main(urndata,ores,'Ore')
	else
		error('Unrecognized urn type. Use: "cracked", "fragile", "normal", "strong", or "decorated".')
	end
end
 
--[[
-- Functions with no data yet
 
--
-- Cooking urns
--
function p.cooking(frame)
	local args = frame:getParent().args
	local urntype = string.lower(args[1] or '')
	local urndata = urns.cooking[urntype]
	local foods = mw.loadData('Module:Cooking urn/Data')
	if urndata then
		return p._main(urndata,foods,'Food')
	else
		error('Unrecognized urn type. Use: "cracked", "fragile", "normal", "strong", or "decorated".')
	end
end
 
--
-- Smelting urns
--
function p.smelting(frame)
	local args = frame:getParent().args
	local urntype = string.lower(args[1] or '')
	local urndata = urns.smelting[urntype]
	local bars = mw.loadData('Module:Smelting urn/Data')
	if urndata then
		return p._main(urndata,bars,'Bar')
	else
		error('Unrecognized urn type. Use: "cracked", "fragile", "normal", or "strong".')
	end
end
 
--
-- Woodcutting urns
--
function p.woodcutting(frame)
	local args = frame:getParent().args
	local urntype = string.lower(args[1] or '')
	local urndata = urns.woodcutting[urntype]
	local logs = mw.loadData('Module:Woodcutting urn/Data')
	if urndata then
		return p._main(urndata,logs,'Logs')
	else
		error('Unrecognized urn type. Use: "cracked", "fragile", "normal", or "strong".')
	end
end
 
--]]
 
function p._main(urndata,materials,mat_type)
	local max_level = urndata[1]
	local max_xp = urndata[2]
	local ret_table = mw.html.create('table')
			:addClass('wikitable')
			:addClass('sortable')
			:addClass('align-center-1 align-center-3 align-right-4 align-right-5 align-right-6')
			:tag('tr')
				:tag('th')
					:css('border-right','none')
					:addClass('unsortable')
				:done()
				:tag('th')
					:css('border-left','none')
					:wikitext(mat_type)
				:done()
				:tag('th')
					:wikitext('Level')
				:done()
				:tag('th')
					:wikitext('Experience')
				:done()
				:tag('th')
					:wikitext('% filling')
				:done()
				:tag('th')
					:wikitext('# to fill')
				:done()
			:done()
	for i, v in ipairs(materials) do
		local mat_level = v.level
		if mat_level > max_level then
			break
		else
			local mat_name = uclc(v.name)
			local mat_file = v.image or mat_name
			local mat_img = '[[File:'..mat_file..'.png|link='..mat_name..']]'
			local mat_link = '[['..mat_name..']]'
			local mat_xp = v.xp
			local filling = math.floor(1000 * (mat_xp / max_xp)) / 10
			local to_fill = max_xp / mat_xp
			if not (math.floor(to_fill) == to_fill) then
				to_fill = math.floor(to_fill) + 1
			end
			ret_table:tag('tr')
					:tag('td')
						:wikitext(mat_img)
					:done()
					:tag('td')
						:wikitext(mat_link)
					:done()
					:tag('td')
						:wikitext(mat_level)
					:done()
					:tag('td')
						:wikitext(mat_xp)
					:done()
					:tag('td')
						:wikitext(filling)
					:done()
					:tag('td')
						:wikitext(to_fill)
					:done()
				:done()
		end
	end
	return ret_table:done()
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.