Reference › Function reference › Conditions

Conditions.hero_talent.listedSpec

dependency

Call as

Conditions.hero_talent.listedSpec(spec)

Record the dependency Conditions.hero_talent.listedSpec, then call it by that name. A namespaced call does not pass self: use a colon call or pass the object yourself.

What it does

Returns the specialization ID when it is one of the player's own class's specializations, which are the only ones whose hero talent trees the game can list. Reads the class from UnitClass and the choices from Platform:GetClassSpecializationChoices.

Arguments

NameTypeWhat it does
specnumber | nilSpecialization ID of the rotation being edited.

Returns

1number | nilThe same ID when the player's class has it; nil otherwise, or when the class or the list cannot be read.

Editions

Built In helpers are registered on every edition. What differs is the game API they read; where one is missing the helper falls back or returns nil with a reason.

  • Not available on that edition (the reason is in the tooltip)
  • Only while Blizzard's deprecation fallbacks are on
Game APIClassic EraTBC AnniversaryClassic progressionForeverRetail
UnitClassClassic EraTBC AnniversaryClassic progressionForeverRetail

Secret values (Retail and Forever)

On Retail and Forever the game hands addons secret values. This helper checks what it reads (addon.Platform:CanReadValue) and returns nil with a reason such as restricted-value instead of a secret it cannot compare. Treat nil as unavailable, not as false.

How the addon calls it

  • Hero Talent Tree (widget)
    local listed = type(platform.GetHeroTreeChoices) == "function" and platform:GetHeroTreeChoices(listedSpec(spec))

Source

Conditions/hero_talent.lua, line 54. Read only in game; Duplicate makes an editable copy.

Conditions.hero_talent.listedSpec(spec)
    local platform = addon.Platform
    if type(spec) ~= "number" or type(platform.GetClassSpecializationChoices) ~= "function" then return nil end
    local ok, _, _, classID = pcall(UnitClass, "player")
    if not ok or not platform:CanReadValue(classID) then return nil end
    for _, choice in ipairs(platform:GetClassSpecializationChoices(classID) or {}) do
        if choice.id == spec then return spec end
    end

Back to Function reference