Aura Tracking
This outlines how to use the Aura Tracking system to monitor auras across multiple units.
TrackAuras
Aurora.TrackAuras(auraIds: string|number|string[]|number[], callback: function) -> function
Tracks specific auras across all units and calls your callback when those auras are added, updated, or removed.
Parameters:
auraIds
- Single spell ID/name or an array of spell IDs/names to trackcallback
- Function called with parameters:unit
- The unit that has the auraaura
- The aura object with all propertiesevent
- Event type ("ADD_OR_UPDATE" or "REMOVE")
Returns:
- A function that when called will unregister the tracker
Basic Usage
-- Track a single aura by ID
local unregisterTracker = Aurora.TrackAuras(462854, function(unit, aura, event)
if event == "ADD_OR_UPDATE" then
print("Aura detected:", aura.name, "on", unit.name)
elseif event == "REMOVE" then
print("Aura removed:", aura.name, "from", unit.name)
end
end)
-- Track multiple auras
local aurasToTrack = {
462854, -- First aura ID
123456, -- Second aura ID
"Power Word: Shield" -- Aura by name
}
local unregisterTracker = Aurora.TrackAuras(aurasToTrack, function(unit, aura, event)
-- Handler code
end)
-- When you want to stop tracking:
unregisterTracker()
Advanced Usage
-- Track important debuffs and count affected units
local debuffCount = 0
local affectedUnits = {}
local unregisterTracker = Aurora.TrackAuras({12345, 67890}, function(unit, aura, event)
if event == "ADD_OR_UPDATE" and not affectedUnits[unit.guid] then
affectedUnits[unit.guid] = true
debuffCount = debuffCount + 1
print("Units affected by tracked debuffs:", debuffCount)
elseif event == "REMOVE" then
affectedUnits[unit.guid] = nil
debuffCount = debuffCount - 1
end
end)
Event Types
The callback receives one of these event types:
- ADD_OR_UPDATE - Called when an aura is first detected or when it updates
- REMOVE - Called when an aura is removed from a unit