GetPlayerAuraBySpellID

From Warcraft Wiki
Jump to navigation Jump to search

Returns an active buff/debuff by spell ID on the player character.

name, icon, count, dispelType, duration, expirationTime, source, isStealable, nameplateShowPersonal,
spellId, canApplyAura, isBossDebuff, castByPlayer, nameplateShowAll, timeMod, ...
    = GetPlayerAuraBySpellID(spellID)

Arguments

spellID
number

Returns

Returns nil if there is no active aura with that spell ID.
1. name
string - The localized name of the aura, otherwise nil if there is no aura for the index.
2. icon
number : FileID - The icon texture.
3. count
number - The amount of stacks, otherwise 0.
4. dispelType
string? - The locale-independent magic type of the aura: Curse, Disease, Magic, Poison, otherwise nil.
5. duration
number - The full duration of the aura in seconds.
6. expirationTime
number - Time the aura expires compared to GetTime(), e.g. to get the remaining duration: expirationtime - GetTime()
7. source
string : UnitId - The unit that applied the aura.
8. isStealable
boolean - If the aura may be stolen.
9. nameplateShowPersonal
boolean - If the aura should be shown on the player/pet/vehicle nameplate.
10. spellId
number - The spell ID for e.g. GetSpellInfo()
11. canApplyAura
boolean - If the player can apply the aura.
12. isBossDebuff
boolean - If the aura was cast by a boss.
13. castByPlayer
boolean - If the aura was applied by a player.
14. nameplateShowAll
boolean - If the aura should be shown on nameplates.
15. timeMod
number - The scaling factor used for displaying time left.
16. shouldConsolidate (WoW Icon update.pngWrath-Logo-Small.png)
boolean - Whether to consolidate auras, only exists in Classic Era/Wrath.
...
Variable returns - Some auras return additional values that typically correspond to something shown in the tooltip, such as the remaining strength of an absorption effect.

Details

  • The advantage over UnitAura() is this function does not require iterating over a list of auras for a specific Spell ID.
  • If two spells of the same ID are active, then the first applied one will be returned until it expires and then the second applied one.

Example

Returns if the player has the Power Word: Fortitude buff

/dump GetPlayerAuraBySpellID(21562)

Patch changes

Shadowlands Patch 9.2.5 (2022-05-31): The GetPlayerAuraBySpellID() API no longer returns information about hidden auras.[1]
Shadowlands Patch 9.0.1 (2020-10-13): Added.