WowAddons

World of Warcraft Forever API · C_SpellBook.md, for your AI

C_SpellBook

51 functions, 19 events, 2 tables, as Blizzard documents them for Forever 1.60.1 (70959).

Making an addon with an AI? Tell it: Read https://wowaddons.gg/agents.md, then make me a World of Warcraft Forever addon that …, try it with me in the game, and publish it. It checks every call against this API before you try it in the game, then publishes it here. How it works.

Functions

C_SpellBook.AbortSpellIntro

C_SpellBook.AbortSpellIntro(spellID)

Arguments

spellIDnumber

C_SpellBook.CastSpellBookItem

C_SpellBook.CastSpellBookItem(spellBookItemSlotIndex, spellBookItemSpellBank, [targetSelf])

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank
targetSelfbool default falseIf true, spell will target the current player; Otherwise, targets the player's current target

C_SpellBook.ContainsAnyDisenchantSpell

contains = C_SpellBook.ContainsAnyDisenchantSpell()

Returns true if player knows any Disenchant spells

Returns

containsbool

C_SpellBook.FindBaseSpellByID

baseSpellID = C_SpellBook.FindBaseSpellByID(spellID)

Arguments

spellIDnumber

Returns

baseSpellIDnumber may be nil

C_SpellBook.FindFlyoutSlotBySpellID

flyoutSlot = C_SpellBook.FindFlyoutSlotBySpellID(spellID)

Arguments

spellIDnumber

Returns

flyoutSlotluaIndex

C_SpellBook.FindSpellBookSlotForSpell

spellBookItemSlotIndex, spellBookItemSpellBank = C_SpellBook.FindSpellBookSlotForSpell(spellIdentifier, [includeHidden], [includeFlyouts], [includeFutureSpells], [includeOffSpec])

If found, returns the first slot position of a SpellBookItem matching the specified spell and criteria

May return nothing.

Arguments

spellIdentifierSpellIdentifier
includeHiddenbool default falseIf true, search includes SpellBookItems that are hidden from the SpellBook UI (ex: spells that have been replaced, are also in a Flyout, etc)
includeFlyoutsbool default trueIf true, search includes Flyout SpellBookItems containing the specified spell
includeFutureSpellsbool default falseIf true, search includes SpellBookItems for spells that have not yet been learned
includeOffSpecbool default falseIf true, search includes SpellBookItems belonging to non-active specializations; If spell is in active and inactive spec, the active spec slot will always be returned

Returns

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank

C_SpellBook.FindSpellOverrideByID

overrideSpellID = C_SpellBook.FindSpellOverrideByID(spellID)

Arguments

spellIDnumber

Returns

overrideSpellIDnumber may be nil

C_SpellBook.GetClassSkillLineInfo

skillLineInfo = C_SpellBook.GetClassSkillLineInfo()

May return nothing.

Returns

skillLineInfoSpellBookSkillLineInfo

C_SpellBook.GetCurrentLevelSpells

spellIDs = C_SpellBook.GetCurrentLevelSpells(level)

Returns general, class, and active spec spells that are learned at the specified level

May return nothing.

Arguments

levelnumber

Returns

spellIDsnumber[]

C_SpellBook.GetNumSpellBookSkillLines

numSpellBookSkillLines = C_SpellBook.GetNumSpellBookSkillLines()

Returns

numSpellBookSkillLinesnumber

C_SpellBook.GetSkillLineIndexByID

skillIndex = C_SpellBook.GetSkillLineIndexByID(skillLineID)

Arguments

skillLineIDnumber

Returns

skillIndexluaIndex may be nilWill be nil if the specified SkillLine could not be found, or if it is not one of the player's tracked skill lines

C_SpellBook.GetSpellBookItemAutoCast

autoCastAllowed, autoCastEnabled = C_SpellBook.GetSpellBookItemAutoCast(spellBookItemSlotIndex, spellBookItemSpellBank)

Returns nothing if item doesn't exist or isn't a spell

May return nothing.

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank

Returns

autoCastAllowedboolTrue if this spell is allowed to be auto-cast
autoCastEnabledboolTrue if auto-casting this spell is currently enabled (usually by the player)

C_SpellBook.GetSpellBookItemCastCount

