Appel
Platform.spells.cooldownFlags(self, record)
Enregistrez la dépendance Platform.spells.cooldownFlags, puis appelez-la sous ce nom. Un appel par espace de noms ne transmet pas self : utilisez un appel avec deux-points ou passez l'objet vous-même.
Ce qu'elle fait
Extracts the never-secret isEnabled, isActive and isOnGCD flags from a C_Spell.GetSpellCooldown record whose times are secret. Returns all three when they are readable, isEnabled and isActive are Booleans and isOnGCD is a Boolean or nil; otherwise returns nothing.
Arguments
| Nom | Type | Ce qu'elle fait |
|---|---|---|
self | RMPlatform | Rotation Master platform adapter (normally addon.Platform), used for its CanReadValue check. |
record | table | Cooldown record from C_Spell.GetSpellCooldown; any other type returns nothing. |
Retours
| 1 | boolean | nil | isEnabled, false while the cooldown is on hold. |
|---|---|---|
| 2 | boolean | nil | isActive, true while a cooldown (its own or the global one) is running. |
| 3 | boolean | nil | isOnGCD, true when the running cooldown is the global cooldown; may be 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.
Elle ne lit directement aucune API du jeu.
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.
Comment l'addon l'appelle
Platform.spells.GetSpellCooldownif why == "restricted-value" and not built then return nil, why, cooldownFlags(self, record) end
Source
Platform/spells.lua, ligne 375. En lecture seule dans le jeu ; Dupliquer crée une copie modifiable.
Platform.spells.cooldownFlags(self, record)
if type(record) ~= "table" then return end
local enabled, active, onGCD = record.isEnabled, record.isActive, record.isOnGCD
if not self:CanReadValue(enabled) or not self:CanReadValue(active) or not self:CanReadValue(onGCD) then return end
if type(enabled) ~= "boolean" or type(active) ~= "boolean" or (onGCD ~= nil and type(onGCD) ~= "boolean") then return end
return enabled, active, onGCD