# C_ClassTalents: 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_ClassTalents

## Functions

### C_ClassTalents.CanChangeTalents

```lua
canChange, canAdd, changeError = C_ClassTalents.CanChangeTalents()
```

Returns true only if the player has staged changes and can commit their talents in their current state.

Returns:
- `canChange`: bool
- `canAdd`: bool
- `changeError`: string, may be nil

### C_ClassTalents.CanCreateNewConfig

```lua
canCreate = C_ClassTalents.CanCreateNewConfig()
```

Returns:
- `canCreate`: bool

### C_ClassTalents.CanEditTalents

```lua
canEdit, changeError = C_ClassTalents.CanEditTalents()
```

Returns true if the player could switch talents if they staged a proper loadout.

Returns:
- `canEdit`: bool
- `changeError`: cstring

### C_ClassTalents.CommitConfig

```lua
success = C_ClassTalents.CommitConfig([savedConfigID])
```

Arguments:
- `savedConfigID`: number, may be nil

Returns:
- `success`: bool

### C_ClassTalents.DeleteConfig

```lua
success = C_ClassTalents.DeleteConfig(configID)
```

Arguments:
- `configID`: number

Returns:
- `success`: bool

### C_ClassTalents.GetActiveConfigID

```lua
activeConfigID = C_ClassTalents.GetActiveConfigID()
```

Returns:
- `activeConfigID`: number, may be nil

### C_ClassTalents.GetActiveHeroTalentSpec

```lua
heroSpecID = C_ClassTalents.GetActiveHeroTalentSpec()
```

Returns the SubTreeID of the player's active Hero Talent Specialization SubTree.

Returns:
- `heroSpecID`: number, may be nil. SubTreeID of the player's active Hero Talent Specialization or nil if no Specialization is active.

### C_ClassTalents.GetConfigIDsBySpecID

```lua
configIDs = C_ClassTalents.GetConfigIDsBySpecID([specID])
```

Arguments:
- `specID`: number, may be nil

Returns:
- `configIDs`: number[]

### C_ClassTalents.GetHasStarterBuild

```lua
hasStarterBuild = C_ClassTalents.GetHasStarterBuild()
```

Returns:
- `hasStarterBuild`: bool

### C_ClassTalents.GetHeroTalentSpecsForClassSpec

```lua
subTreeIDs, requiredPlayerLevel = C_ClassTalents.GetHeroTalentSpecsForClassSpec([configID], [classSpecID])
```

Returns the SubTreeIDs of the Hero Talent Specializations available to a Class Specialization and config; Returns nothing if none available

May return nothing.

Arguments:
- `configID`: number, may be nil. If not supplied, defaults to the player's active config
- `classSpecID`: number, may be nil. If not supplied, defaults to the player's active spec

Returns:
- `subTreeIDs`: number[], may be nil. SubTreeIDs of each Hero Talent Specialization
- `requiredPlayerLevel`: number, may be nil. The player level at which one of the Hero Talent Specializations can be activated

### C_ClassTalents.GetLastSelectedSavedConfigID

```lua
configID = C_ClassTalents.GetLastSelectedSavedConfigID(specID)
```

Arguments:
- `specID`: number

Returns:
- `configID`: number, may be nil

### C_ClassTalents.GetNextStarterBuildPurchase

```lua
nodeID, entryID = C_ClassTalents.GetNextStarterBuildPurchase()
```

Returns:
- `nodeID`: number, may be nil
- `entryID`: number, may be nil

### C_ClassTalents.GetStarterBuildActive

```lua
isActive = C_ClassTalents.GetStarterBuildActive()
```

Returns:
- `isActive`: bool

### C_ClassTalents.GetTraitTreeForSpec

```lua
treeID = C_ClassTalents.GetTraitTreeForSpec(specID)
```

Arguments:
- `specID`: number

Returns:
- `treeID`: number, may be nil

### C_ClassTalents.HasUnspentHeroTalentPoints

```lua
hasUnspentPoints, numHeroPoints = C_ClassTalents.HasUnspentHeroTalentPoints()
```

Returns whether the player has any unspent talent points in their active hero talent tree. If hasUnspentPoints is true, numHeroPoints will be greater than zero.

Returns:
- `hasUnspentPoints`: bool
- `numHeroPoints`: number

### C_ClassTalents.HasUnspentTalentPoints

```lua
hasUnspentPoints, numClassPoints, numSpecPoints = C_ClassTalents.HasUnspentTalentPoints()
```

Returns whether the player has any unspent talent points in their class or spec talent trees. If hasUnspentPoints is true, the number of unspent points for at least one of the trees will be greater than zero. Hero talent points are not included by this function.

Returns:
- `hasUnspentPoints`: bool
- `numClassPoints`: number
- `numSpecPoints`: number

### C_ClassTalents.ImportLoadout

```lua
success, importError = C_ClassTalents.ImportLoadout(configID, entries, name, [importString])
```

