Appel
addon.Platform:GetLossOfControlEvent(index, kind)
Disponible directement via addon ; aucune dépendance n'est nécessaire.
Ce qu'elle fait
Lit une ligne de perte de contrôle active documentée, par son indice natif et le type de sujet demandé. Les requêtes type n'exigent que la chaîne lisible du type de contrôle ; les requêtes school n'exigent que le masque d'école lisible, fini et entier non négatif. La durée facultative est renvoyée sous forme de timeRemaining fini ou d'un motif explicite par champ, de sorte qu'un sujet sans rapport n'exige pas de minuteur utilisable. Les lignes manquantes sont des observations d'instantané indisponibles. Aucun champ d'affichage, échéance déduite, somme de durées, maximum ni repli sur un alias natif n'est utilisé.
Arguments
| Nom | Type | Ce qu'elle fait |
|---|---|---|
self | RMPlatform | Adaptateur de plateforme Rotation Master (implicite avec un appel par deux-points). |
index | number | Indice natif de ligne active, entier à partir de un, dans la limite du budget de parcours de 256 lignes de RM. |
kind | string | Exactement type ou school ; sélectionne le champ de sujet requis sans exiger l'autre. |
Retours
| 1 | table | nil | Sujet demandé normalisé, avec timeRemaining fini ou timeRemainingReason ; nil si la ligne ou le sujet requis est indisponible. |
|---|---|---|
| 2 | string | nil | Motif de politique, de requête, de capacité ou de disponibilité de la ligne ou du sujet requis pour un enregistrement nil. |
Éditions
Les fonctions utilitaires intégrées sont enregistrées sur toutes les éditions. Ce qui diffère, c'est l'API du jeu qu'elles lisent ; quand l'une manque, la fonction utilitaire se rabat sur une alternative ou renvoie nil avec une raison.
- Indisponible sur cette édition (la raison figure dans l'infobulle)
- Uniquement tant que les solutions de repli de Blizzard pour les fonctions obsolètes sont actives
| API du jeu | |||||
|---|---|---|---|---|---|
C_LossOfControl | |||||
canaccessvalue |
Valeurs secrètes (Retail et Forever)
Sur Retail et Forever, le jeu transmet aux addons des valeurs secrètes. Cette fonction utilitaire vérifie ce qu'elle lit (addon.Platform:CanReadValue) et renvoie nil avec une raison telle que restricted-value au lieu d'une valeur secrète qu'elle ne peut pas comparer. Traitez nil comme indisponible, pas comme false.
Exemple
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"Source
Platform/loss_of_control.lua, ligne 45. En lecture seule dans le jeu ; Dupliquer crée une copie modifiable.
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




