Llamar como
Platform.spells.flagReadiness(self, enabled, active, onGCD, now)
Registra la dependencia Platform.spells.flagReadiness y luego llámala con ese nombre. Una llamada con espacio de nombres no pasa self: usa una llamada con dos puntos o pasa tú mismo el objeto.
Qué hace
Decides cooldown readiness from the never-secret flags when the cooldown times are hidden. Returns false when the cooldown is disabled, true when no cooldown is active, false when the active cooldown is known not to be the global cooldown or the global cooldown is known not to be running, and true when the active cooldown is the global cooldown; otherwise nil with a reason.
Argumentos
| Nombre | Tipo | Qué hace |
|---|---|---|
self | RMPlatform | Rotation Master platform adapter (normally addon.Platform), used for its CanReadValue check. |
enabled | boolean | The spell's isEnabled flag. |
active | boolean | The spell's isActive flag. |
onGCD | boolean | nil | The spell's isOnGCD flag, when the client reports it. |
now | number | Evaluation time in GetTime() seconds, used to test the global cooldown. |
Retornos
| 1 | boolean | nil | True when ready by the end of the global cooldown, false when not; nil when it cannot be decided. |
|---|---|---|
| 2 | string | nil | The global cooldown reason, or restricted-value, when the result is 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 lee directamente ninguna API del juego.
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.
Cómo la llama el addon
Platform.spells.IsSpellReadyreturn flagReadiness(self,enabled,active,onGCD,now)
Dependencias
gcdRunning→Platform.spells.gcdRunning
Código fuente
Platform/spells.lua, línea 556. Solo lectura en el juego; Duplicar crea una copia editable.
Platform.spells.flagReadiness(self, enabled, active, onGCD, now)
if not enabled then return false end
if not active then return true end
if onGCD==false then return false end
local running,why=gcdRunning(self,now)
if running==false then return false end
if onGCD==true then return true end
return nil,why or "restricted-value"