2,875
edits
m (Add experience per hour row) |
No edit summary |
||
Line 3: | Line 3: | ||
local MEXP = require('Module:Experience') | local MEXP = require('Module:Experience') | ||
local number = require('Module:Number') | local number = require('Module:Number') | ||
local TimeSpan = require('Module:TimeSpan') | |||
local function formatTime( | local function formatTime(seconds) | ||
local timespan = | local timespan = TimeSpan.fromSeconds(seconds) | ||
return timespan:toStringLong() | |||
end | end | ||
Line 23: | Line 19: | ||
local function calc(currentExp, targetLvl, expPerAction, actionTime) | local function calc(currentExp, targetLvl, expPerAction, actionTime) | ||
local actionsPerHour = math.floor(3600 / actionTime) | |||
local actionsPerHour = math.floor( | |||
local targetExp = MEXP.expForLevel(targetLvl) | local targetExp = MEXP.expForLevel(targetLvl) | ||
local expRemaining = math.max(targetExp - currentExp, 0) | local expRemaining = math.max(targetExp - currentExp, 0) | ||
local expPerHour = math.floor( | local expPerHour = math.floor(3600 / actionTime * expPerAction) | ||
local actionsToTarget = math.ceil(expRemaining / expPerAction) | local actionsToTarget = math.ceil(expRemaining / expPerAction) | ||
Line 59: | Line 53: | ||
local targetLvl = number.toNumberOrError(args.targetLvl) | local targetLvl = number.toNumberOrError(args.targetLvl) | ||
local actionExp = number.toNumberOrError(args.actionExp) | local actionExp = number.toNumberOrError(args.actionExp) | ||
local actionTime = number.toNumberOrError(args.actionTime) | local actionTime = number.toNumberOrError(args.actionTime) | ||
-- Check Exp param for validity first, then Lvl | -- Check Exp param for validity first, then Lvl |
edits