qstbak/Questionable/Questionable.Controller.DebugCommands/TaxiCommandHandler.cs
2025-11-30 10:36:46 +10:00

66 lines
1.6 KiB
C#

using System.Collections.Generic;
using Dalamud.Plugin.Services;
using FFXIVClientStructs.FFXIV.Client.Game.UI;
using Lumina.Excel;
using Lumina.Excel.Sheets;
namespace Questionable.Controller.DebugCommands;
internal sealed class TaxiCommandHandler : IDebugCommandHandler
{
private readonly IDataManager _dataManager;
private readonly IClientState _clientState;
private readonly IChatGui _chatGui;
public string CommandName => "taxi";
public TaxiCommandHandler(IDataManager dataManager, IClientState clientState, IChatGui chatGui)
{
_dataManager = dataManager;
_clientState = clientState;
_chatGui = chatGui;
}
public unsafe void Execute(string[] arguments)
{
List<string> list = new List<string>();
ExcelSheet<ChocoboTaxiStand> excelSheet = _dataManager.GetExcelSheet<ChocoboTaxiStand>();
UIState* ptr = UIState.Instance();
if (ptr == null)
{
_chatGui.PrintError("UIState is null", "Questionable", 576);
return;
}
for (int i = 0; i < 192; i++)
{
uint num = (uint)(i + 1179648);
try
{
if (excelSheet.HasRow(num) && ptr->IsChocoboTaxiStandUnlocked(num))
{
string value = excelSheet.GetRow(num).PlaceName.ToString();
if (string.IsNullOrEmpty(value))
{
value = "Unknown";
}
list.Add($"{value} (ID: {i}, Row: 0x{num:X})");
}
}
catch
{
}
}
_chatGui.Print($"Unlocked taxi stands ({list.Count}):", "Questionable", 576);
if (list.Count == 0)
{
_chatGui.Print(" (No unlocked taxi stands found)", "Questionable", 576);
return;
}
foreach (string item in list)
{
_chatGui.Print(" - " + item, "Questionable", 576);
}
}
}