Chame como
addon.Platform:GetLossOfControlEvent(index, kind)
Disponível diretamente por meio de addon; nenhuma dependência é necessária.
O que faz
Lê uma linha documentada de perda de controle ativa pelo índice nativo e pelo tipo de assunto solicitado. Consultas de tipo exigem apenas o texto legível do tipo de controle; consultas de escola exigem apenas a máscara de escola inteira, legível, finita e não negativa. Os tempos opcionais são retornados como um timeRemaining finito ou um motivo explícito por campo, então um assunto não relacionado não exige um temporizador utilizável. Linhas ausentes são observações de instantâneo indisponíveis. Nenhum campo de exibição, prazo deduzido, soma de duração, máximo ou alias nativo alternativo é usado.
Argumentos
| Nome | Tipo | O que faz |
|---|---|---|
self | RMPlatform | Adaptador de plataforma do Rotation Master (implícito nas chamadas com dois-pontos). |
index | number | Índice nativo inteiro, começando em um, da linha ativa dentro do orçamento de varredura de 256 linhas do RM. |
kind | string | Exatamente type ou school; seleciona o campo de assunto necessário sem exigir o outro. |
Retornos
| 1 | table | nil | Assunto solicitado normalizado com timeRemaining finito ou timeRemainingReason; nil quando a linha ou o assunto necessário está indisponível. |
|---|---|---|
| 2 | string | nil | Motivo de disponibilidade da política, da consulta, da capacidade ou da linha/assunto necessários para um registro nil. |
Edições
As funções auxiliares integradas são registradas em todas as edições. O que muda é a API do jogo que elas leem; quando uma está ausente, a função auxiliar recorre a uma alternativa ou retorna nil com um motivo.
- Indisponível nessa edição (o motivo está na dica)
- Só enquanto as alternativas da Blizzard para APIs obsoletas estiverem ativas
| API do jogo | |||||
|---|---|---|---|---|---|
C_LossOfControl | |||||
canaccessvalue |
Valores secretos (Retail e Forever)
No Retail e no Forever, o jogo entrega valores secretos aos addons. Esta função auxiliar verifica o que lê (addon.Platform:CanReadValue) e retorna nil com um motivo como restricted-value em vez de um valor secreto que não consegue comparar. Trate nil como indisponível, não como false.
Exemplo
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"Código-fonte
Platform/loss_of_control.lua, linha 45. Somente leitura no jogo; Duplicar cria uma cópia editável.
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




