From 82c3e3c647e82ebf93dcb27ddfccd6dda3733d3c Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Mon, 4 Nov 2024 20:10:35 +0100 Subject: [PATCH] Move when 'SendNotification' happens so it'll be before the solo duty dialog --- .../Steps/Common/SendNotification.cs | 25 ++++++++++++++++++- .../Controller/Steps/Shared/WaitAtEnd.cs | 24 +++--------------- Questionable/QuestionablePlugin.cs | 3 ++- 3 files changed, 29 insertions(+), 23 deletions(-) diff --git a/Questionable/Controller/Steps/Common/SendNotification.cs b/Questionable/Controller/Steps/Common/SendNotification.cs index 76b8a810..5edb743c 100644 --- a/Questionable/Controller/Steps/Common/SendNotification.cs +++ b/Questionable/Controller/Steps/Common/SendNotification.cs @@ -1,13 +1,36 @@ -using Dalamud.Game.Text; +using System.Collections.Generic; +using Dalamud.Game.Text; using Dalamud.Game.Text.SeStringHandling; using Dalamud.Plugin.Services; +using Questionable.Data; using Questionable.External; +using Questionable.Model; using Questionable.Model.Questing; namespace Questionable.Controller.Steps.Common; internal static class SendNotification { + internal sealed class Factory( + Configuration configuration, + TerritoryData territoryData) : SimpleTaskFactory + { + public override ITask? CreateTask(Quest quest, QuestSequence sequence, QuestStep step) + { + return step.InteractionType switch + { + EInteractionType.Snipe when !configuration.General.AutomaticallyCompleteSnipeTasks => + new Task(step.InteractionType, step.Comment), + EInteractionType.Duty => + new Task(step.InteractionType, step.ContentFinderConditionId.HasValue + ? territoryData.GetContentFinderConditionName(step.ContentFinderConditionId.Value) + : step.Comment), + EInteractionType.SinglePlayerDuty => new Task(step.InteractionType, quest.Info.Name), + _ => null, + }; + } + } + internal sealed record Task(EInteractionType InteractionType, string? Comment) : ITask { public override string ToString() => "SendNotification"; diff --git a/Questionable/Controller/Steps/Shared/WaitAtEnd.cs b/Questionable/Controller/Steps/Shared/WaitAtEnd.cs index 84d2e1ca..d64c009b 100644 --- a/Questionable/Controller/Steps/Shared/WaitAtEnd.cs +++ b/Questionable/Controller/Steps/Shared/WaitAtEnd.cs @@ -6,7 +6,6 @@ using System.Numerics; using Dalamud.Game.ClientState.Conditions; using Dalamud.Plugin.Services; using Questionable.Controller.Steps.Common; -using Questionable.Controller.Steps.Interactions; using Questionable.Controller.Utils; using Questionable.Data; using Questionable.Functions; @@ -20,8 +19,7 @@ internal static class WaitAtEnd internal sealed class Factory( IClientState clientState, ICondition condition, - TerritoryData territoryData, - Configuration configuration) + TerritoryData territoryData) : ITaskFactory { public IEnumerable CreateAllTasks(Quest quest, QuestSequence sequence, QuestStep step) @@ -49,28 +47,12 @@ internal static class WaitAtEnd case EInteractionType.WaitForManualProgress: case EInteractionType.Instruction: + case EInteractionType.Snipe: return [new WaitNextStepOrSequence()]; - case EInteractionType.Snipe: - if (configuration.General.AutomaticallyCompleteSnipeTasks) - return [new WaitNextStepOrSequence()]; - else - return [ - new SendNotification.Task(step.InteractionType, step.Comment), - new WaitNextStepOrSequence() - ]; - case EInteractionType.Duty: - return [ - new SendNotification.Task(step.InteractionType, step.ContentFinderConditionId.HasValue ? territoryData.GetContentFinderConditionName(step.ContentFinderConditionId.Value) : step.Comment), - new EndAutomation(), - ]; - case EInteractionType.SinglePlayerDuty: - return [ - new SendNotification.Task(step.InteractionType, quest.Info.Name), - new EndAutomation() - ]; + return [new EndAutomation()]; case EInteractionType.WalkTo: case EInteractionType.Jump: diff --git a/Questionable/QuestionablePlugin.cs b/Questionable/QuestionablePlugin.cs index b97158c6..9289b120 100644 --- a/Questionable/QuestionablePlugin.cs +++ b/Questionable/QuestionablePlugin.cs @@ -163,6 +163,8 @@ public sealed class QuestionablePlugin : IDalamudPlugin serviceCollection.AddTaskFactoryAndExecutor(); serviceCollection.AddTaskExecutor(); serviceCollection.AddTaskExecutor(); + serviceCollection + .AddTaskFactoryAndExecutor(); serviceCollection .AddTaskFactoryAndExecutor(); @@ -206,7 +208,6 @@ public sealed class QuestionablePlugin : IDalamudPlugin serviceCollection.AddTaskExecutor(); serviceCollection.AddTaskExecutor(); - serviceCollection.AddTaskExecutor(); serviceCollection.AddTaskExecutor(); serviceCollection.AddTaskFactory(); serviceCollection.AddTaskExecutor();