1
0
forked from liza/Questionable

Add extra sequence + step arguments to /qst sim

This commit is contained in:
Liza 2024-11-11 22:21:19 +01:00
parent 63bf674e4f
commit ea42b5b8df
Signed by: liza
GPG Key ID: 7199F8D727D55F67
3 changed files with 26 additions and 9 deletions

View File

@ -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);
}
}

View File

@ -509,11 +509,11 @@ internal sealed class QuestController : MiniTaskController<QuestController>, 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<QuestController>, 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)

View File

@ -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");