Chame como
Platform.spells.cooldownFlags(self, record)
Registre a dependência Platform.spells.cooldownFlags e depois chame-a por esse nome. Uma chamada com namespace não passa self: use uma chamada com dois-pontos ou passe o objeto você mesmo.
O que faz
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
| Nome | Tipo | O que faz |
|---|---|---|
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. |
Edições
As funções auxiliares integradas são registradas em todas as edições. O que muda é a API do jogo que elas leem; quando uma está ausente, a função auxiliar recorre a uma alternativa ou retorna nil com um motivo.
Não lê nenhuma API do jogo diretamente.
Valores secretos (Retail e Forever)
No Retail e no Forever, o jogo entrega valores secretos aos addons. Esta função auxiliar verifica o que lê (addon.Platform:CanReadValue) e retorna nil com um motivo como restricted-value em vez de um valor secreto que não consegue comparar. Trate nil como indisponível, não como false.
Como o addon a chama
Platform.spells.GetSpellCooldownif why == "restricted-value" and not built then return nil, why, cooldownFlags(self, record) end
Código-fonte
Platform/spells.lua, linha 375. Somente leitura no jogo; Duplicar cria uma cópia editável.
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