AgentSkillsCN

wow-api-spells-abilities

WoW Retail法术、法术书、动作栏、冷却时间、图腾,以及变形API的完整参考。涵盖C_Spell信息/冷却时间/可用性/射程、C_SpellBook的导航/槽位查询、C_ActionBar的槽位管理/状态/覆盖、C_SpellActivationOverlay的施法过程、C_SpellDiminish的减益追踪、C_CooldownViewer、C_AssistedCombat的轮换辅助功能、图腾查询、变形形态、施法/引导功能、弹出菜单、法术确认,以及全局法术分类功能。当您需要处理法术、技能、动作栏、冷却时间、施法、图腾、变形形态、法术施法过程,或减益效果时,此功能将为您提供全面支持。

SKILL.md
--- frontmatter
name: wow-api-spells-abilities
description: "Complete reference for WoW Retail Spell, SpellBook, ActionBar, Cooldown, Totem, and Shapeshifting APIs. Covers C_Spell info/cooldown/usability/range, C_SpellBook navigation/slot queries, C_ActionBar slot management/state/overrides, C_SpellActivationOverlay procs, C_SpellDiminish DR tracking, C_CooldownViewer, C_AssistedCombat rotation helpers, totem queries, shapeshift forms, casting/channeling functions, flyouts, spell confirmation, and global spell category functions. Use when working with spells, abilities, action bars, cooldowns, casting, totems, shapeshift forms, spell procs, or diminishing returns."

Spell & Ability API (Retail — Patch 12.0.0)

Comprehensive reference for all Spell, SpellBook, ActionBar, Cooldown, Totem, Shapeshifting, and related APIs. Covers spell information, cooldowns, usability, range checking, spellbook navigation, action bar slot management, spell procs, diminishing returns, assisted combat, and global spell functions.

Source of truth: https://warcraft.wiki.gg/wiki/World_of_Warcraft_API#Spell SpellBook: https://warcraft.wiki.gg/wiki/World_of_Warcraft_API#SpellBook ActionBar: https://warcraft.wiki.gg/wiki/World_of_Warcraft_API#ActionBar Current as of: Patch 12.0.0 (Build 65655) — January 28, 2026 Scope: Retail only. No deprecated or removed functions.

Scope

This skill covers these API systems:

  • C_Spell — Core spell information, cooldowns, charges, usability, range, type checks
  • C_SpellBook — Spellbook navigation, skill lines, slot queries, spell lookup
  • C_ActionBar — Action bar slot management, state queries, bar pages, overrides
  • C_SpellActivationOverlay — Spell proc/activation glow detection
  • C_SpellDiminish — Diminishing returns tracking for crowd control
  • C_CooldownViewer — Cooldown viewer categories and layout
  • C_AssistedCombat — Assisted combat (rotation helper) integration
  • Totem — Totem query functions (GetTotemInfo, DestroyTotem)
  • Shapeshifting — Form/stance functions (GetShapeshiftForm, GetShapeshiftFormInfo)
  • Global Spell Functions — CastSpellByName, CastSpellByID, SpellIsTargeting, etc.

When to Use This Skill

Use this skill when you need to:

  • Query spell info: name, description, icon, subtext, link, power cost
  • Check spell cooldowns, charges, or GCD state
  • Determine if a spell is usable, in range, or on cooldown
  • Navigate the spellbook: enumerate skill lines, find spell slots, check known spells
  • Manage action bars: query action type, usability, cooldown, texture for a slot
  • Detect action bar pages, bonus bars, override bars, vehicle bars
  • Check for spell procs / activation overlays (glowing buttons)
  • Track diminishing returns on crowd control effects
  • Query totem state, duration, or destroy totems
  • Check or cast shapeshift forms and stances
  • Cast spells programmatically (protected functions)
  • Handle spell targeting (SpellIsTargeting, SpellTargetUnit, SpellStopCasting)
  • Use the assisted combat (rotation helper) system
  • Work with flyout menus and multi-cast totem spells

Reference Files

ReferenceContents
SPELLS-CORE.mdC_Spell — spell info, cooldowns, charges, usability, range, type checks
SPELLBOOK.mdC_SpellBook — spellbook navigation, skill lines, slot queries
ACTIONBAR.mdC_ActionBar — action bar slots, state, pages, overrides, pet/vehicle bars
COOLDOWNS-CASTING.mdCooldowns, casting functions, spell targeting, procs, DR, assisted combat
TOTEM-SHAPESHIFT.mdTotem functions, shapeshifting/stances, global spell casting functions

C_Spell — Core Spell API (Quick Reference)

The C_Spell namespace provides direct access to spell data by spellIdentifier — which can be a spellID (number) or spellName (string).

Wiki: https://warcraft.wiki.gg/wiki/World_of_Warcraft_API#Spell

Key Functions

