Llamar como
addon.Platform:GetLossOfControlEvent(index, kind)
Disponible directamente a través de addon; no hace falta ninguna dependencia.
Qué hace
Lee una fila documentada de pérdida de control activa por su índice nativo y el tipo de sujeto solicitado. Las consultas de tipo solo requieren la cadena legible del tipo de control; las consultas de escuela solo requieren la máscara de escuela entera, legible, finita y no negativa. Los tiempos opcionales se devuelven como un timeRemaining finito o un motivo explícito por campo, así que un sujeto no relacionado no requiere un temporizador utilizable. Las filas que faltan son observaciones de instantánea no disponibles. No se usan campos de visualización, plazos deducidos, sumas de duración, máximos ni alias nativos alternativos.
Argumentos
| Nombre | Tipo | Qué hace |
|---|---|---|
self | RMPlatform | Adaptador de plataforma de Rotation Master (implícito en las llamadas con dos puntos). |
index | number | Índice nativo entero, empezando en uno, de la fila activa dentro del presupuesto de exploración de 256 filas de RM. |
kind | string | Exactamente type o school; selecciona el campo de sujeto necesario sin requerir el otro. |
Retornos
| 1 | table | nil | Sujeto solicitado normalizado con timeRemaining finito o timeRemainingReason; nil cuando la fila o el sujeto necesarios no están disponibles. |
|---|---|---|
| 2 | string | nil | Motivo de disponibilidad de la política, la consulta, la capacidad o la fila/sujeto necesarios para un registro nil. |
Ediciones
Las funciones auxiliares integradas se registran en todas las ediciones. Lo que cambia es la API del juego que leen; donde falta alguna, la función auxiliar recurre a una alternativa o devuelve nil con un motivo.
- No disponible en esa edición (el motivo aparece en la información emergente)
- Solo mientras estén activas las alternativas de Blizzard para API obsoletas
| API del juego | |||||
|---|---|---|---|---|---|
C_LossOfControl | |||||
canaccessvalue |
Valores secretos (Retail y Forever)
En Retail y Forever, el juego entrega a los addons valores secretos. Esta función auxiliar comprueba lo que lee (addon.Platform:CanReadValue) y, en lugar de un secreto que no puede comparar, devuelve nil con un motivo como restricted-value. Trata nil como no disponible, no como falso.
Ejemplo
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 fuente
Platform/loss_of_control.lua, línea 45. Solo lectura en el juego; Duplicar crea una copia editable.
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




