UnitAura

From Wowpedia
Jump to: navigation, search

Retrieve info about a certain buff on a certain unit.

name, icon, count, debuffType, duration, expirationTime, source, isStealable, 
  nameplateShowPersonal, spellId, canApplyAura, isBossDebuff, castByPlayer, nameplateShowAll, timeMod, ...
= UnitAura("unit", index[, "filter"])

Arguments

unit 
String (unitId) - unit whose auras to query.
index 
Number or String - index
filter 
String (optional) - list of filters, separated by spaces or pipes. "HELPFUL" by default. The following filters are available:
HELPFUL - buffs.
HARMFUL - debuffs.
PLAYER - auras that were applied by the player.
RAID - auras that can be applied (if HELPFUL) or dispelled (if HARMFUL) by the player.
CANCELABLE - buffs that can be removed (such as by right-clicking or using the /cancelaura command)
NOT_CANCELABLE - buffs that cannot be removed
INCLUDE_NAME_PLATE_ONLY

Returns

see Aura Type

1. name 
String - The localized name of the aura, or nil if no aura was found at the specified index. This is the name shown in yellow when you mouse over the aura's icon.
2. icon 
Number (fileDataID) - Identifier of the aura's icon for use with SetTexture()
3. count 
Number - The number of stacks, or 0 for a non-stackable aura
4. debuffType 
String - The magic type of the aura
5. duration 
Number - The full duration of the aura in seconds
6. expirationTime 
Number - Time the aura expires (compare to GetTime())
7. source 
String - The unit that cast the aura
8. isStealable 
Boolean - true if it the aura may be stolen (see [Spellsteal])
9. nameplateShowPersonal 
Boolean - true if the aura should be shown on the player/pet/vehicle nameplate
10. spellId 
Number - unique ID of the aura for use with the spell API such as GetSpellInfo()
11. canApplyAura 
Boolean - true if the player can apply the aura (not necessarily that the player did apply it, just that the player can).
12. isBossDebuff 
Boolean - true if the aura was cast by a boss.
13. castByPlayer 
Boolean - true if the aura was applied by a player.
14. nameplateShowAll 
Boolean - true if the aura should be shown on nameplates
15. timeMod 
Number - scaling factor used for displaying time left
16 and subsequent. ... 
Additional values, documented as up to 11 but possibly more, based on the specifics of the aura in question.

Examples

UnitAura("target", 1) 
the first buff on the target
UnitAura("target", 1, "PLAYER HARMFUL") 
the first debuff cast by the player on the target

The following macro prints the names of any stealable buffs on the current target, or a notice if nothing is stealable:

/run local y,n,s,_ for i=1,40 do n,_,_,_,_,_,_,s=UnitAura("target",i)if s then print(n.." on target, steal it!")y=1 end end if y~=1 then print("No stealable buffs.")end

Notes

  • Spell ranks were removed in Patch 4.0 (Cataclysm), so the rank argument to this function is largely useless today.
  • Some filters are mutually exclusive. Using "HELPFUL HARMFUL" together will return no results, since no aura can be both a buff and a debuff at the same time. Using "CANCELABLE NOT_CANCELABLE" will also return no results, since no buff can be both removable and unremovable.
  • The debuffType return value is not localized.
  • The UnitBuff function is an alias for using UnitAura with the "HELPFUL" filter. The UnitDebuff function is an alias for using UnitAura with the "HARMFUL" filter. Both aliases will ignore the "HELPFUL" and "HARMFUL" filters, but will accept other filters.

Patch changes

See also

External links