Download
(6Kb)
Download
Updated: 07-15-18 01:03 PM
Compatibility:
Battle for Azeroth (8.0.1)
Updated:07-15-18 01:03 PM
Created:04-26-18 09:48 PM
Downloads:1,080
Favorites:4
MD5:

LibAuras

Version: 1.0-BETAr1
by: Falcon213 [More]

There is once again a function in the API to retrieve auras by name (AuraUtil.FindAuraByName), which I recommend instead of this library.

Since 8.0, the lua API no longer allows calling UnitAura(), UnitBuff, or UnitDebuff() with the name of an aura. Instead of having each addon loop through every buff or debuff every time they just want to call one, LibAuras only does so once (for each UNIT_AURA event), and shares that data across addons.

Usage

LibAuras has a very familiar interface. Ex:

Lua Code:
  1. local LibAuras = LibStub:GetLibrary("LibAuras")
  2. local name, _, count = LibAuras:UnitAura("player", "buff name", "HELPFUL")

API

:UnitAura(unitId, spellIdOrName[, filter]) returns name, icon, count, debuffType, duration, expirationTime, unitCaster, canStealOrPurge, nameplateShowPersonal, spellId, canApplyAura, isBossDebuff, isCastByPlayer, nameplateShowAll, timeMod, value1, value2, value3

:UnitBuff and :UnitDebuff work exactly the same, except they automatically add the "HELPFUL" or "HARMFUL" filters, respectively.

There are two major differences between these and the base UnitAura() family of functions:
  • LibAuras allows you to specify a spellId instead of an aura name
  • There is no rank field returned (this also applies to the base UnitAura() starting in 8.0)

Caveats

LibAuras currently only supports the "HELPFUL", "HARMFUL", and "PLAYER" filters.

Optional Files (0)


Post A Reply Comment Options
Unread 08-02-18, 06:17 AM  
Lightfire
A Kobold Labourer

Forum posts: 0
File comments: 1
Uploads: 0
Hey, your idea is great.

What happens when auras are dispelled or cancelled?
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: