AgentSkillsCN

wow-api-talents

WoW Retail职业天赋、英雄天赋、特质系统、专精,以及职业专精API的完整参考。涵盖C_ClassTalents(天赋加载、配置管理、天赋树交互)、C_Traits(底层特质系统——节点、条目、配置、货币、条件)、C_SpecializationInfo(专精查询、推荐内容)、全局专精功能(GetSpecialization、GetSpecializationInfo、SetSpecialization),以及职业专精。当您需要处理天赋树、天赋加载、英雄天赋选择、特质节点、专精切换,或天赋导入/导出时,此功能将为您提供全面支持。

SKILL.md
--- frontmatter
name: wow-api-talents
description: "Complete reference for WoW Retail Class Talents, Hero Talents, Traits system, Specialization, and Profession Specialization APIs. Covers C_ClassTalents (loadouts, config management, talent tree interactions), C_Traits (the underlying trait system — nodes, entries, configs, currencies, conditions), C_SpecializationInfo (spec queries, recommended content), global specialization functions (GetSpecialization, GetSpecializationInfo, SetSpecialization), and profession specialization. Use when working with talent trees, talent loadouts, hero talent selection, trait nodes, specialization switching, or talent import/export."

Talents & Specialization API (Retail — Patch 12.0.0)

Comprehensive reference for class talents, hero talents, the traits system, and specialization APIs.

Source: https://warcraft.wiki.gg/wiki/World_of_Warcraft_API Current as of: Patch 12.0.0 (Build 65655) — January 28, 2026 Scope: Retail only.


Scope

  • C_ClassTalents — Talent loadouts, config management
  • C_Traits — Trait system (nodes, entries, configs, currencies)
  • C_SpecializationInfo — Specialization queries
  • Global Spec Functions — GetSpecialization, SetSpecialization
  • Profession Specialization — C_ProfessionSpecUI (cross-ref professions skill)

Architecture Overview

The talent system uses a layered architecture:

  1. Specialization — Top level: player picks a spec (e.g., Fire Mage)
  2. C_ClassTalents — Manages loadouts (saved talent builds) and provides high-level talent tree interaction
  3. C_Traits — Low-level trait system: nodes, entries, definitions, configs, currencies
  4. Hero Talents — Sub-trees within the talent system, selected as a package

C_ClassTalents — Talent Loadouts & Config

Loadout Management

FunctionReturnsDescription
C_ClassTalents.GetActiveConfigID()configIDActive talent config
C_ClassTalents.GetConfigIDsBySpecID(specID)configIDsConfigs for spec
C_ClassTalents.GetStarterBuildActive()isActiveUsing starter build?
C_ClassTalents.GetHasStarterBuild()hasStarterBuildStarter build available?
C_ClassTalents.SetStarterBuildActive(active)successToggle starter build
C_ClassTalents.GetTraitTreeForSpec(specID)treeIDTrait tree for spec
C_ClassTalents.GetHeroTalentSpecsForClassSpec(specID)heroSpecIDsHero talent specs
C_ClassTalents.CanCreateNewConfig()canCreateCan create new loadout?
C_ClassTalents.RequestNewConfig(name)successCreate new loadout
C_ClassTalents.DeleteConfig(configID)successDelete loadout
C_ClassTalents.RenameConfig(configID, name)successRename loadout
C_ClassTalents.UpdateLastSelectedSavedConfigID(specID, configID)Set last selected config
C_ClassTalents.GetLastSelectedSavedConfigID(specID)configIDLast selected config

Talent Import/Export

FunctionReturnsDescription
C_ClassTalents.ImportLoadout(importString)success, loadoutEntryInfoImport talent string
C_ClassTalents.GetLoadoutExportString()exportStringExport current build
C_ClassTalents.ViewLoadout(loadoutInfo)Preview a loadout

Talent Commit

FunctionReturnsDescription
C_ClassTalents.CommitConfig(configID)successApply talent config
C_ClassTalents.CanChangeTalents()canChange, failureReasonCan change talents?
C_ClassTalents.HasUnspentTalentPoints()hasUnspentHas unspent points?
C_ClassTalents.GetConfigBaseName(configID)baseNameConfig display name

C_Traits — Core Trait System

Config Functions

FunctionReturnsDescription
C_Traits.GetConfigInfo(configID)configInfoConfig details
C_Traits.GetConfigsByType(configType)configIDsConfigs by type
C_Traits.HasValidInspectData()hasDataValid inspect data?

Tree Functions

FunctionReturnsDescription
C_Traits.GetTreeInfo(configID, treeID)treeInfoTree structure
C_Traits.GetTreeNodes(treeID)nodeIDsAll nodes in tree
C_Traits.GetTreeCurrencyInfo(configID, treeID, traitCurrencyIndex)currencyInfoTree currency info

