Quest window: Only enable skip if not on the last step
authorLiza Carvelli <liza@carvel.li>
Sun, 16 Jun 2024 16:24:59 +0000 (18:24 +0200)
committerLiza Carvelli <liza@carvel.li>
Sun, 16 Jun 2024 16:24:59 +0000 (18:24 +0200)
Questionable/Windows/DebugWindow.cs

index 380e7819c1257115f502aad99f1aa59c44f0c09e..8cfdb488698a2a25c6d15c70589dc5a6956465ca 100644 (file)
@@ -1,6 +1,7 @@
 using System;
 using System.Diagnostics;
 using System.Globalization;
+using System.Linq;
 using System.Numerics;
 using Dalamud.Game.ClientState.Objects;
 using Dalamud.Interface;
@@ -162,10 +163,14 @@ internal sealed class DebugWindow : LWindow, IPersistableWindowConfig
             QuestStep? currentStep = currentQuest.Quest
                 .FindSequence(currentQuest.Sequence)
                 ?.FindStep(currentQuest.Step);
-            bool colored = currentStep != null && currentStep.InteractionType == EInteractionType.Instruction
-                                               && _questController
-                                                   .HasCurrentTaskMatching<WaitAtEnd.WaitNextStepOrSequence>();
-
+            bool lastStep = currentStep ==
+                            currentQuest.Quest.FindSequence(currentQuest.Sequence)?.Steps.LastOrDefault();
+            bool colored = currentStep != null
+                           && !lastStep
+                           && currentStep.InteractionType == EInteractionType.Instruction
+                           && _questController.HasCurrentTaskMatching<WaitAtEnd.WaitNextStepOrSequence>();
+
+            ImGui.BeginDisabled(lastStep);
             if (colored)
                 ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.HealerGreen);
             if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.ArrowCircleRight, "Skip"))
@@ -176,6 +181,7 @@ internal sealed class DebugWindow : LWindow, IPersistableWindowConfig
 
             if (colored)
                 ImGui.PopStyleColor();
+            ImGui.EndDisabled();
 
             bool autoAcceptNextQuest = _configuration.General.AutoAcceptNextQuest;
             if (ImGui.Checkbox("Automatically accept next quest", ref autoAcceptNextQuest))