Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix: more ignores.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Jul 18, 2024
1 parent 291f428 commit 9fc95e6
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 6 deletions.
17 changes: 17 additions & 0 deletions ActionTimelineEx/Configurations/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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)]
Expand Down
39 changes: 34 additions & 5 deletions ActionTimelineEx/Helpers/RotationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
Expand Down Expand Up @@ -193,6 +221,7 @@ private static bool IsGcd(in ActionEffectSet set)
public static void Clear()
{
Index = 0;
SubIndex = 0;
SuccessActions.Clear();
}
}
8 changes: 7 additions & 1 deletion ActionTimelineEx/Windows/RotationHelperWindow.cs
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)
{
Expand Down

0 comments on commit 9fc95e6

Please sign in to comment.