add logging to show when quest prereq was skipped/added

This commit is contained in:
Chomp 2021-09-14 20:11:41 +01:00
parent 786740c4e1
commit b29719f6ad

View File

@ -99,10 +99,15 @@ namespace GenerateQuestFile
} }
var questRequirement = QuestHelper.GetQuestDependancy(quest.Key); var questRequirement = QuestHelper.GetQuestDependancy(quest.Key);
if (questRequirement != null if (questRequirement == null || questRequirement.PreceedingQuest?.Length == 0)
&& !string.IsNullOrEmpty(questRequirement.PreceedingQuest)
&& !quest.Value.conditions.AvailableForStart.Any(x => x._parent == "Quest" && x._props.target.ToString() == questRequirement.PreceedingQuest))
{ {
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 quest.Value.conditions.AvailableForStart.Add(new AvailableFor
{ {
_parent = "Quest", _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"); JsonWriter.WriteJson(questsToOutputToFile, "output", Directory.GetCurrentDirectory(), "quests");