FANDOM


-- <pre>
local p = {}
 
local addcommas = require( 'Module:Addcommas' )._add
 
-- Skilling data
 
--
-- fishing defines the possible fish that can be caught to gain augmented xp.
--
local fishing = {
	{level = 1, name = 'Raw shrimp', xp = 10, aquarium = false, crystallise = true},
	{level = 1, name = 'Raw crayfish', xp = 10, aquarium = false, crystallise = true},
	{level = 1, name = 'Raw minnow', xp = 10, aquarium = false, crystallise = true},
	{level = 5, name = 'Raw karambwanji', xp = 5, aquarium = false, crystallise = true},
	{level = 5, name = 'Raw sardine', xp = 20, aquarium = false, crystallise = true},
	{level = 10, name = 'Raw herring', xp = 30, aquarium = true, crystallise = true},
	{level = 15, name = 'Raw anchovies', xp = 40, aquarium = true, crystallise = true},
	{level = 16, name = 'Raw mackerel', xp = 20, aquarium = true, crystallise = true},
	{level = 20, name = 'Raw trout', xp = 50, aquarium = true, crystallise = true},
	{level = 23, name = 'Raw cod', xp = 45, aquarium = true, crystallise = true},
	{level = 25, name = 'Raw pike', xp = 60, aquarium = true, crystallise = true},
	{level = 28, name = 'Slimy eel', xp = 65, aquarium = false, crystallise = true},
	{level = 30, name = 'Raw salmon', xp = 70, aquarium = true, crystallise = true},
	{level = 33, name = 'Frog spawn', xp = 75, aquarium = false, crystallise = true},
	{level = 35, name = 'Raw tuna', xp = 80, aquarium = true, crystallise = true},
	{level = 38, name = 'Raw cave eel', xp = 80, aquarium = false, crystallise = true},
	{level = 38, name = 'Raw rainbow fish', xp = 80, aquarium = true, crystallise = true},
	{level = 40, name = 'Raw lobster', xp = 90, aquarium = true, crystallise = true},
	{level = 46, name = 'Raw bass', xp = 100, aquarium = true, crystallise = true},
	{level = 48, name = 'Leaping trout', xp = 60, aquarium = true, crystallise = false},
	{level = 50, name = 'Raw swordfish', xp = 100, aquarium = true, crystallise = true},
	{level = 58, name = 'Leaping salmon', xp = 82, aquarium = true, crystallise = false},
	{level = 62, name = 'Raw monkfish', xp = 120, aquarium = true, crystallise = true},
	{level = 70, name = 'Leaping sturgeon', xp = 92, aquarium = true, crystallise = false},
	{level = 75, name = 'Floating crystals', xp = 120, aquarium = false, crystallise = false, image = 'Crystal fragment'},
	{level = 76, name = 'Raw shark', xp = 110, aquarium = true, crystallise = true},
	{level = 76, name = 'Raw baron shark', xp = 110, aquarium = true, crystallise = true},
	{level = 80, name = 'Raw great white shark', xp = 130, aquarium = true, crystallise = true},
	{level = 85, name = 'Raw cavefish', xp = 300, aquarium = true, crystallise = false},
	{level = 90, name = 'Raw rocktail', xp = 380, aquarium = true, crystallise = false},
	{level = 90, name = 'Raw tarpon', xp = 90, aquarium = false, crystallise = false},
	{level = 92, name = 'Raw seerfish', xp = 60, aquarium = false, crystallise = false},
	{level = 93, name = 'Small crystal urchin', xp = 310, aquarium = false, crystallise = false},
	{level = 94, name = 'Raw sillago', xp = 270, aquarium = false, crystallise = false},
	{level = 95, name = 'Medium crystal urchin', xp = 330, aquarium = false, crystallise = false},
	{level = 96, name = 'Raw wobbegong', xp = 612.5, aquarium = false, crystallise = false},
	{level = 97, name = 'Large crystal urchin', xp = 350, aquarium = false, crystallise = false},
}
 
