Giter Site home page Giter Site logo

infusonwow / libspellrange-1.0 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ascott18/libspellrange-1.0

0.0 0.0 0.0 13 KB

WoW Addon Lib that provides more robust spell range checking functionality.

Home Page: https://wow.curseforge.com/projects/libspellrange-1-0

Lua 100.00%

libspellrange-1.0's Introduction

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:

  • Allows ranged checking based on both spell name and spellID.
  • Works correctly with replacement spells that will not work using Blizzard's IsSpellInRange method alone.
  • Attempts to works with pet spells via the action bar API, which as of some indeterminate recent WoW version no longer work with IsSpellInRange.

SpellRange.IsSpellInRange(spell, unit) - Improved IsSpellInRange

Parameters

  • spell - Name or spellID of a spell that you wish to check the range of. The spell must be a spell that you have in your spellbook or your pet's spellbook.
  • unit - UnitID of the spell that you wish to check the range on.

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

  • spell - Name or spellID of a spell that you wish to check for a range. The spell must be a spell that you have in your spellbook or your pet's spellbook.

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)

libspellrange-1.0's People

Contributors

ascott18 avatar infusonwow avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.