castCount = C_SpellBook.GetSpellBookItemCastCount(spellBookItemSlotIndex, spellBookItemSpellBank)

Returns number of times a SpellBookItem can be cast, typically based on availability of things like required reagent items; Always returns 0 if item is not found or is not a spell

Its returns can be secret values (in some instances and fights): guard them before any arithmetic.

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank

Returns

castCountnumber

C_SpellBook.GetSpellBookItemChargeDuration

duration = C_SpellBook.GetSpellBookItemChargeDuration(spellBookItemSlotIndex, spellBookItemSpellBank)

Returns a duration object describing the active recharge time for a spellbook item.

May return nothing.

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank

Returns

durationLuaDurationObject

C_SpellBook.GetSpellBookItemCharges

chargeInfo = C_SpellBook.GetSpellBookItemCharges(spellBookItemSlotIndex, spellBookItemSpellBank)

Returns a table of info about the charges of a charge-accumulating SpellBookItem; May return nil if item is not found or is not charge-based

May return nothing.

Its returns can be secret values (in some instances and fights): guard them before any arithmetic.

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank

Returns

chargeInfoSpellChargeInfo

C_SpellBook.GetSpellBookItemCooldown

spellCooldownInfo = C_SpellBook.GetSpellBookItemCooldown(spellBookItemSlotIndex, spellBookItemSpellBank)

Returns nil if item doesn't exist or if this kind of item doesn't display cooldowns (ex: future or offspec spells)

May return nothing.

Its returns can be secret values (in some instances and fights): guard them before any arithmetic.

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank

Returns

spellCooldownInfoSpellCooldownInfo

C_SpellBook.GetSpellBookItemCooldownDuration

duration = C_SpellBook.GetSpellBookItemCooldownDuration(spellBookItemSlotIndex, spellBookItemSpellBank, [ignoreGCD])

Returns a duration object describing the active cooldown duration for a spellbook item.

May return nothing.

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank
ignoreGCDbool default false

Returns

durationLuaDurationObject

C_SpellBook.GetSpellBookItemDescription

description = C_SpellBook.GetSpellBookItemDescription(spellBookItemSlotIndex, spellBookItemSpellBank)

May return nothing.

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank

Returns

descriptionstringMay be empty if spell's data isn't loaded yet; Listen for SPELL_TEXT_UPDATE event, or use SpellMixin to load asynchronously

C_SpellBook.GetSpellBookItemInfo

spellBookItemInfo = C_SpellBook.GetSpellBookItemInfo(spellBookItemSlotIndex, spellBookItemSpellBank)

May return nothing.

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank

Returns

spellBookItemInfoSpellBookItemInfo

C_SpellBook.GetSpellBookItemLevelLearned

levelLearned = C_SpellBook.GetSpellBookItemLevelLearned(spellBookItemSlotIndex, spellBookItemSpellBank)

Returns the level the spell is learned at; May return a different value if the player is currently Level Linked with another player; Returns 0 if item is not a Spell

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank

Returns

levelLearnednumber

C_SpellBook.GetSpellBookItemLossOfControlCooldownDuration

duration = C_SpellBook.GetSpellBookItemLossOfControlCooldownDuration(spellBookItemSlotIndex, spellBookItemSpellBank)

Returns a duration object describing the active loss of control cooldown duration for a spellbook item.

May return nothing.

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank

Returns

durationLuaDurationObject

C_SpellBook.GetSpellBookItemLossOfControlCooldownInfo

lossOfControlInfo = C_SpellBook.GetSpellBookItemLossOfControlCooldownInfo(spellBookItemSlotIndex, spellBookItemSpellBank)

Returns nil if item doesn't exist or if this kind of item doesn't display cooldowns (ex: future or offspec spells)

May return nothing.

Its returns can be secret values (in some instances and fights): guard them before any arithmetic.

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank

Returns

lossOfControlInfoSpellLossOfControlInfo

C_SpellBook.GetSpellBookItemName

name, subName = C_SpellBook.GetSpellBookItemName(spellBookItemSlotIndex, spellBookItemSpellBank)

May return nothing.

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank

Returns

namestring
subNamestringMay be empty if spell's data isn't loaded yet; Listen for SPELL_TEXT_UPDATE event, or use SpellMixin to load asynchronously

