diff --git a/Questionable/Controller/CommandHandler.cs b/Questionable/Controller/CommandHandler.cs index 0bb87429f..42759d998 100644 --- a/Questionable/Controller/CommandHandler.cs +++ b/Questionable/Controller/CommandHandler.cs @@ -205,7 +205,24 @@ internal sealed class CommandHandler : IDisposable { if (_questRegistry.TryGetQuest(questId, out Quest? quest)) { - _questController.SimulateQuest(quest); + byte sequenceId = 0; + int stepId = 0; + if (arguments.Length >= 2 && byte.TryParse(arguments[1], out byte parsedSequence)) + { + QuestSequence? sequence = quest.FindSequence(parsedSequence); + if (sequence != null) + { + sequenceId = (byte)sequence.Sequence; + if (arguments.Length >= 3 && int.TryParse(arguments[2], out int parsedStep)) + { + QuestStep? step = sequence.FindStep(parsedStep); + if (step != null) + stepId = parsedStep; + } + } + } + + _questController.SimulateQuest(quest, sequenceId, stepId); _chatGui.Print($"Simulating quest {questId} ({quest.Info.Name}).", MessageTag, TagColor); } else @@ -213,7 +230,7 @@ internal sealed class CommandHandler : IDisposable } else { - _questController.SimulateQuest(null); + _questController.SimulateQuest(null, 0, 0); _chatGui.Print("Cleared simulated quest.", MessageTag, TagColor); } } diff --git a/Questionable/Controller/QuestController.cs b/Questionable/Controller/QuestController.cs index 594cac80a..0fbd79fe7 100644 --- a/Questionable/Controller/QuestController.cs +++ b/Questionable/Controller/QuestController.cs @@ -509,11 +509,11 @@ internal sealed class QuestController : MiniTaskController, IDi Stop(label); } - public void SimulateQuest(Quest? quest) + public void SimulateQuest(Quest? quest, byte sequence, int step) { _logger.LogInformation("SimulateQuest: {QuestId}", quest?.Id); if (quest != null) - _simulatedQuest = new QuestProgress(quest); + _simulatedQuest = new QuestProgress(quest, sequence, step); else _simulatedQuest = null; } @@ -675,16 +675,16 @@ internal sealed class QuestController : MiniTaskController, IDi public int Step { get; private set; } public StepProgress StepProgress { get; private set; } = new(DateTime.Now); - public QuestProgress(Quest quest, byte sequence = 0) + public QuestProgress(Quest quest, byte sequence = 0, int step = 0) { Quest = quest; - SetSequence(sequence); + SetSequence(sequence, step); } - public void SetSequence(byte sequence) + public void SetSequence(byte sequence, int step = 0) { Sequence = sequence; - SetStep(0); + SetStep(step); } public void SetStep(int step) diff --git a/Questionable/Windows/QuestComponents/ActiveQuestComponent.cs b/Questionable/Windows/QuestComponents/ActiveQuestComponent.cs index 59d1eaf2f..2652685f4 100644 --- a/Questionable/Windows/QuestComponents/ActiveQuestComponent.cs +++ b/Questionable/Windows/QuestComponents/ActiveQuestComponent.cs @@ -400,7 +400,7 @@ internal sealed partial class ActiveQuestComponent ImGui.SameLine(); if (ImGui.Button("Clear sim")) { - _questController.SimulateQuest(null); + _questController.SimulateQuest(null, 0, 0); _movementController.Stop(); _questController.Stop("ClearSim");