LibPlayerSpells-1.0

Libraries Login to Add Favorites
  • 0 Likes
  • World of Warcraft
  • 92 Monthly Downloads
  • Supports: 7.2.5
  • 16,477 Total Downloads
  • Updated Sep 4, 2017
  • Created Jan 10, 2014
  • 4 Favorites
  • Project Site
  • Release Type: Release
  • License: GNU General Public License version 3 (GPLv3)
  • Newest File: 0.7

About LibPlayerSpells-1.0

LibPlayerSpells-1.0

Build Status Gitter chat

LibPlayerSpells-1.0 is a library providing data about the spells of the twelve character classes in World of Warcraft. It also includes additional spells derived from racial traits and other sources. The word "spells" is used here in the general sense; it includes active skills as well as passive spells that are found in the players' spellbook. Buffs and debuffs that are applied by the player from other sources are also covered.

This library is born from the need to centralize similar data used in several addons to reduce the maintenance cost and to have a better consistency across those addons.

It provides answers to questions like:
  • Does this spell have a cooldown?
  • Does this spell apply one or several buff(s) or debuff(s)?
  • Is this spell a survival cooldown, or used for DPS?
  • Does this spell regenerate mana or some other resource?
  • What are the survival buffs of all the classes?
  • Which spell interrupt abilities are available?

Each class has his own data file that can be updated separately from the main code.

Supported classes & specs

Not all classes and specializations are 100% supported yet. However, most interrupts, dispels, and survival cooldowns are complete.

If LibPlayerSpells is missing something specific from your class please file a detailed bug on Github or contribute to the project yourself if you are feeling brave! In the second case, be sure to read the contribution guidelines.

Usage

Copy the library files in your addon and list the lib.xml file in the TOC file.

LibPlayerSpells-1.0 uses LibStub: local LibPlayerSpells = LibStub('LibPlayerSpells-1.0')

Querying information from a spell

You can then obtain information about a given spell with GetSpellInfo: local flags, providers, modifiedSpells[, moreFlags] = LibPlayerSpells:GetSpellinfo(spellId) Where:

  • spellId is the numerical spell identifier.
  • flags is a bitfield containing data about the spells (see below).
  • providers is the identifier (or a table of) identifier(s) of the spell(s) to; said otherwise, if the provider is not found in the player's spellbook, the given spell is unavailable. For example, the provider spell can be a passive spell given by a talent.
  • modifiedSpells is the (or a table of) identifier(s) of the spell(s) affected by the given spells.
  • If the given spell is a special case (see below), moreFlags contains another bitfield.

Querying the spell database

You can iterate the database, looking for certain spells, using IterateSpells: for spellId, flags, providers, modifiedSpells, moreFlags in LibPlayerSpells:IterateSpells(oneOfFlags, requiredFlags, rejectedFlags) do -- Do something with the loot end flags, providers, modifiedSpells, moreFlags have the same meaning as the values returned by GetSpellinfo. spellId is obviously the numerical identifier of the current spell.

The three method arguments are used to build a filter. They are bitmask specifications. They can be passed as an numerical bitmask computed using bit.bor and library constants, or a string containing the flags separated by white spaces or commas. For example, bit.bor(LibPlayerSpells.constants.HUNTER, LibPlayerSpells.constants.BURST) is the same bitmask as "HUNTER BURST".

IterateSpells lists all spells that:

  • has at least one of the flags listed by oneOfFlags
  • and has all flags listed by requiredFlags,
  • and has none of the flags in rejectedFlags.

If a bitmask is empty or not provided, the corresponding condition is ignored. With no arguments, all spells are listed.

Example: -- Iterate through spells that have a cooldown, are/apply an aura and are either survival or mana-regenerating skills. for spellId, flags, providers, modifiedSpells, moreFlags in LibPlayerSpells:IterateSpells("SURVIVAL REGEN_MANA", "AURA COOLDOWN") do -- Do something with it ! end

Flags

Most spell information is stored in a bitfield to compact storage and easily test or filter spells. The bit value constants are available in the LibPlayerSpells.constants table.

The presence of a specific flag can be tested this way: if bit.band(flags, LibPlayerSpells.constants.AURA) ~= 0 then -- This spell is an aura, do something meaningful with it. end

However, the library provides a way to easily build flag tests.

Special spell types

These flags indicate special spells, that (will) have additional data.

  • CROWD_CTRL: this is a crowd-control spell; additional data is a bitfield indicating the diminishing returns category (disorient, taunt, etc.).
  • DISPEL: this spell can dispel either allies' debuffs or enemies' buffs; no additional data yet.
Crowd control flags

These flags are used in the additional data for crowd control spells and indicate the diminishing returns category a spell belongs to. While INTERRUPT and KNOCKBACK are technically DR categories themselves, they do not always have an associated aura and are not traceable through the UNIT_AURA event. Thus they are just ordinary flags in the spell bitmask.

  • DISORIENT
  • INCAPACITATE
  • ROOT
  • STUN
  • TAUNT

Spell sources

These flags indicate the source of the spell. The constants are self-explanatory: DEATHKNIGHT, DRUID, HUNTER, MAGE, MONK, PALADIN, PRIEST, ROGUE, SHAMAN, WARLOCK, WARRIOR, RACIAL.

Targeting

