Remove YA interaction for SinglePlayerDuty; remove data id being required for accept...
authorLiza Carvelli <liza@carvel.li>
Tue, 13 Aug 2024 23:49:02 +0000 (01:49 +0200)
committerLiza Carvelli <liza@carvel.li>
Tue, 13 Aug 2024 23:49:02 +0000 (01:49 +0200)
QuestPaths/quest-v1.json
Questionable/Controller/Steps/Interactions/Interact.cs
Questionable/Controller/Steps/Interactions/SinglePlayerDuty.cs [deleted file]
Questionable/QuestionablePlugin.cs
Questionable/Windows/QuestWindow.cs

index c8533fdf69862124c5aa0a534dad4de67669d5ea..96560c31079c2b79f4d8d9ee42a7e1078795037d 100644 (file)
                     ]
                   }
                 },
-                {
-                  "if": {
-                    "properties": {
-                      "InteractionType": {
-                        "const": "SinglePlayerDuty"
-                      },
-                      "Emote": {
-                        "not": true
-                      }
-                    }
-                  },
-                  "then": {
-                    "required": [
-                      "DataId"
-                    ]
-                  }
-                },
                 {
                   "if": {
                     "properties": {
index dc50ac06a060e9c6b6326dc3a725eefb733f09d6..9fc57638414104e434bc22cdef2edaf3b6331d64 100644 (file)
@@ -20,10 +20,14 @@ internal static class Interact
         public IEnumerable<ITask> CreateAllTasks(Quest quest, QuestSequence sequence, QuestStep step)
         {
             if (step.InteractionType is EInteractionType.AcceptQuest or EInteractionType.CompleteQuest
-                or EInteractionType.AcceptLeve or EInteractionType.CompleteLeve)
+                or EInteractionType.AcceptLeve or EInteractionType.CompleteLeve
+                or EInteractionType.SinglePlayerDuty)
             {
                 if (step.Emote != null)
                     yield break;
+
+                if (step.DataId == null)
+                    yield break;
             }
             else if (step.InteractionType != EInteractionType.Interact)
                 yield break;
diff --git a/Questionable/Controller/Steps/Interactions/SinglePlayerDuty.cs b/Questionable/Controller/Steps/Interactions/SinglePlayerDuty.cs
deleted file mode 100644 (file)
index 0e1dbf8..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-using System;
-using System.Collections.Generic;
-using Dalamud.Plugin.Services;
-using Microsoft.Extensions.DependencyInjection;
-using Questionable.External;
-using Questionable.Model;
-using Questionable.Model.Questing;
-
-namespace Questionable.Controller.Steps.Interactions;
-
-internal static class SinglePlayerDuty
-{
-    internal sealed class Factory(IServiceProvider serviceProvider) : ITaskFactory
-    {
-        public IEnumerable<ITask> CreateAllTasks(Quest quest, QuestSequence sequence, QuestStep step)
-        {
-            if (step.InteractionType != EInteractionType.SinglePlayerDuty)
-                return [];
-
-            ArgumentNullException.ThrowIfNull(step.DataId);
-            return
-            [
-                serviceProvider.GetRequiredService<DisableYesAlready>(),
-                serviceProvider.GetRequiredService<Interact.DoInteract>()
-                    .With(step.DataId.Value, quest, EInteractionType.None, true),
-                serviceProvider.GetRequiredService<RestoreYesAlready>()
-            ];
-        }
-
-        public ITask CreateTask(Quest quest, QuestSequence sequence, QuestStep step)
-            => throw new InvalidOperationException();
-    }
-
-    internal sealed class DisableYesAlready(YesAlreadyIpc yesAlreadyIpc) : ITask
-    {
-        public bool Start()
-        {
-            yesAlreadyIpc.DisableYesAlready();
-            return true;
-        }
-
-        public ETaskResult Update() => ETaskResult.TaskComplete;
-
-        public override string ToString() => "DisableYA";
-    }
-
-    internal sealed class RestoreYesAlready(YesAlreadyIpc yesAlreadyIpc, IGameGui gameGui) : ITask
-    {
-        public bool Start() => true;
-
-        public ETaskResult Update()
-        {
-            if (gameGui.GetAddonByName("SelectYesno") != nint.Zero ||
-                gameGui.GetAddonByName("DifficultySelectYesNo") != nint.Zero)
-                return ETaskResult.StillRunning;
-
-            yesAlreadyIpc.RestoreYesAlready();
-            return ETaskResult.TaskComplete;
-        }
-
-        public override string ToString() => "Wait(DialogClosed) → RestoreYA";
-    }
-}
index 4a9702f85fb5b8ab573bce204c1875158b724ea0..1068f274a112f5b4f22e58319a39b0589d1df4d0 100644 (file)
@@ -154,9 +154,6 @@ public sealed class QuestionablePlugin : IDalamudPlugin
         serviceCollection.AddTaskWithFactory<EquipItem.Factory, EquipItem.DoEquip>();
         serviceCollection.AddTaskWithFactory<EquipRecommended.Factory, EquipRecommended.DoEquipRecommended>();
         serviceCollection.AddTaskWithFactory<TurnInDelivery.Factory, TurnInDelivery.SatisfactionSupplyTurnIn>();
-        serviceCollection
-            .AddTaskWithFactory<SinglePlayerDuty.Factory, SinglePlayerDuty.DisableYesAlready,
-                SinglePlayerDuty.RestoreYesAlready>();
         serviceCollection
             .AddTaskWithFactory<InitiateLeve.Factory,
                 InitiateLeve.SkipInitiateIfActive,
index 26891d8ba56cc6cf191c41ee1a13947c08c6fbf1..b5c30076e4e86160e0b6fbc5f2ed083f40b68d3b 100644 (file)
@@ -1,6 +1,7 @@
 using System;
 using System.Numerics;
 using Dalamud.Interface;
+using Dalamud.Interface.Colors;
 using Dalamud.Plugin;
 using Dalamud.Plugin.Services;
 using ImGuiNET;
@@ -120,22 +121,29 @@ internal sealed class QuestWindow : LWindow, IPersistableWindowConfig
 
     public override void Draw()
     {
-        _activeQuestComponent.Draw(IsMinimized);
-        if (!IsMinimized)
+        try
         {
-            ImGui.Separator();
-
-            if (_aRealmRebornComponent.ShouldDraw)
+            _activeQuestComponent.Draw(IsMinimized);
+            if (!IsMinimized)
             {
-                _aRealmRebornComponent.Draw();
                 ImGui.Separator();
-            }
 
-            _creationUtilsComponent.Draw();
-            ImGui.Separator();
+                if (_aRealmRebornComponent.ShouldDraw)
+                {
+                    _aRealmRebornComponent.Draw();
+                    ImGui.Separator();
+                }
+
+                _creationUtilsComponent.Draw();
+                ImGui.Separator();
 
-            _quickAccessButtonsComponent.Draw();
-            _remainingTasksComponent.Draw();
+                _quickAccessButtonsComponent.Draw();
+                _remainingTasksComponent.Draw();
+            }
+        }
+        catch (Exception e)
+        {
+            ImGui.TextColored(ImGuiColors.DalamudRed, e.ToString());
         }
     }