1,027
edits
m (Fix formatting) |
mNo edit summary |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
local number = require('Module:Number') | local number = require('Module:Number') | ||
local economy = require('Module:ItemEconomy') | local economy = require('Module:ItemEconomy') | ||
local TimeSpan = require('Module:TimeSpan') | |||
local p = {} | local p = {} | ||
Line 20: | Line 21: | ||
return result | return result | ||
end | end | ||
-- Calculate item economy for tablet output | |||
local eco = economy.ItemEconomy:new() | |||
eco.outputsPerAction = playerStats.tabletsMade | |||
eco.duplicationChance = playerStats.tabletDoubleChance | |||
-- Values below are not included, but might be available as boosts. | |||
eco.extraItemChance = 0 | |||
eco.extraItemAmount = 0 | |||
eco.flatExtraItems = 0 | |||
eco.extraBaseItemChance = 0 | |||
eco.extraBaseItems = 0 | |||
-- Calculate total amount of tablets made, including double chance | -- Calculate total amount of tablets made, including double chance | ||
local averageTabletsMade = economy. | local averageTabletsMade = 1 * economy.estimatedOutputMultiplier(eco) | ||
-- Calculate the effective amount of tablets the player has from one craft, including tablet save chance | -- Calculate the effective amount of tablets the player has from one craft, including tablet save chance | ||
Line 90: | Line 99: | ||
else | else | ||
-- Calculate time saved in seconds for two and three tablet synergy | -- Calculate time saved in seconds for two and three tablet synergy | ||
local twoTab = | local twoTab = TimeSpan.fromSeconds(calcResult.twoTabletTimeSave) | ||
local threeTab = | local threeTab = TimeSpan.fromSeconds(calcResult.threeTabletTimeSave) | ||
tableData.effectiveTablets = number.round(calcResult.effectiveTablets, 2) | tableData.effectiveTablets = number.round(calcResult.effectiveTablets, 2) | ||
tableData.twoTabletTimeSave = number.round(twoTab | tableData.twoTabletTimeSave = number.round(twoTab:getTotalSeconds(), 2) | ||
tableData.threeTabletTimeSave = number.round(threeTab | tableData.threeTabletTimeSave = number.round(threeTab:getTotalSeconds(), 2) | ||
end | end | ||
addTableRow(tbl, "Effective tablets", tableData.effectiveTablets) | addTableRow(tbl, "Effective tablets", tableData.effectiveTablets) | ||
addTableRow(tbl, "Two tablet time save", tableData.twoTabletTimeSave) | addTableRow(tbl, "Two tablet time save", tableData.twoTabletTimeSave, ' sec') | ||
addTableRow(tbl, "Three tablet time save", tableData.threeTabletTimeSave) | addTableRow(tbl, "Three tablet time save", tableData.threeTabletTimeSave, ' sec') | ||
return tbl | return tbl | ||
end | end | ||
Line 110: | Line 119: | ||
function p._main(args) | function p._main(args) | ||
-- Parse inputs and turn intervals into integers (hundreds of a second) | -- Parse inputs and turn intervals into integers (hundreds of a second) | ||
local summoningInterval = number.toNumberOrError(args.summoningInterval) | local summoningInterval = number.toNumberOrError(args.summoningInterval) | ||
local actionTimeSaved = number.toNumberOrError(args.actionTimeSaved) | local actionTimeSaved = number.toNumberOrError(args.actionTimeSaved) | ||
local tabletsMade = number.toNumberOrError(args.tabletsMade) | local tabletsMade = number.toNumberOrError(args.tabletsMade) | ||
local tabletDoubleChance = number.toNumberOrDefault(args.tabletDoubleChance, 0) | local tabletDoubleChance = number.toNumberOrDefault(args.tabletDoubleChance, 0) |
edits