using Lumina.Excel.Sheets; namespace HellionChat; // Ported 1:1 from v1.5.6 ChatLogWindow.SetUpAllCommands. Provides a fast // lookup from slash-command string to the game's TextCommand row so the // InputBar callback can feed descriptions to CommandHelpWindow without // hitting the sheet on every keystroke. internal static class AllCommands { private static readonly Dictionary Commands = BuildCommands(); private static Dictionary BuildCommands() { var dict = new Dictionary(StringComparer.Ordinal); foreach (var command in Sheets.TextCommandSheet) { if (!command.Command.IsEmpty) dict.TryAdd(command.Command.ToString(), command); if (!command.ShortCommand.IsEmpty) dict.TryAdd(command.ShortCommand.ToString(), command); if (!command.Alias.IsEmpty) dict.TryAdd(command.Alias.ToString(), command); if (!command.ShortAlias.IsEmpty) dict.TryAdd(command.ShortAlias.ToString(), command); } return dict; } public static bool TryGetValue(string command, out TextCommand textCommand) => Commands.TryGetValue(command, out textCommand); }