Skip to main content

Overview

The BuffTrigger system (BuffTrigger2) manages all “aura2” type triggers for buffs and debuffs. It provides efficient tracking of unit auras across single units, groups, and multi-target scenarios.

System API

The BuffTrigger system is accessed through the global BuffTrigger table or Private.triggerTypes["aura2"].

Add

Adds an aura, setting up internal data structures for all buff triggers.
data
table
required
The aura data configuration
local Private = select(2, ...)
local BuffTrigger = Private.triggerTypes["aura2"]
BuffTrigger:Add(auraData)

LoadDisplays

Loads and enables all buff triggers for an aura.
id
string
required
The aura identifier
BuffTrigger:LoadDisplays("MyAuraID")

UnloadDisplays

Unloads and disables all buff triggers for an aura.
id
string
required
The aura identifier
BuffTrigger:UnloadDisplays("MyAuraID")

UnloadAll

Unloads all buff triggers.
BuffTrigger:UnloadAll()

Delete

Removes all data for an aura.
id
string
required
The aura identifier to delete
BuffTrigger:Delete("MyAuraID")

Rename

Renames an aura, updating all internal references.
oldid
string
required
The current aura ID
newid
string
required
The new aura ID
BuffTrigger:Rename("OldID", "NewID")

Modernize

Updates all buff triggers in aura data to the latest format.
data
table
required
The aura data to modernize
BuffTrigger:Modernize(auraData)

Helper Functions

These functions are primarily used by WeakAuras Options.

GetOverlayInfo

Returns overlay information for a trigger.
data
table
required
The aura data
triggernum
number
required
The trigger number
overlays
table
Table of overlay configurations
local overlays = BuffTrigger:GetOverlayInfo(data, 1)

CanHaveTooltip

Determines the tooltip type for a trigger.
data
table
required
The aura data
triggernum
number
required
The trigger number
tooltipType
string
The tooltip type: “SPELL”, “UNIT_BUFF”, “UNIT_DEBUFF”, or nil
local tooltipType = BuffTrigger:CanHaveTooltip(data, 1)

GetNameAndIcon

Returns the display name and icon for a trigger.
data
table
required
The aura data
triggernum
number
required
The trigger number
name
string
The display name
icon
string
The icon texture path
local name, icon = BuffTrigger:GetNameAndIcon(data, 1)
print("Trigger:", name, icon)

GetAdditionalProperties

Returns tooltip text for additional properties.
data
table
required
The aura data
triggernum
number
required
The trigger number
text
string
Formatted tooltip text
local tooltip = BuffTrigger:GetAdditionalProperties(data, 1)

GetTriggerConditions

Returns available conditions for a trigger.
data
table
required
The aura data
triggernum
number
required
The trigger number
conditions
table
Array of condition definitions
local conditions = BuffTrigger:GetTriggerConditions(data, 1)
for i, condition in ipairs(conditions) do
  print(condition.display, condition.type)
end

Match Data Structure

Internal match data structure for tracked auras.
name
string
Aura name
icon
string
Aura icon
stacks
number
Stack count
debuffClass
string
Debuff type: “magic”, “curse”, “disease”, “poison”, “enrage”, “none”
duration
number
Aura duration
expirationTime
number
When the aura expires
unitCaster
string
Unit ID of the caster
casterName
string
Name of the caster
spellId
number
Spell ID of the aura
unit
string
Unit ID that has the aura
unitName
string
Name of the unit
index
number
Aura index from UnitAura
filter
string
Aura filter: “HELPFUL” or “HARMFUL”

Trigger Configuration

Buff trigger configuration options.

Basic Settings

type
string
Must be “aura2” for buff triggers
unit
string
Unit to check: “player”, “target”, “group”, “raid”, etc.
debuffType
string
Filter by debuff type: “HELPFUL”, “HARMFUL”, or “BOTH”

Aura Matching

auranames
table
Array of aura names to match
useName
boolean
Whether to match by name
auraspellids
table
Array of spell IDs to match
useSpellId
boolean
Whether to match by spell ID

Caster Filtering

ownOnly
boolean
Only match auras cast by player/pet
unitCaster
string
Match specific caster unit

Group Options

matchesShowOn
string
Display mode: “showOnActive”, “showOnMissing”, “showOnMatches”
showClones
boolean
Show one clone per match
useMatch_count
boolean
Filter by match count
match_count
number
Minimum match count
match_countOperator
string
Comparison operator: >=, ==, <=

Example Usage

Single Unit Buff Check

trigger = {
  type = "aura2",
  unit = "player",
  debuffType = "HELPFUL",
  useName = true,
  auranames = { "Power Word: Fortitude" },
  matchesShowOn = "showOnActive"
}

Group Missing Buff

trigger = {
  type = "aura2",
  unit = "group",
  debuffType = "HELPFUL",
  useSpellId = true,
  auraspellids = { 48161 }, -- Power Word: Fortitude rank 8
  matchesShowOn = "showOnMissing",
  useMatch_count = true,
  match_count = 1,
  match_countOperator = ">="
}

Show Clone Per Affected Unit

trigger = {
  type = "aura2",
  unit = "group",
  debuffType = "HARMFUL",
  useSpellId = true,
  auraspellids = { 28622 }, -- Web Wrap
  showClones = true,
  matchesShowOn = "showOnActive"
}

See Also

Build docs developers (and LLMs) love