Skip to content

Commit

Permalink
fate window options
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaksuhn committed Aug 4, 2024
1 parent bcc38cf commit c293b71
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
7 changes: 7 additions & 0 deletions Automaton/Features/DateWithDestiny.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public class DateWithDestinyConfiguration
[FloatConfig(DefaultValue = 900)] public float MaxDuration = 900;
[FloatConfig(DefaultValue = 120)] public float MinTimeRemaining = 120;
[FloatConfig(DefaultValue = 90)] public float MaxProgress = 90;

[BoolConfig] public bool ShowFateTimeRemaining;
[BoolConfig] public bool ShowFateBonusIndicator;
}

[Tweak, Requirement(NavmeshIPC.Name, NavmeshIPC.Repo)]
Expand Down Expand Up @@ -172,6 +175,10 @@ public override void DrawConfig()
ImGui.DragFloat("Max Progress (%)", ref Config.MaxProgress);
ImGui.SameLine();
ImGuiX.ResetButton(ref Config.MaxProgress, 90);

ImGuiX.DrawSection("Fate Window Options");
ImGui.Checkbox("Show Time Remaining", ref Config.ShowFateTimeRemaining);
ImGui.Checkbox("Show Bonus Indicator", ref Config.ShowFateBonusIndicator);
}

public override void Enable()
Expand Down
17 changes: 16 additions & 1 deletion Automaton/UI/FateTrackerUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public override void Draw()
{
ImGui.TableNextRow();
ImGui.TableNextColumn();

if (ImGuiComponents.IconButton($"###Pathfind{fate.FateId}", FontAwesomeIcon.Map))
{
if (!P.Navmesh.IsRunning())
Expand All @@ -64,20 +65,34 @@ public override void Draw()
P.Navmesh.Stop();
}
if (ImGui.IsItemHovered()) ImGui.SetTooltip($"Pathfind to {fate.Position}");

ImGui.SameLine();

if (ImGuiComponents.IconButton($"###Flag{fate.FateId}", FontAwesomeIcon.Flag))
{
unsafe { AgentMap.Instance()->SetFlagMapMarker(Svc.ClientState.TerritoryType, Svc.ClientState.MapId, fate.Position); }
}
if (ImGui.IsItemHovered()) ImGui.SetTooltip($"Set map flag to {fate.Position}");

ImGui.SameLine();

if (_tweak.Config.ShowFateBonusIndicator && fate.HasExpBonus)
{
ImGui.Image(Svc.Texture.GetFromGameIcon(new Dalamud.Interface.Textures.GameIconLookup(65001)).GetWrapOrEmpty().ImGuiHandle, new Vector2(ImGuiX.IconUnitHeight()));

ImGui.SameLine();
}

var nameColour = _tweak.FateConditions(fate) ? new Vector4(1, 1, 1, 1) : _tweak.Config.blacklist.Contains(fate.FateId) ? new Vector4(1, 0, 0, 0.5f) : new Vector4(1, 1, 1, 0.5f);
ImGuiEx.TextV(nameColour, $"{fate.Name}");
ImGuiEx.TextV(nameColour, $"{fate.Name} {(_tweak.Config.ShowFateTimeRemaining && fate.TimeRemaining >= 0 ? TimeSpan.FromSeconds(fate.TimeRemaining) : string.Empty)}");
if (ImGui.IsItemHovered()) ImGui.SetTooltip($"[{fate.FateId}] {fate.Position} {fate.Progress}%% {fate.TimeRemaining}/{fate.Duration}\nFate {(_tweak.FateConditions(fate) ? "meets" : "doesn't meet")} conditions and {(_tweak.FateConditions(fate) ? "will" : "won't")} be pathed to in auto mode.");

ImGui.TableNextColumn();

ImGuiX.DrawProgressBar(fate.Progress, 100, new Vector4(0.404f, 0.259f, 0.541f, 1));

ImGui.SameLine();

ImGui.SetCursorPosX(ImGui.GetContentRegionMax().X - ImGuiX.IconUnitWidth() - ImGui.GetStyle().WindowPadding.X);
if (ImGuiComponents.IconButton($"###Blacklist{fate.FateId}", FontAwesomeIcon.Ban))
{
Expand Down

0 comments on commit c293b71

Please sign in to comment.