WowAddons

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

C_Spell

71 functions, 6 events, 3 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_Spell.CancelAutoRepeatSpell

wasCancelled = C_Spell.CancelAutoRepeatSpell()

Cancels the player's active auto repeat spell, if any

Returns

wasCancelledbool

C_Spell.CancelItemTempEnchantment

C_Spell.CancelItemTempEnchantment(weaponSlot, enchantmentType)

Cancel a temporary enchantment on an item

Arguments

weaponSlotWeaponSlot
enchantmentTypeItemEnchantType

C_Spell.CancelSpellByID

C_Spell.CancelSpellByID(spellID)

Arguments

spellIDnumber

C_Spell.DoesSpellExist

spellExists = C_Spell.DoesSpellExist(spellIdentifier)

Returns true if the spell exists, regardless of whether the player has learned it

Arguments

spellIdentifierSpellIdentifierSpell ID, name, name(subtext), or link; Using name will always check for an override on that spell

Returns

spellExistsbool

C_Spell.EnableSpellRangeCheck

C_Spell.EnableSpellRangeCheck(spellIdentifier, enable)

Used in conjunction with SpellRangeCheckUpdate to inform the UI when a spell goes in or out of range with the current target.

Arguments

spellIdentifierSpellIdentifier
enableboolTrue if changes in range for the spell should dispatch SpellRangeCheckUpdate. False if the spell no longer needs the event.

C_Spell.GetAuraStatChanges

healthChange, powerTypeChanges = C_Spell.GetAuraStatChanges(spellID)

Arguments

spellIDnumber

Returns

healthChangenumber
powerTypeChangesPowerTypeChange[]

C_Spell.GetBaseSpell

baseSpellID = C_Spell.GetBaseSpell(spellIdentifier, [spec])

Arguments

spellIdentifierSpellIdentifier
specnumber default 0Which Class Specialization to consider, as overrides may vary by Spec; Defaults to player's current Spec

Returns

baseSpellIDnumberReturns the spellID passed in if there is no override

C_Spell.GetDeadlyDebuffInfo

deadlyDebuffInfo = C_Spell.GetDeadlyDebuffInfo(spellIdentifier)

May return nothing.

Arguments

spellIdentifierSpellIdentifier

Returns

deadlyDebuffInfoDeadlyDebuffInfo

C_Spell.GetItemCooldown

spellCooldownInfo = C_Spell.GetItemCooldown(itemID)

Returns nil if the item is not found or on cooldown

May return nothing.

Arguments

itemIDnumber

Returns

spellCooldownInfoSpellCooldownInfo

C_Spell.GetItemModifiedAppearancesApplied

itemModifiedAppearanceIDs = C_Spell.GetItemModifiedAppearancesApplied(spellID)

Arguments

spellIDnumber

Returns

itemModifiedAppearanceIDsnumber[]

C_Spell.GetLastCategoryCooldownSource

spellID, itemID = C_Spell.GetLastCategoryCooldownSource(spellCategory)

Searches for the most recent spellID and itemID that started a cooldown in this category

May return nothing.

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

Arguments

spellCategorynumber

Returns

spellIDnumber may be nilThe most recent spell associated with the category
itemIDnumber may be nilThe item used to trigger this spell

C_Spell.GetMawPowerLinkBySpellID

link = C_Spell.GetMawPowerLinkBySpellID(spellID)

May return nothing.

Arguments

spellIDSpellIdentifier

Returns

linkcstring

C_Spell.GetMawPowerRarityInfoBySpellID

rarityID, rarityBorderAtlas = C_Spell.GetMawPowerRarityInfoBySpellID(spellID)

May return nothing.

Arguments

spellIDSpellIdentifier

Returns

rarityIDnumber
rarityBorderAtlastextureAtlas

C_Spell.GetOverrideSpell

overrideSpellID = C_Spell.GetOverrideSpell(spellIdentifier, [spec], [onlyKnown], [ignoreOverrideSpellID])

