forked from liza/Questionable
master #3
@ -453,10 +453,26 @@ internal sealed unsafe class QuestFunctions
|
|||||||
return !HasCompletedPreviousQuests(questInfo, extraCompletedQuest) || !HasCompletedPreviousInstances(questInfo);
|
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)
|
public bool IsQuestUnobtainable(ElementId elementId, ElementId? extraCompletedQuest = null)
|
||||||
{
|
{
|
||||||
if (elementId is QuestId questId)
|
if (elementId is QuestId questId)
|
||||||
return IsQuestUnobtainable(questId, extraCompletedQuest);
|
return IsQuestUnobtainable(questId, extraCompletedQuest);
|
||||||
|
else if (elementId is LeveId leveId)
|
||||||
|
return IsQuestUnobtainable(leveId);
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -464,6 +480,9 @@ internal sealed unsafe class QuestFunctions
|
|||||||
public bool IsQuestUnobtainable(QuestId questId, ElementId? extraCompletedQuest = null)
|
public bool IsQuestUnobtainable(QuestId questId, ElementId? extraCompletedQuest = null)
|
||||||
{
|
{
|
||||||
var questInfo = (QuestInfo)_questData.GetQuestInfo(questId);
|
var questInfo = (QuestInfo)_questData.GetQuestInfo(questId);
|
||||||
|
if (questInfo.Expansion > (EExpansionVersion)PlayerState.Instance()->MaxExpansion)
|
||||||
|
return true;
|
||||||
|
|
||||||
if (questInfo.QuestLocks.Count > 0)
|
if (questInfo.QuestLocks.Count > 0)
|
||||||
{
|
{
|
||||||
var completedQuests = questInfo.QuestLocks.Count(x => IsQuestComplete(x) || x.Equals(extraCompletedQuest));
|
var completedQuests = questInfo.QuestLocks.Count(x => IsQuestComplete(x) || x.Equals(extraCompletedQuest));
|
||||||
@ -515,15 +534,13 @@ internal sealed unsafe class QuestFunctions
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsQuestLocked(LeveId leveId)
|
private bool IsQuestUnobtainable(LeveId leveId)
|
||||||
{
|
{
|
||||||
// this only checks for the current class
|
|
||||||
IQuestInfo questInfo = _questData.GetQuestInfo(leveId);
|
IQuestInfo questInfo = _questData.GetQuestInfo(leveId);
|
||||||
if (!questInfo.ClassJobs.Contains((EClassJob)_clientState.LocalPlayer!.ClassJob.Id) ||
|
if (questInfo.Expansion > (EExpansionVersion)PlayerState.Instance()->MaxExpansion)
|
||||||
questInfo.Level > _clientState.LocalPlayer.Level)
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return !IsQuestAccepted(leveId) && QuestManager.Instance()->NumLeveAllowances == 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool HasCompletedPreviousQuests(QuestInfo questInfo, ElementId? extraCompletedQuest)
|
private bool HasCompletedPreviousQuests(QuestInfo questInfo, ElementId? extraCompletedQuest)
|
||||||
|
@ -224,12 +224,17 @@ internal sealed class QuestJournalComponent
|
|||||||
string len = 9999.ToString(CultureInfo.CurrentCulture);
|
string len = 9999.ToString(CultureInfo.CurrentCulture);
|
||||||
ImGui.PushFont(UiBuilder.MonoFont);
|
ImGui.PushFont(UiBuilder.MonoFont);
|
||||||
|
|
||||||
|
if (total == 0)
|
||||||
|
ImGui.TextColored(ImGuiColors.DalamudGrey, $"{"-".PadLeft(len.Length)} / {"-".PadLeft(len.Length)}");
|
||||||
|
else
|
||||||
|
{
|
||||||
string text =
|
string text =
|
||||||
$"{count.ToString(CultureInfo.CurrentCulture).PadLeft(len.Length)} / {total.ToString(CultureInfo.CurrentCulture).PadLeft(len.Length)}";
|
$"{count.ToString(CultureInfo.CurrentCulture).PadLeft(len.Length)} / {total.ToString(CultureInfo.CurrentCulture).PadLeft(len.Length)}";
|
||||||
if (count == total)
|
if (count == total)
|
||||||
ImGui.TextColored(ImGuiColors.ParsedGreen, text);
|
ImGui.TextColored(ImGuiColors.ParsedGreen, text);
|
||||||
else
|
else
|
||||||
ImGui.TextUnformatted(text);
|
ImGui.TextUnformatted(text);
|
||||||
|
}
|
||||||
|
|
||||||
ImGui.PopFont();
|
ImGui.PopFont();
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ internal sealed class PriorityWindow : LWindow
|
|||||||
{
|
{
|
||||||
foundQuests = _questRegistry.AllQuests
|
foundQuests = _questRegistry.AllQuests
|
||||||
.Where(x => x.Info.Name.Contains(_searchString, StringComparison.CurrentCultureIgnoreCase))
|
.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
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user