diff --git a/ActionTimelineEx/Configurations/Settings.cs b/ActionTimelineEx/Configurations/Settings.cs index de3f5c9..24e2dd0 100644 --- a/ActionTimelineEx/Configurations/Settings.cs +++ b/ActionTimelineEx/Configurations/Settings.cs @@ -50,6 +50,9 @@ public class Settings : IPluginConfiguration [UI("Draw Rotation", 1)] public bool DrawRotation { get; set; } = false; + [UI("Only Show when Weapon On", Parent = nameof(DrawRotation))] + public bool OnlyShowRotationWhenWeaponOn { get; set; } = true; + [UI("Locked", Parent = nameof(DrawRotation))] public bool RotationLocked { get; set; } = false; @@ -86,6 +89,20 @@ public class Settings : IPluginConfiguration [UI("Reverse Draw", Parent = nameof(VerticalDraw))] public bool Reverse { get; set; } = false; + [UI("Ignore Items", Parent = nameof(DrawRotation))] + public bool IgnoreItems { get; set; } = false; + + [UI("Ignore System Actions", Parent = nameof(DrawRotation))] + public bool IgnoreSystemActions { get; set; } = false; + + [UI("Ignore Role Actions", Parent = nameof(DrawRotation))] + public bool IgnoreRoleActions { get; set; } = false; + + [UI("Ignore Limit Breaks", Parent = nameof(DrawRotation))] + public bool IgnoreLimitBreaks { get; set; } = false; + + [UI("Ignore Duty Actions", Parent = nameof(DrawRotation))] + public bool IgnoreDutyActions { get; set; } = false; [JsonIgnore] [TimelineChoices] [UI("Rotation Choice", 3)] diff --git a/ActionTimelineEx/Helpers/RotationHelper.cs b/ActionTimelineEx/Helpers/RotationHelper.cs index 2ce240f..ea3e42d 100644 --- a/ActionTimelineEx/Helpers/RotationHelper.cs +++ b/ActionTimelineEx/Helpers/RotationHelper.cs @@ -131,20 +131,20 @@ private static void ActionFromSelf(ActionEffectSet set) if (!Plugin.Settings.DrawRotation) return; - foreach (var act in RotationSetting.IgnoreActions) - { - if (act.IsMatched(actionId, actionSettingType)) return; - } + if (IsIgnored(set)) return; ActionSetting? nextAction; if (IsGcd(set)) { nextAction = SubIndex == 0 ? RotationSetting.GetNextAction(Index, 0) : RotationSetting.GetNextAction(Index + 1, 0); + SubIndex = 0; + Index++; } else { nextAction = RotationSetting.GetNextAction(Index, SubIndex); + SubIndex++; } if (nextAction == null) return; @@ -157,7 +157,35 @@ private static void ActionFromSelf(ActionEffectSet set) { Svc.Chat.PrintError($"Clicked the wrong action {set.Name}! You should Click {nextAction.DisplayName}!"); } - Index++; + } + + private static bool IsIgnored(in ActionEffectSet set) + { + if (Plugin.Settings.IgnoreItems && set.Action == null) return true; + + if (set.Action != null) + { + var type = set.Action.GetActionType(); + + switch (type) + { + case ActionType.SystemAction when Plugin.Settings.IgnoreSystemActions: + case ActionType.RoleAction when Plugin.Settings.IgnoreRoleActions: + case ActionType.LimitBreak when Plugin.Settings.IgnoreLimitBreaks: + case ActionType.DutyAction when Plugin.Settings.IgnoreDutyActions: + return true; + } + } + + var actionSettingType = (ActionSettingType)(byte)set.Header.ActionType; + var actionId = set.Header.ActionID; + + foreach (var act in RotationSetting.IgnoreActions) + { + if (act == null) continue; + if (act.IsMatched(actionId, actionSettingType)) return true; + } + return false; } private static void RecordRotation(in ActionEffectSet set) @@ -193,6 +221,7 @@ private static bool IsGcd(in ActionEffectSet set) public static void Clear() { Index = 0; + SubIndex = 0; SuccessActions.Clear(); } } diff --git a/ActionTimelineEx/Windows/RotationHelperWindow.cs b/ActionTimelineEx/Windows/RotationHelperWindow.cs index d187ffd..6b1edbf 100644 --- a/ActionTimelineEx/Windows/RotationHelperWindow.cs +++ b/ActionTimelineEx/Windows/RotationHelperWindow.cs @@ -1,9 +1,9 @@ using ActionTimelineEx.Helpers; using Dalamud.Interface.Utility; using Dalamud.Interface.Utility.Raii; +using ECommons.GameHelpers; using ImGuiNET; using System.Numerics; -using XIVConfigUI; namespace ActionTimelineEx.Windows; internal static class RotationHelperWindow @@ -13,6 +13,12 @@ public static void Draw() var setting = Plugin.Settings; if (!setting.DrawRotation) return; + unsafe + { + if (setting.OnlyShowRotationWhenWeaponOn + && !Player.BattleChara->IsWeaponDrawn) return; + } + var flag = TimelineWindow._baseFlags; if (setting.RotationLocked) {