There is no relevant WOW API to have an easily accessible state of the swing timer. This library fires custom EVENTS that can be used in other ADDONs to produce swing timer information.
local SwingTimerLib = LibStub("LibClassicSwingTimerAPI", true)
if not SwingTimerLib then return end
local f = CreateFrame("Frame", nil)
local SwingTimerInfo = function(hand)
return SwingTimerLib:SwingTimerInfo(hand)
end
local SwingTimerEventHandler = function(event, ...)
return f[event](f, event, ...)
end
SwingTimerLib.RegisterCallback(f, "SWING_TIMER_START", SwingTimerEventHandler)
SwingTimerLib.RegisterCallback(f, "SWING_TIMER_UPDATE", SwingTimerEventHandler)
SwingTimerLib.RegisterCallback(f, "SWING_TIMER_CLIPPED", SwingTimerEventHandler)
SwingTimerLib.RegisterCallback(f, "SWING_TIMER_PAUSED", SwingTimerEventHandler)
SwingTimerLib.RegisterCallback(f, "SWING_TIMER_STOP", SwingTimerEventHandler)
SwingTimerLib.RegisterCallback(f, "SWING_TIMER_DELTA", SwingTimerEventHandler)
Fired when a weapon or ranged swing starts.
Property | Description |
---|---|
speed | number - weapon speed |
expirationTime | number - end of swing relative to GetTime() |
hand | string - the hand that start to swing ("mainhand", "offhand" or "ranged") |
Fired when weapon speed changes.
Property | Description |
---|---|
speed | number - weapon speed |
expirationTime | number - end of swing relative to GetTime() |
hand | string - the hand speed that update ("mainhand" or "offhand") |
Fired if a weapon swing is clipped by a spell cast.
Property | Description |
---|---|
hand | string - The hand that is clipped "mainhand" or "offhand" |
Fired if a weapon swing is paused by a spell cast.
Property | Description |
---|---|
hand | string - The hand that is paused "mainhand" or "offhand" |
Fired when a weapon or ranged swing ends.
Property | Description |
---|---|
hand | string - the hand that end a swing ("mainhand", "offhand" or "ranged") |
Fired when delta calculation between MH and OH update
Property | Description |
---|---|
swingDelta | number - Delta in seconds between MH and OH. |
Returns the hand
's current swing state.
speed, expirationTime, lastSwing = SwingTimerInfo(hand)
- Arguments
- hand
- string - The hand to get information for ("mainhand", "offhand" or "ranged")
- hand
- Returns
- speed
- number - weapon speed
- expirationTime
- number - end of swing relative to GetTime()
- lastSwing
- number - last swing relative to GetTime()
- speed