53 lines
1.5 KiB
C#
53 lines
1.5 KiB
C#
using Dalamud.Plugin.Services;
|
|
using Questionable.Functions;
|
|
using Questionable.Model;
|
|
using Questionable.Model.Questing;
|
|
|
|
namespace Questionable.Controller.DebugCommands;
|
|
|
|
internal sealed class NextQuestCommandHandler : IDebugCommandHandler
|
|
{
|
|
private readonly QuestController _questController;
|
|
|
|
private readonly QuestRegistry _questRegistry;
|
|
|
|
private readonly QuestFunctions _questFunctions;
|
|
|
|
private readonly IChatGui _chatGui;
|
|
|
|
public string CommandName => "next";
|
|
|
|
public NextQuestCommandHandler(QuestController questController, QuestRegistry questRegistry, QuestFunctions questFunctions, IChatGui chatGui)
|
|
{
|
|
_questController = questController;
|
|
_questRegistry = questRegistry;
|
|
_questFunctions = questFunctions;
|
|
_chatGui = chatGui;
|
|
}
|
|
|
|
public void Execute(string[] arguments)
|
|
{
|
|
if (arguments.Length >= 1 && ElementId.TryFromString(arguments[0], out ElementId elementId) && elementId != null)
|
|
{
|
|
Quest quest;
|
|
if (_questFunctions.IsQuestLocked(elementId))
|
|
{
|
|
_chatGui.PrintError($"Quest {elementId} is locked.", "Questionable", 576);
|
|
}
|
|
else if (_questRegistry.TryGetQuest(elementId, out quest))
|
|
{
|
|
_questController.SetNextQuest(quest);
|
|
_chatGui.Print($"Set next quest to {elementId} ({quest.Info.Name}).", "Questionable", 576);
|
|
}
|
|
else
|
|
{
|
|
_chatGui.PrintError($"Unknown quest {elementId}.", "Questionable", 576);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
_questController.SetNextQuest(null);
|
|
_chatGui.Print("Cleared next quest.", "Questionable", 576);
|
|
}
|
|
}
|
|
}
|