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

Platform.mobinfo2.GetMobInfo2Observation

공개

호출 방법

addon.Platform:GetMobInfo2Observation(unit, kind, school, cache)

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

하는 일

점검 또는 제한 정책 클라이언트에서 선택적인 MobInfo2 과거 관찰을 읽습니다. 정확히 선택한 유닛의 존재만 캐시하며, UnitName의 첫 번째 결과, UnitLevel의 첫 번째 결과, 인수 세 개인 MI2_GetMobData(name,level,unit) 점 호출은 매번 새로 읽습니다. 없는 것으로 알려진 유닛과 성공적으로 기록되지 않은 nil 또는 생략된 기록은 사용할 수 없는 기본/제공자 정보와 구별됩니다. 읽을 수 있는 runner 스칼라의 참 여부, 계열 부호, 없는 Hits의 기본값 1을 보존합니다. 양의 저항 비율은 유한해야 하며, 완전 면역은 유한한 Hits를 사용하고 부분 면역은 음의 계열 관찰만 필요합니다. 기본 저항을 추론하거나 이전 기록을 빌려오지 않습니다.

인수

이름유형하는 일
selfRMPlatformRotation Master 플랫폼 어댑터 (콜론 호출에서는 암묵적).
unitstring기본 및 제공자 호출에 그대로 쓰이는 선택한 비어 있지 않은 유닛 토큰.
kindstring닫힌 종류: runner, resist, immune.
schoolstring | nilresist/immune용 비어 있지 않은 과거 계열 키. runner에는 사용하지 않습니다.
cachetable | nil존재 여부만을 위한 평가 패스 캐시. 이름, 레벨, 제공자 기록은 항상 새로 읽습니다.

반환값

1table | nilexists=false인 레코드, 기록이 없는 것으로 알려지면 recorded=false, 또는 hits/hitsReason이 있는 runner, ratio, immune. nil은 필수 관찰을 사용할 수 없다는 뜻입니다.
2string | nil정책, 기능 또는 필수 관찰 사용 불가 이유.

버전

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

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

비공개 값 (Retail과 Forever)

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

애드온에서 호출하는 방식

  • 면역 (evaluate)
    local observation,reason=addon.Platform:GetMobInfo2Observation(value.unit,"immune",value.school,cache)
  • 저항함 (evaluate)
    local observation,reason=addon.Platform:GetMobInfo2Observation(value.unit,"resist",value.school,cache)
  • 실행기 (evaluate)
    local observation,reason=addon.Platform:GetMobInfo2Observation(value.unit,"runner",nil,cache)

의존성

소스

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

Platform.mobinfo2.GetMobInfo2Observation(self, unit, kind, school, cache)
    local policy=self:GetCombatDataPolicy()
    if policy~='probe' and policy~='restricted' then return nil,'unsupported-policy' end
    if not self:CanReadValue(unit) or not self:CanReadValue(kind) or not self:CanReadValue(cache) then return nil,'restricted-value' end
    if type(unit)~='string' or unit=='' then return nil,'invalid-unit' end
    if kind~='runner' and kind~='resist' and kind~='immune' then return nil,'invalid-mobinfo2-kind' end
    if cache~=nil and type(cache)~='table' then return nil,'invalid-mobinfo2-cache' end
    if kind~='runner' then
        if not self:CanReadValue(school) then return nil,'restricted-value' end
        if type(school)~='string' or school=='' then return nil,'invalid-mobinfo2-school' end
    end
    local exists,reason=addon.Functions.cache.getCached(cache,presence,self,unit)
    if exists==nil then return nil,reason end
    if not exists then return {exists=false} end
    local query,queryReason=readField(self,_G,'MI2_GetMobData')
    if queryReason then return nil,queryReason end
    if type(query)~='function' then return nil,'missing-api' end
    if type(UnitName)~='function' then return nil,'missing-api' end
    local nameOk,name=pcall(UnitName,unit)
    if not nameOk then return nil,'api-error' end
    if not self:CanReadValue(name) then return nil,'restricted-value' end
    if canaccessvalue and not canaccessvalue(name) then return nil,'restricted-value' end
    if name==nil then return nil,'unit-name-unavailable' end
    if type(name)~='string' or name=='' then return nil,'invalid-api-result' end
    if type(UnitLevel)~='function' then return nil,'missing-api' end
    local levelOk,level=pcall(UnitLevel,unit)
    if not levelOk then return nil,'api-error' end
    if not self:CanReadValue(level) then return nil,'restricted-value' end
    if canaccessvalue and not canaccessvalue(level) then return nil,'restricted-value' end
    local valid,why=finite(self,level)
    if not valid then return nil,why end
    local ok,data=pcall(query,name,level,unit)
    if not ok then return nil,'mobinfo2-provider-error' end
    if not self:CanReadValue(data) then return nil,'restricted-value' end
    -- A successful nil lookup means unrecorded data in the publisher API.
    if data==nil then return {exists=true,recorded=false} end
    if type(data)~='table' then return nil,'invalid-mobinfo2-data' end
    if kind=='runner' then
        local action,actionReason=readField(self,data,'lowHpAction')
        if actionReason then return nil,actionReason end
        local actionType=type(action)
        if actionType=='number' then
            valid,why=finite(self,action)
            if not valid then return nil,why end
        elseif actionType~='nil' and actionType~='boolean' and actionType~='string' then
            return nil,'invalid-mobinfo2-action'
        end
        -- Preserve readable scalar truthiness, including numeric zero and ''.
        return {exists=true,recorded=true,runner=action and true or false}
    end
    local resists,resistsReason=readField(self,data,'resists')
    if resistsReason then return nil,resistsReason end
    if resists==nil then return {exists=true,recorded=false} end
    local count,countReason=readField(self,resists,school)
    if countReason then return nil,countReason end
    if count==nil then return {exists=true,recorded=false} end
    valid,why=finite(self,count)
    if not valid then return nil,why end
    if kind=='resist' then
        if count<=0 then return {exists=true,recorded=false} end
        local hits,hitsReason=hitCount(self,resists,school)
        if hits==nil then return nil,hitsReason end
        local ratio=count/hits
        valid,why=finite(self,ratio)
        if not valid then return nil,why end
        return {exists=true,recorded=true,ratio=ratio}
    end
    if count>=0 then return {exists=true,recorded=false} end
    local hits,hitsReason=hitCount(self,resists,school)
    -- Partial immunity needs only the negative observation. Full immunity
    -- separately requires this optional count, including meaningful zero.
    return {exists=true,recorded=true,immune=true,hits=hits,hitsReason=hitsReason}

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