Reference › Function reference › Core

Core.point_conditions.GetConditionPointResource

public

Call as

addon:GetConditionPointResource(unit, cache)

Available directly through addon; no dependency is needed.

What it does

Resolve the selected unit point-resource selector using the live class-to-resource map and ComboPoints fallback. Known absence returns false; unavailable required identity or selector data returns nil with a reason. Share complete identity observations within the evaluation pass. Only successful player class observations persist in the current longterm cache, tied to the native UnitClass identity; existence is refreshed each pass. This selects a resource without reading its current or maximum quantity.

Arguments

NameTypeWhat it does
selfRMAddonRotation Master addon instance (implicit with colon calls).
unitstringExact selected unit token; player class alone may use the successful longterm cache.
cachetable | nilEvaluation-pass cache, or nil to observe identity directly. Resource mapping is resolved live on each invocation.

Returns

1number | boolean | nilExplicit nonnegative integer power selector, false for a known absent unit, or nil when required data is unavailable.
2string | nilPolicy, query-validation or identity/selector availability reason for a nil selector.

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.

Example

local power, reason = addon:GetConditionPointResource("player", cache)
if power == nil then return nil, reason end
if power == false then return false end
return UnitPower("player", power) >= 4

Dependencies

Source

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

Core.point_conditions.GetConditionPointResource(self, unit, cache)
    local platform=self.Platform
    if platform:GetCombatDataPolicy()~='probe' then return nil,'unsupported-policy' end
    if not platform:CanReadValue(unit) then return nil,'restricted-value' end
    if type(unit)~='string' or unit=='' then return nil,'invalid-unit' end
    local record,reason=addon.Functions.cache.getCached(cache,pointIdentity,self,unit,playerClassCacheKey)
    if not record then return nil,reason end
    if not record.exists then return false end
    local points=self.points
    if not platform:CanReadValue(points) then return nil,'restricted-value' end
    if type(points)~='table' then return nil,'invalid-point-resource-map' end
    local ok,selected=pcall(function() return points[record.class] end)
    if not ok then return nil,'api-error' end
    if not platform:CanReadValue(selected) then return nil,'restricted-value' end
    if selected==nil or selected==false then
        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 typesOK,types=pcall(function() return enum.PowerType end)
        if not typesOK then return nil,'api-error' end
        if not platform:CanReadValue(types) then return nil,'restricted-value' end
        if type(types)~='table' then return nil,'point-resource-unavailable' end
        local fallbackOK,fallback=pcall(function() return types.ComboPoints end)
        if not fallbackOK then return nil,'api-error' end
        selected=fallback
        if not platform:CanReadValue(selected) then return nil,'restricted-value' end
    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

Back to Function reference