Module:Augmented skilling xp

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}, {level = 1, name = 'Raw crayfish',				xp =  10}, {level = 1, name = 'Raw minnow',				xp =  10}, {level = 5, name = 'Karambwanji', 				xp =   5}, {level = 5, name = 'Raw sardine',				xp =  20}, {level = 10, name = 'Raw herring',				xp = 30}, {level = 15, name = 'Raw anchovies',			xp = 40}, {level = 16, name = 'Raw mackerel',				xp = 20}, {level = 20, name = 'Raw trout',				xp = 50}, {level = 23, name = 'Raw cod',					xp = 45}, {level = 25, name = 'Raw pike',					xp = 60}, {level = 28, name = 'Slimy eel',				xp = 65}, {level = 30, name = 'Raw salmon',				xp = 70}, {level = 33, name = 'Frog spawn',				xp = 75}, {level = 35, name = 'Raw tuna',					xp = 80}, {level = 38, name = 'Raw cave eel',				xp = 80}, {level = 38, name = 'Raw rainbow fish',			xp = 80}, {level = 40, name = 'Raw lobster',				xp = 90}, {level = 46, name = 'Raw bass',					xp = 100}, {level = 48, name = 'Leaping trout',			xp = 60}, {level = 50, name = 'Raw swordfish',			xp = 100}, {level = 58, name = 'Leaping salmon',			xp = 82}, {level = 62, name = 'Raw monkfish',				xp = 120}, {level = 70, name = 'Leaping sturgeon',			xp = 92}, {level = 76, name = 'Raw shark',				xp = 110}, {level = 76, name = 'Raw baron shark',         xp = 110}, {level = 80, name = 'Raw great white shark',	xp = 130}, {level = 85, name = 'Raw cavefish',				xp = 300}, {level = 90, name = 'Raw rocktail',				xp = 380}, {level = 10, name = 'Small crystal urchin',    xp = 310}, {level = 10, name = 'Medium crystal urchin',   xp = 330}, {level = 10, name = 'Large crystal urchin',    xp = 350} }

-- -- woodcutting defines the logs that can be chopped to gain augmented xp. -- local woodcutting = { {name = 'logs',                    xp= 25}, }

-- -- augmentXP contains the experience needed to reach various levels. -- local augmentXP = { 0,1160,2607,5167,8286,   11760,15835,21152,28761,40120,    57095,81960 }

-- -- 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(xp) return math.floor(xp * 118); end

-- -- Calculates the actions required to get a certain augmented level based on the skilling xp -- function p.getActions(level,actionXP) local requiredAugmentationXP = augmentXP[level]*1000 return math.ceil(requiredAugmentationXP/p.skillingXPToRawAugmentXP(actionXP)) end

-- -- Wrapper function for skills. -- function p.getData(skill) if skill == 'Fishing' then return fishing; end if skill == 'Woodcutting' then return woodcutting; 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

-- -- showSkill generates a table to display. -- function p.showSkill(skill,xp_multiplier,xp_divider) local ret = mw.html.create("table"); ret :tag('tr') :tag('td'):attr('rowspan','2'):wikitext("Item"):done :tag('td'):attr('rowspan','2'):wikitext("Fishing level"):done :tag('td'):attr('colspan','3'):wikitext("Required for level:"):done :done :tag("tr") :tag("td"):wikitext("level 5"):done :tag("td"):wikitext("level 10"):done :tag("td"):wikitext("level 12"):done :done local skill_data = p.getData(skill) for n,k in pairs(skill_data) do       local actionXP = p.adjustSkillingXP(k['xp'],xp_multiplier,xp_divider) ret :tag("tr") :tag("td"):wikitext(""):done :tag("td"):wikitext(k['level']):done :tag("td"):wikitext(addcommas(p.getActions(5,actionXP))):done :tag("td"):wikitext(addcommas(p.getActions(10,actionXP))):done :tag("td"):wikitext(addcommas(p.getActions(12,actionXP))):done :done end return ret:done end

function p.main(frame) local args = frame:getParent.args local skill = args[1] local xp_multiplier = args[2] or 1 local xp_divider = args[3] or 1

return p.showSkill(skill,xp_multiplier,xp_divider) end

return p