FunctionReturnsDescription
C_Spell.GetSpellInfo(spellIdentifier)spellInfo tablePrimary spell data (name, icon, castTime, etc.)
C_Spell.GetSpellName(spellIdentifier)nameLocalized spell name
C_Spell.GetSpellDescription(spellIdentifier)descriptionTooltip description text
C_Spell.GetSpellTexture(spellIdentifier)iconID, originalIconIDSpell icon texture
C_Spell.GetSpellSubtext(spellIdentifier)subtextRank or specialization label
C_Spell.GetSpellLink(spellIdentifier [, glyphID])spellLinkClickable hyperlink
C_Spell.DoesSpellExist(spellIdentifier)spellExistsValidates a spell ID/name
C_Spell.GetSpellIDForSpellIdentifier(spellIdentifier)spellIDResolves spell name → ID
C_Spell.GetBaseSpell(spellIdentifier [, spec])baseSpellIDUnwraps overrides to base spell
C_Spell.GetOverrideSpell(spellIdentifier [, spec [, onlyKnown [, ignoreOverrideID]]])overrideSpellIDGets current override for a spell

Cooldowns & Charges

FunctionReturnsDescription
C_Spell.GetSpellCooldown(spellIdentifier)spellCooldownInfoStart time, duration, enabled, modRate
C_Spell.GetSpellCooldownDuration(spellIdentifier)durationRemaining cooldown in seconds
C_Spell.GetSpellCharges(spellIdentifier)chargeInfoCharges, maxCharges, start, duration
C_Spell.GetSpellChargeDuration(spellIdentifier)durationCharge recharge duration
C_Spell.GetSpellLossOfControlCooldown(spellIdentifier)startTime, durationLoC lockout timing
C_Spell.GetSpellLossOfControlCooldownDuration(spellIdentifier)durationRemaining LoC duration

Usability & Range

FunctionReturnsDescription
C_Spell.IsSpellUsable(spellIdentifier)isUsable, insufficientPowerCan be cast now?
C_Spell.IsSpellInRange(spellIdentifier [, targetUnit])inRangeTarget in range?
C_Spell.SpellHasRange(spellIdentifier)hasRangeDoes the spell have range?
C_Spell.IsSpellDisabled(spellIdentifier)disabledIs spell disabled?
C_Spell.GetSpellCastCount(spellIdentifier)castCountNumber of available casts

Type Checks

FunctionReturnsDescription
C_Spell.IsSpellPassive(spellIdentifier)isPassivePassive ability?
C_Spell.IsSpellHarmful(spellIdentifier)isHarmfulOffensive spell?
C_Spell.IsSpellHelpful(spellIdentifier)isHelpfulBeneficial spell?
C_Spell.IsAutoAttackSpell(spellIdentifier)isAutoAttackAuto-attack?
C_Spell.IsAutoRepeatSpell(spellIdentifier)isAutoRepeatAuto-repeat (e.g., Auto Shot)?
C_Spell.IsRangedAutoAttackSpell(spellIdentifier)isRangedAutoAttackRanged auto-attack?
C_Spell.IsCurrentSpell(spellIdentifier)isCurrentSpellCurrently being cast?
C_Spell.IsConsumableSpell(spellIdentifier)consumableConsumes a resource on use?
C_Spell.IsPressHoldReleaseSpell(spellIdentifier)isPressHoldReleaseEmpowered spell?
C_Spell.IsClassTalentSpell(spellIdentifier)isClassTalentFrom the talent tree?
C_Spell.IsPvPTalentSpell(spellIdentifier)isPvPTalentPvP talent?
C_Spell.IsSpellCrowdControl(spellIdentifier)isCrowdControlCC effect?
C_Spell.IsSpellImportant(spellIdentifier)isImportantMarked as important?
C_Spell.IsPriorityAura(spellID)isHighPriorityHigh-priority display aura?
C_Spell.IsSelfBuff(spellID)hasSelfEffectsOnlyOnly affects self?
C_Spell.IsExternalDefensive(spellID)isExternalDefensiveExternal defensive?

Power Cost & Data

FunctionReturnsDescription
C_Spell.GetSpellPowerCost(spellIdentifier)powerCosts tableResources required to cast
C_Spell.GetSpellLevelLearned(spellIdentifier)levelLearnedLevel at which spell is learned
C_Spell.GetSpellSkillLineAbilityRank(spellIdentifier)rankRank for profession recipes
C_Spell.GetSpellMaxCumulativeAuraApplications(spellID)cumulativeAuraMax stacks
C_Spell.GetAuraStatChanges(spellID)healthChange, powerTypeChangesStat effects of an aura
C_Spell.GetDeadlyDebuffInfo(spellIdentifier)deadlyDebuffInfoDeadly debuff display data
C_Spell.GetSpellQueueWindow()resultSpell queue window (ms)

Spell Manipulation

FunctionReturnsDescription
C_Spell.CancelSpellByID(spellID)Cancel a channeled/cast spell
C_Spell.PickupSpell(spellIdentifier)Attach spell to cursor
C_Spell.RequestLoadSpellData(spellIdentifier)Request async spell data load
C_Spell.IsSpellDataCached(spellIdentifier)isCachedIs data ready for query?
C_Spell.EnableSpellRangeCheck(spellIdentifier, enable)Enable/disable range checking
C_Spell.SetSpellAutoCastEnabled(spellIdentifier, enabled)Toggle pet spell autocast
C_Spell.ToggleSpellAutoCast(spellIdentifier)Toggle pet spell autocast
C_Spell.GetSpellAutoCast(spellIdentifier)autoCastAllowed, autoCastEnabledAutocast state