Arguments

spellIdentifierSpellIdentifier
specnumber default 0Which Class Specialization to consider, as overrides may vary by Spec; Defaults to player's current Spec
onlyKnownbool default true
ignoreOverrideSpellIDnumber default 0

Returns

overrideSpellIDnumberReturns the spellID passed in if there is no override

C_Spell.GetSchoolString

result = C_Spell.GetSchoolString(schoolMask)

Arguments

schoolMasknumber

Returns

resultcstring

C_Spell.GetSpellAutoCast

autoCastAllowed, autoCastEnabled = C_Spell.GetSpellAutoCast(spellIdentifier)

Returns nil if spell is not found

May return nothing.

Arguments

spellIdentifierSpellIdentifier

Returns

autoCastAllowedbool
autoCastEnabledbool

C_Spell.GetSpellCastCount

castCount = C_Spell.GetSpellCastCount(spellIdentifier)

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

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

Arguments

spellIdentifierSpellIdentifier

Returns

castCountnumber

C_Spell.GetSpellChargeDuration

duration = C_Spell.GetSpellChargeDuration(spellIdentifier)

Returns a duration object describing the active recharge time for a spell.

May return nothing.

Arguments

spellIdentifierSpellIdentifier

Returns

durationLuaDurationObject

C_Spell.GetSpellCharges

chargeInfo = C_Spell.GetSpellCharges(spellIdentifier)

Returns a table of info about the charges of a charge-accumulating spell; May return nil if spell 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

spellIdentifierSpellIdentifier

Returns

chargeInfoSpellChargeInfo

C_Spell.GetSpellCooldown

spellCooldownInfo = C_Spell.GetSpellCooldown(spellIdentifier)

Returns nil if spell is not found

May return nothing.

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

Arguments

spellIdentifierSpellIdentifier

Returns

spellCooldownInfoSpellCooldownInfo

C_Spell.GetSpellCooldownDuration

duration = C_Spell.GetSpellCooldownDuration(spellIdentifier, [ignoreGCD])

Returns a duration object describing the active cooldown duration for a spell.

May return nothing.

Arguments

spellIdentifierSpellIdentifier
ignoreGCDbool default false

Returns

durationLuaDurationObject

C_Spell.GetSpellDescription

description = C_Spell.GetSpellDescription(spellIdentifier)

Returns nil if spell is not found

May return nothing.

Arguments

spellIdentifierSpellIdentifier

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_Spell.GetSpellDescriptionForItemLocation

description = C_Spell.GetSpellDescriptionForItemLocation(spellIdentifier, itemLocation)

Returns nil if spell is not found

May return nothing.

Arguments

spellIdentifierSpellIdentifier
itemLocationItemLocation

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_Spell.GetSpellDisplayCount

displayCount = C_Spell.GetSpellDisplayCount(spellIdentifier, [maxDisplayCount], [replacementString])

Depending on the spell, return a string that is either the use count or number of charges. If value is beyond the display count parameter, returns the replacementString (defaults to '*').

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

Arguments

spellIdentifierSpellIdentifier
maxDisplayCountnumber default 9999
replacementStringcstring default "*"

Returns

displayCountstring

C_Spell.GetSpellIDForSpellIdentifier

spellID = C_Spell.GetSpellIDForSpellIdentifier(spellIdentifier)

Meant primarily for getting a spell id from a spell name or link; Returns nothing if spell does not exist

May return nothing.

Arguments

spellIdentifierSpellIdentifierSpell ID, name, name(subtext), or link; Using name will always check for an override on that spell; If passed a spell ID, will return same id as was passed

Returns

spellIDnumber

C_Spell.GetSpellInfo

spellInfo = C_Spell.GetSpellInfo(spellIdentifier)

Returns nil if spell is not found

May return nothing.

Arguments

spellIdentifierSpellIdentifierSpell ID, name, name(subtext), or link; Using name will always check for an override on that spell