Node Functions

FunctionReturnsDescription
C_Traits.GetNodeInfo(configID, nodeID)nodeInfoComplete node data
C_Traits.GetNodeCost(configID, nodeID)costsNode cost
C_Traits.CanPurchaseRank(configID, nodeID)canPurchaseCan buy next rank?
C_Traits.CanRefundRank(configID, nodeID)canRefundCan refund rank?
C_Traits.PurchaseRank(configID, nodeID)successPurchase rank
C_Traits.RefundRank(configID, nodeID)successRefund rank
C_Traits.SetSelection(configID, nodeID, entryID)successSelect choice node
C_Traits.GetNodePositionForTree(treeID, nodeID)posX, posYNode visual position

Node Info Fields

The nodeInfo table from GetNodeInfo():

  • ID — Node ID
  • posX, posY — Position in tree
  • type — Node type (Single, Tiered, Selection, SubTreeSelection)
  • maxRanks — Maximum ranks
  • activeRank — Current active rank
  • currentRank — Current rank (may differ from active during editing)
  • entryIDs — Available entries (for choice nodes)
  • activeEntry — Currently active entry
  • currentEntry — Entry during editing
  • canPurchaseRank — Can purchase next rank
  • canRefundRank — Can refund a rank
  • isAvailable — Node unlocked
  • isCascadeRepurchasable — Can cascade repurchase
  • isVisible — Visible in UI
  • meetsEdgeRequirements — Edge requirements met
  • groupIDs — Associated groups
  • visibleEdges — Connected edges
  • conditionIDs — Conditions for availability
  • subTreeID — Sub-tree ID (hero talents)

Entry Functions

FunctionReturnsDescription
C_Traits.GetEntryInfo(configID, entryID)entryInfoEntry details
C_Traits.GetDefinitionInfo(definitionID)definitionInfoSpell/ability for entry
C_Traits.GetSubTreeInfo(configID, subTreeID)subTreeInfoSub-tree (hero) details
C_Traits.GetSubTreesForSpecID(specID)subTreeIDsSub-trees for spec

Entry Info Fields

  • definitionID — The talent definition
  • type — Entry type
  • maxRanks — Max ranks for this entry
  • isAvailable — Is this entry available
  • conditionIDs — Conditions

Definition Info Fields

  • spellID — Spell granted by this talent
  • overrideName — Override display name
  • overrideSubtext — Override subtext
  • overrideIcon — Override icon

Condition Functions

FunctionReturnsDescription
C_Traits.GetConditionInfo(configID, conditionID)conditionInfoCondition details

Currency Functions

FunctionReturnsDescription
C_Traits.GetTraitCurrencyInfo(traitCurrencyID)currencyInfoCurrency info

Global Specialization Functions

FunctionReturnsDescription
GetSpecialization()specIndexCurrent spec index (1-4)
GetSpecializationInfo(specIndex [, isInspect [, isPet [, inspectUnit [, sex]]]])id, name, description, icon, role, primaryStatSpec details
GetSpecializationInfoByID(specID)id, name, description, icon, role, primaryStat, ...Spec details by ID
GetSpecializationInfoForClassID(classID, specIndex)id, name, description, icon, role, primaryStatSpec for class
GetSpecializationInfoForSpecID(specID [, sex])id, name, description, icon, role, primaryStatSpec by spec ID
GetSpecializationRole(specIndex)roleSpec's role type
GetSpecializationRoleByID(specID)roleRole by spec ID
GetNumSpecializations([isInspect [, isPet]])numSpecsNumber of specs
GetNumSpecializationsForClassID(classID)numSpecsSpecs for class
SetSpecialization(specIndex)Switch spec
GetActiveSpecGroup()specGroupActive spec group
GetSpecializationMasterySpells(specIndex [, isInspect [, isPet]])spellIDsMastery spell(s)
GetSpecializationSpells(specIndex [, isInspect [, isPet]])... (spellID, level pairs)Spec spells

C_SpecializationInfo

FunctionReturnsDescription
C_SpecializationInfo.CanPlayerUseTalentSpecUI()canUse, failureReasonCan use talent UI?
C_SpecializationInfo.GetAllSelectedPvpTalentIDs()talentIDsSelected PvP talents
C_SpecializationInfo.GetInspectSelectedPvpTalent(inspectUnit, talentIndex)talentIDInspected PvP talent
C_SpecializationInfo.GetPvpTalentAlertStatus()hasUnspentPvP talent alert?
C_SpecializationInfo.GetPvpTalentSlotInfo(slotIndex)slotInfoPvP talent slot
C_SpecializationInfo.GetPvpTalentSlotUnlockLevel(slotIndex)levelPvP slot unlock level
C_SpecializationInfo.GetPvpTalentUnlockLevel(talentID)levelPvP talent unlock level
C_SpecializationInfo.GetSpellsDisplay(specID)spellIDsDisplay spells for spec
C_SpecializationInfo.IsInitialized()isInitializedSpec system ready?
C_SpecializationInfo.MatchesCurrentSpecSet(setID)matchesEquipment set matches spec?
C_SpecializationInfo.SetPvpTalentLocked(talentID, locked)Lock PvP talent