--
-- mining defines the possible ore that can be mined to gain augmented xp.
--
local mining = {
	{level = 1, name = 'Clay', xp = 5, crystallise = true},
	{level = 1, name = 'Rune essence', xp = 5, crystallise = false},
	{level = 1, name = 'Copper ore', xp = 17.5, crystallise = true},
	{level = 1, name = 'Tin ore', xp = 17.5, crystallise = true},
	{level = 10, name = 'Limestone', xp = 26.5, crystallise = true},
	{level = 10, name = 'Blurite ore', xp = 17.5, crystallise = true},
	{level = 15, name = 'Iron ore', xp = 35, crystallise = true},
	{level = 20, name = 'Daeyalt ore', xp = 17.5, crystallise = true},
	{level = 20, name = 'Silver ore', xp = 40, crystallise = true},
	{level = 30, name = 'Pure essence', xp = 5, crystallise = false},
	{level = 30, name = 'Coal', xp = 50, crystallise = true},
	{level = 35, name = 'Sandstone (1kg)', xp = 30, crystallise = true},
	{level = 35, name = 'Sandstone (2kg)', xp = 40, crystallise = true},
	{level = 35, name = 'Sandstone (5kg)', xp = 50, crystallise = true},
	{level = 35, name = 'Sandstone (10kg)', xp = 60, crystallise = true},
	{level = 40, name = 'Gem rock', image = 'Uncut opal', xp = 65, crystallise = true},
	{level = 40, name = 'Gold ore', xp = 35, crystallise = true},
	{level = 45, name = 'Granite (500g)', xp = 50, crystallise = true},
	{level = 45, name = 'Granite (2kg)', xp = 60, crystallise = true},
	{level = 45, name = 'Granite (5kg)', xp = 75, crystallise = true},
	{level = 46, name = 'Rubium', xp = 17.5, crystallise = true},
	{level = 55, name = 'Mithril ore', xp = 80, crystallise = true},
	{level = 70, name = 'Adamantite ore', xp = 95, crystallise = true},
	{level = 73, name = 'Living minerals', xp = 25, crystallise = false},
	{level = 77, name = 'Bane ore', xp = 90, crystallise = true},
	{level = 77, name = 'Concentrated coal rocks', image = 'Coal', xp = 50, crystallise = false},
	{level = 80, name = 'Concentrated gold rocks', image = 'Gold ore', xp = 65, crystallise = false},
	{level = 81, name = 'Red sandstone', xp = 70, crystallise = false},
	{level = 81, name = 'Crystal-flecked sandstone', xp = 70, crystallise = false},
	{level = 85, name = 'Runite ore', xp = 125, crystallise = true},
	{level = 89, name = 'Corrupted ore', image = 'Corrupted ore', article = 'Seren stone', xp = 296.7, crystallise = false},
	{level = 89, name = 'Corrupted ore (Voice of Seren)', image = 'Corrupted ore', article = 'Seren stone', xp = 356, crystallise = false},
	{level = 91, name = 'Sea salt', xp = 445.5, crystallise = false},
	{level = 97, name = 'Alaea sea salt', xp = 692.5, crystallise = false},
	{level = 98, name = 'Golden idol', xp = 5250, crystallise = false},
}
 
