Get an Epic Experience with Premium

LibPlayerSpells-1.0

Libraries Login to Add Favorites
  • 0 Likes
  • World of Warcraft
  • 57 Monthly Downloads
  • Supports: 5.4.2
  • 616 Total Downloads
  • Updated 01/10/2014
  • Created 01/10/2014
  • 0 Favorites
  • Project Site
  • Release Type: Release
  • License: GNU General Public License version 3 (GPLv3)
  • Newest File: 0.1
or

About LibPlayerSpells-1.0

LibPlayerSpells-1.0

LibPlayerSpells-1.0 is a library providing data about the spells of the 11 character classes. It also includes data about racial and tradeskill spells. The word “spells” is used here in the general sense, it includes active skills as well as passive spells that are found in player spellbooks, but also buffs and debuffs that are not in spellbooks but are applied somehow by player characters.

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 these:

  • Does this spell has a cooldown ?
  • Does this spell applies one or several buff(s) or debuff(s) ? Which ?
  • Is this spell a survival cooldown, or a burst one ?
  • Does this spell regenerate mana or some other power resource ?
  • Is this spell a “raid” buff ?
  • What are the survival buffs of all classes ?
  • What are the interrupting spells of said class ?

Each class has his own data file and can be upgraded separately.

Supported classes/specs

Not all classes and specializations are fully supported yet. Most interrupts, dispels, survival cooldowns and raid buffs are in, but detailled spells are missing for several classes.

Contributions are welcome !

Usage

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

LibPlayerSpells-1.0 uses LibStub, so you can get the library list this:

local LibPlayerSpells = LibStub('LibPlayerSpells-1.0')

Querying one spell information

Then you can get 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) affetcted by the given spells.
  • if the given spell is a special case (see below), moreFlags contains another bitfield.

Querying the spell database

One 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 an a string containing the flags separated by whitespaces 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 an bitmask is empty or not provided, the correspoding 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 are stored in a bitfield, in order to have a compact storage and to 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.

  • RAIDBUFF: this is a raid buff; additional data is a bitfield indicating the provided buffs (spell haste, critical strike, ...).
  • CROWD_CTL: this is a crowd-control spell; no additional data yet.
  • INTERRUPT: this spell can interrupt spell casts; no additional data yet.
  • DISPEL: this spell can dispel either allies’ debuffs or enemies’ buffs; no additional data yet.
Raid buff flags

These flags are used in the additional data for raids buffs.

  • STATS: strengh, agility and intellect,
  • STAMINA: stamina,
  • ATK_POWER: attack power,
  • ATK_SPEED: attack speed,
  • SPL_POWER: spell power,
  • SPL_HASTE: spell haste,
  • CRITICAL: critical strike,
  • MASTERY: mastery bonus,
  • BURST_HASTE: burst haste (e.g. Bloodlust/Heroism & al).

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, TRADESKILL.

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.

Miscellanous

  • 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, that might worths reminding the player.
  • SURVIVAL: This spell is considered a survival skill.
  • BURST: This spell is considered a burst skill (either damaging or healing).
  • MANA_REGEN: This spell allows it target to recharge his/her mana; e.g. Innervate.
  • POWER_REGEN: This spell allows it target to recharge some kind of power, but mana, e.g. Fervor, Energizing Brew, ...
  • IMPORTANT: 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.

Acknowledgment

Thanks to ckaotik and Rainrider for testing and their contributons to 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 0.1
96e02ff89dbdf9919e93947cdb9699a82ec00f7f
Guillaume Perréal <guillaume.perreal@irstea.fr>
2014-01-10 14:39:18 +0100

Have the wowace packager issue at least one version.

--------------------

Guillaume Perréal:
    - More README updates.
    - README updated.
    - Preparing for the wowace.com packager and documenter.
    - Added a README.
Adirelle:
    - Shaman: updated some totems and Feral Spirit.
    See #1.
    - Druid: fixed Savage Defense buff id.
    Fixes https://github.com/Adirelle/AdiButtonAuras/issues/8.
Guillaume Perréal:
    - Monk: fixed Ring of Peace targeting and Rising Sun Kick id.
    - Monk: Dizzying Haze debuff has several ids.
Adirelle:
    - Shaman: added several spells for elemental spec.
    Code provided by ckaotik, see #1.
    - Hunter: Serpent Sting debuff has a different id for Survival.
Guillaume Perréal:
    - Druid: Omen of Clarity has different ids for feral and restoration.
