API IsUsableSpell

Determines whether a spell can be used by the player character.

usable, noMana = IsUsableSpell("spellName" or spellID or spellIndex[, "bookType"]);

Arguments

 * spellName : String: name of the spell to check.
 * spellID : Number: SpellID of a spell to check.
 * spellIndex : Number: index of a spell in the player's or pet's spellbook.
 * bookType: String: Use the BOOKTYPE_SPELL constant if spellIndex refers to a spell in the player's spellbook or the BOOKTYPE_PET constant if the spellIndex refers to a spell in the pet's spellbook. Defaults to BOOKTYPE_SPELL.

Returns

 * usable : Boolean - True if the spell is usable, false otherwise. A spell might be un-usable for a variety of reasons, such as:
 * The player hasn't learned the spell
 * The player lacks required mana or reagents.
 * Reactive conditions haven't been met.


 * noMana : Boolean - True if the spell can not be cast due to low mana, false otherwise.

Example
The following code snippet will check if the spell 'Healing Touch' can be cast: usable, nomana = IsUsableSpell("Curse of Elements"); if (not usable) then if (not nomana) then message("The spell cannot be cast"); else message("You do not have enough mana to cast the spell"); end else message("The spell may be cast"); end The following code snippet will check if the 20th spell in the player's spellbook is usable: usable, nomana = IsUsableSpell(20, BOOKTYPE_SPELL); print(GetSpellName(20, BOOKTYPE_SPELL) .. " is " .. (usable and "" or "not ") .. " usable.");