C_SpellBook.GetSpellBookItemPowerCost

powerCosts = C_SpellBook.GetSpellBookItemPowerCost(spellBookItemSlotIndex, spellBookItemSpellBank)

Returns a table containing one or more SpellPowerCostInfos, one for each power type a SpellBookItem costs; May return nil if item is not found or has no resource costs

May return nothing.

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank

Returns

powerCostsSpellPowerCostInfo[]

C_SpellBook.GetSpellBookItemSkillLineIndex

skillLineIndex = C_SpellBook.GetSpellBookItemSkillLineIndex(spellBookItemSlotIndex, spellBookItemSpellBank)

Get the index of the SkillLine this SpellBookItem is part of

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank

Returns

skillLineIndexluaIndex may be nilWill be nil if the specified SpellBookItem doesn't exist or isn't part of a SkillLine

C_SpellBook.GetSpellBookItemTexture

iconID = C_SpellBook.GetSpellBookItemTexture(spellBookItemSlotIndex, spellBookItemSpellBank)

May return nothing.

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank

Returns

iconIDfileID

C_SpellBook.GetSpellBookItemType

itemType, actionID, spellID = C_SpellBook.GetSpellBookItemType(spellBookItemSlotIndex, spellBookItemSpellBank)

May return nothing.

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank

Returns

itemTypeSpellBookItemType
actionIDnumberRepresents a base spellID for spells, flyoutID for flyouts, or petActionID for pet actions
spellIDnumber may be nilMay be nil if item is not a spell; Will be the overriding spellID if spell is overriden, otherwise will match actionID

C_SpellBook.GetSpellBookSkillLineInfo

skillLineInfo = C_SpellBook.GetSpellBookSkillLineInfo(skillLineIndex)

May return nothing.

Arguments

skillLineIndexluaIndex

Returns

skillLineInfoSpellBookSkillLineInfo

C_SpellBook.HasPetSpells

numPetSpells, petNameToken = C_SpellBook.HasPetSpells()

Returns nothing if player has no pet spells

May return nothing.

Returns

numPetSpellsnumber
petNameTokenstring

C_SpellBook.IsAutoAttackSpellBookItem

isAutoAttack = C_SpellBook.IsAutoAttackSpellBookItem(spellBookItemSlotIndex, spellBookItemSpellBank)

Returns true if the SpellBookItem is the player's melee Auto Attack spell

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank

Returns

isAutoAttackbool

C_SpellBook.IsClassTalentSpellBookItem

isClassTalent = C_SpellBook.IsClassTalentSpellBookItem(spellBookItemSlotIndex, spellBookItemSpellBank)

Returns true if the SpellBookItem comes from a Class Talent

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank

Returns

isClassTalentbool

C_SpellBook.IsPvPTalentSpellBookItem

isPvPTalent = C_SpellBook.IsPvPTalentSpellBookItem(spellBookItemSlotIndex, spellBookItemSpellBank)

Returns true if the SpellBookItem comes from a PvP Talent

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank

Returns

isPvPTalentbool

C_SpellBook.IsRangedAutoAttackSpellBookItem

isRangedAutoAttack = C_SpellBook.IsRangedAutoAttackSpellBookItem(spellBookItemSlotIndex, spellBookItemSpellBank)

Returns true if the SpellBookItem is the player's ranged Auto Attack spell (ex: Shoot, Auto Shot, etc)

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank

Returns

isRangedAutoAttackbool

C_SpellBook.IsSpellBookItemHarmful

isHarmful = C_SpellBook.IsSpellBookItemHarmful(spellBookItemSlotIndex, spellBookItemSpellBank)

Returns true if the SpellBookIem can be cast on hostile targets

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank

Returns

isHarmfulbool

C_SpellBook.IsSpellBookItemHelpful

isHelpful = C_SpellBook.IsSpellBookItemHelpful(spellBookItemSlotIndex, spellBookItemSpellBank)

Returns true if the SpellBookIem can be cast on the player or other friendly targets

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank

Returns

isHelpfulbool

C_SpellBook.IsSpellBookItemInRange

inRange = C_SpellBook.IsSpellBookItemInRange(spellBookItemSlotIndex, spellBookItemSpellBank, [targetUnit])

