Aufruf als
Conditions.weapon.swingSpeed(value, cache)
Erfassen Sie die Abhängigkeit Conditions.weapon.swingSpeed 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 the player's main-hand, or off-hand when value.offhand is set, attack speed from the cached UnitAttackSpeed for the swing timer conditions. An off-hand check with no off-hand speed returns false.
Argumente
| Name | Typ | Was sie bewirkt |
|---|---|---|
value | table | Condition settings; a truthy offhand field selects the off hand. |
cache | table | nil | Evaluation-pass cache passed to getCached, or nil to read directly. |
Rückgabewerte
| 1 | number | boolean | nil | Swing speed in seconds, false when there is no off-hand weapon, or nil when unavailable. |
|---|---|---|
| 2 | string | nil | Reason for nil: missing-api, api-error, restricted-value or invalid-weapon-observation. |
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 | |||||
|---|---|---|---|---|---|
UnitAttackSpeed | |||||
UnitRangedDamage |
Wie das Addon sie aufruft
- Schlagzeit der Waffe (evaluate)
local speed,reason=swingSpeed(value,cache) - Verbleibende Schlagzeit der Waffe (evaluate)
local speed,reason=swingSpeed(value,cache)
Abhängigkeiten
Functions.cache.getCached→Functions.cache.getCachedFunctions.presentation.compareString→Functions.presentation.compareStringFunctions.presentation.nullable→Functions.presentation.nullableFunctions.values.compare→Functions.values.compareFunctions.values.isin→Functions.values.isinnumericObservation→Conditions.weapon.numericObservation
Quelle
Conditions/weapon.lua, Zeile 96. Im Spiel schreibgeschützt; Duplizieren erstellt eine bearbeitbare Kopie.
Conditions.weapon.swingSpeed(value, cache)
-- Ranged: the Auto Shot or wand interval (UnitRangedDamage), false with no
-- ranged attack; the melee hands read UnitAttackSpeed.
if value.ranged then
local speed,reason=Functions.cache.getCached(cache,addon.Platform.GetRangedSwingSpeed,addon.Platform)
if speed==nil then return nil,reason end
return speed
end
if type(UnitAttackSpeed)~="function" then return nil,"missing-api" end
-- pcall forwards the mainhand and offhand speeds from the observation.
---@diagnostic disable-next-line: unbalanced-assignments
local ok,main,off=pcall(addon.getCached,cache,UnitAttackSpeed,"player")
if not ok then return nil,"api-error" end
local speed=main
if value.offhand then
speed=off
-- No off-hand weapon: the API returns no off-hand speed. That is a
-- reading (nothing to swing), so off-hand checks are false.
if speed==nil then return false end
end
return numericObservation(speed)




