From e086fedd6754bfd9431f69b3d76b809b70a867a3 Mon Sep 17 00:00:00 2001 From: Riot Date: Sun, 14 May 2023 23:30:41 +0200 Subject: [PATCH] feat: Add DutyWiped method that resets all IsLastXYZ --- RotationSolver.Basic/DataCenter.cs | 7 +++++++ RotationSolver/Updaters/SocialUpdater.cs | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/RotationSolver.Basic/DataCenter.cs b/RotationSolver.Basic/DataCenter.cs index 19449ae57..e7045bd6d 100644 --- a/RotationSolver.Basic/DataCenter.cs +++ b/RotationSolver.Basic/DataCenter.cs @@ -373,6 +373,13 @@ public static unsafe void AddActionRec(Action act) _actions.Enqueue(new ActionRec(_timeLastActionUsed, act)); } + public static void ResetAllLastActions() + { + LastAction = 0; + LastGCD = 0; + LastAbility = 0; + } + public static void AddDamageRec(float damageRatio) { if (_damages.Count >= QUEUECAPACITY) diff --git a/RotationSolver/Updaters/SocialUpdater.cs b/RotationSolver/Updaters/SocialUpdater.cs index 0adb96a7f..0bae1c43e 100644 --- a/RotationSolver/Updaters/SocialUpdater.cs +++ b/RotationSolver/Updaters/SocialUpdater.cs @@ -52,6 +52,7 @@ static bool CanSocial internal static void Enable() { Service.DutyState.DutyStarted += DutyState_DutyStarted; + Service.DutyState.DutyWiped += DutyState_DutyWiped; Service.DutyState.DutyCompleted += DutyState_DutyCompleted; Service.ClientState.TerritoryChanged += ClientState_TerritoryChanged; @@ -127,9 +128,16 @@ static void DutyState_DutyStarted(object sender, ushort e) } } + static void DutyState_DutyWiped(object sender, ushort e) + { + if (Service.Player == null) return; + DataCenter.ResetAllLastActions(); + } + internal static void Disable() { Service.DutyState.DutyStarted -= DutyState_DutyStarted; + Service.DutyState.DutyWiped -= DutyState_DutyWiped; Service.DutyState.DutyCompleted -= DutyState_DutyCompleted; Service.ClientState.TerritoryChanged -= ClientState_TerritoryChanged; }