Module:Calculator/Archaeology: Difference between revisions

From Melvor Idle
m (Ricewind moved page Module:Calculator/Archeology to Module:Calculator/Archaeology without leaving a redirect: I don't know how to English sometimes)
(wip: partially add function to compare time for making a new map)
 
Line 4: Line 4:
local TimeSpan = require('Module:TimeSpan')
local TimeSpan = require('Module:TimeSpan')


-- Constants
local CMapSize = 5760
local CMinInterval = .25
-- Estimate 50% to get item.
local CDropTreshold = .5
----------------------------------------------------------------
------------------------Lookup Functions------------------------
----------------------------------------------------------------
local function getExcavationItem(itemName)
local item = {
name,
timeSave,
isFlatTimeSave,
rarity,
}
item.rarity = 1/2023
return item
end
local function getBagItem(itemName)
local item = {
name,
timeSave,
isFlatTimeSave,
}
return item
end
----------------------------------------------------------------
------------------------Public Functions------------------------
----------------------------------------------------------------
-- Calculates how much time a certain consumable saves (or loses) depending on the player's
-- excavation interval, success rate, item rarity, and item effect.
function p._consumableTimeSave(itemName, excavationInterval, successRate)
end
function p._newMapTimeSave(itemName, excavationInterval, successRate, cartographyInterval)
excavationInterval = num.toNumberOrError(excavationInterval)
excavationInterval  = math.max(excavationInterval, CMinInterval)
successRate = num.toNumberOrError(successRate)
successRate = num.clamp(successRate, 0, 1)
cartographyInterval = num.toNumberOrError(cartographyInterval)
cartographyInterval = math.max(cartographyInterval, CMinInterval)
local item = getExcavationItem(itemName)
-- Estimates player time to get the item.
local estimatedTime = num.getDropsForProbability(successRate * item.rarity, CDropTreshold) * excavationInterval
-- Estimates time to make a new map and get the item.
-- Assumes 100% success rate for now.
local estimatedMapTime = num.getDropsForProbability(1 * item.rarity, CDropTreshold) * excavationInterval
+ cartographyInterval * CMapSize
mw.log(estimatedTime)
mw.log(estimatedMapTime)
end


return p
return p

Latest revision as of 19:34, 17 April 2024

Documentation for this module may be created at Module:Calculator/Archaeology/doc

local p = {}

local num = require('Module:Number')
local TimeSpan = require('Module:TimeSpan')

-- Constants
local CMapSize = 5760
local CMinInterval = .25
-- Estimate 50% to get item.
local CDropTreshold = .5

----------------------------------------------------------------
------------------------Lookup Functions------------------------
----------------------------------------------------------------
local function getExcavationItem(itemName)
	local item = {
		name,
		timeSave,
		isFlatTimeSave,
		rarity,
	}
	
	item.rarity = 1/2023
	return item
end	

local function getBagItem(itemName)
	local item = {
		name,
		timeSave,
		isFlatTimeSave,
	}
	
	return item
end


----------------------------------------------------------------
------------------------Public Functions------------------------
----------------------------------------------------------------

-- Calculates how much time a certain consumable saves (or loses) depending on the player's
-- excavation interval, success rate, item rarity, and item effect.
function p._consumableTimeSave(itemName, excavationInterval, successRate)
end

function p._newMapTimeSave(itemName, excavationInterval, successRate, cartographyInterval)
	excavationInterval	= num.toNumberOrError(excavationInterval)
	excavationInterval  = math.max(excavationInterval, CMinInterval)
	successRate 		= num.toNumberOrError(successRate)
	successRate 		= num.clamp(successRate, 0, 1)
	cartographyInterval = num.toNumberOrError(cartographyInterval)
	cartographyInterval = math.max(cartographyInterval, CMinInterval)
	
	local item = getExcavationItem(itemName)

	-- Estimates player time to get the item.
	local estimatedTime = num.getDropsForProbability(successRate * item.rarity, CDropTreshold) * excavationInterval
	
	-- Estimates time to make a new map and get the item.
	-- Assumes 100% success rate for now.
	local estimatedMapTime = num.getDropsForProbability(1 * item.rarity, CDropTreshold) * excavationInterval
		+ cartographyInterval * CMapSize
		
	mw.log(estimatedTime)
	mw.log(estimatedMapTime)
end

return p