Ralgathor / LibClassicSwingTimerAPI

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

Some formatting and fixes #24

Closed mrbuds closed 2 years ago

mrbuds commented 2 years ago

Nothing major, but commit looks large due to StyLua formatting

PS: beware, I didn't test these changes in game!

Ralgathor commented 2 years ago

Thx @mrbuds for this code review and optimisation.

simplify logic of aura iteration for UNIT_SPELLCAST_START btw checking an aura on UNIT_SPELLCAST_START doesn't make sense

The idea is to check at spell cast start if any buff present on player prevent the swing reset. For wotlk it's only used for shaman maelstrom buff. The issue it's maybe if the aura fade before the UNIT_SPELLCAST_SUCCEEDED the flag will still by true. This will probably never happen as the maelstrom buff it's a 30 sec buff and have a high proc rate.

Butt it may still be better and more logical to set the value of preventSwingReset flag on SPELL_AURA_APPLIED and SPELL_AURA_REMOVED to handle this particular case.

add comment self:SwingStart("ranged", now, (spell ~= 75 and spell ~= 3018 and spell ~= 2764 and spell ~= 5019)) -- this needs to be refactored That the list of spells for auto shot, shoots and throw. It set the isReset flag to false to prevent the self.rangedTimer:Cancel() as some time the timer don't end before the next UNIT_SPELLCAST_SUCCEEDED for this spells and prevent the swingEnd method to be fired. It's happen particulary in case of auto shot.

I'm not sure how to refactor that as it's really a specific internal logic.