diff --git a/Questionable/Functions/QuestFunctions.cs b/Questionable/Functions/QuestFunctions.cs index 0e12262e7..46f52f8fc 100644 --- a/Questionable/Functions/QuestFunctions.cs +++ b/Questionable/Functions/QuestFunctions.cs @@ -453,10 +453,26 @@ internal sealed unsafe class QuestFunctions return !HasCompletedPreviousQuests(questInfo, extraCompletedQuest) || !HasCompletedPreviousInstances(questInfo); } + public bool IsQuestLocked(LeveId leveId) + { + if (IsQuestUnobtainable(leveId)) + return true; + + // this only checks for the current class + IQuestInfo questInfo = _questData.GetQuestInfo(leveId); + if (!questInfo.ClassJobs.Contains((EClassJob)_clientState.LocalPlayer!.ClassJob.Id) || + questInfo.Level > _clientState.LocalPlayer.Level) + return true; + + return !IsQuestAccepted(leveId) && QuestManager.Instance()->NumLeveAllowances == 0; + } + public bool IsQuestUnobtainable(ElementId elementId, ElementId? extraCompletedQuest = null) { if (elementId is QuestId questId) return IsQuestUnobtainable(questId, extraCompletedQuest); + else if (elementId is LeveId leveId) + return IsQuestUnobtainable(leveId); else return false; } @@ -464,6 +480,9 @@ internal sealed unsafe class QuestFunctions public bool IsQuestUnobtainable(QuestId questId, ElementId? extraCompletedQuest = null) { var questInfo = (QuestInfo)_questData.GetQuestInfo(questId); + if (questInfo.Expansion > (EExpansionVersion)PlayerState.Instance()->MaxExpansion) + return true; + if (questInfo.QuestLocks.Count > 0) { var completedQuests = questInfo.QuestLocks.Count(x => IsQuestComplete(x) || x.Equals(extraCompletedQuest)); @@ -515,15 +534,13 @@ internal sealed unsafe class QuestFunctions return false; } - public bool IsQuestLocked(LeveId leveId) + private bool IsQuestUnobtainable(LeveId leveId) { - // this only checks for the current class IQuestInfo questInfo = _questData.GetQuestInfo(leveId); - if (!questInfo.ClassJobs.Contains((EClassJob)_clientState.LocalPlayer!.ClassJob.Id) || - questInfo.Level > _clientState.LocalPlayer.Level) + if (questInfo.Expansion > (EExpansionVersion)PlayerState.Instance()->MaxExpansion) return true; - return !IsQuestAccepted(leveId) && QuestManager.Instance()->NumLeveAllowances == 0; + return false; } private bool HasCompletedPreviousQuests(QuestInfo questInfo, ElementId? extraCompletedQuest) diff --git a/Questionable/Windows/JournalComponents/QuestJournalComponent.cs b/Questionable/Windows/JournalComponents/QuestJournalComponent.cs index 715c045fc..e1d2b6c55 100644 --- a/Questionable/Windows/JournalComponents/QuestJournalComponent.cs +++ b/Questionable/Windows/JournalComponents/QuestJournalComponent.cs @@ -224,12 +224,17 @@ internal sealed class QuestJournalComponent string len = 9999.ToString(CultureInfo.CurrentCulture); ImGui.PushFont(UiBuilder.MonoFont); - string text = - $"{count.ToString(CultureInfo.CurrentCulture).PadLeft(len.Length)} / {total.ToString(CultureInfo.CurrentCulture).PadLeft(len.Length)}"; - if (count == total) - ImGui.TextColored(ImGuiColors.ParsedGreen, text); + if (total == 0) + ImGui.TextColored(ImGuiColors.DalamudGrey, $"{"-".PadLeft(len.Length)} / {"-".PadLeft(len.Length)}"); else - ImGui.TextUnformatted(text); + { + string text = + $"{count.ToString(CultureInfo.CurrentCulture).PadLeft(len.Length)} / {total.ToString(CultureInfo.CurrentCulture).PadLeft(len.Length)}"; + if (count == total) + ImGui.TextColored(ImGuiColors.ParsedGreen, text); + else + ImGui.TextUnformatted(text); + } ImGui.PopFont(); } diff --git a/Questionable/Windows/PriorityWindow.cs b/Questionable/Windows/PriorityWindow.cs index 7c76aca32..60428f1cd 100644 --- a/Questionable/Windows/PriorityWindow.cs +++ b/Questionable/Windows/PriorityWindow.cs @@ -81,7 +81,7 @@ internal sealed class PriorityWindow : LWindow { foundQuests = _questRegistry.AllQuests .Where(x => x.Info.Name.Contains(_searchString, StringComparison.CurrentCultureIgnoreCase)) - .Where(x => x.Id is not QuestId questId || !_questFunctions.IsQuestUnobtainable(questId)); + .Where(x => !_questFunctions.IsQuestUnobtainable(x.Id)); } else {