Module:GoldMath
Jump to navigation
Jump to search
Documentation for this module may be created at Module:GoldMath/doc
local p = {}
function p.main(frame)
local lvl = tonumber(frame.args.lvl) or error('no lvl dumbass')
local multi = tonumber(frame.args.multi) or error('no multi dumbass')
local spread = tonumber(frame.args.spread) or 0
local base = 1.13
--
local value = base^(lvl - 1) * multi
local lowVal = value * (1 - spread)
local highVal = value * (1 + spread)
local lowRound = math.floor(lowVal + 0.5)
local highRound = math.floor(highVal + 0.5)
local out
if lowRound == highRound then
out = tostring(lowRound)
else
out = string.format("%d – %d",
lowRound, highRound
)
end
return out .. " "
end
return p