Add command to show single quest
parent
5511e36921
commit
8f7b0a6ffd
|
@ -8,17 +8,28 @@ namespace QuestMap {
|
|||
internal Commands(Plugin plugin) {
|
||||
this.Plugin = plugin;
|
||||
|
||||
this.Plugin.CommandManager.AddHandler("/quests", new CommandInfo(this.OnCommand) {
|
||||
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 OnCommand(string command, string args) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace QuestMap {
|
|||
private Node? Centre { get; set; }
|
||||
private ChannelReader<GraphInfo> GraphChannel { get; }
|
||||
private CancellationTokenSource? CancellationTokenSource { get; set; }
|
||||
private HashSet<uint> InfoWindows { get; } = [];
|
||||
public HashSet<uint> InfoWindows { get; } = [];
|
||||
private List<(Quest, bool, string)> FilteredQuests { get; } = [];
|
||||
|
||||
internal bool Show;
|
||||
|
@ -364,7 +364,9 @@ namespace QuestMap {
|
|||
|
||||
foreach (var id in this.InfoWindows) {
|
||||
var quest = this.Plugin.DataManager.GetExcelSheet<Quest>()!.GetRow(id);
|
||||
if (quest == null) {
|
||||
if (quest == null)
|
||||
{
|
||||
remove = id;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -381,7 +383,7 @@ namespace QuestMap {
|
|||
/// <returns>true if closing</returns>
|
||||
private bool DrawInfoWindow(Quest quest) {
|
||||
var open = true;
|
||||
if (!ImGui.Begin($"{this.Convert(quest.Name)}##{quest.RowId}", ref open, ImGuiWindowFlags.AlwaysAutoResize)) {
|
||||
if (!ImGui.Begin($"{this.Convert(quest.Name)} [{quest.Id}]##{quest.RowId}", ref open, ImGuiWindowFlags.AlwaysAutoResize)) {
|
||||
ImGui.End();
|
||||
return !open;
|
||||
}
|
||||
|
@ -660,6 +662,7 @@ namespace QuestMap {
|
|||
if (Util.IconButton(FontAwesomeIcon.ProjectDiagram)) {
|
||||
this.Quest = quest;
|
||||
this._relayout = true;
|
||||
this.Plugin.Ui.Show = true;
|
||||
}
|
||||
|
||||
Util.Tooltip("Show quest graph");
|
||||
|
|
Loading…
Reference in New Issue