Implement ore camper for mobs

This commit is contained in:
2024-11-08 00:38:33 +01:00
parent f7c91862a0
commit e2113dd722
2 changed files with 44 additions and 1 deletions

View File

@@ -0,0 +1,40 @@
---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

View File

@@ -1,2 +1,5 @@
aura_env.cooldown = 205 aura_env.cooldown = 300
aura_env.depositIterator = {} aura_env.depositIterator = {}
aura_env.lastEventTimes = {}
aura_env.throttle = 0.5
aura_env.lastEvent = 0