Reference › Function reference › Platform

Platform.spells.IsAutoRepeatActive

public

Call as

addon.Platform:IsAutoRepeatActive(spellID)

Available directly through addon; no dependency is needed.

What it does

Read the player auto-repeat state for a spell such as Shoot or Auto Shot. This is distinct from a current or queued cast. Modern clients receive the exact spell ID; a legacy query resolves the player spell-book slot first. Restricted client policies, unreadable results and unavailable book slots return nil with a reason. This observes state and never starts or stops a spell.

Arguments

NameTypeWhat it does
selfRMPlatformRotation Master platform adapter (implicit with colon calls).
spellIDnumberPositive integer spell ID, not a spell-book slot.

Returns

1boolean | nilTrue when the client reports this spell auto-repeating; false when it reports inactive; nil when unavailable.
2string | nilValidation or availability reason for a nil result.

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
C_Spell.IsAutoRepeatSpellClassic EraTBC AnniversaryClassic progressionForeverRetail
FindSpellBookSlotBySpellIDClassic EraTBC AnniversaryClassic progressionForeverRetail
IsAutoRepeatSpellClassic 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 shooting = addon.Platform:IsAutoRepeatActive(75) -- Auto Shot
if shooting == nil then return nil end
return not shooting

Dependencies

Source

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

Platform.spells.IsAutoRepeatActive(self, spellID)
    local policy=self:GetCombatDataPolicy()
    if policy~='probe' and policy~='restricted' then return nil,'unsupported-policy' end
    local valid,reason=identifier(spellID,true)
    if not valid then return nil,reason end
    local native=C_Spell and C_Spell.IsAutoRepeatSpell
    local ok,active
    if type(native)=='function' then
        ok,active=pcall(native,spellID)
    else
        if type(IsAutoRepeatSpell)~='function' or type(FindSpellBookSlotBySpellID)~='function' then return nil,'missing-api' end
        local found,slot=pcall(FindSpellBookSlotBySpellID,spellID,false)
        if not found then return nil,'api-error' end
        if not self:CanReadValue(slot) then return nil,'restricted-value' end
        if slot==nil then return nil,'spell-not-in-book' end
        if type(slot)~='number' or slot<1 or slot==math.huge or slot%1~=0 then return nil,'invalid-api-result' end
        ok,active=pcall(IsAutoRepeatSpell,slot,BOOKTYPE_SPELL or 'spell')
    end
    if not ok then return nil,'api-error' end
    if not self:CanReadValue(active) then return nil,'restricted-value' end
    if type(native)~='function' then
        if active==0 then active=false elseif active==1 then active=true end
    end
    if type(active)~='boolean' then return nil,'invalid-api-result' end
    return active

Back to Function reference