Reference › Function reference › Platform

Platform.spells.IsSpellReady

public

Call as

addon.Platform:IsSpellReady(spell, now)

Available directly through addon; no dependency is needed.

What it does

Check whether a spell can be recommended now, allowing a spell whose remaining cooldown ends with the current global cooldown. On Retail and Forever, where cooldown times are secret in combat, readiness comes from the never-secret isEnabled, isActive and isOnGCD flags instead. This checks cooldown readiness only; it does not check learned status, range or resource usability. Pass evaluation time from evalStart or GetTime().

Arguments

NameTypeWhat it does
selfRMPlatformRotation Master platform adapter. A dot reference requires addon.Platform as the first argument; a colon call supplies it implicitly.
spellnumber | stringSpell ID or client-recognized spell name whose cooldown should be checked.
nownumberCurrent evaluation time in seconds from GetTime(), normally evalStart.

Returns

1boolean | nilTrue when ready by the end of the global cooldown; false when its own cooldown prevents recommendation; nil when the client cannot supply a readable result.
2string | nilAvailability or validation reason when the result is nil.

Editions

Built In helpers are registered on every edition. What differs is the game API they read; where one is missing the helper falls back or returns nil with a reason.

  • Not available on that edition (the reason is in the tooltip)
  • Only while Blizzard's deprecation fallbacks are on
Game APIClassic EraTBC AnniversaryClassic progressionForeverRetail
GetTimeClassic EraTBC AnniversaryClassic progressionForeverRetail

Secret values (Retail and Forever)

On Retail and Forever the game hands addons secret values. This helper checks what it reads (addon.Platform:CanReadValue) and returns nil with a reason such as restricted-value instead of a secret it cannot compare. Treat nil as unavailable, not as false.

Example

local ready = addon.Platform:IsSpellReady(value.spell, evalStart)
if ready == nil then return nil end
return ready

Dependencies

Source

Platform/spells.lua, line 575. Read only in game; Duplicate makes an editable copy.

Platform.spells.IsSpellReady(self, spell, now)
    if not self:CanReadValue(now) then return nil, "restricted-value" end
    if type(now)~="number" or now~=now or now==math.huge or now==-math.huge then
        return nil, "invalid-time"
    end
    local start,duration,enabled,reason,active,onGCD=cooldownValues(self,spell)
    if start==nil then
        if active==nil then return nil,reason end
        return flagReadiness(self,enabled,active,onGCD,now)
    end
    if not enabled then return false end
    local expires=start+duration
    if duration==0 or expires<=now then return true end

    if not gcdSpell then self:GetGlobalCooldown() end
    local gcdStart,gcdDuration,gcdEnabled,why,gcdActive=cooldownValues(self,gcdSpell)
    if gcdStart==nil then
        -- The GCD's times are hidden: one known not to be running cannot
        -- cover this spell's own, still running, cooldown.
        if gcdActive~=nil and (not gcdEnabled or not gcdActive) then return false end
        return nil,why
    end
    if not gcdEnabled or gcdDuration==0 then return false end
    -- modRate controls cooldown animation; API timestamps/duration already
    -- describe expiration in GetTime seconds, so do not divide them by it.
    local gcdExpires=gcdStart+gcdDuration
    return gcdExpires>now and expires<=gcdExpires+0.001

Back to Function reference