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

Core.threat_count_conditions.GetConditionThreatCount

공개

호출 방법

addon:GetConditionThreatCount(minimum, cache)

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

하는 일

관찰된 소속 스냅샷에 이미 있는 GUID 키 유닛만 셉니다. 공개된 위협 수준 관찰자를 쓰기 전에 현재 토큰 식별을 확인하며, 없거나 재사용된 것으로 알려진 토큰은 대체 없이 제외합니다. 완전한 식별 및 위협 관찰은 전달된 평가 캐시만 공유하고, 소속은 새로 순회합니다. 적이 아닌 것으로 알려졌거나 선택적 위협이 nil이면 세지 않으며, 필수 정보를 읽을 수 없거나 잘못되었거나 실패하면 결과 전체를 사용할 수 없습니다. 전체 구성을 나열하거나, 사거리 필터를 적용하거나, 추적 기록을 바꾸지 않습니다.

인수

이름유형하는 일
selfRMAddonRotation Master 애드온 인스턴스 (콜론 호출에서는 암묵적).
minimumnumber부호 있는 값과 소수 기준을 보존한 유한한 최소 기본 위협 상태.
cachetable | nil호출자가 소유한 평가 관찰 캐시. nil이면 새로 조회합니다.

반환값

1number | nil0을 포함한 음수가 아닌 전체 관찰 개수. 사용할 수 없으면 nil.
2string | nil정책, 스냅샷, 식별 또는 위협 관찰 사용 불가 이유.

버전

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

게임 API를 직접 읽지 않습니다.

비공개 값 (Retail과 Forever)

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

애드온에서 호출하는 방식

  • 위협 수준 개수 (evaluate)
    local count,reason=addon:GetConditionThreatCount(value.threat-1,cache)

의존성

소스

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

Core.threat_count_conditions.GetConditionThreatCount(self, minimum, cache)
    local platform=self.Platform
    local policy=platform:GetCombatDataPolicy()
    if policy~='probe' and policy~='restricted' then return nil,'unsupported-policy' end
    local valid,issue=finite(platform,minimum)
    if not valid then return nil,issue end
    if not platform:CanReadValue(cache) then return nil,'restricted-value' end
    if cache~=nil and type(cache)~='table' then return nil,'invalid-threat-count-cache' end
    if policy=='restricted' then return self:GetConditionNameplateThreatCount(minimum,cache) end
    local snapshot,why=readField(platform,self,'unitsInRange')
    if why then return nil,why end
    if type(snapshot)~='table' then return nil,'unit-snapshot-unavailable' end
    local count=0
    for guid,entity in pairs(snapshot) do
        if not platform:CanReadValue(guid) or not platform:CanReadValue(entity) then return nil,'restricted-value' end
        if type(guid)~='string' or guid=='' or type(entity)~='table' then return nil,'invalid-unit-snapshot' end
        local unit,reason=readField(platform,entity,'unit')
        if reason then return nil,reason end
        if type(unit)~='string' or unit=='' then return nil,'invalid-unit-snapshot' end
        -- The existing forecast identity observer is exactly existence + GUID;
        -- it consumes no health, history, provider or clock facts.
        local observeIdentity=platform.GetHealthForecastIdentityObservation
        if type(observeIdentity)~='function' then return nil,'missing-api' end
        local current,identityReason=addon.Functions.cache.getCached(cache,observeIdentity,platform,unit)
        if not platform:CanReadValue(current) then return nil,'restricted-value' end
        if current==nil then return nil,identityReason or 'unit-guid-unavailable' end
        if current~=false then
            if type(current)~='string' or current=='' then return nil,'invalid-unit-identity' end
            -- A recycled token is excluded; its replacement is not new membership.
            if current==guid then
                local observeThreat=platform.GetUnitThreatObservation
                if type(observeThreat)~='function' then return nil,'missing-api' end
                local status,threatReason=addon.Functions.cache.getCached(cache,observeThreat,platform,unit)
                if not platform:CanReadValue(status) then return nil,'restricted-value' end
                if status==nil then return nil,threatReason or 'threat-data-unavailable' end
                if status~=false then
                    local readable,problem=finite(platform,status)
                    if not readable then return nil,problem end
                    if status>=minimum then count=count+1 end
                end
            end
        end
    end
    return count

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