using System.Linq;
+using Dalamud.Bindings.ImGui;
using Dalamud.Interface;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Utility.Raii;
foreach (var instanceId in RequiredPrimalInstances)
{
(Vector4 color, FontAwesomeIcon icon) = UiUtils.GetInstanceStyle(instanceId);
- _uiUtils.ChecklistItem(_territoryData.GetInstanceName(instanceId) ?? "?", color, icon);
+ _uiUtils.ChecklistItem(_territoryData.GetInstanceName(instanceId) ?? "?", color, icon, ImGui.GetStyle().FramePadding.X);
}
}
foreach (var questId in QuestData.CrystalTowerQuests)
{
(Vector4 color, FontAwesomeIcon icon, _) = _uiUtils.GetQuestStyle(questId);
- _uiUtils.ChecklistItem(_questData.GetQuestInfo(questId).Name, color, icon);
+ _uiUtils.ChecklistItem(_questData.GetQuestInfo(questId).Name, color, icon, ImGui.GetStyle().FramePadding.X);
}
}
}
private void DrawQuestButtons(QuestController.QuestProgress currentQuest, QuestStep? currentStep,
QuestProgressInfo? questProgressInfo, bool isMinimized)
{
- ImGui.BeginDisabled(_questController.IsRunning);
- if (ImGuiComponents.IconButton(FontAwesomeIcon.Play))
+ using (ImRaii.Disabled(_questController.IsRunning))
{
- // if we haven't accepted this quest, mark it as next quest so that we can optionally use aetherytes to travel
- if (questProgressInfo == null)
- _questController.SetNextQuest(currentQuest.Quest);
-
- _questController.Start("UI start");
- }
+ if (ImGuiComponents.IconButton(FontAwesomeIcon.Play))
+ {
+ // if we haven't accepted this quest, mark it as next quest so that we can optionally use aetherytes to travel
+ if (questProgressInfo == null)
+ _questController.SetNextQuest(currentQuest.Quest);
- if (!isMinimized)
- {
- ImGui.SameLine();
+ _questController.Start("UI start");
+ }
- if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.StepForward, "Step"))
+ if (!isMinimized)
{
- _questController.StartSingleStep("UI step");
+ ImGui.SameLine();
+
+ if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.StepForward, "Step"))
+ {
+ _questController.StartSingleStep("UI step");
+ }
}
}
- ImGui.EndDisabled();
ImGui.SameLine();
if (ImGuiComponents.IconButton(FontAwesomeIcon.Stop))
&& currentStep.InteractionType == EInteractionType.Instruction
&& _questController.HasCurrentTaskMatching<WaitAtEnd.WaitNextStepOrSequence>(out _);
- ImGui.BeginDisabled(lastStep);
- if (colored)
- ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.ParsedGreen);
- if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.ArrowCircleRight, "Skip"))
+ using (ImRaii.Disabled(lastStep))
{
- _movementController.Stop();
- _questController.Skip(currentQuest.Quest.Id, currentQuest.Sequence);
- }
-
- if (colored)
- ImGui.PopStyleColor();
- ImGui.EndDisabled();
+ using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.ParsedGreen, colored))
+ {
+ if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.ArrowCircleRight, "Skip"))
+ {
+ _movementController.Stop();
+ _questController.Skip(currentQuest.Quest.Id, currentQuest.Sequence);
+ }
- ImGui.SameLine();
- if (ImGuiComponents.IconButton(FontAwesomeIcon.SortAmountDown))
- _priorityWindow.ToggleOrUncollapse();
+ if (ImGui.IsItemHovered())
+ ImGui.SetTooltip("Skip the current step of the quest path.");
+ }
+ }
if (_commandManager.Commands.ContainsKey("/questinfo"))
{
ImGui.SameLine();
if (ImGuiComponents.IconButton(FontAwesomeIcon.Atlas))
_commandManager.ProcessCommand($"/questinfo {currentQuest.Quest.Id}");
+
+ if (ImGui.IsItemHovered())
+ ImGui.SetTooltip($"Show information about '{currentQuest.Quest.Info.Name}' in Quest Map plugin.");
}
}
}
using Dalamud.Interface;
using Dalamud.Interface.Components;
using Dalamud.Interface.Utility.Raii;
-using Dalamud.Plugin;
using Humanizer;
using Humanizer.Localisation;
using Questionable.Controller;
private readonly QuestController _questController;
private readonly QuestTooltipComponent _questTooltipComponent;
private readonly Configuration _configuration;
- private readonly IDalamudPluginInterface _pluginInterface;
- public EventInfoComponent(QuestData questData, QuestRegistry questRegistry, QuestFunctions questFunctions,
- UiUtils uiUtils, QuestController questController, QuestTooltipComponent questTooltipComponent,
- Configuration configuration, IDalamudPluginInterface pluginInterface)
+ public EventInfoComponent(QuestData questData,
+ QuestRegistry questRegistry,
+ QuestFunctions questFunctions,
+ UiUtils uiUtils,
+ QuestController questController,
+ QuestTooltipComponent questTooltipComponent,
+ Configuration configuration)
{
_questData = questData;
_questRegistry = questRegistry;
_questController = questController;
_questTooltipComponent = questTooltipComponent;
_configuration = configuration;
- _pluginInterface = pluginInterface;
}
[SuppressMessage("ReSharper", "UnusedMember.Local")]
else
ImGui.Text(eventQuest.Name);
- float width;
- using (var _ = _pluginInterface.UiBuilder.IconFontHandle.Push())
- width = ImGui.CalcTextSize(FontAwesomeIcon.Play.ToIconString()).X + ImGui.GetStyle().FramePadding.X;
-
- using (var _ = _pluginInterface.UiBuilder.IconFontFixedWidthHandle.Push())
- width -= ImGui.CalcTextSize(FontAwesomeIcon.Check.ToIconString()).X;
-
List<ElementId> startableQuests = eventQuest.QuestIds.Where(x =>
_questRegistry.IsKnownQuest(x) &&
_questFunctions.IsReadyToAcceptQuest(x) &&
x != _questController.StartedQuest?.Quest.Id &&
x != _questController.NextQuest?.Quest.Id)
.ToList();
- if (startableQuests.Count == 0)
- width = 0;
-
foreach (var questId in eventQuest.QuestIds)
{
if (_questFunctions.IsQuestComplete(questId))
}
else
{
- if (width > 0)
- ImGui.SetCursorPosX(ImGui.GetCursorPosX() + width);
+ ImGui.SetCursorPosX(ImGui.GetCursorPosX());
var style = _uiUtils.GetQuestStyle(questId);
if (_uiUtils.ChecklistItem(questName, style.Color, style.Icon, ImGui.GetStyle().FramePadding.X))
private readonly QuestRegistry _questRegistry;
private readonly QuestValidationWindow _questValidationWindow;
private readonly JournalProgressWindow _journalProgressWindow;
+ private readonly PriorityWindow _priorityWindow;
private readonly ICommandManager _commandManager;
private readonly IDalamudPluginInterface _pluginInterface;
QuestRegistry questRegistry,
QuestValidationWindow questValidationWindow,
JournalProgressWindow journalProgressWindow,
+ PriorityWindow priorityWindow,
ICommandManager commandManager,
IDalamudPluginInterface pluginInterface)
{
_questRegistry = questRegistry;
_questValidationWindow = questValidationWindow;
_journalProgressWindow = journalProgressWindow;
+ _priorityWindow = priorityWindow;
_commandManager = commandManager;
_pluginInterface = pluginInterface;
}
public void Draw()
{
- if (_commandManager.Commands.ContainsKey("/vnav"))
+ DrawQuestPriorityButton();
+ ImGui.SameLine();
+ DrawRebuildNavmeshButton();
+
+ DrawReloadDataButton();
+ ImGui.SameLine();
+ DrawJournalProgressButton();
+
+ if (_questRegistry.ValidationIssueCount > 0)
{
- using (var unused = ImRaii.Disabled(!ImGui.IsKeyDown(ImGuiKey.ModCtrl)))
- {
- if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.GlobeEurope, "Rebuild Navmesh"))
- _commandManager.ProcessCommand("/vnav rebuild");
- }
+ ImGui.SameLine();
+ DrawValidationIssuesButton();
+ }
+ }
+
+ private void DrawQuestPriorityButton()
+ {
+ if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Exclamation, "Priority Quests"))
+ _priorityWindow.ToggleOrUncollapse();
+
+ if (ImGui.IsItemHovered())
+ ImGui.SetTooltip("Configure priority quests which will be done as soon as possible.");
+ }
+
+ private void DrawRebuildNavmeshButton()
+ {
+ bool isNavmeshAvailable = _commandManager.Commands.ContainsKey("/vnav");
+ using (ImRaii.Disabled(!isNavmeshAvailable || !ImGui.IsKeyDown(ImGuiKey.ModCtrl)))
+ {
+ if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.GlobeEurope, "Rebuild Navmesh"))
+ _commandManager.ProcessCommand("/vnav rebuild");
+ }
- if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
+ if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
+ {
+ if (!isNavmeshAvailable)
+ ImGui.SetTooltip("vnavmesh is not available.\nPlease install it first.");
+ else
ImGui.SetTooltip("Hold CTRL to enable this button.\nRebuilding the navmesh will take some time.");
}
+ }
+ private void DrawReloadDataButton()
+ {
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.RedoAlt, "Reload Data"))
Reload?.Invoke(this, EventArgs.Empty);
+ }
- ImGui.SameLine();
+ private void DrawJournalProgressButton()
+ {
if (ImGuiComponents.IconButton(FontAwesomeIcon.BookBookmark))
_journalProgressWindow.IsOpenAndUncollapsed = true;
+
if (ImGui.IsItemHovered())
ImGui.SetTooltip("Journal Progress");
-
-
- if (_questRegistry.ValidationIssueCount > 0)
- {
- ImGui.SameLine();
- if (DrawValidationIssuesButton())
- _questValidationWindow.IsOpenAndUncollapsed = true;
- }
}
- private bool DrawValidationIssuesButton()
+ private void DrawValidationIssuesButton()
{
int errorCount = _questRegistry.ValidationErrorCount;
int infoCount = _questRegistry.ValidationIssueCount - _questRegistry.ValidationErrorCount;
if (errorCount == 0 && infoCount == 0)
- return false;
+ return;
int partsToRender = errorCount == 0 || infoCount == 0 ? 1 : 2;
using var id = ImRaii.PushId("validationissues");
dl.AddText(position, ImGui.GetColorU32(ImGuiCol.Text), text2);
}
- return button;
+ if (button)
+ _questValidationWindow.IsOpenAndUncollapsed = true;
}
}
public bool ChecklistItem(string text, Vector4 color, FontAwesomeIcon icon, float extraPadding = 0)
{
+ if (extraPadding > 0)
+ ImGui.SetCursorPosX(ImGui.GetCursorPosX() + extraPadding);
+
using (_pluginInterface.UiBuilder.IconFontFixedWidthHandle.Push())
- {
ImGui.TextColored(color, icon.ToIconString());
- }
bool hover = ImGui.IsItemHovered();