Returns true if the current target is within range of the SpellBookIem; False if out of range; Nil if range check was invalid

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank
targetUnitUnitToken may be nilOptional specific target; If not supplied, player's current target (if any) will be used

Returns

inRangebool may be nilMay be nil if the range check was invalid, ie due to unknown/invalid spell, missing/invalid target, etc

C_SpellBook.IsSpellBookItemLooseFlyoutMember

isFlyoutMember = C_SpellBook.IsSpellBookItemLooseFlyoutMember(spellBookItemSlotIndex, spellBookItemSpellBank)

Returns true if the SpellBookItem is represented in a Flyout.

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank

Returns

isFlyoutMemberbool

C_SpellBook.IsSpellBookItemLowRank

isLowRank = C_SpellBook.IsSpellBookItemLowRank(spellBookItemSlotIndex, spellBookItemSpellBank)

Returns true if the SpellBookItem is a lower rank of a known higher rank spell. Returns false if there is only a single rank or it is the highest rank known.

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank

Returns

isLowRankbool

C_SpellBook.IsSpellBookItemOffSpec

isOffSpec = C_SpellBook.IsSpellBookItemOffSpec(spellBookItemSlotIndex, spellBookItemSpellBank)

Returns true if the SpellBookItem belongs to a non-active class specialization

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank

Returns

isOffSpecbool

C_SpellBook.IsSpellBookItemPassive

isPassive = C_SpellBook.IsSpellBookItemPassive(spellBookItemSlotIndex, spellBookItemSpellBank)

Returns true if the SpellBookItem is a passive spell; Will always return false if it is not a spell

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank

Returns

isPassivebool

C_SpellBook.IsSpellBookItemUsable

isUsable, insufficientPower = C_SpellBook.IsSpellBookItemUsable(spellBookItemSlotIndex, spellBookItemSpellBank)

Returns whether the SpellBookIem is currently castable; Typically based on things like learned status, required resources, etc

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank

Returns

isUsablebool
insufficientPowerboolTrue if SpellBookIem is specifically unusable due to insufficient power (ie MANA, RAGE, etc)

C_SpellBook.IsSpellInSpellBook

isInSpellBook = C_SpellBook.IsSpellInSpellBook(spellID, [spellBank], [includeOverrides])

Returns true if a spell should be found in the spellbook. This function can also return true for spells that aren't known, such as override spells granted by an aura linked to class talents

Arguments

spellIDnumber
spellBankSpellBookSpellBank default "Player"
includeOverridesbool default true

Returns

isInSpellBookbool

C_SpellBook.IsSpellKnown

isKnown = C_SpellBook.IsSpellKnown(spellID, [spellBank])

Returns true if a player knows a spell. This function can also return true for spells that aren't in the spellbook, such as temporarily-granted abilities

Arguments

spellIDnumber
spellBankSpellBookSpellBank default "Player"

Returns

isKnownbool

C_SpellBook.IsSpellKnownOrInSpellBook

isKnownOrInSpellBook = C_SpellBook.IsSpellKnownOrInSpellBook(spellID, [spellBank], [includeOverrides])

Returns true if a spell is considered to be known or present in the spellbook

Arguments

spellIDnumber
spellBankSpellBookSpellBank default "Player"
includeOverridesbool default true

Returns

isKnownOrInSpellBookbool

C_SpellBook.PickupSpellBookItem

C_SpellBook.PickupSpellBookItem(spellBookItemSlotIndex, spellBookItemSpellBank)

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank

C_SpellBook.SetBarSlotFromIntro

C_SpellBook.SetBarSlotFromIntro(spellID, slotIndex)

Arguments

spellIDnumber
slotIndexluaIndex

C_SpellBook.SetSpellBookItemAutoCastEnabled

C_SpellBook.SetSpellBookItemAutoCastEnabled(spellBookItemSlotIndex, spellBookItemSpellBank, enabled)

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank
enabledbool

C_SpellBook.SpellBookItemHasRange

hasRange = C_SpellBook.SpellBookItemHasRange(spellBookItemSlotIndex, spellBookItemSpellBank)

Returns true if the SpellBookIem has a min and/or max range greater than 0; Will always return false if it is not a spell

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank

