Как вызывать
Platform.spells.cooldownFlags(self, record)
Запишите зависимость Platform.spells.cooldownFlags и вызывайте её по этому имени. Вызов через пространство имён не передаёт self: используйте вызов через двоеточие или передайте объект сами.
Что делает
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.
Аргументы
| Имя | Тип | Что делает |
|---|---|---|
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. |
Возвращает
| 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. |
Издания
Встроенные помощники регистрируются во всех изданиях. Различается игровой API, который они читают; если нужного API нет, помощник использует запасной вариант или возвращает nil с причиной.
Не читает игровой API напрямую.
Секретные значения (Retail и Forever)
В Retail и Forever игра передаёт аддонам секретные значения. Этот помощник проверяет то, что читает (addon.Platform:CanReadValue), и вместо секретного значения, которое нельзя сравнить, возвращает nil с причиной, например restricted-value. Считайте nil недоступным значением, а не ложью.
Как его вызывает аддон
Platform.spells.GetSpellCooldownif why == "restricted-value" and not built then return nil, why, cooldownFlags(self, record) end
Исходный код
Platform/spells.lua, строка 375. В игре только для чтения; «Дублировать» создаёт редактируемую копию.
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