UnitAuraBySlot

From Warcraft Wiki
Jump to navigation Jump to search

Needs summary.

name, icon, count, debuffType, duration, expirationTime, source, isStealable,
nameplateShowPersonal, spellId, canApplyAura, isBossDebuff, castByPlayer, nameplateShowAll, timeMod, ... = UnitAuraBySlot(unit, slot)

Arguments

unit
string : UnitId
slot
number - Aura slot from UnitAuraSlots()

Returns

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

It's recommended to just use AuraUtil.ForEachAura() instead of UnitAuraBySlot() & UnitAuraSlots() as it'll "do the right thing". Note that this API is not available on Classic.

2022-08-25 | Meorawr @ Discord

With UnitAura the index parameter is a relative index into a list of auras specified by the filter parameter - so assuming zero optimizations each call effectively means that the client needs to traverse over the aura list each time counting how many auras match the given filter until the index is reached.

In reality it's likely got a basic optimization in-place that allows successive calls with the same unit/filter parameter to continue, thus bypassing that search.

UnitAuraSlots "advantage" is that it:

  1. Doesn't return just one aura slot.
  2. It returns a continuation token marking the number of slots the API can skip on the next call - basically making that above theoretical optimization explicit.

Patch changes

Dragonflight Patch 10.2.5 (2024-01-16): Deprecated. Replaced by C_UnitAuras.GetAuraDataBySlot.
Battle for Azeroth Patch 8.2.5 (2019-09-24): Added.