ascott18 / LibSpellRange-1.0

WoW Addon Lib that provides more robust spell range checking functionality.
https://wow.curseforge.com/projects/libspellrange-1-0
2 stars 4 forks source link
library world-of-warcraft world-of-warcraft-addon

LibSpellRange-1.0

Background

Blizzard's IsSpellInRange API has always been very limited - you either must have the name of the spell, or its spell book ID. Checking directly by spellID is simply not possible. Now, since Mists of Pandaria, Blizzard changed the way that many talents and specialization spells work - instead of giving you a new spell when leaned, they replace existing spells. These replacement spells do not work with Blizzard's IsSpellInRange function whatsoever; this limitation is what prompted the creation of this lib.

Usage

LibSpellRange-1.0 exposes an enhanced version of IsSpellInRange that:

SpellRange.IsSpellInRange(spell, unit) - Improved IsSpellInRange

Parameters

Return value

Exact same returns as the built-in IsSpellInRange

Usage

-- Check spell range by spell name on unit "target"
local SpellRange = LibStub("SpellRange-1.0")
local inRange = SpellRange.IsSpellInRange("Stormstrike", "target")

-- Check spell range by spellID on unit "mouseover"
local SpellRange = LibStub("SpellRange-1.0")
local inRange = SpellRange.IsSpellInRange(17364, "mouseover")

SpellRange.SpellHasRange(spell) - Improved SpellHasRange

Parameters

Return value

Exact same returns as the built-in SpellHasRange

Usage

-- Check if a spell has a range by spell name
local SpellRange = LibStub("SpellRange-1.0")
local hasRange = SpellRange.SpellHasRange("Stormstrike")

-- Check if a spell has a range by spellID
local SpellRange = LibStub("SpellRange-1.0")
local hasRange = SpellRange.SpellHasRange(17364)