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

Commit

Permalink
fix: better way about getting recast.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Jul 28, 2024
1 parent a179c7a commit 03c36cc
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 8 deletions.
3 changes: 2 additions & 1 deletion ActionTimelineEx/Configurations/Actions/ActionSetting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ public uint ActionId
[UI("Action ID")]
public int ActionID { get => (int) ActionId; set => ActionId = (uint)value; }

internal abstract ActionSettingType Type { get; }
[JsonIgnore]
public abstract ActionSettingType Type { get; }

[UI("Is this Action Highlight")]
public bool Highlight { get; set; }
Expand Down
17 changes: 14 additions & 3 deletions ActionTimelineEx/Configurations/Actions/GCDAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,20 @@ namespace ActionTimelineEx.Configurations.Actions;
[Description("GCD")]
public class GCDAction : ActionSetting
{
internal override ActionSettingType Type => ActionSettingType.Action;
public override ActionSettingType Type => ActionSettingType.Action;

internal float Gcd => GcdOverride != 0 ? GcdOverride
: ActionManager.GetAdjustedRecastTime(FFXIVClientStructs.FFXIV.Client.Game.ActionType.Action, ActionId) / 1000f;

[JsonIgnore]
[Range(0, 20, ConfigUnitType.Seconds)]
[UI("Recast time override")]
public float GcdOverride
{
get => Plugin.Settings.ActionRecast.TryGetValue(ActionId, out var v) ? v : 0f;
set => Plugin.Settings.ActionRecast[ActionId] = value;
}

internal float Gcd => ActionManager.GetAdjustedRecastTime(FFXIVClientStructs.FFXIV.Client.Game.ActionType.Action, ActionId) / 1000f;

[UI]
public List<oGCDAction> oGCDs { get; set; } = [];
Expand All @@ -22,7 +33,7 @@ public float Draw(ImDrawListPtr drawList, Vector2 point, bool pass, ActionSettin
if (Plugin.Settings.DrawTime)
{
var width = ImGui.CalcTextSize(time.GetString()).X + 5;
drawList.AddText(point, uint.MaxValue, time.GetString() + "s ");
drawList.AddText(point, uint.MaxValue, time.GetString());
point += Vector2.UnitX * width;
time += TimeSpan.FromSeconds(Gcd);
}
Expand Down
2 changes: 1 addition & 1 deletion ActionTimelineEx/Configurations/Actions/oGCDAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ public ActionSettingType ActionType
}
}

internal override ActionSettingType Type => ActionType;
public override ActionSettingType Type => ActionType;
}
7 changes: 6 additions & 1 deletion ActionTimelineEx/Configurations/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ public class Settings : IPluginConfiguration
public bool DrawRotation { get; set; } = false;

[UI("Only Show when Weapon On", Parent = nameof(DrawRotation))]
public bool OnlyShowRotationWhenWeaponOn { get; set; } = true;
public bool OnlyShowRotationWhenWeaponOn { get; set; } = true;

[UI("Highlight in hot bar", Parent = nameof(DrawRotation))]
public bool HighlightInHotbar { get; set; } = true;

[UI("Locked", Parent = nameof(DrawRotation))]
public bool RotationLocked { get; set; } = false;
Expand Down Expand Up @@ -139,6 +142,8 @@ internal RotationsSetting RotationHelper

private static readonly RotationsSetting EmptyHolder = new();

public Dictionary<uint, float> ActionRecast { get; set; } = [];

public int Version { get; set; } = 6;

public void Save()
Expand Down
2 changes: 1 addition & 1 deletion ActionTimelineEx/Helpers/ActionHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ internal static bool IsInJob(this Action i)

internal static string GetString(this TimeSpan timespan)
{
return $"{(int)timespan.TotalMinutes}:{timespan.Seconds:D2}.{timespan.Milliseconds.ToString("000")[0..1]}";
return $"{(int)timespan.TotalMinutes}:{timespan.Seconds:D2}.{timespan.Milliseconds.ToString("000")[0..2]}s ";
}
}
1 change: 1 addition & 0 deletions ActionTimelineEx/Helpers/RotationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ private static void Framework_Update(Dalamud.Plugin.Services.IFramework framewor
_highLight.HotbarIDs.Clear();

if (!Plugin.Settings.DrawRotation) return;
if (!Plugin.Settings.HighlightInHotbar) return;

var action = ActiveAction;
if (action == null) return;
Expand Down
3 changes: 2 additions & 1 deletion ActionTimelineEx/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,5 +165,6 @@
"ActionTimelineEx.Configurations.Actions.GCDActionName.RecastOverride": "Recast override time",
"ActionTimelineEx.Configurations.SettingsName.GcdTime": "Gcd Time",
"ActionTimelineEx.Configurations.Actions.GCDActionName.GcdOverride": "Recast time override",
"ActionTimelineEx.Configurations.SettingsName.DrawTime": "Draw Time"
"ActionTimelineEx.Configurations.SettingsName.DrawTime": "Draw Time",
"ActionTimelineEx.Configurations.SettingsName.HighlightInHotbar": "Highlight in hot bar"
}

0 comments on commit 03c36cc

Please sign in to comment.