Adirelle:
    - Hunter: Multi-Shot gives Beast Cleave to BM hunters.
    - Monk: added a second identifier for Legacy of the Emperor.
Guillaume Perréal:
    - Typos.
    - Monk: Power Strikes modifies Rushing Jade Wind.
    - Monk: rewrote definitions using nested tables.
    - Listed interrupts and dispels for all classes.
    - Core: added three new spell types: crowd-control, interrupts and dispels.
    - Priest: link Weakened Soul with Power Word: Shield.
    - Core: added a new flag, INVERT_AURA, to indicate that an aura is a debuff on allies or a buff on enemies.
    - Priest: added a bunch of aura and procs.
Adirelle:
    - Added raid buffs for all classes.
    - Monk: added missing talent cooldowns and glyphed mana tea.
Guillaume Perréal:
    - Priest: added most cooldowns.
    - Added survival cooldowns for DK, mage, paladin, rogue, warrior and priest.
Adirelle:
    - Warlock: typo.
    - Warlock: Nether Ward does not exist anymore.
    - Warlock: first version.
Guillaume Perréal:
    - Core: added an method to retrieve the list of raid buff types.
    - Druid: refactored definition using nested tables.
    - Core: properly propagate flags to nested tables.
    - Hunter: refactored using nested tables.
    - Core: allow [spellId] = true definitions.
    - Hunter: added raid buffs.
    - Core: typo, MASTER => MASTERY.
    - Druid, Monk: added raid buffs.
    - Core: added a raid buffs.
    Raid buffs are denoted by a bit in the flags. The type of raid buffs is stored in a separate table.
    - Racials: updated to use the new complex definition feature.
    - Core: allows more complex spell defintiion, with nested tables and spell-specific flags.
    - Core: filterIterator => FilterIterator.
    - Core: fixed how ValidateSpellId handles nested tables.
    - Core: fixed local function names.
    - Core: Luadoc updates.
    - Core: prefixes private attribute names with "__".
    - Core: moved spell categories to their own tables so .spells only list all spells.
Adirelle:
    - Druid: added Mastery: Harmony.
    - Druid: fixed Typhoon and Nature's Swiftness.
    - Core: sanitized usage of globals.
    - Druid: typo.
Guillaume Perréal:
    - "PROC" flag didn't exist, added "IMPORTANT" instead.
    - Monk: fixed Energizing Brew and added Mana Tea.
    - Hunter: fixed Fervor and Misdirection flags.
    - Druid: first version.
    - Core: added two new flags: MANA_REGEN and POWER_REGEN.
    - Core: fixed :GetFlagTester().
    - Core: use 0 as the mask for false or empty filters.
Adirelle:
    - Hunter: added Kill Shot, Lock and Load, and Bestial Wrath.
    - Core: accept "UNIQUE_AURA".
    - Hunter: added a bunch of spells !
    - Core: added a "PET" target.
    - Added stubs for all classes.
    - Monk: updated providers and added modifiers.
    - Core: provider spell is the modified spell by default.
    - Core: allows to list several modified spells in the modifier table.
    - Core: moved consitency checks after the spell list has been flattened.
    - Typo.
    - Core: added some consistency checks.
    - Core: renamed "aliases" to "providers" and added modifiers.
    - Core: GetVersionInfo(category) now returns (version, interface, minor).
    - Core: minor comment and whitespace changes.
    - Core: reordered the constants.
    - Core: changed the one-uppercase-letter upvalue names to real names.
Guillaume Perréal:
    - Monk: added aura to spell mapping.
    - Core: added an mapping table to link auras to actual spells of the spellobook.
    - Core: removed GetSpellList, made BuildTester public as GetFlagTester.
    - Core: changed the filtering API.
    - Core: check spell existence.
    - Tradeskill: removed obsolete Lifeblood id.
    - Monk: fixed Guard id.
    - Added proper filter for racials and tradeskills.
    - Removed a debug statement.
    - Luadoc updates.
    - Added monks' spells.
    - Added a method to get a list of spells.
    And refactored the internals.
    - Typos.
    - No LoadOnDemand until the library is stable.
    - First version.

Login to Curse

Don't have an account? Create One.

Get an epic experience with Curse Premium
  • Faster addon downloads
  • Premium-Only Beta Giveaways
  • Ad-Free Curse experience
  • Premium Curse Client
  • and many More Features
  • Learn More »

Minecontest - Win a 2013 Minecon Cape!