Visibility & Display

FunctionReturnsDescription
C_Spell.GetVisibilityInfo(spellID, visibilityType)hasCustom, alwaysShowMine, showForMySpecAura display visibility rules
C_Spell.GetSpellDisplayCount(spellIdentifier [, maxDisplayCount [, replacementString]])displayCountDisplay count for stacking

Targeting & Trade

FunctionReturnsDescription
C_Spell.TargetSpellIsEnchanting()isEnchantingCurrent targeting spell is enchant?
C_Spell.TargetSpellJumpsUpgradeTrack()jumpsUpgradeTrackUpgrade track jump?
C_Spell.TargetSpellReplacesBonusTree()resultReplaces bonus loot tree?
C_Spell.GetSpellTradeSkillLink(spellIdentifier)spellLinkTrade skill recipe link

C_SpellBook — Spellbook Navigation (Quick Reference)

The C_SpellBook namespace manages the spellbook UI, skill lines, and per-slot queries. Functions take (spellBookItemSlotIndex, spellBookItemSpellBank) where spellBank is Enum.SpellBookSpellBank.Player or Enum.SpellBookSpellBank.Pet.

Wiki: https://warcraft.wiki.gg/wiki/World_of_Warcraft_API#SpellBook

Key Functions

FunctionReturnsDescription
C_SpellBook.GetNumSpellBookSkillLines()numSkillLinesNumber of spellbook tabs
C_SpellBook.GetSpellBookSkillLineInfo(skillLineIndex)skillLineInfoTab name, icon, offset, count
C_SpellBook.GetSpellBookItemInfo(slot, bank)spellBookItemInfoDetailed spell/flyout info for a slot
C_SpellBook.GetSpellBookItemType(slot, bank)itemType, actionID, spellIDType: SPELL, FLYOUT, FUTURESPELL, PETACTION
C_SpellBook.GetSpellBookItemName(slot, bank)name, subNameLocalized name of slot
C_SpellBook.GetSpellBookItemTexture(slot, bank)iconIDIcon for slot
C_SpellBook.GetSpellBookItemDescription(slot, bank)descriptionTooltip text
C_SpellBook.GetSpellBookItemLink(slot, bank [, glyphID])spellLinkHyperlink
C_SpellBook.GetSpellBookItemLevelLearned(slot, bank)levelLearnedLevel learned
C_SpellBook.FindSpellBookSlotForSpell(spellIdentifier [, includeHidden [, includeFlyouts [, includeFutureSpells [, includeOffSpec]]]])slotIndex, bankFind slot for a spell
C_SpellBook.IsSpellKnown(spellID [, spellBank])isKnownDoes the player know the spell?
C_SpellBook.IsSpellInSpellBook(spellID [, spellBank [, includeOverrides]])isInSpellBookIs it in the spellbook?
C_SpellBook.IsSpellKnownOrInSpellBook(spellID [, spellBank [, includeOverrides]])isKnownOrInSpellBookKnown OR in spellbook?

Slot Usability & State

FunctionReturnsDescription
C_SpellBook.IsSpellBookItemUsable(slot, bank)isUsable, insufficientPowerCan cast from this slot?
C_SpellBook.IsSpellBookItemPassive(slot, bank)isPassivePassive ability?
C_SpellBook.IsSpellBookItemOffSpec(slot, bank)isOffSpecBelongs to inactive spec?
C_SpellBook.IsSpellBookItemHarmful(slot, bank)isHarmfulHarmful to targets?
C_SpellBook.IsSpellBookItemHelpful(slot, bank)isHelpfulHelpful to targets?
C_SpellBook.IsSpellBookItemInRange(slot, bank [, targetUnit])inRangeIn range of target?
C_SpellBook.SpellBookItemHasRange(slot, bank)hasRangeHas range requirement?
C_SpellBook.IsAutoAttackSpellBookItem(slot, bank)isAutoAttackAuto-attack entry?
C_SpellBook.IsRangedAutoAttackSpellBookItem(slot, bank)isRangedAutoAttackRanged auto-attack?
C_SpellBook.IsClassTalentSpellBookItem(slot, bank)isClassTalentClass talent?
C_SpellBook.IsPvPTalentSpellBookItem(slot, bank)isPvPTalentPvP talent?

Slot Cooldowns & Charges

FunctionReturnsDescription
C_SpellBook.GetSpellBookItemCooldown(slot, bank)spellCooldownInfoCooldown for slot
C_SpellBook.GetSpellBookItemCooldownDuration(slot, bank)durationRemaining cooldown
C_SpellBook.GetSpellBookItemCharges(slot, bank)chargeInfoCharge info
C_SpellBook.GetSpellBookItemChargeDuration(slot, bank)durationCharge recharge time
C_SpellBook.GetSpellBookItemCastCount(slot, bank)castCountAvailable casts
C_SpellBook.GetSpellBookItemLossOfControlCooldown(slot, bank)startTime, durationLoC lockout
C_SpellBook.GetSpellBookItemLossOfControlCooldownDuration(slot, bank)durationRemaining LoC

