Returns the number of times a spell can be cast. Generally used for spells whose casting is limited by the number of item reagents in the player's possession.
See also Spell functions.
Signature:
numCasts
=
GetSpellCount(index,
"bookType")
or
GetSpellCount("name")
Arguments:
index
- Index of a spell in the spellbook (number
, spellbookID)bookType
- Type of spellbook (string
)pet
- The pet's spellbookspell
- The player's spellbook
name
- Name of a spell (string
)
Returns:
numCasts
- Number of times the spell can be cast, or 0 if unlimited (number
)
Examples:
-- print a list of reagent-limited spells in the player's spellbook local numTabs = GetNumSpellTabs() for tabid=1,numTabs do local name,texture,offset,numSpells = GetSpellTabInfo(tabid) for spellid=1,numSpells do local name,rank = GetSpellName(spellid + offset, "book") local count = GetSpellCount(spellid + offset, "book") if count > 0 then print(name .. " ( ".. count .. " casts)") end end end