Ralgathor / LibClassicSwingTimerAPI

GNU General Public License v3.0
4 stars 5 forks source link

SWING_TIMER_STOP not firing after some SWING_TIMER_UPDATE events #39

Closed hypernormalisation closed 1 year ago

hypernormalisation commented 1 year ago

As in title. attack speed changes can in some situations prevent the SWING_TIMER_STOP event firing.

Attached is a video where my addon is printing out the library's callbacks to the chat, and you can see that when my DST procs, we get the SWING_TIMER_UPDATE event without any stop event afterwards.

https://user-images.githubusercontent.com/52763122/193384276-22cc5ddf-63a3-4322-973e-56556ef0cbb0.mp4

hypernormalisation commented 1 year ago

Tracked this down to the code at Lines 267-272: https://github.com/Ralgathor/LibClassicSwingTimerAPI/blob/main/LibClassicSwingTimerAPI.lua#L267

Every time an attack speed update gets triggered, the code is cancelling the mainhand/offhand timers, even when the attack speeds have not changed, which is sometimes happening in my testing when UNIT_ATTACK_SPEED has fired.

Taking the code to cancel the timers inside the code block that checks for a non-expired swing and an attack speed change should solve this.

I'll open a pull request.