Как вызывать
Platform.spells.flagReadiness(self, enabled, active, onGCD, now)
Запишите зависимость Platform.spells.flagReadiness и вызывайте её по этому имени. Вызов через пространство имён не передаёт self: используйте вызов через двоеточие или передайте объект сами.
Что делает
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.
Аргументы
| Имя | Тип | Что делает |
|---|---|---|
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. |
Возвращает
| 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. |
Издания
Встроенные помощники регистрируются во всех изданиях. Различается игровой API, который они читают; если нужного API нет, помощник использует запасной вариант или возвращает nil с причиной.
Не читает игровой API напрямую.
Секретные значения (Retail и Forever)
В Retail и Forever игра передаёт аддонам секретные значения. Этот помощник проверяет то, что читает (addon.Platform:CanReadValue), и вместо секретного значения, которое нельзя сравнить, возвращает nil с причиной, например restricted-value. Считайте nil недоступным значением, а не ложью.
Как его вызывает аддон
Platform.spells.IsSpellReadyreturn flagReadiness(self,enabled,active,onGCD,now)
Зависимости
gcdRunning→Platform.spells.gcdRunning
Исходный код
Platform/spells.lua, строка 556. В игре только для чтения; «Дублировать» создаёт редактируемую копию.
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"