Fix missing prev quests
This commit is contained in:
parent
e4c55f7086
commit
97e802f9fb
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
|
||||
namespace QuestMap {
|
||||
@ -101,7 +102,8 @@ namespace QuestMap {
|
||||
}
|
||||
}
|
||||
|
||||
internal static (List<Node<Quest>>, Dictionary<uint, Node<Quest>>) BuildTree(Dictionary<uint, Quest> layouts) {
|
||||
internal static (List<Node<Quest>>, Dictionary<uint, Node<Quest>>) BuildTree(Dictionary<uint, Quest> layouts,
|
||||
IDataManager dataManager) {
|
||||
var lookup = new Dictionary<uint, Node<Quest>>();
|
||||
var rootNodes = new List<Node<Quest>>();
|
||||
var allNodes = new Dictionary<uint, Node<Quest>>();
|
||||
@ -115,7 +117,7 @@ namespace QuestMap {
|
||||
allNodes[item.Key] = ourNode;
|
||||
}
|
||||
|
||||
var previous = item.Value.PreviousQuests().ToList();
|
||||
var previous = item.Value.PreviousQuests(dataManager).ToList();
|
||||
if (previous.Count == 0) {
|
||||
rootNodes.Add(ourNode);
|
||||
} else {
|
||||
@ -150,12 +152,19 @@ namespace QuestMap {
|
||||
return null;
|
||||
}
|
||||
|
||||
internal static IEnumerable<Quest> PreviousQuests(this Quest quest) {
|
||||
internal static IEnumerable<Quest> PreviousQuests(this Quest quest, IDataManager dataManager) {
|
||||
foreach (var previous in quest.PreviousQuest) {
|
||||
if (previous != null && previous.Row != 0) {
|
||||
yield return previous.Value!;
|
||||
}
|
||||
}
|
||||
|
||||
if (quest.Unknown12 != 0)
|
||||
{
|
||||
var previous = dataManager.GetExcelSheet<Quest>()!.GetRow(quest.Unknown12);
|
||||
if (previous != null)
|
||||
yield return previous;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ namespace QuestMap {
|
||||
this.BeastRewards = beastRewards;
|
||||
this.JobRewards = jobRewards;
|
||||
|
||||
var (_, nodes) = Node<Quest>.BuildTree(allQuests);
|
||||
var (_, nodes) = Node<Quest>.BuildTree(allQuests, this.Plugin.DataManager);
|
||||
this.AllNodes = nodes;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user