레퍼런스 › 함수 레퍼런스 › Platform

Platform.points.GetUnitPointFragmentObservation

공개

호출 방법

addon.Platform:GetUnitPointFragmentObservation(unit, powerType, kind)

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

하는 일

클라이언트가 조각 단위로 보고하는 점수 자원(판다리아의 안개의 타오르는 불씨)을 관찰합니다. current는 정확히 UnitPower(unit,powerType,true), maximum은 UnitPowerMax(unit,powerType,true)를 사용하며, 결과를 Blizzard MAX_POWER_PER_EMBER(10)로 나누므로 조각 35개는 3.5입니다. 점검 정책 전용입니다. 데이터가 없거나, 실패하거나, 제한되거나, 잘못되면 사용할 수 없음으로 남으며, 전체 단위 조회로 대체하지 않습니다. 캐시는 추가하지 않습니다.

인수

이름유형하는 일
selfRMPlatformRotation Master 플랫폼 어댑터 (콜론 호출에서는 암묵적).
unitstring그대로 전달되는 비어 있지 않은 정확한 유닛 토큰.
powerTypenumber명시적이고 읽을 수 있는 유한한 음수가 아닌 정수 자원 선택자.
kindstringUnitPower에는 정확히 current, UnitPowerMax에는 maximum.

반환값

1number | nil소수 부분을 포함한 전체 단위의 유한한 수량. 사용할 수 없으면 nil.
2string | nilnil인 수량에 대한 정책, 조회 검증 또는 필수 관찰 사용 불가 이유.

버전

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

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

비공개 값 (Retail과 Forever)

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

예시

local embers = Enum.PowerType.BurningEmbers
if not embers then return nil end
local current = addon.Platform:GetUnitPointFragmentObservation("player", embers, "current")
if current == nil then return nil end
return current >= 3.5

의존성

소스

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

Platform.points.GetUnitPointFragmentObservation(self, unit, powerType, kind)
    if self:GetCombatDataPolicy()~='probe' then return nil,'unsupported-policy' end
    if not self:CanReadValue(unit) or not self:CanReadValue(powerType) or not self:CanReadValue(kind) then return nil,'restricted-value' end
    if type(unit)~='string' or unit=='' then return nil,'invalid-unit' end
    if type(powerType)~='number' or powerType~=powerType or powerType<0 or powerType==math.huge or powerType%1~=0 then return nil,'invalid-point-power-query' end
    if kind~='current' and kind~='maximum' then return nil,'invalid-point-power-query' end
    local api
    if kind=='current' then api=UnitPower else api=UnitPowerMax end
    if type(api)~='function' then return nil,'missing-api' end
    local ok,result=pcall(api,unit,powerType,true)
    if not ok then return nil,'api-error' end
    if not self:CanReadValue(result) then return nil,'restricted-value' end
    if canaccessvalue and not canaccessvalue(result) then return nil,'restricted-value' end
    if result==nil then return nil,'point-power-unavailable' end
    if type(result)~='number' or result~=result or result==math.huge or result==-math.huge then return nil,'invalid-api-result' end
    return result/pointFragmentsPerWhole

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