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

Commit

Permalink
fix: add a feature to control if shown in cooldown window.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Apr 5, 2023
1 parent ef6a377 commit b7904fc
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 5 deletions.
16 changes: 16 additions & 0 deletions RotationSolver.Basic/Actions/BaseAction_BasicInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@ public bool IsEnabled
}
}
}

public bool IsInCooldown
{
get => !Service.Config.NotInCoolDownActions.Contains(ID);
set
{
if (value)
{
Service.Config.NotInCoolDownActions.Remove(ID);
}
else
{
Service.Config.NotInCoolDownActions.Add(ID);
}
}
}
public uint ID => _action.RowId;
public uint AdjustedID => (uint)Service.GetAdjustedActionId((ActionID)ID);

Expand Down
16 changes: 16 additions & 0 deletions RotationSolver.Basic/Actions/BaseItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,22 @@ public bool IsEnabled
}
}

public bool IsInCooldown
{
get => !Service.Config.NotInCoolDownItems.Contains(ID);
set
{
if (value)
{
Service.Config.NotInCoolDownItems.Remove(ID);
}
else
{
Service.Config.NotInCoolDownItems.Add(ID);
}
}
}

public string Description => string.Empty;

public unsafe float RecastTimeOneCharge => ActionManager.Instance()->GetRecastTime(ActionType.Item, ID);
Expand Down
2 changes: 2 additions & 0 deletions RotationSolver.Basic/Actions/IAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ public interface IAction : ITexture
bool EnoughLevel { get; }

internal byte Level { get; }

bool IsInCooldown { get; set; }
}
3 changes: 3 additions & 0 deletions RotationSolver.Basic/Configuration/PluginConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ public class PluginConfiguration : IPluginConfiguration
public string VoiceName = string.Empty;
public SortedSet<string> DisabledCombos { get; private set; } = new SortedSet<string>();
public SortedSet<uint> DisabledActions { get; private set; } = new SortedSet<uint>();
public SortedSet<uint> NotInCoolDownActions { get; private set; } = new SortedSet<uint>();
public SortedSet<uint> DisabledItems { get; private set; } = new SortedSet<uint>();
public SortedSet<uint> NotInCoolDownItems { get; private set; } = new SortedSet<uint>();

public List<ActionEventInfo> Events { get; private set; } = new List<ActionEventInfo>();
public Dictionary<uint, Dictionary<string, Dictionary<string, string>>> RotationsConfigurations { get; private set; }
= new Dictionary<uint, Dictionary<string, Dictionary<string, string>>>();
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/UI/CooldownWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public override void Draw()
{
foreach (var pair in RotationUpdater.AllGroupedActions)
{
IEnumerable<IAction> showItems = pair.OrderBy(a => a.ID);
var showItems = pair.OrderBy(a => a.ID).Where(a => a.IsInCooldown);
if (!Service.Config.ShowGCDCooldown) showItems = showItems.Where(i => !(i is IBaseAction a && a.IsGeneralGCD));

if (!showItems.Any()) continue;
Expand Down
26 changes: 22 additions & 4 deletions RotationSolver/UI/ImGuiHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,9 @@ public static void DrawEnableTexture<T>(this T texture, bool isSelected, Action
}
ImGui.NextColumn();

bool enable = false;

if (isSelected) ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudYellow);
enable = texture.IsEnabled;
if (ImGui.Checkbox($"{texture.Name}##{texture.Name}", ref enable))
var enable = texture.IsEnabled;
if (ImGui.Checkbox($"{texture.Name}##{texture.Name}Enabled", ref enable))
{
texture.IsEnabled = enable;
Service.Config.Save();
Expand Down Expand Up @@ -549,6 +547,16 @@ private unsafe static void Display(this IBaseAction action, bool IsActive) => ac
ImGui.SameLine();
Spacing();

var enable = action.IsInCooldown;
if (ImGui.Checkbox($"CD##{action.Name}InCooldown", ref enable))
{
action.IsInCooldown = enable;
Service.Config.Save();
}

ImGui.SameLine();
Spacing();

OtherCommandType.ToggleActions.DisplayCommandHelp(action.ToString());

if (action.IsTimeline) OtherCommandType.DoActions.DisplayCommandHelp($"{action}-{5}",
Expand Down Expand Up @@ -585,6 +593,16 @@ private unsafe static void Display(this IBaseAction action, bool IsActive) => ac

public unsafe static void Display(this IBaseItem item, bool IsActive) => item.DrawEnableTexture(false, null, otherThing: () =>
{
ImGui.SameLine();
Spacing();

var enable = item.IsInCooldown;
if (ImGui.Checkbox($"CD##{item.Name}InCooldown", ref enable))
{
item.IsInCooldown = enable;
Service.Config.Save();
}

if (Service.Config.InDebug)
{
ImGui.Text("Status: " + ActionManager.Instance()->GetActionStatus(ActionType.Item, item.ID).ToString());
Expand Down

0 comments on commit b7904fc

Please sign in to comment.