50 lines
1.4 KiB
C#
50 lines
1.4 KiB
C#
using Dalamud.Plugin.Services;
|
|
using Questionable.Model;
|
|
using Questionable.Model.Questing;
|
|
using Questionable.Windows;
|
|
|
|
namespace Questionable.Controller.DebugCommands;
|
|
|
|
internal sealed class DebugOverlayCommandHandler : IDebugCommandHandler
|
|
{
|
|
private readonly DebugOverlay _debugOverlay;
|
|
|
|
private readonly QuestRegistry _questRegistry;
|
|
|
|
private readonly IChatGui _chatGui;
|
|
|
|
public string CommandName => "do";
|
|
|
|
public DebugOverlayCommandHandler(DebugOverlay debugOverlay, QuestRegistry questRegistry, IChatGui chatGui)
|
|
{
|
|
_debugOverlay = debugOverlay;
|
|
_questRegistry = questRegistry;
|
|
_chatGui = chatGui;
|
|
}
|
|
|
|
public void Execute(string[] arguments)
|
|
{
|
|
ElementId elementId;
|
|
if (!_debugOverlay.DrawConditions())
|
|
{
|
|
_chatGui.PrintError("You don't have the debug overlay enabled.", "Questionable", 576);
|
|
}
|
|
else if (arguments.Length >= 1 && ElementId.TryFromString(arguments[0], out elementId) && elementId != null)
|
|
{
|
|
if (_questRegistry.TryGetQuest(elementId, out Quest quest))
|
|
{
|
|
_debugOverlay.HighlightedQuest = quest.Id;
|
|
_chatGui.Print($"Set highlighted quest to {elementId} ({quest.Info.Name}).", "Questionable", 576);
|
|
}
|
|
else
|
|
{
|
|
_chatGui.PrintError($"Unknown quest {elementId}.", "Questionable", 576);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
_debugOverlay.HighlightedQuest = null;
|
|
_chatGui.Print("Cleared highlighted quest.", "Questionable", 576);
|
|
}
|
|
}
|
|
}
|