master #2

Merged
cacahuetes merged 79 commits from liza/Questionable:master into master 2024-08-25 10:51:08 +00:00
Showing only changes of commit 7705e34918 - Show all commits

View File

@ -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