From b29719f6ad5d6340883ae9b7875492b07408aba0 Mon Sep 17 00:00:00 2001 From: Chomp Date: Tue, 14 Sep 2021 20:11:41 +0100 Subject: [PATCH] add logging to show when quest prereq was skipped/added --- GenerateQuestFile/Program.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) 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");