41 lines
1.4 KiB
Lua
41 lines
1.4 KiB
Lua
---COMBAT_LOG_EVENT_UNFILTERED
|
|
function(allstates, e, ...)
|
|
local source, err = CLEUParser.GetSourceName(...)
|
|
if err then return end
|
|
if source ~= UnitName("player") then return end
|
|
local targetGUID, err = CLEUParser.GetDestGUID(...)
|
|
if err then return end
|
|
local targetName, err = CLEUParser.GetDestName(...)
|
|
if err then return end
|
|
--if target ~= "Valkor" then return end
|
|
local overkill, err = CLEUParser.GetOverkill(...)
|
|
if err then return end
|
|
if overkill <= 0 then return end
|
|
|
|
local currentTime = GetTime()
|
|
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 state = {
|
|
changed = true,
|
|
show = true,
|
|
progressType = "timed",
|
|
autoHide = true,
|
|
duration = dynamicCooldown,
|
|
expirationTime = currentTime + dynamicCooldown,
|
|
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
|
|
end
|