Spell Lookup

FunctionReturnsDescription
C_SpellBook.FindBaseSpellByID(spellID)baseSpellIDResolve to base spell
C_SpellBook.FindSpellOverrideByID(spellID)overrideSpellIDGet current override
C_SpellBook.GetCurrentLevelSpells(level)spellIDsSpells learned at a level
C_SpellBook.GetSkillLineIndexByID(skillLineID)skillIndexSkill line index by ID
C_SpellBook.HasPetSpells()numPetSpells, petNameTokenDoes the pet have spells?
C_SpellBook.ContainsAnyDisenchantSpell()containsHas disenchant?
C_SpellBook.FindFlyoutSlotBySpellID(spellID)flyoutSlotFind flyout containing spell

Other Slot Operations

FunctionReturnsDescription
C_SpellBook.CastSpellBookItem(slot, bank [, targetSelf])Cast from spellbook slot
C_SpellBook.PickupSpellBookItem(slot, bank)Pick up spell to cursor
C_SpellBook.GetSpellBookItemAutoCast(slot, bank)autoCastAllowed, autoCastEnabledAutocast state
C_SpellBook.SetSpellBookItemAutoCastEnabled(slot, bank, enabled)Set autocast
C_SpellBook.ToggleSpellBookItemAutoCast(slot, bank)Toggle autocast
C_SpellBook.GetSpellBookItemPowerCost(slot, bank)powerCostsResource cost
C_SpellBook.GetSpellBookItemTradeSkillLink(slot, bank)spellLinkTrade skill link
C_SpellBook.GetSpellBookItemSkillLineIndex(slot, bank)skillLineIndexWhich skill line tab

C_ActionBar — Action Bar Slot Management (Quick Reference)

The C_ActionBar namespace manages the 120+ action bar slots. Actions are referenced by actionID (1–180) or slotID.

Wiki: https://warcraft.wiki.gg/wiki/World_of_Warcraft_API#ActionBar

Action Slot Layout

BarSlotsNotes
Main bar1–12Always visible
Bar 2 (Bottom Left)13–24Toggled via settings
Bar 3 (Bottom Right)25–36Toggled via settings
Bar 4 (Right)37–48Toggled via settings
Bar 5 (Right 2)49–60Toggled via settings
Bars 6–1061–120Additional bars
StanceBar pages121–180Stance-specific bars

Core Queries

FunctionReturnsDescription
C_ActionBar.HasAction(actionID)hasActionIs something in this slot?
C_ActionBar.GetSpell(actionID)spellIDSpell in slot (nil if not a spell)
C_ActionBar.GetActionTexture(actionID)textureFileIDIcon for the action
C_ActionBar.GetActionText(actionID)textDisplay text (macros)
C_ActionBar.GetActionCooldown(actionID)cooldownInfoCooldown data
C_ActionBar.GetActionCooldownDuration(actionID)durationRemaining cooldown
C_ActionBar.GetActionChargeDuration(actionID)durationCharge recharge time
C_ActionBar.GetActionCharges(actionID)chargeInfoCharge state
C_ActionBar.IsUsableAction(actionID)isUsable, isLackingResourcesCan use?
C_ActionBar.IsActionInRange(actionID [, target])isInRangeTarget in range?

Action State Checks

FunctionReturnsDescription
C_ActionBar.IsCurrentAction(actionID)isCurrentActionBeing cast now?
C_ActionBar.IsAttackAction(actionID)isAttackActionAuto-attack?
C_ActionBar.IsAutoRepeatAction(actionID)isAutoRepeatActionAuto-repeat?
C_ActionBar.IsConsumableAction(actionID)isConsumableActionConsumable?
C_ActionBar.IsEquippedAction(actionID)isEquippedActionEquipped item?
C_ActionBar.IsStackableAction(actionID)isStackableActionStackable item?
C_ActionBar.IsItemAction(actionID)isItemActionItem action?
C_ActionBar.IsHarmfulAction(actionID, useNeutral)isHarmfulHarmful?
C_ActionBar.IsHelpfulAction(actionID, useNeutral)isHelpfulHelpful?
C_ActionBar.IsInterruptAction(slotID)isInterruptActionInterrupt?
C_ActionBar.IsAssistedCombatAction(slotID)isAssistedCombatAssisted combat action?
C_ActionBar.HasRangeRequirements(actionID)hasRangeRequirementsHas range?

Bar Pages & Overrides

