WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Druid Swipe at low levels (https://www.wowinterface.com/forums/showthread.php?t=57217)

doofus 06-21-19 03:40 AM

Druid Swipe at low levels
 
I am levelling some Horde toons, and noticed that Swipe appears to LUA as being always available, even though it is not until level 32:

local playerSpellSwipeUseable = IsUsableSpell("Swipe");
or
local playerSpellSwipeUseable = IsUsableSpell(213771);

Always returns true!!! I am level 20 and it is not available until level 32.

Other spells, eg Barkskin, return false (correctly):

local playerSpellBarkskinUseable = IsUsableSpell("Barkskin");


Is this a bug associated with "Swipe" and is there a way around it other than manually checking the player's level ?

p3lim 06-21-19 11:47 AM

Try IsSpellKnown or IsPlayerSpell.

We use the latter in oUF to check if Shred is known, thus showing combo points for druids in cat form.

myrroddin 06-21-19 06:37 PM

Quick differences (not comprehensive):
Lua Code:
  1. IsUsableSpell() -- you can use it because it is available to your class and spec, and is not on cooldown
  2. IsPlayerSpell() -- a spell player characters can cast, unlike a spell is that is NPC exclusive (check spellID, not spell name because there are spells with the same name that aren't the same)
  3. IsSpellKnown() -- your character knows the spell because of class and spec; it is in your spellbook. Could also be a pet spell (I'm not 100% on that) that your combat pet can cast

doofus 06-25-19 09:52 AM

Guys thanks, I did not know about these two API calls.

However both IsSpellKnown(213771) and IsPlayerSpell(213771) (Swipe) return false, even when I know the spell and have just casted it!

I have also noticed that the API call IsUsableSpell() works fine for other spells, eg:

local playerSpellBarkskinUseable = IsUsableSpell("Barkskin");

which correctly returns "true" on my 120 druid and "false" on my level 23 druid.

I have not tried those two functions on "Barkskin" to see how they perform since the "IsUsableSpell" works as intended.

Kanegasi 06-25-19 12:09 PM

Itís possible you may have the wrong spell ID. Pick up Swipe from your spellbook (you can use the one on your bars, but it has to be the spell itself, not a macro) and while itís on your cursor, type /dump GetCursorInfo() into chat. The number next to [3]= in your chat window is the spell ID.


All times are GMT -6. The time now is 02:36 AM.

vBulletin © 2021, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI