Wynntils

Wynntils

966k Downloads

Auto attack needs to handle manual spell casts ending/expiring

ShadowCat117 opened this issue ยท 0 comments

commented

#3040 removed SpellEvent.Completed resetting preventWrongCast which fixed #3027 but this now causes a delay before auto attacking resumes after casting a spell manually.

Macro spell casts are unaffected due to the ArmSwingEvent and UseItemEvent not being triggered and therefore not setting any value for preventWrongCast

Below is an annotated log which is what helped discover the cause of #3027 so you can see why simply reverting to use SpellEvent.Completed again isn't the solution

Tick count logged every tick
[16:38:27] [Render thread/INFO] (Minecraft) [STDOUT]: onTick 116470
Manual right click sent
[16:38:27] [Render thread/INFO] (Minecraft) [STDOUT]: Right click
preventWrongCast updated to current tick count + 60
[16:38:27] [Render thread/INFO] (Minecraft) [STDOUT]: preventWrongCast 116530
[16:38:27] [Render thread/INFO] (Minecraft) [STDOUT]: onTick 116471
[16:38:27] [Render thread/INFO] (Minecraft) [STDOUT]: onTick 116472
[16:38:27] [Render thread/INFO] (Minecraft) [STDOUT]: onTick 116473
Manual right click sent
[16:38:27] [Render thread/INFO] (Minecraft) [STDOUT]: Right click
preventWrongCast updated to current tick count + 60
[16:38:27] [Render thread/INFO] (Minecraft) [STDOUT]: preventWrongCast 116533
[16:38:27] [Render thread/INFO] (Minecraft) [STDOUT]: onTick 116474
[16:38:28] [Render thread/INFO] (Minecraft) [STDOUT]: onTick 116475
[16:38:28] [Render thread/INFO] (Minecraft) [STDOUT]: onTick 116476
[16:38:28] [Render thread/INFO] (Minecraft) [STDOUT]: onTick 116477
Manual right click sent
[16:38:28] [Render thread/INFO] (Minecraft) [STDOUT]: Right click
preventWrongCast updated to current tick count + 60
[16:38:28] [Render thread/INFO] (Minecraft) [STDOUT]: preventWrongCast 116537
[16:38:28] [Render thread/INFO] (Minecraft) [STDOUT]: onTick 116478
[16:38:28] [Render thread/INFO] (Minecraft) [STDOUT]: onTick 116479
[16:38:28] [Render thread/INFO] (Minecraft) [STDOUT]: onTick 116480
Issue is here, right click is sent, but SpellEvent.Completed is triggered afterwards which resets preventWrongCast
Manual right click sent
[16:38:28] [Render thread/INFO] (Minecraft) [STDOUT]: Right click
preventWrongCast updated to current tick count + 60
[16:38:28] [Render thread/INFO] (Minecraft) [STDOUT]: preventWrongCast 116540
Spell Completed event, preventWrongCast set to minimum int value
[16:38:28] [Render thread/INFO] (Minecraft) [STDOUT]: Spell completed
[16:38:28] [Render thread/INFO] (Minecraft) [STDOUT]: onTick 116481
[16:38:28] [Render thread/INFO] (Minecraft) [STDOUT]: onTick 116482
Auto attack sends a left click
[16:38:28] [Render thread/INFO] (Minecraft) [STDOUT]: Sending swing at 116482
Manual left click sent
[16:38:28] [Render thread/INFO] (Minecraft) [STDOUT]: Left click