Module:NoitaUtils

local p = {} local framesPerSecond = 60

function getUIHealthOrDamageValue(internalValue) return 25 * internalValue end

function formatNumeric(number) return ("%.5g"):format(tonumber(number)) end

function p.getEnemyGoldValue(frame) local hpValue = frame.args["hp"] local internalHpValue = tonumber(hpValue) / 25 return formatNumeric(math.max(1, math.floor(internalHpValue)) * 10) end

function p.getUIDamageValue(frame) local internalDamageValue = tonumber(frame.args["damage"]) return formatNumeric(getUIHealthOrDamageValue(internalDamageValue)) end

function p.getUIHealthValue(frame) local internalHPValue = tonumber(frame.args["hp"]) return formatNumeric(getUIHealthOrDamageValue(internalHPValue)) end

function p.getTimeValue(frame) local timeInFrames = tonumber(frame.args["frames"]) return formatNumeric(timeInFrames / framesPerSecond) end

return p