# C_Spell: World of Warcraft Forever API

Forever 1.60.1 (70959), Interface 16001, Lua 5.1, from Blizzard's own API documentation. Page: https://wowaddons.gg/forever-api/C_Spell

## Functions

### C_Spell.CancelAutoRepeatSpell

```lua
wasCancelled = C_Spell.CancelAutoRepeatSpell()
```

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

Returns:
- `wasCancelled`: bool

### C_Spell.CancelItemTempEnchantment

```lua
C_Spell.CancelItemTempEnchantment(weaponSlot, enchantmentType)
```

Cancel a temporary enchantment on an item

Arguments:
- `weaponSlot`: WeaponSlot
- `enchantmentType`: ItemEnchantType

### C_Spell.CancelSpellByID

```lua
C_Spell.CancelSpellByID(spellID)
```

Arguments:
- `spellID`: number

### C_Spell.DoesSpellExist

```lua
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

```lua
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

```lua
healthChange, powerTypeChanges = C_Spell.GetAuraStatChanges(spellID)
```

Arguments:
- `spellID`: number

Returns:
- `healthChange`: number
- `powerTypeChanges`: PowerTypeChange[]

### C_Spell.GetBaseSpell

```lua
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

```lua
deadlyDebuffInfo = C_Spell.GetDeadlyDebuffInfo(spellIdentifier)
```

May return nothing.

Arguments:
- `spellIdentifier`: SpellIdentifier

Returns:
- `deadlyDebuffInfo`: DeadlyDebuffInfo

### C_Spell.GetItemCooldown

```lua
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

```lua
itemModifiedAppearanceIDs = C_Spell.GetItemModifiedAppearancesApplied(spellID)
```

Arguments:
- `spellID`: number

Returns:
- `itemModifiedAppearanceIDs`: number[]

### C_Spell.GetLastCategoryCooldownSource

```lua
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

```lua
link = C_Spell.GetMawPowerLinkBySpellID(spellID)
```

May return nothing.

Arguments:
- `spellID`: SpellIdentifier

Returns:
- `link`: cstring

### C_Spell.GetMawPowerRarityInfoBySpellID

```lua
rarityID, rarityBorderAtlas = C_Spell.GetMawPowerRarityInfoBySpellID(spellID)
```

May return nothing.

Arguments:
- `spellID`: SpellIdentifier

Returns:
- `rarityID`: number
- `rarityBorderAtlas`: textureAtlas

### C_Spell.GetOverrideSpell

```lua
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

```lua
result = C_Spell.GetSchoolString(schoolMask)
```

Arguments:
- `schoolMask`: number

Returns:
- `result`: cstring

### C_Spell.GetSpellAutoCast

```lua
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

```lua
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

```lua
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

```lua
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

```lua
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

```lua
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

```lua
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

```lua
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

```lua
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

```lua
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

```lua
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

```lua
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

```lua
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

```lua
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

```lua
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

```lua
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

```lua
name = C_Spell.GetSpellName(spellIdentifier)
```

Returns nil if spell is not found

May return nothing.

Arguments:
- `spellIdentifier`: SpellIdentifier

Returns:
- `name`: cstring

### C_Spell.GetSpellPowerCost

```lua
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

```lua
result = C_Spell.GetSpellQueueWindow()
```

Returns:
- `result`: number

### C_Spell.GetSpellSkillLineAbilityRank

```lua
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

```lua
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

```lua
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

```lua
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

```lua
spellID = C_Spell.GetTargetSpellID()
```

Returns:
- `spellID`: number

### C_Spell.GetVisibilityInfo

```lua
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

```lua
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

```lua
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

```lua
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

```lua
isAutoRepeat = C_Spell.IsClassTalentSpell(spellIdentifier)
```

Returns true if the spell comes from a Class Talent

Arguments:
- `spellIdentifier`: SpellIdentifier

Returns:
- `isAutoRepeat`: bool

### C_Spell.IsConsumableSpell

```lua
consumable = C_Spell.IsConsumableSpell(spellIdentifier)
```

Arguments:
- `spellIdentifier`: SpellIdentifier

Returns:
- `consumable`: bool

### C_Spell.IsCurrentSpell

```lua
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

```lua
isExternalDefensive = C_Spell.IsExternalDefensive(spellID)
```

Returns true if an aura is considered an external defensive.

Arguments:
- `spellID`: number

Returns:
- `isExternalDefensive`: bool

### C_Spell.IsPressHoldReleaseSpell

```lua
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

```lua
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

```lua
isAutoRepeat = C_Spell.IsPvPTalentSpell(spellIdentifier)
```

Returns true if the spell comes from a PvP Talent

Arguments:
- `spellIdentifier`: SpellIdentifier

Returns:
- `isAutoRepeat`: bool

### C_Spell.IsRangedAutoAttackSpell

```lua
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

```lua
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

```lua
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

```lua
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

```lua
disabled = C_Spell.IsSpellDisabled(spellIdentifier)
```

Arguments:
- `spellIdentifier`: SpellIdentifier

Returns:
- `disabled`: bool

### C_Spell.IsSpellHarmful

```lua
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

```lua
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

```lua
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

```lua
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

```lua
isPassive = C_Spell.IsSpellPassive(spellIdentifier)
```

Arguments:
- `spellIdentifier`: SpellIdentifier

Returns:
- `isPassive`: bool

### C_Spell.IsSpellUsable

```lua
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

```lua
C_Spell.PickupSpell(spellIdentifier)
```

Arguments:
- `spellIdentifier`: SpellIdentifier

### C_Spell.PlaceTargetingSpellAtCursor

```lua
C_Spell.PlaceTargetingSpellAtCursor()
```

### C_Spell.RequestLoadSpellData

```lua
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

```lua
C_Spell.SetSpellAutoCastEnabled(spellIdentifier, enabled)
```

Arguments:
- `spellIdentifier`: SpellIdentifier
- `enabled`: bool

### C_Spell.SpellHasRange

```lua
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

```lua
result = C_Spell.TargetSpellChecksItemCondition()
```

Returns:
- `result`: bool

### C_Spell.TargetSpellIsEnchanting

```lua
isEnchanting = C_Spell.TargetSpellIsEnchanting()
```

Returns:
- `isEnchanting`: bool

### C_Spell.TargetSpellJumpsUpgradeTrack

```lua
jumpsUpgradeTrack = C_Spell.TargetSpellJumpsUpgradeTrack()
```

Returns:
- `jumpsUpgradeTrack`: bool

### C_Spell.TargetSpellReplacesBonusTree

```lua
result = C_Spell.TargetSpellReplacesBonusTree()
```

Returns:
- `result`: bool

### C_Spell.ToggleSpellAutoCast

```lua
C_Spell.ToggleSpellAutoCast(spellIdentifier)
```

Toggles whether spell's autoCast is enabled

Arguments:
- `spellIdentifier`: SpellIdentifier

## Events

### ENCHANT_SPELL_COMPLETED

Payload, after the event's name:
- `successful`: bool
- `enchantedItem`: ItemLocation, may be nil

### ENCHANT_SPELL_SELECTED

No payload.

### SPELL_DATA_LOAD_RESULT

Payload, after the event's name:
- `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.

Payload, after the event's name:
- `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

Payload, after the event's name:
- `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

---
Make an addon with your 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."
