Quantcast WoWInterface - View Single Post - Is Spell Usable in Current Form
View Single Post
11-11-19, 12:50 PM   #1
LBXZero
A Theradrim Guardian
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 61
Is Spell Usable in Current Form

The function(s) I wish were in the UI:

IsUsableInForm(spellID, [x])

Input:
spellID = spellID of Spell being checked
x = Index based on class's available forms (Use GetShapeshiftFormInfo index). Optional, if omitted then uses current form.

Output:
usable = boolean
true = Spell can be cast in selected form, disregarding other reasons why it can't be cast
false = Spell can't be cast in selected form, (can return false if not learned)

Detail:
Parallel to "IsUsable", this function takes in a spellID and optionally a form and returns true if the spell can be cast in current form or false if it can't be cast in form.

My intention for function:
I want to highlight spells in the Spellbook based on if the spell is usable in the form. Some basic research shows the only real test if a spell can be cast in the current form is by casting the spell and looking for the UI_ERROR_MESSAGE event. Even then, target and range errors take priority before stance/form errors.

My current alternative is parsing tooltip data for the "Requires" lines, which I have an idea of a workaround for language localization.
  Reply With Quote