muffin v6.22
This commit is contained in:
parent
b7a9243899
commit
c9048e8eb4
2 changed files with 3433 additions and 3042 deletions
|
@ -5,6 +5,7 @@ using Dalamud.Interface;
|
|||
using Dalamud.Interface.Components;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using Dalamud.Plugin.Services;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Questionable.Controller;
|
||||
using Questionable.Data;
|
||||
|
@ -59,7 +60,7 @@ internal sealed class QuestJournalUtils
|
|||
{
|
||||
return;
|
||||
}
|
||||
using (ImRaii.Disabled(!_questFunctions.IsReadyToAcceptQuest(questInfo.QuestId)))
|
||||
using (ImRaii.Disabled(!_questFunctions.IsReadyToAcceptQuest(questInfo.QuestId) || quest == null || quest.Root.Disabled))
|
||||
{
|
||||
if (ImGui.MenuItem("Start as next quest"))
|
||||
{
|
||||
|
@ -67,6 +68,21 @@ internal sealed class QuestJournalUtils
|
|||
_questController.Start(label);
|
||||
}
|
||||
}
|
||||
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
|
||||
{
|
||||
if (!_questFunctions.IsReadyToAcceptQuest(questInfo.QuestId))
|
||||
{
|
||||
ImGui.SetTooltip("Quest is not ready to accept");
|
||||
}
|
||||
else if (quest == null)
|
||||
{
|
||||
ImGui.SetTooltip("Quest has no path available");
|
||||
}
|
||||
else if (quest.Root.Disabled)
|
||||
{
|
||||
ImGui.SetTooltip("Quest path is disabled");
|
||||
}
|
||||
}
|
||||
List<ElementId> incompletePrerequisiteQuests = GetIncompletePrerequisiteQuests(questInfo);
|
||||
using (ImRaii.Disabled(incompletePrerequisiteQuests.Count == 0))
|
||||
{
|
||||
|
@ -84,7 +100,7 @@ internal sealed class QuestJournalUtils
|
|||
{
|
||||
if (incompletePrerequisiteQuests.Count == 0)
|
||||
{
|
||||
ImGui.SetTooltip("No quests to add (quest may be complete or already in priority)");
|
||||
ImGui.SetTooltip("No quests to add (quest may be complete, disabled, locked with no unlock path, or already in priority)");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -101,26 +117,44 @@ internal sealed class QuestJournalUtils
|
|||
}
|
||||
}
|
||||
|
||||
private List<ElementId> GetIncompletePrerequisiteQuests(IQuestInfo questInfo)
|
||||
private unsafe List<ElementId> GetIncompletePrerequisiteQuests(IQuestInfo questInfo)
|
||||
{
|
||||
List<ElementId> list = new List<ElementId>();
|
||||
HashSet<ElementId> visited = new HashSet<ElementId>();
|
||||
CollectPrerequisitesRecursive(questInfo, list, visited);
|
||||
list.Reverse();
|
||||
Quest quest2;
|
||||
List<ElementId> list2 = (from qId in list.Where(delegate(ElementId qId)
|
||||
{
|
||||
if (!_questData.TryGetQuestInfo(qId, out IQuestInfo questInfo2))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return questInfo2.IsRepeatable || !_questFunctions.IsQuestComplete(qId);
|
||||
if (questInfo2.IsRepeatable && qId is QuestId questId2)
|
||||
{
|
||||
if (QuestManager.Instance()->IsDailyQuestCompleted(questId2.Value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (_questFunctions.IsQuestComplete(qId))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
})
|
||||
where !_questFunctions.IsQuestUnobtainable(qId)
|
||||
where _questRegistry.IsKnownQuest(qId)
|
||||
where (!_questRegistry.TryGetQuest(qId, out quest2) || !quest2.Root.Disabled) ? true : false
|
||||
where !_questController.ManualPriorityQuests.Any((Quest q) => q.Id.Equals(qId))
|
||||
select qId).ToList();
|
||||
list2.Reverse();
|
||||
if ((questInfo.IsRepeatable || !_questFunctions.IsQuestComplete(questInfo.QuestId)) && !_questFunctions.IsQuestUnobtainable(questInfo.QuestId) && _questRegistry.IsKnownQuest(questInfo.QuestId) && !_questController.ManualPriorityQuests.Any((Quest q) => q.Id.Equals(questInfo.QuestId)))
|
||||
bool flag = false;
|
||||
flag = ((!questInfo.IsRepeatable || !(questInfo.QuestId is QuestId questId)) ? (!_questFunctions.IsQuestComplete(questInfo.QuestId)) : (!QuestManager.Instance()->IsDailyQuestCompleted(questId.Value)));
|
||||
Quest quest;
|
||||
bool flag2 = _questRegistry.TryGetQuest(questInfo.QuestId, out quest) && quest.Root.Disabled;
|
||||
bool flag3 = _questFunctions.IsQuestLocked(questInfo.QuestId) && questInfo.PreviousQuests.Count == 0;
|
||||
if (flag && !flag2 && !flag3 && !_questFunctions.IsQuestUnobtainable(questInfo.QuestId) && _questRegistry.IsKnownQuest(questInfo.QuestId) && !_questController.ManualPriorityQuests.Any((Quest q) => q.Id.Equals(questInfo.QuestId)))
|
||||
{
|
||||
list2.Add(questInfo.QuestId);
|
||||
}
|
||||
|
@ -194,7 +228,7 @@ internal sealed class QuestJournalUtils
|
|||
else
|
||||
{
|
||||
_logger.LogWarning("No quests were added to priority list for '{QuestName}'", questInfo.Name);
|
||||
_chatGui.Print("No quests to add (may be complete or already in priority).", "Questionable", 576);
|
||||
_chatGui.Print("No quests to add (may be complete, disabled, locked with no unlock path, or already in priority).", "Questionable", 576);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue