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();