Returns

spellInfoSpellInfo

C_Spell.GetSpellLevelLearned

levelLearned = C_Spell.GetSpellLevelLearned(spellIdentifier)

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

Arguments

spellIdentifierSpellIdentifier

Returns

levelLearnednumber

C_Spell.GetSpellLossOfControlCooldownDuration

duration = C_Spell.GetSpellLossOfControlCooldownDuration(spellIdentifier)

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

May return nothing.

Arguments

spellIdentifierSpellIdentifier

Returns

durationLuaDurationObject

C_Spell.GetSpellLossOfControlCooldownInfo

lossOfControlInfo = C_Spell.GetSpellLossOfControlCooldownInfo(spellIdentifier)

Returns nil if spell is not found

May return nothing.

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

Arguments

spellIdentifierSpellIdentifier

Returns

lossOfControlInfoSpellLossOfControlInfo

C_Spell.GetSpellMaxCumulativeAuraApplications

cumulativeAura = C_Spell.GetSpellMaxCumulativeAuraApplications(spellID)

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

Arguments

spellIDSpellIdentifier

Returns

cumulativeAuranumber

C_Spell.GetSpellName

name = C_Spell.GetSpellName(spellIdentifier)

Returns nil if spell is not found

May return nothing.

Arguments

spellIdentifierSpellIdentifier

Returns

namecstring

C_Spell.GetSpellPowerCost

powerCosts = C_Spell.GetSpellPowerCost(spellIdentifier)

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

May return nothing.

Arguments

spellIdentifierSpellIdentifier

Returns

powerCostsSpellPowerCostInfo[]

C_Spell.GetSpellQueueWindow

result = C_Spell.GetSpellQueueWindow()

Returns

resultnumber

C_Spell.GetSpellSkillLineAbilityRank

rank = C_Spell.GetSpellSkillLineAbilityRank(spellIdentifier)

Returns the rank of a spell that corresponds to an ability within a ranked SkillLine (ex: a crafting Recipe); Returns nil if spell is not found, or isn't part of a ranked SkillLine

May return nothing.

Arguments

spellIdentifierSpellIdentifier

Returns

ranknumber

C_Spell.GetSpellSubtext

subtext = C_Spell.GetSpellSubtext(spellIdentifier)

Returns nil if spell is not found

May return nothing.

Arguments

spellIdentifierSpellIdentifier

Returns

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

C_Spell.GetSpellTexture

iconID, originalIconID, conditionalIconID = C_Spell.GetSpellTexture(spellIdentifier)

Returns nothing if spell is not found

May return nothing.

Arguments

spellIdentifierSpellIdentifier

Returns

iconIDfileID
originalIconIDfileID
conditionalIconIDfileID may be nil

C_Spell.GetTargetSpellID

spellID = C_Spell.GetTargetSpellID()

Returns

spellIDnumber

C_Spell.GetVisibilityInfo

hasCustom, alwaysShowMine, showForMySpec = C_Spell.GetVisibilityInfo(spellID, visibilityType)

May return nothing.

Arguments

spellIDnumber
visibilityTypeSpellAuraVisibilityType

Returns

hasCustombool
alwaysShowMinebool
showForMySpecbool

C_Spell.IsActiveSpell

isActiveSpell = C_Spell.IsActiveSpell(spellIdentifier, [targetUnit])

Returns true if the spell is a currently active toggled spell

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

Arguments

spellIdentifierSpellIdentifier
targetUnitUnitToken may be nilOptional specific target; If not supplied, the player will be used, or their pet if the spell is a pet spell

Returns

isActiveSpellbool

C_Spell.IsAutoAttackSpell

isAutoAttack = C_Spell.IsAutoAttackSpell(spellIdentifier)

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

Arguments

spellIdentifierSpellIdentifier

Returns

isAutoAttackbool

C_Spell.IsAutoRepeatSpell

