From 8a228b3f959241895db40e0d7c6a5e957038b3b1 Mon Sep 17 00:00:00 2001 From: LTS-FFXIV <127939494+LTS-FFXIV@users.noreply.github.com> Date: Sat, 19 Oct 2024 10:09:02 -0500 Subject: [PATCH 1/2] Update subproject, fix ObjectHelper, update packages Updated ECommons subproject commit to bf66e3d-dirty. Fixed ObjectHelper class in ObjectHelper.cs for null checks on TopPriorityHostile causing redtext events. Updated System.Drawing.Common to 8.0.10 in RotationSolver.Basic.csproj. Updated Microsoft.CodeAnalysis.CSharp to 4.11.0 in RotationSolver.SourceGenerators.csproj. --- ECommons | 2 +- RotationSolver.Basic/Helpers/ObjectHelper.cs | 5 ++++- RotationSolver.Basic/RotationSolver.Basic.csproj | 2 +- .../RotationSolver.SourceGenerators.csproj | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ECommons b/ECommons index 200096e34..bf66e3d69 160000 --- a/ECommons +++ b/ECommons @@ -1 +1 @@ -Subproject commit 200096e34ef20e9f8d2249086c85e72d1b54f35d +Subproject commit bf66e3d6922325bf6c82ff884021bb9f47ba5e90 diff --git a/RotationSolver.Basic/Helpers/ObjectHelper.cs b/RotationSolver.Basic/Helpers/ObjectHelper.cs index 5fc3ebb64..2febbf840 100644 --- a/RotationSolver.Basic/Helpers/ObjectHelper.cs +++ b/RotationSolver.Basic/Helpers/ObjectHelper.cs @@ -318,7 +318,10 @@ internal static bool IsTopPriorityHostile(this IGameObject obj) var fateId = DataCenter.FateId; - if (obj is IBattleChara b && b.StatusList?.Any(StatusHelper.IsPriority) == true) return true; + if (obj is IBattleChara b) + { + if (b.StatusList != null && b.StatusList.Any(StatusHelper.IsPriority)) return true; + } if (Service.Config.ChooseAttackMark && MarkingHelper.AttackSignTargets.FirstOrDefault(id => id != 0) == (long)obj.GameObjectId) return true; diff --git a/RotationSolver.Basic/RotationSolver.Basic.csproj b/RotationSolver.Basic/RotationSolver.Basic.csproj index 887ac1d87..3498597f5 100644 --- a/RotationSolver.Basic/RotationSolver.Basic.csproj +++ b/RotationSolver.Basic/RotationSolver.Basic.csproj @@ -68,7 +68,7 @@ all - + diff --git a/RotationSolver.SourceGenerators/RotationSolver.SourceGenerators.csproj b/RotationSolver.SourceGenerators/RotationSolver.SourceGenerators.csproj index 41718d824..ed135280b 100644 --- a/RotationSolver.SourceGenerators/RotationSolver.SourceGenerators.csproj +++ b/RotationSolver.SourceGenerators/RotationSolver.SourceGenerators.csproj @@ -7,7 +7,7 @@ - + From 09a337eca0555099aa303be04c75ea845611d765 Mon Sep 17 00:00:00 2001 From: LTS-FFXIV <127939494+LTS-FFXIV@users.noreply.github.com> Date: Sat, 19 Oct 2024 10:13:03 -0500 Subject: [PATCH 2/2] Refactor ActionUpdater Removed `break` statements in `ActionCondition.cs` and directly returned `false` if conditions are not met. Changed `NextGCDActionChanged` and `NextActionChanged` events in `ActionUpdater.cs` from nullable `Action?` to non-nullable `Action` with default empty delegates to avoid null reference issues. --- .../Configuration/Conditions/ActionCondition.cs | 2 -- RotationSolver/Updaters/ActionUpdater.cs | 11 ++++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/RotationSolver.Basic/Configuration/Conditions/ActionCondition.cs b/RotationSolver.Basic/Configuration/Conditions/ActionCondition.cs index baedd6883..a98156479 100644 --- a/RotationSolver.Basic/Configuration/Conditions/ActionCondition.cs +++ b/RotationSolver.Basic/Configuration/Conditions/ActionCondition.cs @@ -67,8 +67,6 @@ protected override bool IsTrueInside(ICustomRotation rotation) break; case ActionConditionType.CanUse: return _action.CanUse(out var act); - break; - } return false; } diff --git a/RotationSolver/Updaters/ActionUpdater.cs b/RotationSolver/Updaters/ActionUpdater.cs index 270fc1c22..d7ff19cca 100644 --- a/RotationSolver/Updaters/ActionUpdater.cs +++ b/RotationSolver/Updaters/ActionUpdater.cs @@ -17,15 +17,16 @@ static ActionUpdater() { EzIPC.Init(typeof(ActionUpdater), "RotationSolverReborn.ActionUpdater"); } - [EzIPCEvent] public static Action? NextGCDActionChanged; - [EzIPCEvent] public static Action? NextActionChanged; + [EzIPCEvent] public static Action NextGCDActionChanged = delegate { }; + [EzIPCEvent] public static Action NextActionChanged = delegate { }; private static IAction? _nextAction; - internal static IAction? NextAction + internal static IAction? NextAction { get => _nextAction; - set { - if (_nextAction != value) + set + { + if (_nextAction != value) { _nextAction = value; NextActionChanged?.Invoke(_nextAction?.ID ?? 0);