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

Commit

Permalink
fix: add 0gcd last option.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Jul 13, 2024
1 parent 5949fa9 commit 4bcbbe7
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 9 deletions.
20 changes: 18 additions & 2 deletions ActionTimelineEx/Configurations/ActionSetting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@ public override string GetDescription(object obj)
}
}

/// <summary>
/// From https://github.com/aers/FFXIVClientStructs/blob/main/FFXIVClientStructs/FFXIV/Client/Game/ActionManager.cs#L373-L395
/// </summary>
public enum ActionSettingType : byte
{
Action,
Item,
Action = 0x01, // Spell, Weaponskill, Ability. Confusing name, I know.
Item = 0x02,
}

[ActionSetting]
Expand Down Expand Up @@ -74,6 +77,19 @@ public ActionSettingType Type
}
}

internal bool Is0GCD => !IsGCD;

[JsonProperty]
private bool _isLast = false;

[JsonIgnore]
[UI("Is the Last Ability during GCD", Parent = nameof(Is0GCD))]
public bool IsLast
{
get => _isLast && Is0GCD;
set => _isLast = value;
}

private void Update()
{
ClearData();
Expand Down
3 changes: 3 additions & 0 deletions ActionTimelineEx/Configurations/UiString.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,7 @@ internal enum UiString

[Description("Reset Count")]
RotationReset,

[Description("Add One Rotation")]
AddOneRotation,
}
5 changes: 4 additions & 1 deletion ActionTimelineEx/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,8 @@
"XIVConfigUI.Attributes.ConfigUnitType.Percent": "Ratio Unit, as percentage.",
"XIVConfigUI.Attributes.ConfigUnitType.Pixels": "Display Unit, in pixels.",
"ActionTimelineEx.Configurations.SettingsName.RecordRotation": "Record Rotation",
"ActionTimelineEx.Description": "Configurable timeline display of all the actions you use."
"ActionTimelineEx.Description": "Configurable timeline display of all the actions you use.",
"ActionTimelineEx.Configurations.UiString.AddOneRotation": "Add One Rotation",
"XIVConfigUI.LocalString.Add": "Add",
"ActionTimelineEx.Configurations.ActionSettingName.IsLast": "Is the Last Ability during GCD"
}
16 changes: 11 additions & 5 deletions ActionTimelineEx/Windows/RotationHelperItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public override void Draw(ConfigWindow window)
_group ??= new CollapsingHeaderGroup(new()
{
{ () => UiString.RotationSetting.Local(), () => DrawSetting(window) },
{ () => UiString.Rotation.Local(), () => DrawRotation(window, setting.RotationSetting)},
{ () => UiString.Rotation.Local(), () => DrawRotation(window, setting)},
});

_group.Draw();
Expand All @@ -53,7 +53,7 @@ private static void DrawSetting(ConfigWindow window)
window.Collection.DrawItems(1);
}

private static void DrawRotation(ConfigWindow window, RotationSetting setting)
private static void DrawRotation(ConfigWindow window, RotationsSetting setting)
{
if (ImGui.Button(UiString.RotationReset.Local()))
{
Expand All @@ -62,9 +62,14 @@ private static void DrawRotation(ConfigWindow window, RotationSetting setting)

ImGui.SameLine();

if (ImGui.Button(UiString.AddOneRotation.Local()))
{
setting.RotationSettings.Add(new());
}

if (ImGui.Button(LocalString.CopyToClipboard.Local()))
{
var str = JsonHelper.SerializeObject(setting.Actions);
var str = JsonHelper.SerializeObject(setting.RotationSetting.Actions);
ImGui.SetClipboardText(str);
}

Expand All @@ -76,16 +81,17 @@ private static void DrawRotation(ConfigWindow window, RotationSetting setting)

try
{
setting.Actions = JsonHelper.DeserializeObject<List<ActionSetting>>(str)!;
setting.RotationSetting.Actions = JsonHelper.DeserializeObject<List<ActionSetting>>(str)!;
}
catch (Exception ex)
{
Svc.Log.Warning(ex, "Failed to load the timeline.");
}
}


window.Collection.DrawItems(2);
ConditionDrawer.Draw(setting.Actions);
ConditionDrawer.Draw(setting.RotationSetting.Actions);
}

private static void DrawTerritoryHeader()
Expand Down
2 changes: 1 addition & 1 deletion XIVConfigUI

0 comments on commit 4bcbbe7

Please sign in to comment.