FunctionReturnsDescription
C_ActionBar.GetActionBarPage()currentPageCurrent page (1–6)
C_ActionBar.SetActionBarPage(pageIndex)Switch page
C_ActionBar.GetBonusBarIndex()bonusBarIndexClass-specific bonus bar
C_ActionBar.GetBonusBarOffset()bonusBarOffsetOffset for bonus bar
C_ActionBar.HasBonusActionBar()hasBonusActionBarHas bonus bar?
C_ActionBar.GetOverrideBarIndex()overrideBarIndexOverride bar index
C_ActionBar.GetOverrideBarSkin()textureFileIDOverride bar texture
C_ActionBar.HasOverrideActionBar()hasOverrideActionBarOverride active?
C_ActionBar.GetExtraBarIndex()extraBarIndexExtra action button bar
C_ActionBar.HasExtraActionBar()hasExtraActionBarExtra bar active?
C_ActionBar.GetVehicleBarIndex()vehicleBarIndexVehicle bar index
C_ActionBar.HasVehicleActionBar()hasVehicleActionBarIn vehicle?
C_ActionBar.GetTempShapeshiftBarIndex()tempShapeshiftBarIndexTemp shapeshift bar
C_ActionBar.HasTempShapeshiftActionBar()hasTempShapeshiftActionBarHas temp form bar?
C_ActionBar.GetMultiCastBarIndex()multiCastBarIndexMulti-cast bar (totem)
C_ActionBar.ShouldOverrideBarShowHealthBar()showHealthBarShow health bar?
C_ActionBar.ShouldOverrideBarShowManaBar()showManaBarShow mana bar?
C_ActionBar.IsPossessBarVisible()isPossessBarVisiblePossess bar visible?

Display & Count

FunctionReturnsDescription
C_ActionBar.GetActionDisplayCount(actionID [, maxDisplayCount [, replacementString]])displayCountDisplay count for stacking
C_ActionBar.GetActionUseCount(actionID)countRemaining uses
C_ActionBar.GetActionAutocast(actionID)autoCastAllowed, autoCastEnabledAutocast state
C_ActionBar.GetActionLossOfControlCooldown(actionID)startTime, durationLoC cooldown
C_ActionBar.GetActionLossOfControlCooldownDuration(actionID)durationRemaining LoC

Spell ↔ Action Lookups

FunctionReturnsDescription
C_ActionBar.FindSpellActionButtons(spellID)slotsFind all slots containing a spell
C_ActionBar.HasSpellActionButtons(spellID)hasButtonsIs spell on any bar?
C_ActionBar.IsOnBarOrSpecialBar(spellID)isOnBarOn any bar or special bar?
C_ActionBar.FindFlyoutActionButtons(flyoutID)slotsFind flyout button slots
C_ActionBar.HasFlyoutActionButtons(flyoutID)hasFlyoutButtonsFlyout on bar?
C_ActionBar.FindPetActionButtons(petActionID)slotsPet action on bar?
C_ActionBar.HasPetActionButtons(petActionID)hasPetButtonsPet action exists?
C_ActionBar.FindAssistedCombatActionButtons()slotsAssisted combat slots
C_ActionBar.HasAssistedCombatActionButtons()hasButtonsHas assisted combat?
C_ActionBar.GetPetActionPetBarIndices(petActionID)slotsPet bar indices
C_ActionBar.HasPetActionPetBarIndices(petActionID)hasIndicesHas pet bar indices?

Profession & Gear

FunctionReturnsDescription
C_ActionBar.GetProfessionQuality(actionID)qualityCrafting result quality
C_ActionBar.GetProfessionQualityInfo(actionID)infoQuality info table
C_ActionBar.GetItemActionOnEquipSpellID(actionID)onEquipSpellIDOn-equip spell ID
C_ActionBar.IsEquippedGearOutfitAction(slotID)isEquippedGear outfit equipped?
C_ActionBar.GetBonusBarIndexForSlot(slotID)bonusBarIndexBonus bar for slot

Slot Management

FunctionReturnsDescription
C_ActionBar.PutActionInSlot(slotID)Place cursor action into slot
C_ActionBar.RegisterActionUIButton(checkboxFrame, actionID, cooldownFrame)Register frame for updates
C_ActionBar.UnregisterActionUIButton(checkboxFrame)Unregister frame
C_ActionBar.ForceUpdateAction(slotID)Force action update
C_ActionBar.EnableActionRangeCheck(actionID, enable)Enable/disable range check
C_ActionBar.ToggleAutoCastPetAction(slotID)Toggle pet autocast
C_ActionBar.IsAutoCastPetAction(slotID)isAutoCastPetActionPet autocast?
C_ActionBar.IsEnabledAutoCastPetAction(slotID)isEnabledPet autocast enabled?

Auxiliary Namespaces (Quick Reference)

C_SpellActivationOverlay — Spell Procs

Detects when a spell has a visual activation overlay (glowing border / proc alert).

FunctionReturnsDescription
C_SpellActivationOverlay.IsSpellOverlayed(spellID)isOverlayedSpell has active proc glow?

Wiki: https://warcraft.wiki.gg/wiki/World_of_Warcraft_API#SpellActivationOverlay

C_SpellDiminish — Diminishing Returns

Tracks diminishing returns (DR) categories for crowd control and interrupt tracking.

FunctionReturnsDescription
C_SpellDiminish.GetAllSpellDiminishCategories([ruleset])categoriesAll DR categories
C_SpellDiminish.GetSpellDiminishCategoryInfo(category)categoryInfoInfo for a DR category
C_SpellDiminish.IsSystemSupported()isSupportedIs DR tracking available?
C_SpellDiminish.ShouldTrackSpellDiminishCategory(category, ruleset)isTrackedShould this category be tracked?

