Add /qst reload

This commit is contained in:
Liza 2024-07-22 10:09:23 +02:00
parent 39f698242d
commit 325b529337
Signed by: liza
GPG Key ID: 7199F8D727D55F67
3 changed files with 43 additions and 12 deletions

View File

@ -5,6 +5,7 @@ using Dalamud.Game.Command;
using Dalamud.Plugin.Services;
using Questionable.Model;
using Questionable.Windows;
using Questionable.Windows.QuestComponents;
namespace Questionable.Controller;
@ -14,6 +15,7 @@ internal sealed class CommandHandler : IDisposable
private readonly IChatGui _chatGui;
private readonly QuestController _questController;
private readonly MovementController _movementController;
private readonly QuickAccessButtonsComponent _quickAccessButtonsComponent;
private readonly QuestRegistry _questRegistry;
private readonly ConfigWindow _configWindow;
private readonly DebugOverlay _debugOverlay;
@ -22,15 +24,25 @@ internal sealed class CommandHandler : IDisposable
private readonly ITargetManager _targetManager;
private readonly GameFunctions _gameFunctions;
public CommandHandler(ICommandManager commandManager, IChatGui chatGui, QuestController questController,
MovementController movementController, QuestRegistry questRegistry,
ConfigWindow configWindow, DebugOverlay debugOverlay, QuestWindow questWindow,
QuestSelectionWindow questSelectionWindow, ITargetManager targetManager, GameFunctions gameFunctions)
public CommandHandler(
ICommandManager commandManager,
IChatGui chatGui,
QuestController questController,
MovementController movementController,
QuickAccessButtonsComponent quickAccessButtonsComponent,
QuestRegistry questRegistry,
ConfigWindow configWindow,
DebugOverlay debugOverlay,
QuestWindow questWindow,
QuestSelectionWindow questSelectionWindow,
ITargetManager targetManager,
GameFunctions gameFunctions)
{
_commandManager = commandManager;
_chatGui = chatGui;
_questController = questController;
_movementController = movementController;
_quickAccessButtonsComponent = quickAccessButtonsComponent;
_questRegistry = questRegistry;
_configWindow = configWindow;
_debugOverlay = debugOverlay;
@ -41,7 +53,14 @@ internal sealed class CommandHandler : IDisposable
_commandManager.AddHandler("/qst", new CommandInfo(ProcessCommand)
{
HelpMessage = "Opens the Questing window"
HelpMessage = string.Join($"{Environment.NewLine}\t",
"Opens the Questing window",
"/qst config - opens the configuration window",
"/qst start - starts doing quests",
"/qst stop - stops doing quests",
"/qst reload - reload all quest data",
"/qst which - shows all quests starting with your selected target",
"/qst zone - shows all quests starting in the current zone (only includes quests with a known quest path, and currently visible unaccepted quests)")
});
}
@ -56,6 +75,7 @@ internal sealed class CommandHandler : IDisposable
break;
case "start":
_questWindow.IsOpen = true;
_questController.ExecuteNextStep(true);
break;
@ -64,6 +84,10 @@ internal sealed class CommandHandler : IDisposable
_questController.Stop("Stop command");
break;
case "reload":
_quickAccessButtonsComponent.Reload();
break;
case "do":
ConfigureDebugOverlay(parts.Skip(1).ToArray());
break;
@ -85,9 +109,13 @@ internal sealed class CommandHandler : IDisposable
_questSelectionWindow.OpenForCurrentZone();
break;
default:
case "":
_questWindow.Toggle();
break;
default:
_chatGui.PrintError($"Unknown subcommand {parts[0]}", "Questionable");
break;
}
}

View File

@ -321,7 +321,7 @@ internal sealed class QuestController
private void ClearTasksInternal()
{
_logger.LogDebug("Clearing task (internally)");
//_logger.LogDebug("Clearing task (internally)");
_currentTask = null;
if (_taskQueue.Count > 0)

View File

@ -73,11 +73,7 @@ internal sealed class QuickAccessButtonsComponent
ImGui.EndDisabled();
if (ImGui.Button("Reload Data"))
{
_questController.Reload();
_framework.RunOnTick(() => _gameUiController.HandleCurrentDialogueChoices(),
TimeSpan.FromMilliseconds(200));
}
Reload();
if (_questRegistry.ValidationIssueCount > 0)
{
@ -87,6 +83,13 @@ internal sealed class QuickAccessButtonsComponent
}
}
public void Reload()
{
_questController.Reload();
_framework.RunOnTick(() => _gameUiController.HandleCurrentDialogueChoices(),
TimeSpan.FromMilliseconds(200));
}
private bool DrawValidationIssuesButton()
{
int errorCount = _questRegistry.ValidationErrorCount;