--
-- woodcutting defines the logs that can be chopped to gain augmented xp.
--
local woodcutting = {
	{level = 1, name = 'Logs', xp = 25, crystallise = true},
	{level = 1, name = 'Achey tree logs', xp = 25, crystallise = true},
	{level = 15, name = 'Oak logs', xp = 37.5, crystallise = true},
	{level = 30, name = 'Willow logs', xp = 30, crystallise = true},
	{level = 35, name = 'Teak logs', xp = 85, crystallise = true},
	{level = 45, name = 'Hollow tree (fail)', image = 'Bark', article = 'Bark',
		xp = 82.5, crystallise = true},
	{level = 45, name = 'Hollow tree (success)', image = 'Bark', article = 'Bark',
		xp = 357.7, crystallise = true},
	{level = 45, name = 'Maple logs', xp = 100, crystallise = true},
	{level = 45, name = 'Maple logs (With seers headband)', image = 'Maple logs', 
		article = 'Maple logs', xp = 110, crystallise = false},
	{level = 45, name = 'Mahogany logs', xp = 125, crystallise = true},
	{level = 54, name = 'Arctic pine logs', xp = 140.2, crystallise = true},
	{level = 58, name = 'Eucalyptus logs', xp = 165, crystallise = true},
	{level = 60, name = 'Yew logs', xp = 175, crystallise = true},
	{level = 68, name = 'Ivy', xp = 332.5, image = 'ivy icon', crystallise = true},
	{level = 75, name = 'Magic logs', xp = 250, crystallise = true},
	{level = 76, name = 'Blisterwood logs', xp = 200, crystallise = false},
	{level = 80, name = 'Branching crystal', xp = 240, crystallise = false, image = 'Crystal fragment'},
	{level = 82, name = 'Cursed magic logs', xp = 275, crystallise = true},
	{level = 83, name = 'Jade root (mutated)', image = 'Mutated vine', article = 'Mutated vine',
		xp = 140, crystallise = false},
	{level = 83, name = 'Straight root (chop & collect)', image = 'Straight root', article = 'Straight root',
		xp = 161, image = 'Straight root', crystallise = false},
	{level = 83, name = 'Curly root (chop & collect)', image = 'Curly root', article = 'Curly root',
		xp = 161, image = 'Straight root', crystallise = false},
	{level = 90, name = 'Bamboo', xp = 120, crystallise = false},
	{level = 90, name = 'Bloodwood logs', xp = 320, crystallise = false},
	{level = 90, name = 'Elder logs', xp = 325, crystallise = false},
	{level = 94, name = 'Crystal tree', image = 'Crystal geode', xp = 434.5, crystallise = false},
	{level = 96, name = 'Golden bamboo', xp = 655.5, crystallise = false},
}
 
--
-- firemaking defines the possible logs that can be burned to gain augmented xp.
--
local firemaking = {
	{level = 1, name = 'Logs', xp = 40},
	{level = 1, name = 'Achey tree logs', xp = 40},
	{level = 15, name = 'Oak logs', xp = 60},
	{level = 30, name = 'Willow logs', xp = 90},
	{level = 35, name = 'Teak logs', xp = 105},
	{level = 42, name = 'Arctic pine logs', xp = 125},
	{level = 45, name = 'Maple logs', xp = 135.5},
	{level = 50, name = 'Mahogany logs', xp = 157.5},
	{level = 58, name = 'Eucalyptus logs', xp = 193.5},
	{level = 60, name = 'Yew logs', xp = 202.5},
	{level = 75, name = 'Magic logs', xp = 303.8},
	{level = 76, name = 'Blisterwood logs', xp = 303.8},
	{level = 82, name = 'Cursed magic logs', xp = 303.8},
	{level = 83, name = 'Curly root', xp = 378.7},
	{level = 90, name = 'Elder logs', xp = 450},
	{level = 92, name = 'Driftwood', xp = 454}
}
 
--
-- augmentXP contains the experience needed to reach various levels.
--
local augmentXP = {
	0, 1160, 2607, 5167, 8286,
	11760, 15835, 21152, 28761, 40120,
	57095, 81960, 117397, 166496, 232886,
	320080, 432785, 575592, 753631, 972440
}
 
--
-- Testing revealed that augment xp has 3 extra digits.
-- This method returns the raw XP gained for a certain skilling xp amount.
-- This raw amount is 1000x the visible amount.
--
function p.skillingXPToRawAugmentXP(skill, xp, enlightened)
    local multiplier = 118
    if skill == 'Firemaking' then
        multiplier = 65
    end
	return math.floor(xp * multiplier * (1 + (0.03 * enlightened)))
end
 
--
-- Calculates the actions required to get a certain augmented level based on the skilling xp
--
function p.getActions(skill, level, actionXP, enlightened)
	local requiredAugmentationXP = augmentXP[level]*1000
	return math.ceil(requiredAugmentationXP/p.skillingXPToRawAugmentXP(skill, actionXP, enlightened))
