using System; using Dalamud.Game.Command; namespace QuestMap { internal class Commands : IDisposable { private Plugin Plugin { get; } internal Commands(Plugin plugin) { this.Plugin = plugin; this.Plugin.CommandManager.AddHandler("/quests", new CommandInfo(this.OnShowQuestMap) { HelpMessage = "Show Quest Map", }); this.Plugin.CommandManager.AddHandler("/questinfo", new CommandInfo(this.OnShowQuestInfo) { HelpMessage = "Show Quest Details", }); } public void Dispose() { this.Plugin.CommandManager.RemoveHandler("/quests"); } private void OnShowQuestMap(string command, string args) { this.Plugin.Ui.Show ^= true; } private void OnShowQuestInfo(string command, string args) { if (!string.IsNullOrEmpty(args) && uint.TryParse(args, out uint questId)) { if (questId < 0x10000) questId += 0x10000; this.Plugin.Ui.InfoWindows.Add(questId); } } } }