These flags hints about the targeting mechanism of the spell. They are exclusive most of the time.

  • HELPFUL: The spell can be cast on any ally, including the player and his pet.
  • HARMFUL: The spell can be cast on any enemy.
  • PERSONAL: The spell automatically targets the player.
  • PET: The spell automatically targets the player's pet.

Miscellaneous

  • AURA: The spell applies (or is) a buff on allies, or a debuff on enemies.
  • UNIQUE_AURA: A given character can have only one instance of this (de)buff at a time, even if several players cast the same spell on it, e.g. Hunter's Mark.
  • COOLDOWN: This spell has a meaningful cooldown.
  • SURVIVAL: This spell is considered a survival skill.
  • BURST: This spell is considered a burst skill (either damaging or healing).
  • POWER_REGEN: This spell allows the target to recharge some kind of alternative resource e.g. Energizing Brew
  • IMPORTANT: An important spell the player should react to.
  • INVERT_AURA: The aura logic of this spell is inverted. It applies a debuff on allies or a buff on enemies (this case has yet to be found), e.g. the Weakened Soul applied by Power Word: Shield.

Acknowledgements

Thanks to ckaotik, Rainrider, mjmurray88, arcadepro for their testing and contributions to the class spells.

License

LibPlayerSpells-1.0 is licensed using GPL v3. This means that any addon using it must have a compatible license (see there).

tag 4b7c4dbb0f252cbd9b7b4ef331314a4df5c9479e 0.7
Author:    Rainrider <rainride[email protected]>
Date:    Wed Jun 14 10:17:16 2017 +0200

Support for patch 7.2.5

commit 6d9fbbdb6d439779987ba3185e1e4f6de045e701
Author: Rainrider <[email protected]>
Date:   Sun Jun 4 19:16:31 2017 +0200

    demonhunter: update for 7.2.5

commit 879d687e68e873af47a2e562b981f7b167bf59e6
Author: Rainrider <[email protected]>
Date:   Sun Jun 4 18:57:47 2017 +0200

    deathknight: update for 7.2.5

commit 7a73ba7e3b6de82572bd8672dc6f15cc48ddc5aa
Author: Rainrider <[email protected]>
Date:   Sun Jun 4 18:48:54 2017 +0200

    warrior: update for 7.2.5

commit 0f1d155ba395f5c11861a7f3960850a797f6ffb1
Author: Rainrider <[email protected]>
Date:   Sun Jun 4 18:33:46 2017 +0200

    warlock: update for 7.2.5

commit 0671eeab732abec4034466f2fea012bd577ac4e6
Author: Rainrider <[email protected]>
Date:   Sun Jun 4 16:40:38 2017 +0200

    hunter: fix Scorpid Sting

commit 6da41435654ed761331904a7e1b58c580527c37b
Author: Rainrider <[email protected]>
Date:   Sun Jun 4 16:34:32 2017 +0200

    shaman: update for 7.2.5

commit 77a3cb8ef8927399f02ab26bb9afdc073db1dc9d
Author: Rainrider <[email protected]>
Date:   Sun Jun 4 16:19:00 2017 +0200

    rogue: update for 7.2.5

commit 1be50d0260c3d5b7c3b41c39f762ff95aab53f6b
Author: Rainrider <[email protected]>
Date:   Sun Jun 4 15:07:59 2017 +0200

    priest: update for 7.2.5

commit 0856bfc8ebe871691f96b3eac42eab631b457b30
Author: Rainrider <[email protected]>
Date:   Sun Jun 4 14:40:58 2017 +0200

    monk: update for 7.2.5

commit 65bffcd6a1794f5a8a318e3f78d63568da8869fa
Author: Rainrider <[email protected]>
Date:   Sun Jun 4 14:07:42 2017 +0200

    mage: rename Flurry (frozen) to Winter's Chill

commit 4d3f61bbad03e6c6eae9c2a831b4bbf7dfec7071
Author: Rainrider <[email protected]>
Date:   Sun Jun 4 13:37:51 2017 +0200

    druid: update for 7.2.5

commit 6c58236182a4ef0f63f0518223512043cf65290c
Author: Rainrider <[email protected]>
Date:   Sun Jun 4 12:36:41 2017 +0200

    Revert "CI: triggers a build of AdiButtonAuras on success."

    This reverts commit 4e228cce1d668e677aeb00ff7a0c5f5357523dc5.
    It does not seem to work. Curse returns a 302

commit 320ba83285ac3797e49fa74a13491aa2b974a6f0
Author: Rainrider <[email protected]>
Date:   Thu Apr 13 18:56:55 2017 +0200

    hunter: fix Viper Sting

commit 951175d1c2509ead02647488c4fef8ccc3baba4f
Author: Adirelle <[email protected]>
Date:   Sun Apr 2 16:50:48 2017 +0200

    CI: corrected the deploy script.

commit 4e228cce1d668e677aeb00ff7a0c5f5357523dc5
Author: Adirelle <[email protected]>
Date:   Sun Apr 2 16:45:38 2017 +0200

    CI: triggers a build of AdiButtonAuras on success.

commit cf73d9cf37a5ba79604e3da433635e6dc9a7a800
Author: Rainrider <[email protected]>
Date:   Sat Apr 1 01:10:50 2017 +0200

    druid: Wax and Wane affect Sunfire too

    Hotfix from March 29

Addon Packs Containing This...