isAutoRepeat = C_Spell.IsAutoRepeatSpell(spellIdentifier)

Returns true if the spell is an auto repeat player spell

Arguments

spellIdentifierSpellIdentifier

Returns

isAutoRepeatbool

C_Spell.IsClassTalentSpell

isAutoRepeat = C_Spell.IsClassTalentSpell(spellIdentifier)

Returns true if the spell comes from a Class Talent

Arguments

spellIdentifierSpellIdentifier

Returns

isAutoRepeatbool

C_Spell.IsConsumableSpell

consumable = C_Spell.IsConsumableSpell(spellIdentifier)

Arguments

spellIdentifierSpellIdentifier

Returns

consumablebool

C_Spell.IsCurrentSpell

isCurrentSpell = C_Spell.IsCurrentSpell(spellIdentifier)

Returns true if the spell is currently being cast or is queued to be cast

Arguments

spellIdentifierSpellIdentifier

Returns

isCurrentSpellbool

C_Spell.IsExternalDefensive

isExternalDefensive = C_Spell.IsExternalDefensive(spellID)

Returns true if an aura is considered an external defensive.

Arguments

spellIDnumber

Returns

isExternalDefensivebool

C_Spell.IsPressHoldReleaseSpell

isPressHoldRelease = C_Spell.IsPressHoldReleaseSpell(spellIdentifier)

Returns true if the spell is an 'empower' type spell that is cast by pressing and holding, with the on-release cast typically being affected by time held

Arguments

spellIdentifierSpellIdentifier

Returns

isPressHoldReleasebool

C_Spell.IsPriorityAura

isHighPriority = C_Spell.IsPriorityAura(spellID)

Returns true if an aura is considered high priority and should be ordered ahead of other auras in the UI.

Arguments

spellIDnumber

Returns

isHighPrioritybool

C_Spell.IsPvPTalentSpell

isAutoRepeat = C_Spell.IsPvPTalentSpell(spellIdentifier)

Returns true if the spell comes from a PvP Talent

Arguments

spellIdentifierSpellIdentifier

Returns

isAutoRepeatbool

C_Spell.IsRangedAutoAttackSpell

isRangedAutoAttack = C_Spell.IsRangedAutoAttackSpell(spellIdentifier)

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

Arguments

spellIdentifierSpellIdentifier

Returns

isRangedAutoAttackbool

C_Spell.IsSelfBuff

hasSelfEffectsOnly = C_Spell.IsSelfBuff(spellID)

Returns true if an aura only applies effects to the player, and no other units.

Arguments

spellIDnumber

Returns

hasSelfEffectsOnlybool

C_Spell.IsSpellCrowdControl

isCrowdControl = C_Spell.IsSpellCrowdControl(spellIdentifier)

Returns true if the spell causes a crowd control effect when cast on a valid target.

Arguments

spellIdentifierSpellIdentifier

Returns

isCrowdControlbool

C_Spell.IsSpellDataCached

isCached = C_Spell.IsSpellDataCached(spellIdentifier)

Returns true if data for the spell has already been loaded and cached this session

Arguments

spellIdentifierSpellIdentifier

Returns

isCachedbool

C_Spell.IsSpellDisabled

disabled = C_Spell.IsSpellDisabled(spellIdentifier)

Arguments

spellIdentifierSpellIdentifier

Returns

disabledbool

C_Spell.IsSpellHarmful

isHarmful = C_Spell.IsSpellHarmful(spellIdentifier)

Returns true if the spell can be cast on hostile targets

Arguments

spellIdentifierSpellIdentifier

Returns

isHarmfulbool

C_Spell.IsSpellHelpful

isHelpful = C_Spell.IsSpellHelpful(spellIdentifier)

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

Arguments

spellIdentifierSpellIdentifier

Returns

isHelpfulbool

C_Spell.IsSpellImportant

isImportant = C_Spell.IsSpellImportant(spellIdentifier)

