diff --git a/Questionable/GameFunctions.cs b/Questionable/GameFunctions.cs index ff74a708..a95f15ab 100644 --- a/Questionable/GameFunctions.cs +++ b/Questionable/GameFunctions.cs @@ -291,6 +291,9 @@ internal sealed unsafe class GameFunctions return true; } + if (questInfo.GrandCompany != GrandCompany.None && questInfo.GrandCompany != GetGrandCompany()) + return true; + return !HasCompletedPreviousQuests(questInfo, extraCompletedQuest) || !HasCompletedPreviousInstances(questInfo); } @@ -728,4 +731,9 @@ internal sealed unsafe class GameFunctions LAddon.IsAddonReady(fade) && fade->IsVisible; } + + public GrandCompany GetGrandCompany() + { + return (GrandCompany)PlayerState.Instance()->GrandCompany; + } } diff --git a/Questionable/Model/QuestInfo.cs b/Questionable/Model/QuestInfo.cs index d0d1913b..db4ded12 100644 --- a/Questionable/Model/QuestInfo.cs +++ b/Questionable/Model/QuestInfo.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using Dalamud.Game.Text; +using FFXIVClientStructs.FFXIV.Client.UI.Agent; using JetBrains.Annotations; using ExcelQuest = Lumina.Excel.GeneratedSheets.Quest; @@ -25,6 +26,7 @@ internal sealed class QuestInfo CompletesInstantly = quest.ToDoCompleteSeq[0] == 0; PreviousInstanceContent = quest.InstanceContent.Select(x => (ushort)x.Row).Where(x => x != 0).ToList(); PreviousInstanceContentJoin = (QuestJoin)quest.InstanceContentJoin; + GrandCompany = (GrandCompany)quest.GrandCompany.Row; } @@ -35,12 +37,13 @@ internal sealed class QuestInfo public bool IsRepeatable { get; } public ImmutableList PreviousQuests { get; } public QuestJoin PreviousQuestJoin { get; } - public ImmutableList QuestLocks { get; set; } - public QuestJoin QuestLockJoin { get; set; } - public List PreviousInstanceContent { get; set; } - public QuestJoin PreviousInstanceContentJoin { get; set; } + public ImmutableList QuestLocks { get; } + public QuestJoin QuestLockJoin { get; } + public List PreviousInstanceContent { get; } + public QuestJoin PreviousInstanceContentJoin { get; } public bool IsMainScenarioQuest { get; } - public bool CompletesInstantly { get; set; } + public bool CompletesInstantly { get; } + public GrandCompany GrandCompany { get; } public string SimplifiedName => Name .TrimStart(SeIconChar.QuestSync.ToIconChar(), SeIconChar.QuestRepeatable.ToIconChar(), ' '); diff --git a/Questionable/Windows/QuestComponents/ActiveQuestComponent.cs b/Questionable/Windows/QuestComponents/ActiveQuestComponent.cs index c18c7d72..7821bbc1 100644 --- a/Questionable/Windows/QuestComponents/ActiveQuestComponent.cs +++ b/Questionable/Windows/QuestComponents/ActiveQuestComponent.cs @@ -116,7 +116,9 @@ internal sealed class ActiveQuestComponent if (_configuration.Advanced.AdditionalStatusInformation && _questController.IsInterruptible()) { ImGui.SameLine(); - ImGui.TextColored(ImGuiColors.DalamudYellow, "Interruptible"); + ImGui.PushFont(UiBuilder.IconFont); + ImGui.TextColored(ImGuiColors.DalamudYellow, FontAwesomeIcon.CodeBranch.ToIconString()); + ImGui.PopFont(); } } diff --git a/Questionable/Windows/QuestSelectionWindow.cs b/Questionable/Windows/QuestSelectionWindow.cs index 1594c497..7594fc4a 100644 --- a/Questionable/Windows/QuestSelectionWindow.cs +++ b/Questionable/Windows/QuestSelectionWindow.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Numerics; @@ -11,6 +12,7 @@ using Dalamud.Plugin; using Dalamud.Plugin.Services; using FFXIVClientStructs.FFXIV.Client.Game.UI; using FFXIVClientStructs.FFXIV.Client.UI; +using FFXIVClientStructs.FFXIV.Client.UI.Agent; using ImGuiNET; using LLib.GameUI; using LLib.ImGui; @@ -187,10 +189,7 @@ internal sealed class QuestSelectionWindow : LWindow } if (quest.PreviousQuests.Count > 0) - { - ImGui.Separator(); DrawQuestUnlocks(quest, 0); - } } } } @@ -266,6 +265,9 @@ internal sealed class QuestSelectionWindow : LWindow if (quest.PreviousQuests.Count > 0) { + if (counter == 0) + ImGui.Separator(); + if (quest.PreviousQuests.Count > 1) { if (quest.PreviousQuestJoin == QuestInfo.QuestJoin.All) @@ -278,17 +280,10 @@ internal sealed class QuestSelectionWindow : LWindow { var qInfo = _questData.GetQuestInfo(q); var (iconColor, icon, _) = _uiUtils.GetQuestStyle(q); - // ReSharper disable once UnusedVariable - using (var font = _pluginInterface.UiBuilder.IconFontFixedWidthHandle.Push()) - { - if (_questRegistry.IsKnownQuest(qInfo.QuestId)) - ImGui.TextColored(iconColor, icon.ToIconString()); - else - ImGui.TextColored(ImGuiColors.DalamudGrey, icon.ToIconString()); - } + if (!_questRegistry.IsKnownQuest(qInfo.QuestId)) + iconColor = ImGuiColors.DalamudGrey; - ImGui.SameLine(); - ImGui.TextUnformatted(FormatQuestUnlockName(qInfo)); + _uiUtils.ChecklistItem(FormatQuestUnlockName(qInfo), iconColor, icon); DrawQuestUnlocks(qInfo, counter + 1); } @@ -296,12 +291,13 @@ internal sealed class QuestSelectionWindow : LWindow if (counter == 0 && quest.QuestLocks.Count > 0) { + ImGui.Separator(); if (quest.QuestLocks.Count > 1) { if (quest.QuestLockJoin == QuestInfo.QuestJoin.All) - ImGui.Text("Blocked if all completed:"); + ImGui.Text("Blocked by (if all completed):"); else if (quest.QuestLockJoin == QuestInfo.QuestJoin.AtLeastOne) - ImGui.Text("Blocked if at least completed:"); + ImGui.Text("Blocked by (if at least completed):"); } else ImGui.Text("Blocked by (if completed):"); @@ -310,22 +306,16 @@ internal sealed class QuestSelectionWindow : LWindow { var qInfo = _questData.GetQuestInfo(q); var (iconColor, icon, _) = _uiUtils.GetQuestStyle(q); - // ReSharper disable once UnusedVariable - using (var font = _pluginInterface.UiBuilder.IconFontFixedWidthHandle.Push()) - { - if (_questRegistry.IsKnownQuest(qInfo.QuestId)) - ImGui.TextColored(iconColor, icon.ToIconString()); - else - ImGui.TextColored(ImGuiColors.DalamudGrey, icon.ToIconString()); - } + if (!_questRegistry.IsKnownQuest(qInfo.QuestId)) + iconColor = ImGuiColors.DalamudGrey; - ImGui.SameLine(); - ImGui.TextUnformatted(FormatQuestUnlockName(qInfo)); + _uiUtils.ChecklistItem(FormatQuestUnlockName(qInfo), iconColor, icon); } } if (counter == 0 && quest.PreviousInstanceContent.Count > 0) { + ImGui.Separator(); if (quest.PreviousInstanceContent.Count > 1) { if (quest.PreviousQuestJoin == QuestInfo.QuestJoin.All) @@ -340,18 +330,25 @@ internal sealed class QuestSelectionWindow : LWindow { string instanceName = _territoryData.GetInstanceName(instanceId) ?? "?"; var (iconColor, icon) = UiUtils.GetInstanceStyle(instanceId); - - // ReSharper disable once UnusedVariable - using (var font = _pluginInterface.UiBuilder.IconFontFixedWidthHandle.Push()) - { - ImGui.TextColored(iconColor, icon.ToIconString()); - } - - ImGui.SameLine(); - ImGui.TextUnformatted(instanceName); + _uiUtils.ChecklistItem(instanceName, iconColor, icon); } } + if (counter == 0 && quest.GrandCompany != GrandCompany.None) + { + ImGui.Separator(); + string gcName = quest.GrandCompany switch + { + GrandCompany.Maelstrom => "Maelstrom", + GrandCompany.TwinAdder => "Twin Adder", + GrandCompany.ImmortalFlames => "Immortal Flames", + _ => "None", + }; + + GrandCompany currentGrandCompany = _gameFunctions.GetGrandCompany(); + _uiUtils.ChecklistItem($"Grand Company: {gcName}", quest.GrandCompany == currentGrandCompany); + } + if (counter > 0) ImGui.Unindent(); }