Refactor orecamper to be a bit more accurate
This commit is contained in:
@@ -16,24 +16,21 @@ function(allstates, e, ...)
|
||||
if aura_env.lastEvent > 0 and currentTime - aura_env.lastEvent < aura_env.throttle then return end
|
||||
aura_env.lastEvent = currentTime
|
||||
|
||||
print("Current time: " .. currentTime)
|
||||
local lastEventTime = aura_env.lastEventTimes[targetGUID] or currentTime
|
||||
print("Last event time: " .. lastEventTime)
|
||||
local timeSinceLastEvent = currentTime - lastEventTime
|
||||
print("Time since last event: " .. timeSinceLastEvent)
|
||||
|
||||
local dynamicCooldown = math.min(300, timeSinceLastEvent)
|
||||
local cooldown = timeSinceLastEvent
|
||||
if cooldown == 0 then cooldown = aura_env.cooldown end
|
||||
local state = {
|
||||
changed = true,
|
||||
show = true,
|
||||
progressType = "timed",
|
||||
autoHide = true,
|
||||
duration = dynamicCooldown,
|
||||
expirationTime = currentTime + dynamicCooldown,
|
||||
duration = cooldown,
|
||||
expirationTime = currentTime + cooldown,
|
||||
name = string.format("%s", targetName),
|
||||
}
|
||||
|
||||
print(string.format("Setting time for %s to %d", targetGUID, currentTime))
|
||||
aura_env.lastEventTimes[targetGUID] = currentTime
|
||||
allstates[targetGUID] = state
|
||||
return true
|
||||
|
@@ -1,4 +1,4 @@
|
||||
aura_env.cooldown = 300
|
||||
aura_env.cooldown = 240
|
||||
aura_env.depositIterator = {}
|
||||
aura_env.lastEventTimes = {}
|
||||
aura_env.throttle = 0.5
|
||||
|
Reference in New Issue
Block a user