end
 
--
-- Wrapper function for skills.
--
function p.getData(skill)
	if skill == 'Fishing' then
		return fishing
	end
	if skill == 'Mining' then
		return mining
	end
	if skill == 'Woodcutting' then
		return woodcutting
	end
	if skill == 'Firemaking' then
		return firemaking
	end
end
 
-- 
-- adjustSkillingXP is here so we can account for certain bonusses
--
function p.adjustSkillingXP(xp, multiplier, divider)
	local adjustedXP = math.floor((xp * 10 * multiplier)/divider)
	return adjustedXP / 10
end
 
function p.plink(name,image,article)
	return string.format('[[File:%s.png|link=%s]]&nbsp;[[%s|%s]]', image or name, article or name , article or name, name)
end
 
function p.getEffectiveSkillingXP(inXP,bonusses,xp_m,xp_d)
	local xp = 10 * inXP
 
	if bonusses.aquarium then
		xp = math.floor(xp * 1.02)
	end
 
	if bonusses.crystallise_with_prayer then
		xp = math.floor(xp * 1.875)
	elseif bonusses.crystallise then
		xp = math.floor(xp * 1.50)
	end
 
	return p.adjustSkillingXP(xp/10,xp_m,xp_d)
end
 
--
-- showSkill generates a table to display.
--
function p.showSkill(frame, level, skill, xp_multiplier, xp_divider, bonusses)
	local ret = mw.html.create('table')
				:addClass('wikitable')
				:addClass('align-left-1')
				:css('text-align', 'right')
	ret
		:tag('tr')
			:tag('th'):wikitext('Item'):done()
			:tag('th'):wikitext('Level'):done()
			:tag('th'):wikitext('Item XP each'):done()
			:tag('th'):wikitext('Actions'):done()
			:tag('th'):wikitext('Enlightened 1'):done()
			:tag('th'):wikitext('Enlightened 2'):done()
			:tag('th'):wikitext('Enlightened 3'):done()
		:done()
 
	local skill_data = p.getData(skill)
 
	for n, k in pairs(skill_data) do
		local skip = false
 
		skip = skip or (bonusses.aquarium and not k.aquarium)
		skip = skip or (bonusses.crystallise and not k.crystallise)
 
		if not skip then
			local actionXP = p.getEffectiveSkillingXP(k.xp, bonusses, xp_multiplier, xp_divider)
			ret
				:tag('tr')
					:tag('td'):wikitext(p.plink(k.name,k.image,k.article)):done()
					:tag('td'):wikitext(k.level):done()
					:tag('td'):wikitext(p.skillingXPToRawAugmentXP(skill, actionXP, 0)/1000):done()
					:tag('td'):wikitext(addcommas(p.getActions(skill, level, actionXP, 0))):done()
					:tag('td'):wikitext(addcommas(p.getActions(skill, level, actionXP, 1))):done()
					:tag('td'):wikitext(addcommas(p.getActions(skill, level, actionXP, 2))):done()
					:tag('td'):wikitext(addcommas(p.getActions(skill, level, actionXP, 3))):done()
				:done()
		end
	end
 
	return ret:done()
end
 
function p.bonusses(args)
	local bonusses = {}
	bonusses.aquarium = (args.aquarium or 'no') == 'yes'
	bonusses.crystallise_with_prayer = (args.crystallise_with_prayer or 'no') == 'yes'
	bonusses.crystallise = ((args.crystallise or 'no') == 'yes') or bonusses.crystallise_with_prayer
	return bonusses
end
 
function p.main(frame)
	local args = frame:getParent().args
	local skill = args.skill or 'Fishing'
	local level = tonumber(args.level,10) or 10
	local xp_multiplier = args.xp_mul or 1
	local xp_divider = args.xp_div or 1
 
	return p.showSkill(frame, level, skill, xp_multiplier, xp_divider, p.bonusses(args))
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.