diff --git a/GenerateQuestFile/Program.cs b/GenerateQuestFile/Program.cs index 8be80d5..7ac6633 100644 --- a/GenerateQuestFile/Program.cs +++ b/GenerateQuestFile/Program.cs @@ -99,10 +99,15 @@ namespace GenerateQuestFile } var questRequirement = QuestHelper.GetQuestDependancy(quest.Key); - if (questRequirement != null - && !string.IsNullOrEmpty(questRequirement.PreceedingQuest) - && !quest.Value.conditions.AvailableForStart.Any(x => x._parent == "Quest" && x._props.target.ToString() == questRequirement.PreceedingQuest)) + if (questRequirement == null || questRequirement.PreceedingQuest?.Length == 0) { + continue; + } + + if (!quest.Value.conditions.AvailableForStart.Any(x => x._parent == "Quest" + && x._props.target.ToString() == questRequirement.PreceedingQuest)) + { + LoggingHelpers.LogSuccess($"{quest.Value.QuestName} needs a prereq of quest {QuestHelper.GetQuestNameById(questRequirement.PreceedingQuest)}, adding."); quest.Value.conditions.AvailableForStart.Add(new AvailableFor { _parent = "Quest", @@ -117,6 +122,13 @@ namespace GenerateQuestFile } ); } + else + { + if (questRequirement != null) + { + LoggingHelpers.LogInfo($"{quest.Value.QuestName} already has prereq of quest {QuestHelper.GetQuestNameById(questRequirement.PreceedingQuest)}, skipping."); + } + } } JsonWriter.WriteJson(questsToOutputToFile, "output", Directory.GetCurrentDirectory(), "quests");