Aufruf als
Platform.spells.cooldownValues(self, spell)
Erfassen Sie die Abhängigkeit Platform.spells.cooldownValues und rufen Sie sie dann unter diesem Namen auf. Ein Aufruf über den Namensraum übergibt kein self: Verwenden Sie einen Doppelpunkt-Aufruf oder übergeben Sie das Objekt selbst.
Was sie bewirkt
Reads a spell cooldown as separate values for the readiness checks. When the platform is marked secretsUnrestricted and the legacy GetSpellCooldown exists it calls that directly; otherwise it uses addon.Platform:GetSpellCooldown, passing along its never-secret flags when the times are restricted.
Argumente
| Name | Typ | Was sie bewirkt |
|---|---|---|
self | RMPlatform | Rotation Master platform adapter (normally addon.Platform), used for its CanReadValue check. |
spell | number | string | Spell ID or client-recognized spell name. |
Rückgabewerte
| 1 | number | nil | Cooldown start time in GetTime() seconds; nil when unavailable. |
|---|---|---|
| 2 | number | nil | Cooldown duration in seconds; nil when unavailable. |
| 3 | boolean | nil | Whether the cooldown is enabled; when the times are unavailable, the never-secret isEnabled flag if it could be read. |
| 4 | string | nil | Reason when the times are unavailable. |
| 5 | boolean | nil | With restricted-value from GetSpellCooldown only: isActive. |
| 6 | boolean | nil | With restricted-value from GetSpellCooldown only: isOnGCD; may be nil. |
Editionen
Integrierte Hilfsfunktionen werden auf jeder Edition registriert. Unterschiedlich ist die Spiel-API, die sie lesen; fehlt eine, weicht die Hilfsfunktion aus oder gibt nil mit einem Grund zurück.
- Auf dieser Edition nicht verfügbar (den Grund nennt der Tooltip)
- Nur, solange Blizzards Ersatz für veraltete Funktionen aktiv ist
| Spiel-API | |||||
|---|---|---|---|---|---|
GetSpellCooldown |
Geheime Werte (Retail und Forever)
Auf Retail und Forever übergibt das Spiel Addons geheime Werte. Diese Hilfsfunktion prüft, was sie liest (addon.Platform:CanReadValue), und gibt statt eines geheimen Werts, den sie nicht vergleichen kann, nil mit einem Grund wie restricted-value zurück. Behandeln Sie nil als nicht verfügbar, nicht als false.
Wie das Addon sie aufruft
Platform.spells.IsSpellReadylocal start,duration,enabled,reason,active,onGCD=cooldownValues(self,spell)Platform.spells.gcdRunninglocal start,duration,enabled,why,active=cooldownValues(self,gcdSpell)
Abhängigkeiten
finiteNonNegative→Platform.spells.finiteNonNegativeidentifier→Platform.spells.identifier
Quelle
Platform/spells.lua, Zeile 507. Im Spiel schreibgeschützt; Duplizieren erstellt eine bearbeitbare Kopie.
Platform.spells.cooldownValues(self, spell)
local legacy=self.secretsUnrestricted and GetSpellCooldown
if type(legacy)~="function" then
local cooldown,reason,enabled,active,onGCD=self:GetSpellCooldown(spell)
if not cooldown then return nil,nil,enabled,reason,active,onGCD end
return cooldown.startTime,cooldown.duration,cooldown.isEnabled
end
local valid,reason=identifier(spell)
if not valid then return nil,nil,nil,reason end
local ok,start,duration,enabled=pcall(legacy,spell)
if not ok then return nil,nil,nil,"api-error" end
if not self:CanReadValue(start) or not self:CanReadValue(duration) or not self:CanReadValue(enabled) then
return nil,nil,nil,"restricted-value"
end
if start==nil then return nil,nil,nil,"spell-data-unavailable" end
if enabled~=0 and enabled~=1 and enabled~=true and enabled~=false then return nil,nil,nil,"invalid-api-result" end
if not finiteNonNegative(start) or not finiteNonNegative(duration) then return nil,nil,nil,"invalid-api-result" end
return start,duration,enabled==1 or enabled==true




