From fdb8eed7a44ad8cdca53bacd2d52455e0769043f Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Wed, 14 Aug 2024 01:49:02 +0200 Subject: [PATCH] Remove YA interaction for SinglePlayerDuty; remove data id being required for accept/complete quest + SinglePlayerDuty --- QuestPaths/quest-v1.json | 17 ----- .../Controller/Steps/Interactions/Interact.cs | 6 +- .../Steps/Interactions/SinglePlayerDuty.cs | 63 ------------------- Questionable/QuestionablePlugin.cs | 3 - Questionable/Windows/QuestWindow.cs | 32 ++++++---- 5 files changed, 25 insertions(+), 96 deletions(-) delete mode 100644 Questionable/Controller/Steps/Interactions/SinglePlayerDuty.cs diff --git a/QuestPaths/quest-v1.json b/QuestPaths/quest-v1.json index c8533fdf..96560c31 100644 --- a/QuestPaths/quest-v1.json +++ b/QuestPaths/quest-v1.json @@ -397,23 +397,6 @@ ] } }, - { - "if": { - "properties": { - "InteractionType": { - "const": "SinglePlayerDuty" - }, - "Emote": { - "not": true - } - } - }, - "then": { - "required": [ - "DataId" - ] - } - }, { "if": { "properties": { diff --git a/Questionable/Controller/Steps/Interactions/Interact.cs b/Questionable/Controller/Steps/Interactions/Interact.cs index dc50ac06..9fc57638 100644 --- a/Questionable/Controller/Steps/Interactions/Interact.cs +++ b/Questionable/Controller/Steps/Interactions/Interact.cs @@ -20,10 +20,14 @@ internal static class Interact public IEnumerable 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 index 0e1dbf8c..00000000 --- a/Questionable/Controller/Steps/Interactions/SinglePlayerDuty.cs +++ /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 CreateAllTasks(Quest quest, QuestSequence sequence, QuestStep step) - { - if (step.InteractionType != EInteractionType.SinglePlayerDuty) - return []; - - ArgumentNullException.ThrowIfNull(step.DataId); - return - [ - serviceProvider.GetRequiredService(), - serviceProvider.GetRequiredService() - .With(step.DataId.Value, quest, EInteractionType.None, true), - serviceProvider.GetRequiredService() - ]; - } - - 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"; - } -} diff --git a/Questionable/QuestionablePlugin.cs b/Questionable/QuestionablePlugin.cs index 4a9702f8..1068f274 100644 --- a/Questionable/QuestionablePlugin.cs +++ b/Questionable/QuestionablePlugin.cs @@ -154,9 +154,6 @@ public sealed class QuestionablePlugin : IDalamudPlugin serviceCollection.AddTaskWithFactory(); serviceCollection.AddTaskWithFactory(); serviceCollection.AddTaskWithFactory(); - serviceCollection - .AddTaskWithFactory(); serviceCollection .AddTaskWithFactory