Module:Blast Furnace Gold calculator

From Old School RuneScape Wiki
Jump to: navigation, search
Module documentation
This documentation is transcluded from Template:No documentation/doc. [edit] [purge]
This module does not have any documentation. Please consider adding documentation at Module:Blast Furnace Gold calculator/doc. [edit]
Module:Blast Furnace Gold calculator requires Module:Coins.

local coins = require('Module:Coins')._amount

local lang = mw.getContentLanguage()
function fnum(x)
    if type(x) == 'number' then return lang:formatNum(x) end
return x end

local p = {}

function p.main(frame)
	local args = frame:getParent().args --get args from calc input
	local drop = tonumber(args.Drop) --set up basic variables from args
	local hop = tonumber(args.Hop)
	local sixty = args.Sixty
	local dropticks26 = math.ceil(26/drop)
	local dropticks22 = math.ceil(22/drop)
	local methodbase = {}
	local methodtotal = {}
	local buyarray = {}
	if sixty == 'yes' then
		methodbase = {15,26,41,52} --amount of ticks for basic method, without dropping or hopping
		buyarray = {7306, 17654, 31044, 44750} --array for buy cost per cycle
		methodbase = {22,33,48,59} --amount of ticks for basic method, without dropping or hopping
		buyarray = {9806, 20154, 33544, 47250} --array for buy cost per cycle
	for i=1, 3 do --math section to add in drop and hop ticks
		methodtotal[i] = methodbase[i]+(i*dropticks26)+hop
	methodtotal[4] =  methodbase[4]+(3*dropticks26)+dropticks22+hop
	local oresarray = {26, 52, 78, 100}
	local exparray = {1461.2, 2922.4, 4383.6, 5620} --array for exp per cycle
	local xphr = {} --setting up arrays for xp/hr, gp/hr, gp,/xp
	local gphr = {}
	local gpxp = {}
	for i=1,4 do --filling arrays
		xphr[i] = 6000*exparray[i]/methodtotal[i] --6000 ticks per hour, multiplied by exp/tick
		gphr[i] = (6000*buyarray[i]/methodtotal[i])+72000 --6000 ticks per hour, multiplied by buycost/tick, add 72000 for hour cost
		gpxp[i] = gphr[i]/xphr[i] 
	local t = mw.html.create('table')
			:wikitext('Ores bought per world')
			:wikitext('Experience per hour')
			:wikitext('Cost per hour')
			:wikitext('Cost per experience point')
	for i=1,4 do
	return t

return p