public static QuestParent ReadParentQuest(FLD_QuestList parentQuest) { var quest = new QuestParent(); quest.Id = parentQuest.Id; quest.Flag = parentQuest.FlagPRT; quest.Summary = parentQuest._Summary?.name; quest.Title = parentQuest._QuestTitle?.name; if (string.IsNullOrWhiteSpace(quest.Title)) { quest.Title = $"Quest #{quest.Id}"; } var childQuest = parentQuest._NextQuestA; int stage = 1; while (childQuest != null) { var child = ReadChildQuest(childQuest); child.Parent = quest; child.Stage = stage++; quest.Children.Add(child); childQuest = childQuest._NextQuestA; } return(quest); }
public static List <QuestParent> ReadQuests(BdatTable <FLD_QuestList> table) { FLD_QuestList[] parents = table.Where(x => x.FlagPRT != 0).ToArray(); var quests = new List <QuestParent>(); foreach (FLD_QuestList parent in parents) { QuestParent quest = ReadParentQuest(parent); quests.Add(quest); } return(quests); }