Returns

hasRangebool

C_SpellBook.ToggleSpellBookItemAutoCast

C_SpellBook.ToggleSpellBookItemAutoCast(spellBookItemSlotIndex, spellBookItemSpellBank)

Arguments

spellBookItemSlotIndexluaIndex
spellBookItemSpellBankSpellBookSpellBank

Events

CURRENT_SPELL_CAST_CHANGED

cancelledCastbool

LEARNED_SPELL_IN_SKILL_LINE

spellIDnumber
skillLineIndexluaIndex
isGuildPerkSpellbool

MAX_SPELL_START_RECOVERY_OFFSET_CHANGED

clampedNewQueueWindowMsnumber

PLAYER_TOTEM_UPDATE

totemSlotluaIndex

SPELL_FLYOUT_UPDATE

flyoutIDnumber may be nil
spellIDnumber may be nil
isLearnedbool may be nil

SPELL_PUSHED_TO_ACTIONBAR

spellIDnumber
slotluaIndex
pageluaIndex

SPELL_PUSHED_TO_FLYOUT_ON_ACTIONBAR

spellIDnumber
flyoutSlotluaIndex
flyoutPageluaIndex

SPELL_UPDATE_CHARGES

No payload.

SPELL_UPDATE_COOLDOWN

spellIDnumber may be nilCan be a base spell or an override spell. A nil value indicates that all cooldowns should be updated, rather than just a specific one.
baseSpellIDnumber may be nilWill be set to the base spell if the spellID parameter is an override spell.
categorynumber may be nilIf the spellID parameter is set, the cooldown category of the spell. A nil value indicates the spell does not have a cooldown category.
startRecoveryCategorynumber may be nilIf the spellID parameter is set, the cooldown start recovery category of the spell. A nil value indicates the spell does not have a cooldown start recovery category.
itemIDnumber may be nilIf the itemID parameter is set, it's the itemID associated with the cast of the spell.

SPELL_UPDATE_ICON

spellIDnumber may be nilAlways refers to the base spell. A nil value indicates that all icons should be updated, rather than just a specific one.

SPELL_UPDATE_USABLE

No payload.

SPELL_UPDATE_USES

spellIDnumberCan be a base spell or override spell.
baseSpellIDnumber may be nilWill be set to the base spell if the spellID parameter is an override spell.

SPELLS_CHANGED

No payload.

START_AUTOREPEAT_SPELL

No payload.

STOP_AUTOREPEAT_SPELL

No payload.

UPDATE_SHAPESHIFT_COOLDOWN

No payload.

UPDATE_SHAPESHIFT_FORM

No payload.

UPDATE_SHAPESHIFT_FORMS

No payload.

UPDATE_SHAPESHIFT_USABLE

No payload.

Tables

SpellBookItemInfo structure

actionIDnumberRepresents a base spellID for spells, flyoutID for flyouts, or petActionID for pet actions
spellIDnumber may be nilMay be nil if item is not a spell; Will be the overriding spellID if spell is overriden, otherwise will match actionID
itemTypeSpellBookItemType
namestring
subNamestringMay be empty if flyout, or if spell's data isn't loaded yet; Listen for SPELL_TEXT_UPDATE event, or use SpellMixin to load asynchronously
iconIDfileID
isPassiveboolTrue if the item is a passive spell; Will always be false if it is not a spell
isOffSpecboolTrue if the item belongs to a non-active specialization
skillLineIndexluaIndex may be nilIndex of the SkillLine this SpellBookItem is part of; Nil this SpellBookItem isn't part of a SkillLine

SpellBookSkillLineInfo structure

namestring
iconIDfileID
itemIndexOffsetnumberThis value + 1 is the first Spell Book Item slotIndex within this skill line
numSpellBookItemsnumber
isGuildbool
shouldHidebool
specIDnumber may be nilWill be nil if this skill line is not associated with a specialization
offSpecIDnumber may be nilWill be nil if this skill line is not associated with a non-active specialization

It takes WowAddons

Free, for Windows, macOS and Linux: it puts the addon in your game in one click and keeps it up to date. Open it once, then press Install again.

WowAddons runs on your computer: open wowaddons.gg there.

Download for Windows