Wiki: https://warcraft.wiki.gg/wiki/World_of_Warcraft_API#SpellDiminishUI

C_CooldownViewer — Cooldown Display

Provides categorized cooldown data for the cooldown viewer UI.

FunctionReturnsDescription
C_CooldownViewer.GetCooldownViewerCategorySet(category [, allowUnlearned])cooldownIDsCooldowns in a category
C_CooldownViewer.GetCooldownViewerCooldownInfo(cooldownID)cooldownInfoCooldown details
C_CooldownViewer.GetLayoutData()dataViewer layout state
C_CooldownViewer.GetValidAlertTypes(cooldownID)validAlertTypesValid alert types for cooldown
C_CooldownViewer.IsCooldownViewerAvailable()isAvailable, failureReasonIs viewer available?
C_CooldownViewer.SetLayoutData(data)Save layout state

Wiki: https://warcraft.wiki.gg/wiki/World_of_Warcraft_API#CooldownViewer

C_AssistedCombat — Rotation Helper

The Assisted Combat system (new in 12.0) provides suggested spell rotations.

FunctionReturnsDescription
C_AssistedCombat.GetActionSpell()spellIDCurrent action spell suggestion
C_AssistedCombat.GetNextCastSpell([checkForVisibleButton])spellIDNext suggested cast
C_AssistedCombat.GetRotationSpells()spellIDsAll rotation spells
C_AssistedCombat.IsAvailable()isAvailable, failureReasonIs system available?

Wiki: https://warcraft.wiki.gg/wiki/World_of_Warcraft_API#AssistedCombat

C_LevelLink — Spell Level Lock

Checks if spells or actions are level-locked for scaling content.

FunctionReturnsDescription
C_LevelLink.IsActionLocked(actionID)isLockedAction locked by level?
C_LevelLink.IsSpellLocked(spellID)isLockedSpell locked by level?

Totem Functions

Totem functions query and manage totem/minion slots. Shamans have 4 totem slots; other classes may have totem-style minions (e.g., Death Knight ghouls, mushrooms).

Wiki: https://warcraft.wiki.gg/wiki/World_of_Warcraft_API#Totem

FunctionReturnsDescription
GetTotemInfo(slot)haveTotem, totemName, startTime, duration, icon, modRate, spellIDComplete totem info
GetTotemTimeLeft(slot)timeLeftRemaining duration (seconds)
GetTotemCannotDismiss(slot)cannotDismissCan this totem be dismissed?
DestroyTotem(slot)Destroy totem/minion #protected
TargetTotem(slot)Target the totem

totem Slot Constants

lua
EARTH_TOTEM_SLOT  = 2
FIRE_TOTEM_SLOT   = 1
WATER_TOTEM_SLOT  = 3
AIR_TOTEM_SLOT    = 4

Shapeshifting / Stances

Manages shapeshift forms (Druid forms, Warrior stances, Rogue stealth, Paladin auras, etc.).

Wiki: https://warcraft.wiki.gg/wiki/World_of_Warcraft_API#Shapeshifting
Category: https://warcraft.wiki.gg/wiki/World_of_Warcraft_API (Shapeshifting section)

FunctionReturnsDescription
GetNumShapeshiftForms()numFormsNumber of available forms
GetShapeshiftForm([flag])indexCurrent form (0 = none)
GetShapeshiftFormID()indexForm ID of current form
GetShapeshiftFormInfo(index)icon, active, castable, spellIDInfo for a form
GetShapeshiftFormCooldown(index)startTime, duration, isActiveCooldown for a form
CancelShapeshiftForm()Leave current form #protected
CastShapeshiftForm(index)Enter a form #protected

Global Spell Casting Functions

These are category-level functions (not namespaced) for casting, targeting, and confirming spells.

Wiki: https://warcraft.wiki.gg/wiki/World_of_Warcraft_API (Spells category)

Casting (Protected)

FunctionDescription
CastSpell(spellIndex, spellbookType)Cast from spellbook by index #protected
CastSpellByID(spellID [, target])Cast by spell ID #protected
CastSpellByName(name [, target])Cast by name #protected
UseAction(slot [, checkCursor [, onSelf]])Use action bar slot #protected
SpellStopCasting()Stop current cast #protected

Targeting (Protected)

FunctionDescription
SpellIsTargeting()Is a spell waiting for target selection?
SpellCanTargetUnit(unit)Can the pending spell target this unit?
SpellTargetUnit(unit)Cast pending spell on unit #protected
SpellStopTargeting()Cancel pending spell targeting #protected
SpellTargetItem(item)Cast pending spell on item #protected
SpellCanTargetItem()Can pending spell target an item?
SpellCanTargetItemID()Can pending spell target an item ID?
SpellCanTargetQuest()Can pending spell target a quest?
SpellCancelQueuedSpell()Cancel queued spell
CancelSpellByName(name)Cancel channeling by name #nocombat

