From ea42b5b8dffae26fc7d2aea30b2ecd5738c891d5 Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Mon, 11 Nov 2024 22:21:19 +0100 Subject: [PATCH] Add extra sequence + step arguments to /qst sim --- Questionable/Controller/CommandHandler.cs | 21 +++++++++++++++++-- Questionable/Controller/QuestController.cs | 12 +++++------ .../QuestComponents/ActiveQuestComponent.cs | 2 +- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/Questionable/Controller/CommandHandler.cs b/Questionable/Controller/CommandHandler.cs index 0bb87429..42759d99 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 594cac80..0fbd79fe 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 59d1eaf2..2652685f 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");