Anonymous

Module:Calculator/ETA: Difference between revisions

From Melvor Idle
m
Replace Shared module with Number module
m (Use local functions)
m (Replace Shared module with Number module)
Line 2: Line 2:


local MEXP = require('Module:Experience')
local MEXP = require('Module:Experience')
local shared = require('Module:Shared')
local number = require('Module:Number')


local function formatTime(timeInHundredths)
local function formatTime(timeInHundredths)
Line 38: Line 38:
         :addClass("wikitable sticky-header text-align-right align-left-1")
         :addClass("wikitable sticky-header text-align-right align-left-1")


addTableRow(tbl, "Current Experience", shared.formatnum(currentExp))
addTableRow(tbl, "Current Experience", number.formatnum(currentExp))
addTableRow(tbl, "Target Level", targetLvl)
addTableRow(tbl, "Target Level", targetLvl)
addTableRow(tbl, "Target Experience", shared.formatnum(targetExp))
addTableRow(tbl, "Target Experience", number.formatnum(targetExp))
addTableRow(tbl, "Experience Remaining", shared.formatnum(expRemaining))
addTableRow(tbl, "Experience Remaining", number.formatnum(expRemaining))
addTableRow(tbl, "Actions Left", shared.formatnum(actionsToTarget))
addTableRow(tbl, "Actions Left", number.formatnum(actionsToTarget))
addTableRow(tbl, "Time Left", formatTime(timeToTarget))
addTableRow(tbl, "Time Left", formatTime(timeToTarget))


Line 55: Line 55:
local args = frame:getParent().args
local args = frame:getParent().args
local currentExp = shared.toNumberOrDefault(args.currentExp, 0)
local currentExp = number.toNumberOrDefault(args.currentExp, 0)
local currentLvl = shared.toNumberOrDefault(args.currentLvl, 0)
local currentLvl = number.toNumberOrDefault(args.currentLvl, 0)


local targetLvl = shared.toNumberOrError(args.targetLvl)
local targetLvl = number.toNumberOrError(args.targetLvl)
local actionExp = shared.toNumberOrError(args.actionExp)
local actionExp = number.toNumberOrError(args.actionExp)
local actionTime = shared.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
2,875

edits