Reference › Function reference › Core

Core.point_conditions.editionPointResource

dependency

Call as

Core.point_conditions.editionPointResource(platform, info, unit, class, cache)

Record the dependency Core.point_conditions.editionPointResource, 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

Selects the point resource for era and progression clients from the addon's per-edition map (combo points, Holy Power, Soul Shards, Chi, Shadow Orbs and similar). When the resource depends on specialization, only the player can be resolved.

Arguments

NameTypeWhat it does
platformRMPlatformPlatform used for readability checks and the player's specialization.
infotableClient info with family and, on progression clients, expansion.
unitstringUnit token the resource is for.
classstringThe unit's class file token.
cachetable | nilEvaluation-pass cache passed to getCached, or nil to read directly.

Returns

1number | nilEnum.PowerType value of the selected resource, or nil when unavailable.
2string | nilNil on success; otherwise the reason, such as unsupported-point-expansion, point-specialization-unavailable, point-resource-unavailable or invalid-point-resource.
3string | nil"power" on success, marking the selector as a power type; absent on failure.

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
EnumClassic 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

Dependencies

Source

Core/point_conditions.lua, line 163. Read only in game; Duplicate makes an editable copy.

Core.point_conditions.editionPointResource(platform, info, unit, class, cache)
    local family=info.family
    local map=editionPointPowers[family]
    if family=='progression' then
        local expansion=info.expansion
        if not platform:CanReadValue(expansion) then return nil,'restricted-value' end
        if type(expansion)~='number' then return nil,'unsupported-point-expansion' end
        map=map[expansion]
        if map==nil then return nil,'unsupported-point-expansion' end
    end
    local name=map[class]
    if type(name)=='table' then
        -- Only the player's own specialization is readable.
        if unit~='player' then return nil,'point-specialization-unavailable' end
        local spec,why=addon.Functions.cache.getCached(cache,platform.GetPlayerSpecializationIndex,platform)
        if spec==nil then return nil,why end
        name=name[spec]
    end
    if name==nil then return nil,'point-resource-unavailable' end
    local enum=Enum
    if not platform:CanReadValue(enum) then return nil,'restricted-value' end
    if type(enum)~='table' then return nil,'point-resource-unavailable' end
    local types=rawget(enum,'PowerType')
    if not platform:CanReadValue(types) then return nil,'restricted-value' end
    if type(types)~='table' then return nil,'point-resource-unavailable' end
    local selected=rawget(types,name)
    if not platform:CanReadValue(selected) then return nil,'restricted-value' end
    if selected==nil then return nil,'point-resource-unavailable' end
    if type(selected)~='number' or selected~=selected or selected<0 or selected==math.huge or selected%1~=0 then return nil,'invalid-point-resource' end
    return selected,nil,'power'

Back to Function reference