From 47d35f6f824901f7c0ea4bf73ea98e67a120b667 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=A7=8B=E6=B0=B4?= <1123993881@qq.com>
Date: Sat, 29 Jul 2023 20:38:05 +0800
Subject: [PATCH] fix: add duty action.
---
RotationSolver.Basic/Actions/BaseAction_BasicInfo.cs | 10 ++++++++++
RotationSolver.Basic/Actions/IBaseAction.cs | 10 ++++++++++
RotationSolver.Basic/Data/ActionOption.cs | 5 +++++
.../Rotations/CustomRotation_Actions.cs | 8 ++++----
RotationSolver/UI/RotationConfigWindow_Debug.cs | 2 --
RotationSolver/Updaters/RotationUpdater.cs | 11 ++++++++++-
6 files changed, 39 insertions(+), 7 deletions(-)
diff --git a/RotationSolver.Basic/Actions/BaseAction_BasicInfo.cs b/RotationSolver.Basic/Actions/BaseAction_BasicInfo.cs
index 9e887a0d1..ff615b1c9 100644
--- a/RotationSolver.Basic/Actions/BaseAction_BasicInfo.cs
+++ b/RotationSolver.Basic/Actions/BaseAction_BasicInfo.cs
@@ -44,6 +44,16 @@ public partial class BaseAction : IBaseAction
///
public bool IsRealGCD => _option.HasFlag(ActionOption.RealGCD);
+ ///
+ /// Is this action a duty action.
+ ///
+ public bool IsDutyAction => _option.HasFlag(ActionOption.DutyAction);
+
+ ///
+ /// Is this duty action on the slot.
+ ///
+ public bool IsDutyActionOnSlot => ActionManager.GetDutyActionId(0) == AdjustedID || ActionManager.GetDutyActionId(1) == AdjustedID;
+
///
/// How many gcd left to add the dot.
///
diff --git a/RotationSolver.Basic/Actions/IBaseAction.cs b/RotationSolver.Basic/Actions/IBaseAction.cs
index 310ba5c59..40de76a85 100644
--- a/RotationSolver.Basic/Actions/IBaseAction.cs
+++ b/RotationSolver.Basic/Actions/IBaseAction.cs
@@ -67,6 +67,16 @@ public interface IBaseAction : IAction
///
Func, IEnumerable> FilterForHostiles { get; }
+ ///
+ /// Is this action a duty action.
+ ///
+ bool IsDutyAction { get; }
+
+ ///
+ /// Is this duty action on the slot.
+ ///
+ bool IsDutyActionOnSlot { get; }
+
///
/// Can I use this action at this time. It will check a lot of things.
/// Level, Enabled, Action Status, MP, Player Status, Coll down, Combo, Moving (for casting), Charges, Target, etc.
diff --git a/RotationSolver.Basic/Data/ActionOption.cs b/RotationSolver.Basic/Data/ActionOption.cs
index 47c7f423e..031f3f3c2 100644
--- a/RotationSolver.Basic/Data/ActionOption.cs
+++ b/RotationSolver.Basic/Data/ActionOption.cs
@@ -36,6 +36,11 @@ public enum ActionOption : byte
///
RealGCD = 1 << 4,
+ ///
+ /// The duty action
+ ///
+ DutyAction = 1 << 5,
+
///
/// Dot action
///
diff --git a/RotationSolver.Basic/Rotations/CustomRotation_Actions.cs b/RotationSolver.Basic/Rotations/CustomRotation_Actions.cs
index 2b7e0bd8e..f11290a9b 100644
--- a/RotationSolver.Basic/Rotations/CustomRotation_Actions.cs
+++ b/RotationSolver.Basic/Rotations/CustomRotation_Actions.cs
@@ -219,19 +219,19 @@ internal RoleAction(ActionID actionID, JobRole[] roles, ActionOption option = Ac
///
///
public static IBaseAction VariantRaise { get; } = new RoleAction(ActionID.VariantRaise,
- new JobRole[] { JobRole.Melee, JobRole.Tank, JobRole.Ranged }, ActionOption.Friendly);
+ new JobRole[] { JobRole.Melee, JobRole.Tank, JobRole.Ranged }, ActionOption.Friendly | ActionOption.DutyAction);
///
///
///
public static IBaseAction VariantCure { get; } = new RoleAction(ActionID.VariantCure,
- new JobRole[] { JobRole.Melee, JobRole.Tank, JobRole.Ranged }, ActionOption.Heal);
+ new JobRole[] { JobRole.Melee, JobRole.Tank, JobRole.Ranged }, ActionOption.Heal | ActionOption.DutyAction);
///
///
///
public static IBaseAction VariantSpiritDart { get; } = new RoleAction(ActionID.VariantSpiritDart,
- new JobRole[] { JobRole.Healer, JobRole.Tank }, ActionOption.Dot)
+ new JobRole[] { JobRole.Healer, JobRole.Tank }, ActionOption.Dot | ActionOption.DutyAction)
{
TargetStatus = new StatusID[] { StatusID.VariantSpiritDart },
};
@@ -240,7 +240,7 @@ internal RoleAction(ActionID actionID, JobRole[] roles, ActionOption option = Ac
///
///
public static IBaseAction VariantRampart { get; } = new RoleAction(ActionID.VariantRampart,
- new JobRole[] { JobRole.Melee, JobRole.Healer, JobRole.Ranged }, ActionOption.Buff);
+ new JobRole[] { JobRole.Melee, JobRole.Healer, JobRole.Ranged }, ActionOption.Buff | ActionOption.DutyAction);
#endregion
IBaseAction[] _allBaseActions;
diff --git a/RotationSolver/UI/RotationConfigWindow_Debug.cs b/RotationSolver/UI/RotationConfigWindow_Debug.cs
index d38475caf..b8068a772 100644
--- a/RotationSolver/UI/RotationConfigWindow_Debug.cs
+++ b/RotationSolver/UI/RotationConfigWindow_Debug.cs
@@ -164,8 +164,6 @@ private void DrawLastAction()
private unsafe void DrawIcon()
{
- ImGui.Text(ActionManager.GetDutyActionId(0).ToString());
- ImGui.Text(ActionManager.GetDutyActionId(1).ToString());
//if(ImGui.BeginTable("BLUAction", 4, ImGuiTableFlags.Borders | ImGuiTableFlags.Resizable | ImGuiTableFlags.SizingFixedFit))
//{
// foreach (var item in Svc.Data.GetExcelSheet())
diff --git a/RotationSolver/Updaters/RotationUpdater.cs b/RotationSolver/Updaters/RotationUpdater.cs
index b7fa06c2f..6a6b5f37b 100644
--- a/RotationSolver/Updaters/RotationUpdater.cs
+++ b/RotationSolver/Updaters/RotationUpdater.cs
@@ -362,6 +362,15 @@ public static IEnumerable> AllGroupedActions
{
string result;
+ if (act.IsDutyAction)
+ {
+#if DEBUG
+ return "Duty Action";
+#else
+ return act.IsDutyActionOnSlot ? "Duty Action" : string.Empty;
+#endif
+ }
+
if (act.IsRealGCD)
{
result = "GCD";
@@ -396,7 +405,7 @@ public static IEnumerable> AllGroupedActions
}
return string.Empty;
- }).OrderBy(g => g.Key);
+ }).Where(g => !string.IsNullOrEmpty(g.Key)).OrderBy(g => g.Key);
public static void UpdateRotation()
{