Encounter Manager API Reference
This documentation covers the Encounter Manager API available.
Overview
The Encounter Manager provides a framework for:
- Automatically tracking encounter start/end events
- Managing boss unit tracking
- Handling encounter-specific timing
- Executing custom callbacks during encounters
- Regular pulse updates during encounters
Basic Usage
-- Register an encounter
Aurora.EncounterManager.Encounters = {
[2816] = {
name = "Kyrioss",
timing = true,
track_bosses = true,
callback = function(encounter)
print("Encounter started:", encounter.name)
end,
-- Pulse callback called every updateRate seconds
pulse = function(encounter, deltaTime)
for guid, unit in pairs(encounter.bossUnits) do
if unit.exists then
local pos = unit.position
print(string.format("%s: HP: %.1f%%, Pos: %.1f, %.1f, %.1f, Casting: %s",
unit.name,
unit.hp,
pos.x, pos.y, pos.z,
unit.casting and unit.casting or "None"
))
end
end
if encounter.elapsedTime >= 60 then
print("One minute into the fight!")
end
end
}
}
Encounter Registration
Each encounter is registered with a configuration table that defines its behavior:
{
name = string, -- Encounter name
timing = boolean, -- Enable timing tracking
track_bosses = boolean, -- Enable boss unit tracking
callback = function, -- Called when encounter starts
pulse = function -- Called periodically during encounter
}
Encounter Configuration Options
name
: String identifier for the encountertiming
: When true, tracks elapsed timetrack_bosses
: When true, automatically tracks boss unitscallback
: Function called when encounter startspulse
: Function called every update interval
Encounter Info Structure
The encounter info object provided to callbacks contains:
---@class EncounterInfo
{
id = number, -- Encounter ID
name = string, -- Encounter name
difficulty = number, -- Difficulty ID
groupSize = number, -- Group size
startTime = number, -- When encounter started
elapsedTime = number, -- Time since start
bossUnits = table, -- Table of boss Unit objects
isActive = boolean, -- Whether encounter is active
lastPulse = number, -- Last pulse time
deltaTime = number -- Time since last pulse
}
API Methods
Getting Encounter Information
-- Get current encounter info
local encounter = Aurora.EncounterManager:GetCurrentEncounter()
-- Get elapsed time of current encounter
local time = Aurora.EncounterManager:GetEncounterElapsedTime()
-- Get active boss units
local bosses = Aurora.EncounterManager:GetActiveBossUnits()
Debug Mode
The Encounter Manager includes a debug mode that can be enabled for troubleshooting:
-- Enable debug mode
Aurora.EncounterManager.debug = true
-- Disable debug mode
Aurora.EncounterManager.debug = false
Update Rate Configuration
You can adjust how frequently the pulse callback is called:
-- Set update rate to 0.5 seconds
Aurora.EncounterManager.updateRate = 0.5