Include quest id + add context menu for quests in journal window
This commit is contained in:
parent
6b24a08da5
commit
7705e34918
@ -12,6 +12,7 @@ using Questionable.Controller;
|
|||||||
using Questionable.Data;
|
using Questionable.Data;
|
||||||
using Questionable.Functions;
|
using Questionable.Functions;
|
||||||
using Questionable.Model;
|
using Questionable.Model;
|
||||||
|
using Questionable.Model.Questing;
|
||||||
using Questionable.Windows.QuestComponents;
|
using Questionable.Windows.QuestComponents;
|
||||||
|
|
||||||
namespace Questionable.Windows.JournalComponents;
|
namespace Questionable.Windows.JournalComponents;
|
||||||
@ -28,6 +29,7 @@ internal sealed class QuestJournalComponent
|
|||||||
private readonly UiUtils _uiUtils;
|
private readonly UiUtils _uiUtils;
|
||||||
private readonly QuestTooltipComponent _questTooltipComponent;
|
private readonly QuestTooltipComponent _questTooltipComponent;
|
||||||
private readonly IDalamudPluginInterface _pluginInterface;
|
private readonly IDalamudPluginInterface _pluginInterface;
|
||||||
|
private readonly QuestController _questController;
|
||||||
private readonly ICommandManager _commandManager;
|
private readonly ICommandManager _commandManager;
|
||||||
|
|
||||||
private List<FilteredSection> _filteredSections = [];
|
private List<FilteredSection> _filteredSections = [];
|
||||||
@ -35,7 +37,7 @@ internal sealed class QuestJournalComponent
|
|||||||
|
|
||||||
public QuestJournalComponent(JournalData journalData, QuestRegistry questRegistry, QuestFunctions questFunctions,
|
public QuestJournalComponent(JournalData journalData, QuestRegistry questRegistry, QuestFunctions questFunctions,
|
||||||
UiUtils uiUtils, QuestTooltipComponent questTooltipComponent, IDalamudPluginInterface pluginInterface,
|
UiUtils uiUtils, QuestTooltipComponent questTooltipComponent, IDalamudPluginInterface pluginInterface,
|
||||||
ICommandManager commandManager)
|
QuestController questController, ICommandManager commandManager)
|
||||||
{
|
{
|
||||||
_journalData = journalData;
|
_journalData = journalData;
|
||||||
_questRegistry = questRegistry;
|
_questRegistry = questRegistry;
|
||||||
@ -43,6 +45,7 @@ internal sealed class QuestJournalComponent
|
|||||||
_uiUtils = uiUtils;
|
_uiUtils = uiUtils;
|
||||||
_questTooltipComponent = questTooltipComponent;
|
_questTooltipComponent = questTooltipComponent;
|
||||||
_pluginInterface = pluginInterface;
|
_pluginInterface = pluginInterface;
|
||||||
|
_questController = questController;
|
||||||
_commandManager = commandManager;
|
_commandManager = commandManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,19 +174,30 @@ internal sealed class QuestJournalComponent
|
|||||||
|
|
||||||
ImGui.TableNextRow();
|
ImGui.TableNextRow();
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.TreeNodeEx(questInfo.Name,
|
ImGui.TreeNodeEx($"{questInfo.Name} ({questInfo.QuestId})",
|
||||||
ImGuiTreeNodeFlags.Leaf | ImGuiTreeNodeFlags.NoTreePushOnOpen | ImGuiTreeNodeFlags.SpanFullWidth);
|
ImGuiTreeNodeFlags.Leaf | ImGuiTreeNodeFlags.NoTreePushOnOpen | ImGuiTreeNodeFlags.SpanFullWidth);
|
||||||
|
|
||||||
|
|
||||||
if (questInfo is QuestInfo && ImGui.IsItemClicked() &&
|
|
||||||
_commandManager.Commands.TryGetValue("/questinfo", out var commandInfo))
|
|
||||||
{
|
|
||||||
_commandManager.DispatchCommand("/questinfo", questInfo.QuestId.ToString() ?? string.Empty, commandInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui.IsItemHovered())
|
if (ImGui.IsItemHovered())
|
||||||
_questTooltipComponent.Draw(questInfo);
|
_questTooltipComponent.Draw(questInfo);
|
||||||
|
|
||||||
|
if (ImGui.BeginPopupContextItem($"##QuestPopup{questInfo.QuestId}", ImGuiPopupFlags.MouseButtonRight))
|
||||||
|
{
|
||||||
|
if (ImGui.MenuItem("Start as next quest", _questFunctions.IsReadyToAcceptQuest(questInfo.QuestId)))
|
||||||
|
{
|
||||||
|
_questController.SetNextQuest(quest);
|
||||||
|
_questController.Start("SeasonalEventSelection");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool openInQuestMap = _commandManager.Commands.TryGetValue("/questinfo", out var commandInfo);
|
||||||
|
if (ImGui.MenuItem("View in Quest Map", questInfo.QuestId is QuestId && openInQuestMap))
|
||||||
|
{
|
||||||
|
_commandManager.DispatchCommand("/questinfo", questInfo.QuestId.ToString() ?? string.Empty, commandInfo!);
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.EndPopup();
|
||||||
|
}
|
||||||
|
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
float spacing;
|
float spacing;
|
||||||
// ReSharper disable once UnusedVariable
|
// ReSharper disable once UnusedVariable
|
||||||
|
Loading…
Reference in New Issue
Block a user