48 lines
1.3 KiB
C#
48 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Dalamud.Plugin.Services;
|
|
using Questionable.Functions;
|
|
|
|
namespace Questionable.Controller.DebugCommands;
|
|
|
|
internal sealed class UnlockLinksCommandHandler : IDebugCommandHandler
|
|
{
|
|
private readonly GameFunctions _gameFunctions;
|
|
|
|
private readonly IChatGui _chatGui;
|
|
|
|
private IReadOnlyList<uint> _previouslyUnlockedUnlockLinks = Array.Empty<uint>();
|
|
|
|
public string CommandName => "unlock-links";
|
|
|
|
public UnlockLinksCommandHandler(GameFunctions gameFunctions, IChatGui chatGui)
|
|
{
|
|
_gameFunctions = gameFunctions;
|
|
_chatGui = chatGui;
|
|
}
|
|
|
|
public void Execute(string[] arguments)
|
|
{
|
|
IReadOnlyList<uint> unlockLinks = _gameFunctions.GetUnlockLinks();
|
|
if (unlockLinks.Count >= 0)
|
|
{
|
|
_chatGui.Print($"Saved {unlockLinks.Count} unlock links to log.", "Questionable", 576);
|
|
List<uint> list = unlockLinks.Except(_previouslyUnlockedUnlockLinks).ToList();
|
|
if (_previouslyUnlockedUnlockLinks.Count > 0 && list.Count > 0)
|
|
{
|
|
_chatGui.Print("New unlock links: " + string.Join(", ", list), "Questionable", 576);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
_chatGui.PrintError("Could not query unlock links.", "Questionable", 576);
|
|
}
|
|
_previouslyUnlockedUnlockLinks = unlockLinks;
|
|
}
|
|
|
|
public void Reset()
|
|
{
|
|
_previouslyUnlockedUnlockLinks = Array.Empty<uint>();
|
|
}
|
|
}
|