LibPlayerSpells-1.0

Libraries Login to Add Favorites
  • 0 Likes
  • World of Warcraft
  • 111 Monthly Downloads
  • Supports: 7.2.0
  • 14,595 Total Downloads
  • Updated Mar 31, 2017
  • Created Jan 10, 2014
  • 4 Favorites
  • Project Site
  • Release Type: Release
  • License: GNU General Public License version 3 (GPLv3)
  • Newest File: 0.6

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 dd4704f00b6f357a81fe89ae9150d347984ef48f 0.6
Author:    Rainrider <[email protected]>
Date:    Tue Mar 28 16:21:08 2017 +0200

Updated for patch 7.2

commit 9ed7159b55a8c24d7cb640875573ec76bb07d3fb
Author: Rainrider <[email protected]>
Date:   Tue Mar 28 16:17:50 2017 +0200

    Bump interface version

commit 80cd0f07e6f4186324ae1711bcde59d6379b02a4
Author: Rainrider <[email protected]>
Date:   Mon Mar 27 18:38:24 2017 +0200

    racials: add DR categories and missing Arcane Torrent ids

commit 71e93619ebd237358bd43d4eb45b5d126524d57d
Author: Rainrider <[email protected]>
Date:   Mon Mar 27 18:21:09 2017 +0200

    racials: sort and bump version numbers

    No actual changes

commit c34a98a0efddadc079cf8216f65859ec28c7a850
Author: Rainrider <[email protected]>
Date:   Mon Mar 27 18:11:04 2017 +0200

    demonhunter: bump data version

    No changes in 7.2

commit 38055d429d23f09cceb904616c3a7140e3ecf98f
Author: Rainrider <[email protected]>
Date:   Mon Mar 27 18:08:28 2017 +0200

    druid: update for 7.2

commit aaca8e357ea993c3d3adaa16fb7e2ce28b5b2dd8
Author: Rainrider <[email protected]>
Date:   Mon Mar 27 17:34:33 2017 +0200

    warrior: update for 7.2

commit 1700391dddd571ed845320d442988b2802a6f2b4
Author: Rainrider <[email protected]>
Date:   Mon Mar 27 17:12:57 2017 +0200

    warlock: update for 7.2

commit f768c746bf92d535173ccf25353329bd870884d8
Author: Rainrider <[email protected]>
Date:   Mon Mar 27 16:54:07 2017 +0200

    shaman: update for 7.2

commit 41fa471e641aef3dcc4268b13a668817e5d5b445
Author: Rainrider <[email protected]>
Date:   Mon Mar 27 16:43:32 2017 +0200

    rogue: update for 7.2

commit 461f0a5a59814b38b7814503cb82b2f9f1828361
Author: Rainrider <[email protected]>
Date:   Mon Mar 27 16:19:25 2017 +0200

    priest: update for 7.2

commit d2fbce6c5d0216203086099434fdf534627190d4
Author: Rainrider <[email protected]>
Date:   Sun Mar 26 23:21:01 2017 +0200

    paladin: update for 7.2

commit 8b6bf6d003299b5680a4524459a3aed113c72562
Author: Rainrider <[email protected]>
Date:   Sun Mar 26 22:54:55 2017 +0200

    monk: update for 7.2

commit 06c96ec29a8728c029d862eba60a9418bccfd2bc
Author: Rainrider <[email protected]>
Date:   Sun Mar 26 22:22:59 2017 +0200

    mage: update for 7.2

commit fde2bba91498ca1494cdd93fcb59643710c96d89
Author: Rainrider <[email protected]>
Date:   Sun Mar 26 22:06:25 2017 +0200

    hunter: update for 7.2

commit 26124addefdb9d3ae60709cf134c99d8fdb7d269
Author: Rainrider <[email protected]>
Date:   Sat Mar 25 16:47:58 2017 +0100

    deathknight: update for 7.2

commit 3b56ba1daa8716e2ce08f5375cd7bfcccff1d71f
Author: Rainrider <[email protected]>
Date:   Sun Feb 19 17:05:22 2017 +0100

    data: signify snares

commit 4c3bccf74b0a01a6fe340a98ccbfc488de5c485f
Author: Rainrider <[email protected]>
Date:   Sat Feb 18 01:08:36 2017 +0100

    paladin: add Inquisition (Protection Honor Talent)

commit 4aa86a18b7beb55438a212f6c8c0656e4a34e134
Author: Rainrider <[email protected]>
Date:   Sat Feb 18 01:08:01 2017 +0100

    monk: add Admonishment (BM Honor Talent)

commit 665c885581c2ef706096cfff6791bb098b687e6c
Author: Rainrider <[email protected]>
Date:   Sat Feb 18 01:07:31 2017 +0100

    druid: add Alpha Challenge (Guardian Honor Talent)

commit 3d6753a55ef3a11ae823795a0d71275ff1aac308
Author: Rainrider <[email protected]>
Date:   Sat Feb 18 01:07:12 2017 +0100

    demonhunter: add Tormentor (Vengeance Honor Talent)

commit 616b7768376d0df7c5f1b369422cab672c6e4f56
Author: Rainrider <[email protected]>
Date:   Sat Feb 18 01:06:42 2017 +0100

    death knight: add Murderous Intent (Blood Honor Talent)

commit ff1140b3f089e93009b8e6d32c5dcfe08d8216d1
Author: Rainrider <[email protected]>
Date:   Sat Feb 18 00:39:12 2017 +0100

    warrior: increment revision number

commit 94c19b4df5772722abaaac117af81a85d0e8c7bb
Author: Dox <[email protected]>
Date:   Sat Feb 18 00:21:52 2017 +0100

    warrior: add Charge (slow)

commit c59d9a601276169a7d5e7d422c682bb5feea0fe0
Author: Dox <[email protected]>
Date:   Sat Feb 18 00:20:26 2017 +0100

    warrior: add Oppressor (Protection Honor Talent)

commit c55b7025feb00c76cc51f41d08f80c23fa9012a1
Author: Dox <[email protected]>
Date:   Sat Feb 18 00:18:05 2017 +0100

    warrior: show Focused Rage on itself aswell

Addon Packs Containing This...