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
wasCancelled | bool |
|---|
C_Spell.CancelItemTempEnchantment
C_Spell.CancelItemTempEnchantment(weaponSlot, enchantmentType)
Cancel a temporary enchantment on an item
Arguments
weaponSlot | WeaponSlot | |
|---|---|---|
enchantmentType | ItemEnchantType |
C_Spell.CancelSpellByID
C_Spell.CancelSpellByID(spellID)
Arguments
spellID | number |
|---|
C_Spell.DoesSpellExist
spellExists = C_Spell.DoesSpellExist(spellIdentifier)
Returns true if the spell exists, regardless of whether the player has learned it
Arguments
spellIdentifier | SpellIdentifier | Spell ID, name, name(subtext), or link; Using name will always check for an override on that spell |
|---|
Returns
spellExists | bool |
|---|
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
spellIdentifier | SpellIdentifier | |
|---|---|---|
enable | bool | True 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
spellID | number |
|---|
Returns
healthChange | number | |
|---|---|---|
powerTypeChanges | PowerTypeChange[] |
C_Spell.GetBaseSpell
baseSpellID = C_Spell.GetBaseSpell(spellIdentifier, [spec])
Arguments
spellIdentifier | SpellIdentifier | |
|---|---|---|
spec | number default 0 | Which Class Specialization to consider, as overrides may vary by Spec; Defaults to player's current Spec |
Returns
baseSpellID | number | Returns the spellID passed in if there is no override |
|---|
C_Spell.GetDeadlyDebuffInfo
deadlyDebuffInfo = C_Spell.GetDeadlyDebuffInfo(spellIdentifier)
May return nothing.
Arguments
spellIdentifier | SpellIdentifier |
|---|
Returns
deadlyDebuffInfo | DeadlyDebuffInfo |
|---|
C_Spell.GetItemCooldown
spellCooldownInfo = C_Spell.GetItemCooldown(itemID)
Returns nil if the item is not found or on cooldown
May return nothing.
Arguments
itemID | number |
|---|
Returns
spellCooldownInfo | SpellCooldownInfo |
|---|
C_Spell.GetItemModifiedAppearancesApplied
itemModifiedAppearanceIDs = C_Spell.GetItemModifiedAppearancesApplied(spellID)
Arguments
spellID | number |
|---|
Returns
itemModifiedAppearanceIDs | number[] |
|---|
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
spellCategory | number |
|---|
Returns
spellID | number may be nil | The most recent spell associated with the category |
|---|---|---|
itemID | number may be nil | The item used to trigger this spell |
C_Spell.GetMawPowerLinkBySpellID
link = C_Spell.GetMawPowerLinkBySpellID(spellID)
May return nothing.
Arguments
spellID | SpellIdentifier |
|---|
Returns
link | cstring |
|---|
C_Spell.GetMawPowerRarityInfoBySpellID
rarityID, rarityBorderAtlas = C_Spell.GetMawPowerRarityInfoBySpellID(spellID)
May return nothing.
Arguments
spellID | SpellIdentifier |
|---|
Returns
rarityID | number | |
|---|---|---|
rarityBorderAtlas | textureAtlas |
C_Spell.GetOverrideSpell
overrideSpellID = C_Spell.GetOverrideSpell(spellIdentifier, [spec], [onlyKnown], [ignoreOverrideSpellID])
Arguments
spellIdentifier | SpellIdentifier | |
|---|---|---|
spec | number default 0 | Which Class Specialization to consider, as overrides may vary by Spec; Defaults to player's current Spec |
onlyKnown | bool default true | |
ignoreOverrideSpellID | number default 0 |
Returns
overrideSpellID | number | Returns the spellID passed in if there is no override |
|---|
C_Spell.GetSchoolString
result = C_Spell.GetSchoolString(schoolMask)
Arguments
schoolMask | number |
|---|
Returns
result | cstring |
|---|
C_Spell.GetSpellAutoCast
autoCastAllowed, autoCastEnabled = C_Spell.GetSpellAutoCast(spellIdentifier)
Returns nil if spell is not found
May return nothing.
Arguments
spellIdentifier | SpellIdentifier |
|---|
Returns
autoCastAllowed | bool | |
|---|---|---|
autoCastEnabled | bool |
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
spellIdentifier | SpellIdentifier |
|---|
Returns
castCount | number |
|---|
C_Spell.GetSpellChargeDuration
duration = C_Spell.GetSpellChargeDuration(spellIdentifier)
Returns a duration object describing the active recharge time for a spell.
May return nothing.
Arguments
spellIdentifier | SpellIdentifier |
|---|
Returns
duration | LuaDurationObject |
|---|
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
spellIdentifier | SpellIdentifier |
|---|
Returns
chargeInfo | SpellChargeInfo |
|---|
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
spellIdentifier | SpellIdentifier |
|---|
Returns
spellCooldownInfo | SpellCooldownInfo |
|---|
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
spellIdentifier | SpellIdentifier | |
|---|---|---|
ignoreGCD | bool default false |
Returns
duration | LuaDurationObject |
|---|
C_Spell.GetSpellDescription
description = C_Spell.GetSpellDescription(spellIdentifier)
Returns nil if spell is not found
May return nothing.
Arguments
spellIdentifier | SpellIdentifier |
|---|
Returns
description | string | May 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
spellIdentifier | SpellIdentifier | |
|---|---|---|
itemLocation | ItemLocation |
Returns
description | string | May 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
spellIdentifier | SpellIdentifier | |
|---|---|---|
maxDisplayCount | number default 9999 | |
replacementString | cstring default "*" |
Returns
displayCount | string |
|---|
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
spellIdentifier | SpellIdentifier | Spell 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
spellID | number |
|---|
C_Spell.GetSpellInfo
spellInfo = C_Spell.GetSpellInfo(spellIdentifier)
Returns nil if spell is not found
May return nothing.
Arguments
spellIdentifier | SpellIdentifier | Spell ID, name, name(subtext), or link; Using name will always check for an override on that spell |
|---|
Returns
spellInfo | SpellInfo |
|---|
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
spellIdentifier | SpellIdentifier |
|---|
Returns
levelLearned | number |
|---|
C_Spell.GetSpellLink
spellLink = C_Spell.GetSpellLink(spellIdentifier, [glyphID])
Returns nil if spell is not found
May return nothing.
Arguments
spellIdentifier | SpellIdentifier | |
|---|---|---|
glyphID | number may be nil |
Returns
spellLink | string |
|---|
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
spellIdentifier | SpellIdentifier |
|---|
Returns
duration | LuaDurationObject |
|---|
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
spellIdentifier | SpellIdentifier |
|---|
Returns
lossOfControlInfo | SpellLossOfControlInfo |
|---|
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
spellID | SpellIdentifier |
|---|
Returns
cumulativeAura | number |
|---|
C_Spell.GetSpellName
name = C_Spell.GetSpellName(spellIdentifier)
Returns nil if spell is not found
May return nothing.
Arguments
spellIdentifier | SpellIdentifier |
|---|
Returns
name | cstring |
|---|
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
spellIdentifier | SpellIdentifier |
|---|
Returns
powerCosts | SpellPowerCostInfo[] |
|---|
C_Spell.GetSpellQueueWindow
result = C_Spell.GetSpellQueueWindow()
Returns
result | number |
|---|
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
spellIdentifier | SpellIdentifier |
|---|
Returns
rank | number |
|---|
C_Spell.GetSpellSubtext
subtext = C_Spell.GetSpellSubtext(spellIdentifier)
Returns nil if spell is not found
May return nothing.
Arguments
spellIdentifier | SpellIdentifier |
|---|
Returns
subtext | string | May 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
spellIdentifier | SpellIdentifier |
|---|
Returns
iconID | fileID | |
|---|---|---|
originalIconID | fileID | |
conditionalIconID | fileID may be nil |
C_Spell.GetSpellTradeSkillLink
spellLink = C_Spell.GetSpellTradeSkillLink(spellIdentifier)
Returns nil if spell is not associated with a trade skill
May return nothing.
Arguments
spellIdentifier | SpellIdentifier |
|---|
Returns
spellLink | string |
|---|
C_Spell.GetTargetSpellID
spellID = C_Spell.GetTargetSpellID()
Returns
spellID | number |
|---|
C_Spell.GetVisibilityInfo
hasCustom, alwaysShowMine, showForMySpec = C_Spell.GetVisibilityInfo(spellID, visibilityType)
May return nothing.
Arguments
spellID | number | |
|---|---|---|
visibilityType | SpellAuraVisibilityType |
Returns
hasCustom | bool | |
|---|---|---|
alwaysShowMine | bool | |
showForMySpec | bool |
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
spellIdentifier | SpellIdentifier | |
|---|---|---|
targetUnit | UnitToken may be nil | Optional specific target; If not supplied, the player will be used, or their pet if the spell is a pet spell |
Returns
isActiveSpell | bool |
|---|
C_Spell.IsAutoAttackSpell
isAutoAttack = C_Spell.IsAutoAttackSpell(spellIdentifier)
Returns true if the spell is the player's melee Auto Attack spell
Arguments
spellIdentifier | SpellIdentifier |
|---|
Returns
isAutoAttack | bool |
|---|
C_Spell.IsAutoRepeatSpell
isAutoRepeat = C_Spell.IsAutoRepeatSpell(spellIdentifier)
Returns true if the spell is an auto repeat player spell
Arguments
spellIdentifier | SpellIdentifier |
|---|
Returns
isAutoRepeat | bool |
|---|
C_Spell.IsClassTalentSpell
isAutoRepeat = C_Spell.IsClassTalentSpell(spellIdentifier)
Returns true if the spell comes from a Class Talent
Arguments
spellIdentifier | SpellIdentifier |
|---|
Returns
isAutoRepeat | bool |
|---|
C_Spell.IsConsumableSpell
consumable = C_Spell.IsConsumableSpell(spellIdentifier)
Arguments
spellIdentifier | SpellIdentifier |
|---|
Returns
consumable | bool |
|---|
C_Spell.IsCurrentSpell
isCurrentSpell = C_Spell.IsCurrentSpell(spellIdentifier)
Returns true if the spell is currently being cast or is queued to be cast
Arguments
spellIdentifier | SpellIdentifier |
|---|
Returns
isCurrentSpell | bool |
|---|
C_Spell.IsExternalDefensive
isExternalDefensive = C_Spell.IsExternalDefensive(spellID)
Returns true if an aura is considered an external defensive.
Arguments
spellID | number |
|---|
Returns
isExternalDefensive | bool |
|---|
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
spellIdentifier | SpellIdentifier |
|---|
Returns
isPressHoldRelease | bool |
|---|
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
spellID | number |
|---|
Returns
isHighPriority | bool |
|---|
C_Spell.IsPvPTalentSpell
isAutoRepeat = C_Spell.IsPvPTalentSpell(spellIdentifier)
Returns true if the spell comes from a PvP Talent
Arguments
spellIdentifier | SpellIdentifier |
|---|
Returns
isAutoRepeat | bool |
|---|
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
spellIdentifier | SpellIdentifier |
|---|
Returns
isRangedAutoAttack | bool |
|---|
C_Spell.IsSelfBuff
hasSelfEffectsOnly = C_Spell.IsSelfBuff(spellID)
Returns true if an aura only applies effects to the player, and no other units.
Arguments
spellID | number |
|---|
Returns
hasSelfEffectsOnly | bool |
|---|
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
spellIdentifier | SpellIdentifier |
|---|
Returns
isCrowdControl | bool |
|---|
C_Spell.IsSpellDataCached
isCached = C_Spell.IsSpellDataCached(spellIdentifier)
Returns true if data for the spell has already been loaded and cached this session
Arguments
spellIdentifier | SpellIdentifier |
|---|
Returns
isCached | bool |
|---|
C_Spell.IsSpellDisabled
disabled = C_Spell.IsSpellDisabled(spellIdentifier)
Arguments
spellIdentifier | SpellIdentifier |
|---|
Returns
disabled | bool |
|---|
C_Spell.IsSpellHarmful
isHarmful = C_Spell.IsSpellHarmful(spellIdentifier)
Returns true if the spell can be cast on hostile targets
Arguments
spellIdentifier | SpellIdentifier |
|---|
Returns
isHarmful | bool |
|---|
C_Spell.IsSpellHelpful
isHelpful = C_Spell.IsSpellHelpful(spellIdentifier)
Returns true if the spell can be cast on the player or other friendly targets
Arguments
spellIdentifier | SpellIdentifier |
|---|
Returns
isHelpful | bool |
|---|
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
spellIdentifier | SpellIdentifier |
|---|
Returns
isImportant | bool |
|---|
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
spellIdentifier | SpellIdentifier | |
|---|---|---|
targetUnit | UnitToken may be nil | Optional specific target; If not supplied, player's current target (if any) will be used |
Returns
inRange | bool may be nil | May 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
spellIdentifier | SpellIdentifier |
|---|
Returns
isPassive | bool |
|---|
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
spellIdentifier | SpellIdentifier |
|---|
Returns
isUsable | bool | |
|---|---|---|
insufficientPower | bool | True if spell is specifically unusable due to insufficient power (ie MANA, RAGE, etc) |
C_Spell.PickupSpell
C_Spell.PickupSpell(spellIdentifier)
Arguments
spellIdentifier | SpellIdentifier |
|---|
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
spellIdentifier | SpellIdentifier |
|---|
C_Spell.SetSpellAutoCastEnabled
C_Spell.SetSpellAutoCastEnabled(spellIdentifier, enabled)
Arguments
spellIdentifier | SpellIdentifier | |
|---|---|---|
enabled | bool |
C_Spell.SpellHasRange
hasRange = C_Spell.SpellHasRange(spellIdentifier)
Returns true if the spell has a min and/or max range greater than 0
Arguments
spellIdentifier | SpellIdentifier |
|---|
Returns
hasRange | bool |
|---|
C_Spell.TargetSpellChecksItemCondition
result = C_Spell.TargetSpellChecksItemCondition()
Returns
result | bool |
|---|
C_Spell.TargetSpellIsEnchanting
isEnchanting = C_Spell.TargetSpellIsEnchanting()
Returns
isEnchanting | bool |
|---|
C_Spell.TargetSpellJumpsUpgradeTrack
jumpsUpgradeTrack = C_Spell.TargetSpellJumpsUpgradeTrack()
Returns
jumpsUpgradeTrack | bool |
|---|
C_Spell.TargetSpellReplacesBonusTree
result = C_Spell.TargetSpellReplacesBonusTree()
Returns
result | bool |
|---|
C_Spell.ToggleSpellAutoCast
C_Spell.ToggleSpellAutoCast(spellIdentifier)
Toggles whether spell's autoCast is enabled
Arguments
spellIdentifier | SpellIdentifier |
|---|
Events
ENCHANT_SPELL_COMPLETED
successful | bool | |
|---|---|---|
enchantedItem | ItemLocation may be nil |
ENCHANT_SPELL_SELECTED
No payload.
SPELL_DATA_LOAD_RESULT
spellID | number | |
|---|---|---|
success | bool |
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.
spellIdentifier | SpellIdentifier | |
|---|---|---|
isInRange | bool | Whether or not the current target is in range of the spell. Should not be used if the 'checksRange' parameter is false. |
checksRange | bool | Can be false if a range check was not made for any reason, for example there is not a current target. |
SPELL_TEXT_UPDATE
spellID | number |
|---|
UPDATE_SPELL_TARGET_ITEM_CONTEXT
No payload.
Tables
DeadlyDebuffInfo structure
criticalTimeRemainingMs | number may be nil | |
|---|---|---|
criticalStacks | number may be nil | |
priority | number | |
warningText | string | |
soundKitID | number may be nil |
PowerTypeChange structure
powerType | PowerType | |
|---|---|---|
amount | number |
SpellInfo structure
name | string | |
|---|---|---|
iconID | fileID | Icon 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 |
originalIconID | fileID | |
castTime | number | |
minRange | number | |
maxRange | number | |
spellID | number |