Spell Confirmation

FunctionDescription
AcceptSpellConfirmationPrompt(spellID)Accept a spell confirmation dialog
DeclineSpellConfirmationPrompt(spellID)Decline a spell confirmation dialog
GetSpellConfirmationPromptsInfo()Get pending confirmations

Action Button Helpers

FunctionReturnsDescription
GetActionInfo(slot)actionType, id, subTypeWhat's in this action slot?
GetActionBarToggles()bar1..bar7Which extra bars are visible
SetActionBarToggles(bar1..bar7, alwaysShow)Set visibility of extra bars
PetHasActionBar()hasActionBarDoes pet have an action bar?
GetPossessInfo(index)texture, spellID, enabledPossession bar info

Flyouts

FunctionReturnsDescription
GetFlyoutInfo(flyoutID)name, description, numSlots, isKnownFlyout menu info
GetFlyoutSlotInfo(flyoutID, slot)flyoutSpellID, overrideSpellID, isKnown, spellName, slotSpecIDIndividual flyout slot
FlyoutHasSpell(flyoutID, spellID)hasSpellDoes flyout contain spell?
GetNumFlyouts()countTotal flyout count
FindSpellBookSlotBySpellID(spellID [, isPet])slotLegacy slot lookup

Combat Pet Actions

FunctionReturnsDescription
CastPetAction(index [, target])Cast pet action #protected
GetPetActionCooldown(index)startTime, duration, enablePet action cooldown
GetPetActionInfo(index)name, texture, isToken, isActive, autoCastAllowed, autoCastEnabled, spellID, checksRange, inRangeFull pet action info
GetPetActionSlotUsable(index)isUsableCan use this pet action?

Multi-Cast / Totem Bar

FunctionReturnsDescription
GetMultiCastTotemSpells(slot)totem1..totem7Valid spells for a totem slot
SetMultiCastSpell(actionID, spellID)Set totem bar spell #protected

Misc Spell Helpers

FunctionReturnsDescription
GetSpellBaseCooldown(spellID)cooldownMS, gcdMSBase cooldown in milliseconds
IsSelectedSpellBookItem(spellSlot)boolIs this slot selected?
CancelUnitBuff(unit, buffIndex [, filter])Remove a buff #nocombat
QueryCastSequence(sequence)index, item, spellPreview next step in /castsequence

Patch 12.0.0 — Secret Values Impact

Spell-related APIs are significantly affected by Secret Values in Patch 12.0.0:

C_Secrets Predicates for Spells

FunctionReturnsDescription
C_Secrets.GetSpellCastSecrecy(spellIdentifier)secrecyCast info secret level
C_Secrets.GetSpellCooldownSecrecy(spellIdentifier)secrecyCooldown data secret level
C_Secrets.GetSpellAuraSecrecy(spellIdentifier)secrecyAura data secret level
C_Secrets.ShouldCooldownsBeSecret()hasSecretCooldownsAny cooldowns secret?
C_Secrets.ShouldSpellCooldownBeSecret(spellIdentifier)isCooldownSecretThis spell's CD secret?
C_Secrets.ShouldSpellAuraBeSecret(spellIdentifier)isAuraSecretThis spell's aura secret?
C_Secrets.ShouldSpellBookItemCooldownBeSecret(slot, bank)isCooldownSecretSpellbook slot CD secret?
C_Secrets.ShouldActionCooldownBeSecret(actionID)isCooldownSecretAction slot CD secret?
C_Secrets.ShouldTotemSlotBeSecret(slot)isTotemSecretTotem info secret?
C_Secrets.ShouldTotemSpellBeSecret(spellID)isTotemSecretSpecific totem spell secret?
C_Secrets.ShouldUnitSpellCastBeSecret(unit, spellIdentifier)isSpellCastSecretCast info secret?
C_Secrets.ShouldUnitSpellCastingBeSecret(unit)isSpellCastingSecretAll cast info for unit secret?

What Returns Secrets

  • Cooldown timesC_Spell.GetSpellCooldown() may return secret start/duration when C_Secrets.ShouldSpellCooldownBeSecret() is true
  • Spell cast infoUnitCastingInfo() / UnitChannelInfo() return secret fields when unit identity is restricted
  • Totem infoGetTotemInfo() may return secret startTime/duration when the totem spell is secret

Safe Patterns

lua
-- Safe: Pass cooldown secrets directly to Cooldown widget
local cdInfo = C_Spell.GetSpellCooldown(spellID)
myCooldownFrame:SetCooldown(cdInfo.startTime, cdInfo.duration)

-- Safe: Display spell name (concatenation works with secrets)
local name = C_Spell.GetSpellName(spellID)
myFontString:SetText(name)

-- UNSAFE: Cannot branch on cooldown values
local cdInfo = C_Spell.GetSpellCooldown(spellID)
if cdInfo.duration > 0 then end  -- ERROR if duration is secret

Common Patterns

Iterate All Spellbook Entries