Returns true if the spell is considered important. For example a spell that's lethal if not interrupted would be considered important.

Arguments

spellIdentifierSpellIdentifier

Returns

isImportantbool

C_Spell.IsSpellInRange

inRange = C_Spell.IsSpellInRange(spellIdentifier, [targetUnit])

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

Arguments

spellIdentifierSpellIdentifier
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_Spell.IsSpellPassive

isPassive = C_Spell.IsSpellPassive(spellIdentifier)

Arguments

spellIdentifierSpellIdentifier

Returns

isPassivebool

C_Spell.IsSpellUsable

isUsable, insufficientPower = C_Spell.IsSpellUsable(spellIdentifier)

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

Arguments

spellIdentifierSpellIdentifier

Returns

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

C_Spell.PickupSpell

C_Spell.PickupSpell(spellIdentifier)

Arguments

spellIdentifierSpellIdentifier

C_Spell.PlaceTargetingSpellAtCursor

C_Spell.PlaceTargetingSpellAtCursor()

C_Spell.RequestLoadSpellData

C_Spell.RequestLoadSpellData(spellIdentifier)

Requests data for the spell be loaded; Listen for SPELL_DATA_LOAD_RESULT to be notified when load is finished

Arguments

spellIdentifierSpellIdentifier

C_Spell.SetSpellAutoCastEnabled

C_Spell.SetSpellAutoCastEnabled(spellIdentifier, enabled)

Arguments

spellIdentifierSpellIdentifier
enabledbool

C_Spell.SpellHasRange

hasRange = C_Spell.SpellHasRange(spellIdentifier)

Returns true if the spell has a min and/or max range greater than 0

Arguments

spellIdentifierSpellIdentifier

Returns

hasRangebool

C_Spell.TargetSpellChecksItemCondition

result = C_Spell.TargetSpellChecksItemCondition()

Returns

resultbool

C_Spell.TargetSpellIsEnchanting

isEnchanting = C_Spell.TargetSpellIsEnchanting()

Returns

isEnchantingbool

C_Spell.TargetSpellJumpsUpgradeTrack

jumpsUpgradeTrack = C_Spell.TargetSpellJumpsUpgradeTrack()

Returns

jumpsUpgradeTrackbool

C_Spell.TargetSpellReplacesBonusTree

result = C_Spell.TargetSpellReplacesBonusTree()

Returns

resultbool

C_Spell.ToggleSpellAutoCast

C_Spell.ToggleSpellAutoCast(spellIdentifier)

Toggles whether spell's autoCast is enabled

Arguments

spellIdentifierSpellIdentifier

Events

ENCHANT_SPELL_COMPLETED

successfulbool
enchantedItemItemLocation may be nil

ENCHANT_SPELL_SELECTED

No payload.

SPELL_DATA_LOAD_RESULT

spellIDnumber
successbool

SPELL_RANGE_CHECK_UPDATE

Used in conjunction with EnableSpellRangeCheck to inform the UI when a spell goes in or out of range with the current target.

spellIdentifierSpellIdentifier
isInRangeboolWhether or not the current target is in range of the spell. Should not be used if the 'checksRange' parameter is false.
checksRangeboolCan be false if a range check was not made for any reason, for example there is not a current target.

SPELL_TEXT_UPDATE

spellIDnumber

UPDATE_SPELL_TARGET_ITEM_CONTEXT

No payload.

Tables

DeadlyDebuffInfo structure

criticalTimeRemainingMsnumber may be nil
criticalStacksnumber may be nil
prioritynumber
warningTextstring
soundKitIDnumber may be nil

PowerTypeChange structure

powerTypePowerType
amountnumber

SpellInfo structure

namestring
iconIDfileIDIcon for this spell; If spell has been overriden, this may be the icon for the overriding spell; See originalIconID for spell's non-overriden icon
originalIconIDfileID
castTimenumber
minRangenumber
maxRangenumber
spellIDnumber

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