레퍼런스 › 함수 레퍼런스 › Core

Core.point_conditions.GetConditionPointResource

공개

호출 방법

addon:GetConditionPointResource(unit, cache)

addon을 통해 바로 쓸 수 있으며, 의존성이 필요 없습니다.

하는 일

실시간 직업-자원 맵과 ComboPoints 대체로 선택한 유닛의 점수 자원 선택자를 확인합니다. 없는 것으로 알려지면 false를, 필수 식별이나 선택자 데이터를 사용할 수 없으면 nil과 이유를 반환합니다. 완전한 식별 관찰은 평가 패스 안에서 공유합니다. 기본 UnitClass 식별에 묶인 현재 장기 캐시에는 성공한 플레이어 직업 관찰만 유지되며, 존재 여부는 패스마다 새로 고칩니다. 현재나 최대 수량을 읽지 않고 자원만 선택합니다.

인수

이름유형하는 일
selfRMAddonRotation Master 애드온 인스턴스 (콜론 호출에서는 암묵적).
unitstring선택한 정확한 유닛 토큰. 성공한 장기 캐시는 플레이어 직업만 사용할 수 있습니다.
cachetable | nil평가 패스 캐시. 식별 정보를 직접 관찰하려면 nil. 자원 대응은 호출할 때마다 새로 확인합니다.

반환값

1number | boolean | nil명시적인 음수가 아닌 정수 자원 선택자, 없는 것으로 알려진 유닛이면 false, 필수 데이터를 사용할 수 없으면 nil.
2string | nilnil인 선택자에 대한 정책, 조회 검증 또는 식별/선택자 사용 불가 이유.

버전

기본 제공 도우미는 모든 버전에 등록됩니다. 다른 점은 읽는 게임 API이며, API가 없으면 도우미는 대체 동작을 하거나 이유와 함께 nil을 반환합니다.

  • 해당 버전에서 사용할 수 없음 (이유는 툴팁에 표시)
  • Blizzard의 지원 중단 대체 함수가 켜져 있을 때만
게임 APIClassic EraTBC AnniversaryClassic progressionForeverRetail
EnumClassic EraTBC AnniversaryClassic progressionForeverRetail

비공개 값 (Retail과 Forever)

Retail과 Forever에서는 게임이 애드온에 비공개 값을 넘깁니다. 이 도우미는 읽는 값을 확인하고(addon.Platform:CanReadValue), 비교할 수 없는 비공개 값 대신 restricted-value 같은 이유와 함께 nil을 반환합니다. nil은 거짓이 아니라 사용할 수 없음으로 취급하세요.

예시

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

의존성

소스

Core/point_conditions.lua, 58번째 줄. 게임에서는 읽기 전용이며, 복제하면 편집 가능한 사본이 생깁니다.

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

함수 레퍼런스(으)로 돌아가기