lua
local numLines = C_SpellBook.GetNumSpellBookSkillLines()
for skillIndex = 1, numLines do
    local info = C_SpellBook.GetSpellBookSkillLineInfo(skillIndex)
    for slotIndex = info.itemIndexOffset + 1, info.itemIndexOffset + info.numSpellBookItems do
        local itemInfo = C_SpellBook.GetSpellBookItemInfo(slotIndex, Enum.SpellBookSpellBank.Player)
        if itemInfo and itemInfo.itemType == Enum.SpellBookItemType.Spell then
            print(itemInfo.name, itemInfo.spellID)
        end
    end
end

Check If Spell Is Usable and in Range

lua
local function CanCastOnTarget(spellID, unit)
    local isUsable, insufficientPower = C_Spell.IsSpellUsable(spellID)
    if not isUsable then return false, insufficientPower end

    if C_Spell.SpellHasRange(spellID) then
        local inRange = C_Spell.IsSpellInRange(spellID, unit)
        if inRange == false then return false end
    end

    local cdInfo = C_Spell.GetSpellCooldown(spellID)
    -- Note: cdInfo.duration may be a secret value in 12.0
    -- Cannot branch on it — pass to Cooldown widget instead
    return true
end

Display Action Button State

lua
local function UpdateActionButton(button, actionID)
    if not C_ActionBar.HasAction(actionID) then
        button:Hide()
        return
    end

    button.icon:SetTexture(C_ActionBar.GetActionTexture(actionID))

    local isUsable, noMana = C_ActionBar.IsUsableAction(actionID)
    if isUsable then
        button.icon:SetVertexColor(1, 1, 1)
    elseif noMana then
        button.icon:SetVertexColor(0.5, 0.5, 1)
    else
        button.icon:SetVertexColor(0.4, 0.4, 0.4)
    end

    -- Use activation overlay for proc detection
    if C_SpellActivationOverlay.IsSpellOverlayed(C_ActionBar.GetSpell(actionID)) then
        button.overlay:Show()
    else
        button.overlay:Hide()
    end
end

Monitor Totem State

lua
local function UpdateTotemFrame(slot)
    local haveTotem, name, startTime, duration, icon, modRate, spellID = GetTotemInfo(slot)
    if haveTotem then
        -- startTime/duration may be secret in 12.0
        myTotemIcon:SetTexture(icon)
        myTotemCooldown:SetCooldown(startTime, duration)  -- Widget accepts secrets
        myTotemName:SetText(name)
    end
end

Query Shapeshift Forms

lua
local function ShowAvailableForms()
    local numForms = GetNumShapeshiftForms()
    for i = 1, numForms do
        local icon, active, castable, spellID = GetShapeshiftFormInfo(i)
        print(C_Spell.GetSpellName(spellID), active and "(Active)" or "")
    end
end

Related Events

EventPayloadWhen
SPELL_DATA_LOAD_RESULTspellID, successAsync spell data load complete
ACTIONBAR_SLOT_CHANGEDslotAction placed/removed from slot
ACTIONBAR_PAGE_CHANGEDAction bar page changed
ACTIONBAR_UPDATE_COOLDOWNAction cooldown updated
ACTIONBAR_UPDATE_USABLEAction usability changed
ACTIONBAR_UPDATE_STATEAction state changed
UPDATE_BONUS_ACTIONBARBonus bar changed (stance/form)
UPDATE_EXTRA_ACTIONBARExtra action button changed
UPDATE_OVERRIDE_ACTIONBAROverride bar state changed
UPDATE_VEHICLE_ACTIONBARVehicle bar changed
UPDATE_POSSESS_BARPossession bar changed
SPELL_ACTIVATION_OVERLAY_SHOWspellID, ...Proc overlay should show
SPELL_ACTIVATION_OVERLAY_HIDEspellIDProc overlay should hide
SPELL_UPDATE_COOLDOWNSpell cooldowns changed
SPELL_UPDATE_USABLESpell usability changed
SPELL_UPDATE_CHARGESSpell charges changed
CURRENT_SPELL_CAST_CHANGEDCurrent cast changed
SPELLS_CHANGEDSpellbook contents changed
LEARNED_SPELL_IN_SKILL_LINEspellID, skillLineIndex, isGuildPerkSpellNew spell learned
PLAYER_TOTEM_UPDATEslotTotem state changed
UPDATE_SHAPESHIFT_FORMShapeshift form changed
UPDATE_SHAPESHIFT_FORMSAvailable forms changed
UPDATE_SHAPESHIFT_COOLDOWNForm cooldown changed
SPELL_CONFIRMATION_PROMPTspellID, confirmType, text, duration, currencyID, currencyCost, difficultyIDSpell confirmation needed
SPELL_CONFIRMATION_TIMEOUTspellIDConfirmation timed out
PET_BAR_UPDATEPet bar updated
PET_BAR_UPDATE_COOLDOWNPet action cooldown changed
PET_BAR_UPDATE_USABLEPet action usability changed
ASSISTED_COMBAT_UPDATERotation helper suggestion changed
COOLDOWN_VIEWER_UPDATECooldown viewer data changed
SPELL_FLYOUT_UPDATEflyoutID, spellID, isLearnedFlyout spell learned/changed