Référence › Référence des fonctions › Platform

Platform.spells.cooldownValues

dépendance

Appel

Platform.spells.cooldownValues(self, spell)

Enregistrez la dépendance Platform.spells.cooldownValues, puis appelez-la sous ce nom. Un appel par espace de noms ne transmet pas self : utilisez un appel avec deux-points ou passez l'objet vous-même.

Ce qu'elle fait

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.

Arguments

NomTypeCe qu'elle fait
selfRMPlatformRotation Master platform adapter (normally addon.Platform), used for its CanReadValue check.
spellnumber | stringSpell ID or client-recognized spell name.

Retours

1number | nilCooldown start time in GetTime() seconds; nil when unavailable.
2number | nilCooldown duration in seconds; nil when unavailable.
3boolean | nilWhether the cooldown is enabled; when the times are unavailable, the never-secret isEnabled flag if it could be read.
4string | nilReason when the times are unavailable.
5boolean | nilWith restricted-value from GetSpellCooldown only: isActive.
6boolean | nilWith restricted-value from GetSpellCooldown only: isOnGCD; may be nil.

Éditions

Les fonctions utilitaires intégrées sont enregistrées sur toutes les éditions. Ce qui diffère, c'est l'API du jeu qu'elles lisent ; quand l'une manque, la fonction utilitaire se rabat sur une alternative ou renvoie nil avec une raison.

  • Indisponible sur cette édition (la raison figure dans l'infobulle)
  • Uniquement tant que les solutions de repli de Blizzard pour les fonctions obsolètes sont actives
API du jeuClassic EraTBC AnniversaryClassic ProgressionForeverRetail
GetSpellCooldownClassic EraTBC AnniversaryClassic ProgressionForeverRetail

Valeurs secrètes (Retail et Forever)

Sur Retail et Forever, le jeu transmet aux addons des valeurs secrètes. Cette fonction utilitaire vérifie ce qu'elle lit (addon.Platform:CanReadValue) et renvoie nil avec une raison telle que restricted-value au lieu d'une valeur secrète qu'elle ne peut pas comparer. Traitez nil comme indisponible, pas comme false.

Comment l'addon l'appelle

Dépendances

Source

Platform/spells.lua, ligne 507. En lecture seule dans le jeu ; Dupliquer crée une copie modifiable.

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

Retour à Référence des fonctions