레퍼런스 › 함수 레퍼런스 › Platform

Platform.spells.IsSpellReady

공개

호출 방법

addon.Platform:IsSpellReady(spell, now)

addon을 통해 바로 쓸 수 있으며, 의존성이 필요 없습니다.

하는 일

주문을 지금 추천할 수 있는지 확인하며, 남은 재사용 대기시간이 현재 전역 재사용 대기시간과 함께 끝나는 주문도 허용합니다. 전투 중 재사용 대기시간 값이 비공개인 Retail과 Forever에서는 대신 항상 공개되는 isEnabled, isActive, isOnGCD 플래그로 준비 여부를 판단합니다. 재사용 대기시간 준비 여부만 확인하며, 배움 여부, 사거리, 자원 사용 가능 여부는 확인하지 않습니다. 평가 시각은 evalStart 또는 GetTime()에서 전달하세요.

인수

이름유형하는 일
selfRMPlatformRotation Master 플랫폼 어댑터. 점 참조는 첫 번째 인수로 addon.Platform이 필요하며, 콜론 호출은 이를 암묵적으로 전달합니다.
spellnumber | string재사용 대기시간을 확인할 주문 ID 또는 클라이언트가 인식하는 주문 이름.
nownumberGetTime() 기준 초 단위 현재 평가 시각. 보통 evalStart입니다.

반환값

1boolean | nil전역 재사용 대기시간이 끝날 때까지 준비되면 true, 자체 재사용 대기시간 때문에 추천할 수 없으면 false, 클라이언트가 읽을 수 있는 결과를 주지 못하면 nil.
2string | nil결과가 nil일 때의 사용 불가 또는 검증 이유.

버전

기본 제공 도우미는 모든 버전에 등록됩니다. 다른 점은 읽는 게임 API이며, API가 없으면 도우미는 대체 동작을 하거나 이유와 함께 nil을 반환합니다.

  • 해당 버전에서 사용할 수 없음 (이유는 툴팁에 표시)
  • Blizzard의 지원 중단 대체 함수가 켜져 있을 때만
게임 APIClassic EraTBC AnniversaryClassic progressionForeverRetail
GetTimeClassic EraTBC AnniversaryClassic progressionForeverRetail

비공개 값 (Retail과 Forever)

Retail과 Forever에서는 게임이 애드온에 비공개 값을 넘깁니다. 이 도우미는 읽는 값을 확인하고(addon.Platform:CanReadValue), 비교할 수 없는 비공개 값 대신 restricted-value 같은 이유와 함께 nil을 반환합니다. nil은 거짓이 아니라 사용할 수 없음으로 취급하세요.

예시

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

의존성

소스

Platform/spells.lua, 575번째 줄. 게임에서는 읽기 전용이며, 복제하면 편집 가능한 사본이 생깁니다.

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

함수 레퍼런스(으)로 돌아가기