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

Platform.loss_of_control.GetLossOfControlEvent

공개

호출 방법

addon.Platform:GetLossOfControlEvent(index, kind)

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

하는 일

기본 인덱스와 요청한 대상 종류로, 문서화된 활성 제어 불가 행 하나를 읽습니다. 유형 조회는 읽을 수 있는 제어 유형 문자열만, 계열 조회는 읽을 수 있는 유한한 음수가 아닌 정수 계열 마스크만 요구합니다. 선택적인 시간은 유한한 timeRemaining이나 필드별 명시적 이유로 반환되므로, 관련 없는 대상에는 사용 가능한 타이머가 필요하지 않습니다. 없는 행은 사용할 수 없는 스냅샷 관찰입니다. 표시 필드, 추론된 마감 시각, 지속시간 합계, 최댓값, 기본 별칭 대체는 사용하지 않습니다.

인수

이름유형하는 일
selfRMPlatformRotation Master 플랫폼 어댑터 (콜론 호출에서는 암묵적).
indexnumber256행 RM 검색 예산 안에서 1부터 시작하는 기본 정수 활성 행 인덱스.
kindstring정확히 type 또는 school. 다른 쪽 없이 필요한 대상 필드를 선택합니다.

반환값

1table | nil유한한 timeRemaining이나 timeRemainingReason을 가진 정규화된 요청 대상. 필수 행이나 대상을 사용할 수 없으면 nil.
2string | nilnil인 레코드에 대한 정책, 조회, 기능 또는 필수 행/대상 사용 불가 이유.

버전

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

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

비공개 값 (Retail과 Forever)

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

예시

local count = addon.Platform:GetLossOfControlCount()
if count == nil then return nil end
if count == 0 then return false end
local row = addon.Platform:GetLossOfControlEvent(1, "type")
if not row then return nil end
return row.locType == "STUN"

소스

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

Platform.loss_of_control.GetLossOfControlEvent(self, index, kind)
    local policy=self:GetCombatDataPolicy()
    if policy~='probe' and policy~='restricted' then return nil,'unsupported-policy' end
    if not self:CanReadValue(index) or not self:CanReadValue(kind) then return nil,'restricted-value' end
    if canaccessvalue and not canaccessvalue(index) then return nil,'restricted-value' end
    if type(index)~='number' or index~=index or index==math.huge or index==-math.huge or index<1 or index%1~=0 then return nil,'invalid-loss-of-control-query' end
    if kind~='type' and kind~='school' then return nil,'invalid-loss-of-control-query' end
    if index>256 then return nil,'loss-of-control-budget-exceeded' end
    local namespace=C_LossOfControl
    if not self:CanReadValue(namespace) then return nil,'restricted-value' end
    if type(namespace)~='table' then return nil,'missing-api' end
    local methodOk,method=pcall(function() return namespace.GetActiveLossOfControlData end)
    if not methodOk then return nil,'api-error' end
    if not self:CanReadValue(method) then return nil,'restricted-value' end
    if type(method)~='function' then return nil,'missing-api' end
    local ok,event=pcall(method,index)
    if not ok then return nil,'api-error' end
    if not self:CanReadValue(event) then return nil,'restricted-value' end
    if event==nil then return nil,'loss-of-control-event-unavailable' end
    if type(event)~='table' then return nil,'invalid-api-result' end
    local subjectOk,subject=pcall(function() return event[kind=='type' and 'locType' or 'lockoutSchool'] end)
    if not subjectOk then return nil,'api-error' end
    if not self:CanReadValue(subject) then return nil,'restricted-value' end
    if canaccessvalue and not canaccessvalue(subject) then return nil,'restricted-value' end
    if subject==nil then return nil,'loss-of-control-subject-unavailable' end
    local record={}
    if kind=='type' then
        if type(subject)~='string' then return nil,'invalid-api-result' end
        record.locType=subject
    else
        if type(subject)~='number' or subject~=subject or subject==math.huge or subject==-math.huge or subject<0 or subject%1~=0 then return nil,'invalid-api-result' end
        record.lockoutSchool=subject
    end
    local timeOk,remaining=pcall(function() return event.timeRemaining end)
    if not timeOk then record.timeRemainingReason='api-error'
    elseif not self:CanReadValue(remaining) then record.timeRemainingReason='restricted-value'
    elseif canaccessvalue and not canaccessvalue(remaining) then record.timeRemainingReason='restricted-value'
    elseif remaining==nil then record.timeRemainingReason='loss-of-control-time-unavailable'
    elseif type(remaining)~='number' or remaining~=remaining or remaining==math.huge or remaining==-math.huge then record.timeRemainingReason='invalid-api-result'
    else record.timeRemaining=remaining end
    return record

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