forked from chomp/ChompQuestVerifier
Fix blacklisted quests getting into output file
This commit is contained in:
parent
f21da306fb
commit
cf2a2ae899
@ -36,17 +36,16 @@ namespace GenerateQuestFile
|
|||||||
|
|
||||||
OutputQuestRequirementsToConsole(mergedLiveData.data);
|
OutputQuestRequirementsToConsole(mergedLiveData.data);
|
||||||
|
|
||||||
JsonWriter.WriteJson<QuestRoot>(mergedLiveData, "output", Directory.GetCurrentDirectory(), "mergedlivejson");
|
JsonWriter.WriteJson(mergedLiveData, "output", Directory.GetCurrentDirectory(), "mergedlivejson");
|
||||||
|
|
||||||
// Find the quests that are missing from the live file from existing quest data
|
// Find the quests that are missing from the live file from existing quests.json
|
||||||
var missingQuests = GetMissingQuestsNotInLiveFile(existingQuestData, mergedLiveData, questBlacklist);
|
var missingQuests = GetMissingQuestsNotInLiveFile(existingQuestData, mergedLiveData, questBlacklist);
|
||||||
|
|
||||||
// Create a list of quests to output
|
// Create a list of quests to output
|
||||||
// Use all quests in live file
|
// Use all quests in live file
|
||||||
// Use quests from quests.json to fill in missing quests
|
// Use quests from quests.json to fill in missing quests
|
||||||
var questsToOutputToFile = new Dictionary<string, Quest>();
|
|
||||||
|
|
||||||
// Add live quests to collection to return later
|
// Add live quests to collection to return later
|
||||||
|
var questsToOutputToFile = new Dictionary<string, Quest>();
|
||||||
foreach (var liveQuest in mergedLiveData.data)
|
foreach (var liveQuest in mergedLiveData.data)
|
||||||
{
|
{
|
||||||
questsToOutputToFile.Add(liveQuest._id, liveQuest);
|
questsToOutputToFile.Add(liveQuest._id, liveQuest);
|
||||||
@ -486,6 +485,7 @@ namespace GenerateQuestFile
|
|||||||
{
|
{
|
||||||
if (blacklistedQuests.Contains(quest._id))
|
if (blacklistedQuests.Contains(quest._id))
|
||||||
{
|
{
|
||||||
|
LoggingHelpers.LogInfo($"Skipping quest: {quest.QuestName}");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,12 +42,12 @@ namespace AssortGenerator.Common.Helpers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static QuestRoot MergeLiveQuestFiles(List<QuestRoot> liveQuestDataFiles, List<string> questBlacklist)
|
public static QuestRoot MergeLiveQuestFiles(List<QuestRoot> liveQuestDataFiles, List<string> questBlacklist)
|
||||||
{
|
{
|
||||||
QuestRoot mergedResult = null;
|
QuestRoot mergedResult = new QuestRoot
|
||||||
|
{
|
||||||
|
data = new List<Quest>()
|
||||||
|
};
|
||||||
foreach (var liveQuestDataFile in liveQuestDataFiles)
|
foreach (var liveQuestDataFile in liveQuestDataFiles)
|
||||||
{
|
{
|
||||||
// If null, use whole file
|
|
||||||
mergedResult ??= liveQuestDataFile;
|
|
||||||
|
|
||||||
foreach (var quest in liveQuestDataFile.data)
|
foreach (var quest in liveQuestDataFile.data)
|
||||||
{
|
{
|
||||||
// Skip quests on blacklist
|
// Skip quests on blacklist
|
||||||
@ -60,7 +60,7 @@ namespace AssortGenerator.Common.Helpers
|
|||||||
var mergedExistingQuest = mergedResult.data.FirstOrDefault(x => x._id == quest._id);
|
var mergedExistingQuest = mergedResult.data.FirstOrDefault(x => x._id == quest._id);
|
||||||
if (mergedExistingQuest != null)
|
if (mergedExistingQuest != null)
|
||||||
{
|
{
|
||||||
// new quest has more avail for start conditions, use instead
|
// new quest has more `avail for start` conditions, use instead
|
||||||
if (mergedExistingQuest.conditions.AvailableForStart.Count < quest.conditions.AvailableForStart.Count)
|
if (mergedExistingQuest.conditions.AvailableForStart.Count < quest.conditions.AvailableForStart.Count)
|
||||||
{
|
{
|
||||||
mergedExistingQuest = quest;
|
mergedExistingQuest = quest;
|
||||||
@ -68,7 +68,6 @@ namespace AssortGenerator.Common.Helpers
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
LoggingHelpers.LogWarning($"Missing quest {quest._id} {QuestNames.GetNameById(quest._id)} found in subsequent live quest dump");
|
|
||||||
mergedResult.data.Add(quest);
|
mergedResult.data.Add(quest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user