1
0
forked from liza/Questionable

Move when 'SendNotification' happens so it'll be before the solo duty dialog

This commit is contained in:
Liza 2024-11-04 20:10:35 +01:00
parent 8e462c13c0
commit 82c3e3c647
Signed by: liza
GPG Key ID: 7199F8D727D55F67
3 changed files with 29 additions and 23 deletions

View File

@ -1,13 +1,36 @@
using Dalamud.Game.Text; using System.Collections.Generic;
using Dalamud.Game.Text;
using Dalamud.Game.Text.SeStringHandling; using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Questionable.Data;
using Questionable.External; using Questionable.External;
using Questionable.Model;
using Questionable.Model.Questing; using Questionable.Model.Questing;
namespace Questionable.Controller.Steps.Common; namespace Questionable.Controller.Steps.Common;
internal static class SendNotification 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 internal sealed record Task(EInteractionType InteractionType, string? Comment) : ITask
{ {
public override string ToString() => "SendNotification"; public override string ToString() => "SendNotification";

View File

@ -6,7 +6,6 @@ using System.Numerics;
using Dalamud.Game.ClientState.Conditions; using Dalamud.Game.ClientState.Conditions;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Questionable.Controller.Steps.Common; using Questionable.Controller.Steps.Common;
using Questionable.Controller.Steps.Interactions;
using Questionable.Controller.Utils; using Questionable.Controller.Utils;
using Questionable.Data; using Questionable.Data;
using Questionable.Functions; using Questionable.Functions;
@ -20,8 +19,7 @@ internal static class WaitAtEnd
internal sealed class Factory( internal sealed class Factory(
IClientState clientState, IClientState clientState,
ICondition condition, ICondition condition,
TerritoryData territoryData, TerritoryData territoryData)
Configuration configuration)
: ITaskFactory : ITaskFactory
{ {
public IEnumerable<ITask> CreateAllTasks(Quest quest, QuestSequence sequence, QuestStep step) public IEnumerable<ITask> CreateAllTasks(Quest quest, QuestSequence sequence, QuestStep step)
@ -49,28 +47,12 @@ internal static class WaitAtEnd
case EInteractionType.WaitForManualProgress: case EInteractionType.WaitForManualProgress:
case EInteractionType.Instruction: case EInteractionType.Instruction:
case EInteractionType.Snipe:
return [new WaitNextStepOrSequence()]; 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: case EInteractionType.Duty:
return [
new SendNotification.Task(step.InteractionType, step.ContentFinderConditionId.HasValue ? territoryData.GetContentFinderConditionName(step.ContentFinderConditionId.Value) : step.Comment),
new EndAutomation(),
];
case EInteractionType.SinglePlayerDuty: case EInteractionType.SinglePlayerDuty:
return [ return [new EndAutomation()];
new SendNotification.Task(step.InteractionType, quest.Info.Name),
new EndAutomation()
];
case EInteractionType.WalkTo: case EInteractionType.WalkTo:
case EInteractionType.Jump: case EInteractionType.Jump:

View File

@ -163,6 +163,8 @@ public sealed class QuestionablePlugin : IDalamudPlugin
serviceCollection.AddTaskFactoryAndExecutor<MoveTo.MoveTask, MoveTo.Factory, MoveTo.MoveExecutor>(); serviceCollection.AddTaskFactoryAndExecutor<MoveTo.MoveTask, MoveTo.Factory, MoveTo.MoveExecutor>();
serviceCollection.AddTaskExecutor<MoveTo.WaitForNearDataId, MoveTo.WaitForNearDataIdExecutor>(); serviceCollection.AddTaskExecutor<MoveTo.WaitForNearDataId, MoveTo.WaitForNearDataIdExecutor>();
serviceCollection.AddTaskExecutor<MoveTo.LandTask, MoveTo.LandExecutor>(); serviceCollection.AddTaskExecutor<MoveTo.LandTask, MoveTo.LandExecutor>();
serviceCollection
.AddTaskFactoryAndExecutor<SendNotification.Task, SendNotification.Factory, SendNotification.Executor>();
serviceCollection serviceCollection
.AddTaskFactoryAndExecutor<NextQuest.SetQuestTask, NextQuest.Factory, NextQuest.NextQuestExecutor>(); .AddTaskFactoryAndExecutor<NextQuest.SetQuestTask, NextQuest.Factory, NextQuest.NextQuestExecutor>();
@ -206,7 +208,6 @@ public sealed class QuestionablePlugin : IDalamudPlugin
serviceCollection.AddTaskExecutor<InitiateLeve.Initiate, InitiateLeve.InitiateExecutor>(); serviceCollection.AddTaskExecutor<InitiateLeve.Initiate, InitiateLeve.InitiateExecutor>();
serviceCollection.AddTaskExecutor<InitiateLeve.SelectDifficulty, InitiateLeve.SelectDifficultyExecutor>(); serviceCollection.AddTaskExecutor<InitiateLeve.SelectDifficulty, InitiateLeve.SelectDifficultyExecutor>();
serviceCollection.AddTaskExecutor<SendNotification.Task, SendNotification.Executor>();
serviceCollection.AddTaskExecutor<WaitCondition.Task, WaitCondition.WaitConditionExecutor>(); serviceCollection.AddTaskExecutor<WaitCondition.Task, WaitCondition.WaitConditionExecutor>();
serviceCollection.AddTaskFactory<WaitAtEnd.Factory>(); serviceCollection.AddTaskFactory<WaitAtEnd.Factory>();
serviceCollection.AddTaskExecutor<WaitAtEnd.WaitDelay, WaitAtEnd.WaitDelayExecutor>(); serviceCollection.AddTaskExecutor<WaitAtEnd.WaitDelay, WaitAtEnd.WaitDelayExecutor>();