Arguments:
- `configID`: number
- `entries`: ImportLoadoutEntryInfo[]
- `name`: string
- `importString`: string, may be nil

Returns:
- `success`: bool
- `importError`: cstring

### C_ClassTalents.InitializeViewLoadout

```lua
C_ClassTalents.InitializeViewLoadout(specID, level)
```

Arguments:
- `specID`: number
- `level`: number

### C_ClassTalents.IsConfigPopulated

```lua
isPopulated = C_ClassTalents.IsConfigPopulated(configID)
```

New configs may or may not be populated and ready to load immediately after creation. Avoid calling for configs intentionally created empty.

Arguments:
- `configID`: number

Returns:
- `isPopulated`: bool

### C_ClassTalents.LoadConfig

```lua
result, changeError, newLearnedNodeIDs = C_ClassTalents.LoadConfig(configID, autoApply)
```

Arguments:
- `configID`: number
- `autoApply`: bool

Returns:
- `result`: LoadConfigResult
- `changeError`: string, may be nil
- `newLearnedNodeIDs`: number[]

### C_ClassTalents.RenameConfig

```lua
success = C_ClassTalents.RenameConfig(configID, name)
```

Arguments:
- `configID`: number
- `name`: string

Returns:
- `success`: bool

### C_ClassTalents.RequestNewConfig

```lua
success = C_ClassTalents.RequestNewConfig(name)
```

Arguments:
- `name`: string

Returns:
- `success`: bool

### C_ClassTalents.SaveConfig

```lua
success = C_ClassTalents.SaveConfig(configID)
```

Arguments:
- `configID`: number

Returns:
- `success`: bool

### C_ClassTalents.SetStarterBuildActive

```lua
result = C_ClassTalents.SetStarterBuildActive(active)
```

Arguments:
- `active`: bool

Returns:
- `result`: LoadConfigResult

### C_ClassTalents.SetUsesSharedActionBars

```lua
C_ClassTalents.SetUsesSharedActionBars(configID, usesShared)
```

Arguments:
- `configID`: number
- `usesShared`: bool

### C_ClassTalents.SwitchToLoadoutByIndex

```lua
C_ClassTalents.SwitchToLoadoutByIndex(loadoutIndex)
```

Loads loadout for the current specialization by dropdown index. Indices start at 1.

Arguments:
- `loadoutIndex`: number

### C_ClassTalents.SwitchToLoadoutByName

```lua
C_ClassTalents.SwitchToLoadoutByName(loadoutName)
```

Loads loadout for the current specialization by name. Loads the first one found in the case of duplicate names.

Arguments:
- `loadoutName`: cstring

### C_ClassTalents.SwitchToSpecializationByIndex

```lua
C_ClassTalents.SwitchToSpecializationByIndex(specIndex)
```

Activates specialization for the current class by index in the order within the Specializations tab. Indices start at 1.

Arguments:
- `specIndex`: number

### C_ClassTalents.SwitchToSpecializationByName

```lua
C_ClassTalents.SwitchToSpecializationByName(specName)
```

Activates specialization for the current class by spec name.

Arguments:
- `specName`: cstring

### C_ClassTalents.UpdateLastSelectedSavedConfigID

```lua
C_ClassTalents.UpdateLastSelectedSavedConfigID(specID, [configID])
```

Arguments:
- `specID`: number
- `configID`: number, may be nil

### C_ClassTalents.ViewLoadout

```lua
success = C_ClassTalents.ViewLoadout(entries, [importString])
```

Arguments:
- `entries`: ImportLoadoutEntryInfo[]
- `importString`: string, may be nil

Returns:
- `success`: bool

## Events

### ACTIVE_COMBAT_CONFIG_CHANGED

Payload, after the event's name:
- `configID`: number

### CLASS_TALENTS_SWITCH_TO_LOADOUT_BY_INDEX

Payload, after the event's name:
- `loadoutIndex`: number

### CLASS_TALENTS_SWITCH_TO_LOADOUT_BY_NAME

Payload, after the event's name:
- `loadoutName`: cstring

### CLASS_TALENTS_SWITCH_TO_SPECIALIZATION_BY_INDEX

Payload, after the event's name:
- `specIndex`: number

### CLASS_TALENTS_SWITCH_TO_SPECIALIZATION_BY_NAME

Payload, after the event's name:
- `specName`: cstring

### SELECTED_LOADOUT_CHANGED

No payload.

### SPECIALIZATION_CHANGE_CAST_FAILED

No payload.

### STARTER_BUILD_ACTIVATION_FAILED

No payload.

## Tables

### Enum.LoadConfigResult (enumeration)

- `Error` = 0
- `NoChangesNecessary` = 1
- `LoadInProgress` = 2
- `Ready` = 3

### ImportLoadoutEntryInfo (structure)

- `nodeID`: number
- `ranksGranted`: number
- `ranksPurchased`: number
- `selectionEntryID`: 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."
