From dc879a5ff495ad09b576b7756764e99deb36505a Mon Sep 17 00:00:00 2001 From: Chomp Date: Thu, 5 Jan 2023 23:04:11 +0000 Subject: [PATCH] Changes --- GenerateQuestFile/Program.cs | 21 +++++++++++++++ QuestValidator.Common/Helpers/QuestHelper.cs | 15 +++++++---- .../Helpers/QuestRequirements.cs | 27 +++++++++---------- 3 files changed, 43 insertions(+), 20 deletions(-) diff --git a/GenerateQuestFile/Program.cs b/GenerateQuestFile/Program.cs index 4fc052d..2de05d2 100644 --- a/GenerateQuestFile/Program.cs +++ b/GenerateQuestFile/Program.cs @@ -33,6 +33,8 @@ namespace GenerateQuestFile var mergedLiveData = QuestHelper.MergeLiveQuestFiles(liveQuestData); + OutputQuestRequirementsToConsole(mergedLiveData); + JsonWriter.WriteJson(mergedLiveData, "output", Directory.GetCurrentDirectory(), "mergedlivejson"); // Find the quests that are missing from the live file from existing quest data @@ -151,6 +153,25 @@ namespace GenerateQuestFile JsonWriter.WriteJson(questsToOutputToFile, "output", Directory.GetCurrentDirectory(), "quests"); } + private static void OutputQuestRequirementsToConsole(QuestRoot mergedLiveData) + { + var output = new List(); + foreach (var quest in mergedLiveData.data) + { + var questConditions = quest.conditions.AvailableForStart.Where(x => x._parent == "Quest"); + if (questConditions != null) + { + foreach (var questCondition in questConditions) + { + var x = questCondition._props.target.ToString(); + Console.WriteLine($"{QuestHelper.GetQuestNameById(quest._id)} needs {QuestHelper.GetQuestNameById(x)}"); + } + } + } + + // JsonWriter.WriteJson(output, "output", Directory.GetCurrentDirectory(), "questRequirements"); + } + private static int[] GetQuestStatus(QuestStatus status) { switch (status) diff --git a/QuestValidator.Common/Helpers/QuestHelper.cs b/QuestValidator.Common/Helpers/QuestHelper.cs index 30ab0e6..3cc1729 100644 --- a/QuestValidator.Common/Helpers/QuestHelper.cs +++ b/QuestValidator.Common/Helpers/QuestHelper.cs @@ -43,15 +43,20 @@ namespace AssortGenerator.Common.Helpers QuestRoot mergedResult = null; foreach (var liveQuestDataFile in liveQuestDataFiles) { - if (mergedResult == null) - { - mergedResult = liveQuestDataFile; - } + // If null, use whole file + mergedResult ??= liveQuestDataFile; foreach (var quest in liveQuestDataFile.data) { - if (mergedResult.data.Any(x => x._id == quest._id)) + // Already has quest + var mergedExistingQuest = mergedResult.data.Find(x => x._id == quest._id); + if (mergedExistingQuest != null) { + // new quest has more avail for start conditions, use instead + if (mergedExistingQuest.conditions.AvailableForStart.Count < quest.conditions.AvailableForStart.Count) + { + mergedExistingQuest = quest; + } continue; } diff --git a/QuestValidator.Common/Helpers/QuestRequirements.cs b/QuestValidator.Common/Helpers/QuestRequirements.cs index 3606afd..2738730 100644 --- a/QuestValidator.Common/Helpers/QuestRequirements.cs +++ b/QuestValidator.Common/Helpers/QuestRequirements.cs @@ -185,7 +185,8 @@ namespace QuestValidator.Common.Helpers { Quest.GunsmithP3, GetQuestData(Quest.GunsmithP3) .AddPrerequisiteQuest(Quest.GunsmithP1, QuestStatus.Success) }, { Quest.GunsmithP4, GetQuestData(Quest.GunsmithP4) - .AddPrerequisiteQuest(Quest.GunsmithP2, QuestStatus.Success) }, + .AddPrerequisiteQuest(Quest.GunsmithP2, QuestStatus.Success) + .AddPrerequisiteQuest(Quest.GunsmithP3, QuestStatus.Success) }, { Quest.GunsmithP5, GetQuestData(Quest.GunsmithP5) .AddPrerequisiteQuest(Quest.GunsmithP4, QuestStatus.Success) }, { Quest.GunsmithP6, GetQuestData(Quest.GunsmithP6) @@ -333,7 +334,6 @@ namespace QuestValidator.Common.Helpers { Quest.Grenadier, GetQuestData(Quest.Grenadier) .AddPrerequisiteQuest(Quest.ShakingUpTeller, QuestStatus.Success) }, { Quest.DecontaminationService, GetQuestData(Quest.DecontaminationService) - .AddPrerequisiteQuest(Quest.HealthCarePrivacyP5, QuestStatus.Success) .AddPrerequisiteQuest(Quest.PrivateClinic, QuestStatus.Success) }, { Quest.PeacekeepingMission, GetQuestData(Quest.PeacekeepingMission) .AddPrerequisiteQuest(Quest.LendLeaseP2, QuestStatus.Success) }, @@ -454,11 +454,7 @@ namespace QuestValidator.Common.Helpers { Quest.ColleaguesP2, GetQuestData(Quest.ColleaguesP2) .AddPrerequisiteQuest(Quest.ColleaguesP1, QuestStatus.Success) }, { Quest.ColleaguesP3, GetQuestData(Quest.ColleaguesP3) - // .AddPrerequisiteQuest(Quest.HuntsmanPathSadist, QuestStatus.Started) // TODO - what happens when player completes sadist? - .AddPrerequisiteQuest(Quest.ColleaguesP2, QuestStatus.Success) - .AddPrerequisiteQuest(Quest.RiggedGame, QuestStatus.Success) - .AddPrerequisiteQuest(Quest.TheChemistryCloset, QuestStatus.Success) - }, + .AddPrerequisiteQuest(Quest.HuntsmanPathSadist, QuestStatus.Started) }, { Quest.RiggedGame, GetQuestData(Quest.RiggedGame) .AddPrerequisiteQuest(Quest.Anesthesia, QuestStatus.Success) }, { Quest.TerraGroupEmployee, GetQuestData(Quest.TerraGroupEmployee) @@ -592,6 +588,8 @@ namespace QuestValidator.Common.Helpers .AddPrerequisiteQuest(Quest.BroadcastPart2, QuestStatus.Success)}, { Quest.Debtor, GetQuestData(Quest.Debtor) .AddPrerequisiteQuest(Quest.Chumming, QuestStatus.Success)}, + { Quest.BroadcastPart2, GetQuestData(Quest.BroadcastPart2) + .AddPrerequisiteQuest(Quest.BroadcastPart1, QuestStatus.Success)}, // { Quest.CeaseFire, GetQuestData(Quest.CeaseFire) // .AddPrerequisiteQuest(Quest., QuestStatus.Success)}, // NO DATA YET { Quest.KingsOfTheRooftops, GetQuestData(Quest.KingsOfTheRooftops) @@ -601,14 +599,13 @@ namespace QuestValidator.Common.Helpers // { Quest.HarleyForever, GetQuestData(Quest.HarleyForever) // .AddPrerequisiteQuest(Quest., QuestStatus.Success)}, // NO DATA YET { Quest.TheHuntsmanPathAdministrator, GetQuestData(Quest.TheHuntsmanPathAdministrator) - .AddPrerequisiteQuest(Quest.HuntsmanPathWoodsCleaning, QuestStatus.Success)}, - { Quest.GreenCorridor, GetQuestData(Quest.GreenCorridor) + .AddPrerequisiteQuest(Quest.HuntsmanPathWoodsCleaning, QuestStatus.Success) }, + // { Quest.GreenCorridor, GetQuestData(Quest.GreenCorridor) // .AddPrerequisiteQuest(Quest., QuestStatus.Success)}, // NO DATA YET - // { Quest.RevisionStreetsOfTarkov, GetQuestData(Quest.RevisionStreetsOfTarkov) - .AddPrerequisiteQuest(Quest.RevisionStreetsOfTarkov, QuestStatus.Success)}, + { Quest.RevisionStreetsOfTarkov, GetQuestData(Quest.RevisionStreetsOfTarkov) + .AddPrerequisiteQuest(Quest.Revision, QuestStatus.Success) }, { Quest.Surveillance, GetQuestData(Quest.Surveillance) - .AddPrerequisiteQuest(Quest.BroadcastPart2, QuestStatus.Success) - .AddPrerequisiteQuest(Quest.CorporateSecrets, QuestStatus.Success)}, + .AddPrerequisiteQuest(Quest.BroadcastPart2, QuestStatus.Success) }, // { Quest.NetworkProviderPart1, GetQuestData(Quest.NetworkProviderPart1) // .AddPrerequisiteQuest(Quest., QuestStatus.Success)}, // NO DATA YET // { Quest.NetworkProviderPart2, GetQuestData(Quest.NetworkProviderPart2) @@ -649,8 +646,8 @@ namespace QuestValidator.Common.Helpers // .AddPrerequisiteQuest(Quest., QuestStatus.Success)},// NO DATA YET { Quest.BroadcastPart4, GetQuestData(Quest.BroadcastPart4) .AddPrerequisiteQuest(Quest.BroadcastPart3, QuestStatus.Success)}, - // { Quest.RoadClosed, GetQuestData(Quest.RoadClosed) - // .AddPrerequisiteQuest(Quest., QuestStatus.Success)},// NO DATA YET + { Quest.RoadClosed, GetQuestData(Quest.RoadClosed) + .AddPrerequisiteQuest(Quest.SpaTourP7, QuestStatus.Success)}, // { Quest.MakeAmends, GetQuestData(Quest.MakeAmends) // .AddPrerequisiteQuest(Quest., QuestStatus.Success)}// NO DATA YET };