Implement ore camper for mobs
This commit is contained in:
40
FreshShit/OreCamper/event2.lua
Normal file
40
FreshShit/OreCamper/event2.lua
Normal 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
|
||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user