Llamar como
Platform.spells.cooldownFlags(self, record)
Registra la dependencia Platform.spells.cooldownFlags y después llámala con ese nombre. Una llamada con espacio de nombres no pasa self: usa una llamada con dos puntos o pasa el objeto tú mismo.
Qué hace
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.
Argumentos
| Nombre | Tipo | Qué hace |
|---|---|---|
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. |
Retornos
| 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. |
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 usa una alternativa o devuelve nil con un motivo.
No lee directamente ninguna API del juego.
Valores secretos (Retail y Forever)
En Retail y Forever, el juego les entrega a los addons valores secretos. Esta función auxiliar verifica 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.
Cómo la llama el addon
Platform.spells.GetSpellCooldownif why == "restricted-value" and not built then return nil, why, cooldownFlags(self, record) end
Código fuente
Platform/spells.lua, línea 375. Solo lectura en el juego; Duplicar crea una copia editable.
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