Common Patterns

Get Active Spec Info

lua
local specIndex = GetSpecialization()
if specIndex then
    local specID, specName, specDesc, specIcon, specRole = GetSpecializationInfo(specIndex)
    print("Current Spec:", specName, "Role:", specRole)
end

Iterate Talent Tree Nodes

lua
local configID = C_ClassTalents.GetActiveConfigID()
if configID then
    local specID = PlayerUtil.GetCurrentSpecID and PlayerUtil.GetCurrentSpecID()
                   or GetSpecializationInfo(GetSpecialization())
    local treeID = C_ClassTalents.GetTraitTreeForSpec(specID)
    if treeID then
        local nodeIDs = C_Traits.GetTreeNodes(treeID)
        for _, nodeID in ipairs(nodeIDs) do
            local nodeInfo = C_Traits.GetNodeInfo(configID, nodeID)
            if nodeInfo and nodeInfo.isVisible and nodeInfo.activeRank > 0 then
                local entryInfo = C_Traits.GetEntryInfo(configID, nodeInfo.activeEntry.entryID)
                if entryInfo then
                    local defInfo = C_Traits.GetDefinitionInfo(entryInfo.definitionID)
                    if defInfo then
                        local spellName = C_Spell.GetSpellName(defInfo.spellID)
                        print(spellName, "Rank:", nodeInfo.activeRank)
                    end
                end
            end
        end
    end
end

Export/Import Talent String

lua
-- Export current talents
local exportString = C_ClassTalents.GetLoadoutExportString()
print("Talent string:", exportString)

-- Import talents (must be out of combat)
local success, loadoutInfo = C_ClassTalents.ImportLoadout(exportString)
if success then
    C_ClassTalents.ViewLoadout(loadoutInfo)
end

Switch Specialization

lua
local function SwitchSpec(specIndex)
    if specIndex ~= GetSpecialization() then
        if not InCombatLockdown() then
            SetSpecialization(specIndex)
        else
            print("Cannot change spec in combat")
        end
    end
end

Key Events

EventPayloadDescription
PLAYER_SPECIALIZATION_CHANGEDunitSpecialization changed
ACTIVE_COMBAT_CONFIG_CHANGEDconfigIDActive talent config changed
TRAIT_CONFIG_CREATEDconfigInfoNew config created
TRAIT_CONFIG_DELETEDconfigIDConfig deleted
TRAIT_CONFIG_UPDATEDconfigIDConfig updated
TRAIT_CONFIG_LIST_UPDATEDConfig list changed
TRAIT_NODE_CHANGEDnodeIDTrait node changed
TRAIT_NODE_ENTRY_UPDATEDnodeIDNode entry updated
TRAIT_TREE_CHANGEDtreeIDTree structure changed
TRAIT_TREE_CURRENCY_INFO_UPDATEDtreeIDCurrency info changed
SPECIALIZATION_CHANGE_CAST_FAILEDSpec change failed
CONFIRM_TALENT_WIPEcost, respecTypeConfirm talent wipe
STARTER_BUILD_ACTIVATION_FAILEDStarter build failed
SELECTED_PVP_TALENTS_CHANGEDPvP talents changed
PVP_TALENTS_UPDATEPvP talents refreshed
HERO_TALENT_SELECTION_CHANGEDHero talent selection changed

Gotchas & Restrictions

  1. configID is per-spec — Each specialization has its own set of configs. Active configID changes on spec switch.
  2. Cannot change talents in combatC_ClassTalents.CommitConfig() and SetSpecialization() fail in combat.
  3. Trait system is genericC_Traits is the underlying system used for class talents, hero talents, AND profession specializations. The configType differentiates them.
  4. Node types matter — Single nodes have one entry, Selection (choice) nodes have multiple entries you pick between.
  5. Hero talents are sub-trees — Hero talent selection is a SubTreeSelection node type. Use C_Traits.GetSubTreeInfo().
  6. GetNodeInfo is expensive — Cache node info when iterating the full tree. Don't call in OnUpdate.
  7. Loadout export is opaque — The export string format is internal. Use the API functions, don't parse manually.
  8. specIndex vs specIDGetSpecialization() returns an index (1-4), not a specID. Use GetSpecializationInfo() to get the specID.