1
0
Fork 0
annas-questmap/QuestMap/Commands.cs

36 lines
1.1 KiB
C#
Raw Permalink Normal View History

2021-07-21 06:11:01 +00:00
using System;
using Dalamud.Game.Command;
namespace QuestMap {
internal class Commands : IDisposable {
private Plugin Plugin { get; }
internal Commands(Plugin plugin) {
this.Plugin = plugin;
2024-07-16 17:14:36 +00:00
this.Plugin.CommandManager.AddHandler("/quests", new CommandInfo(this.OnShowQuestMap) {
2021-07-21 06:11:01 +00:00
HelpMessage = "Show Quest Map",
});
2024-07-16 17:14:36 +00:00
this.Plugin.CommandManager.AddHandler("/questinfo", new CommandInfo(this.OnShowQuestInfo) {
HelpMessage = "Show Quest Details",
});
2021-07-21 06:11:01 +00:00
}
public void Dispose() {
2021-08-23 17:20:39 +00:00
this.Plugin.CommandManager.RemoveHandler("/quests");
2021-07-21 06:11:01 +00:00
}
2024-07-16 17:14:36 +00:00
private void OnShowQuestMap(string command, string args) {
2021-07-21 06:11:01 +00:00
this.Plugin.Ui.Show ^= true;
}
2024-07-16 17:14:36 +00:00
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);
}
}
2021-07-21 06:11:01 +00:00
}
}