Add blacklist + include terragroup trial quests in it
This commit is contained in:
parent
8e8d5f31ab
commit
f21da306fb
21
GenerateQuestFile/Examples/blacklist.json
Normal file
21
GenerateQuestFile/Examples/blacklist.json
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
[
|
||||||
|
"64b90786bbf5bf2b460ad982",
|
||||||
|
"64b90792f43eebce7c01e7af",
|
||||||
|
"64b907978d327e5bf9085bd9",
|
||||||
|
"64b9079cdd13d43b9d01d6cd",
|
||||||
|
"64b907a49ff61a79b10fab9c",
|
||||||
|
"64b907a85e9b86ab7a08cf0d",
|
||||||
|
"64b907ad60d47bcb98044d10",
|
||||||
|
"64b907b205b23872610c0794",
|
||||||
|
"64b907b5b1548514f3015707",
|
||||||
|
"64b907bae1ed4f11f209e8de",
|
||||||
|
"64b907bd55f4156df8007d14",
|
||||||
|
"64b907c29bd0fad76c072e97",
|
||||||
|
"64b907c4e87866541c0d747e",
|
||||||
|
"64b907cabbf5bf2b460ad984",
|
||||||
|
"64b907cef43eebce7c01e7b1",
|
||||||
|
"64b907d18d327e5bf9085bdb",
|
||||||
|
"64b907d7dd13d43b9d01d6cf",
|
||||||
|
"64b907dc9ff61a79b10fab9e",
|
||||||
|
"64bd4f1d4c2e9f141400bf07"
|
||||||
|
]
|
@ -28,17 +28,18 @@ namespace GenerateQuestFile
|
|||||||
InputFileHelper.SetInputFiles(inputPath);
|
InputFileHelper.SetInputFiles(inputPath);
|
||||||
|
|
||||||
// Read in quest files
|
// Read in quest files
|
||||||
|
var questBlacklist = QuestHelper.GetQuestBlacklist();
|
||||||
var existingQuestData = QuestHelper.GetQuestData();
|
var existingQuestData = QuestHelper.GetQuestData();
|
||||||
var liveQuestData = QuestHelper.GetLiveQuestData();
|
var liveQuestData = QuestHelper.GetLiveQuestData();
|
||||||
|
|
||||||
var mergedLiveData = QuestHelper.MergeLiveQuestFiles(liveQuestData);
|
var mergedLiveData = QuestHelper.MergeLiveQuestFiles(liveQuestData, questBlacklist);
|
||||||
|
|
||||||
OutputQuestRequirementsToConsole(mergedLiveData.data);
|
OutputQuestRequirementsToConsole(mergedLiveData.data);
|
||||||
|
|
||||||
JsonWriter.WriteJson<QuestRoot>(mergedLiveData, "output", Directory.GetCurrentDirectory(), "mergedlivejson");
|
JsonWriter.WriteJson<QuestRoot>(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 quest data
|
||||||
var missingQuests = GetMissingQuestsNotInLiveFile(existingQuestData, mergedLiveData);
|
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
|
||||||
@ -475,7 +476,7 @@ namespace GenerateQuestFile
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loop over live quests and use if it exists, otherwise use existing data
|
/// Loop over live quests and use if it exists, otherwise use existing data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static List<Quest> GetMissingQuestsNotInLiveFile(Dictionary<string, Quest> existingQuests, QuestRoot liveQuestData)
|
private static List<Quest> GetMissingQuestsNotInLiveFile(Dictionary<string, Quest> existingQuests, QuestRoot liveQuestData, List<string> blacklistedQuests)
|
||||||
{
|
{
|
||||||
var missingQuestsToReturn = new List<Quest>();
|
var missingQuestsToReturn = new List<Quest>();
|
||||||
foreach (var quest in existingQuests.Values)
|
foreach (var quest in existingQuests.Values)
|
||||||
@ -483,6 +484,11 @@ namespace GenerateQuestFile
|
|||||||
var liveQuest = liveQuestData.data.Find(x => x._id == quest._id);
|
var liveQuest = liveQuestData.data.Find(x => x._id == quest._id);
|
||||||
if (liveQuest is null)
|
if (liveQuest is null)
|
||||||
{
|
{
|
||||||
|
if (blacklistedQuests.Contains(quest._id))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
missingQuestsToReturn.Add(quest);
|
missingQuestsToReturn.Add(quest);
|
||||||
LoggingHelpers.LogError($"ERROR Quest {quest._id} {QuestHelper.GetQuestNameById(quest._id)} missing in live file. Will use fallback quests.json");
|
LoggingHelpers.LogError($"ERROR Quest {quest._id} {QuestHelper.GetQuestNameById(quest._id)} missing in live file. Will use fallback quests.json");
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using QuestValidator.Common.Helpers;
|
using QuestValidator.Common.Helpers;
|
||||||
using QuestValidator.Models;
|
using QuestValidator.Models;
|
||||||
using QuestValidator.Models.Other;
|
using QuestValidator.Models.Other;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -14,6 +15,7 @@ namespace AssortGenerator.Common.Helpers
|
|||||||
|
|
||||||
private static List<QuestRoot> _liveQuestData;
|
private static List<QuestRoot> _liveQuestData;
|
||||||
private static Dictionary<string, QuestValidator.Models.Quest> _questData;
|
private static Dictionary<string, QuestValidator.Models.Quest> _questData;
|
||||||
|
private static List<string> _questBlacklistData;
|
||||||
private static List<AssortUnlocks> _assortUnlocks;
|
private static List<AssortUnlocks> _assortUnlocks;
|
||||||
|
|
||||||
public static Dictionary<string, QuestValidator.Models.Quest> GetQuestData(string filename = "quests")
|
public static Dictionary<string, QuestValidator.Models.Quest> GetQuestData(string filename = "quests")
|
||||||
@ -38,7 +40,7 @@ namespace AssortGenerator.Common.Helpers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="liveQuestDataFiles"></param>
|
/// <param name="liveQuestDataFiles"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static QuestRoot MergeLiveQuestFiles(List<QuestRoot> liveQuestDataFiles)
|
public static QuestRoot MergeLiveQuestFiles(List<QuestRoot> liveQuestDataFiles, List<string> questBlacklist)
|
||||||
{
|
{
|
||||||
QuestRoot mergedResult = null;
|
QuestRoot mergedResult = null;
|
||||||
foreach (var liveQuestDataFile in liveQuestDataFiles)
|
foreach (var liveQuestDataFile in liveQuestDataFiles)
|
||||||
@ -48,8 +50,14 @@ namespace AssortGenerator.Common.Helpers
|
|||||||
|
|
||||||
foreach (var quest in liveQuestDataFile.data)
|
foreach (var quest in liveQuestDataFile.data)
|
||||||
{
|
{
|
||||||
// Already has quest
|
// Skip quests on blacklist
|
||||||
var mergedExistingQuest = mergedResult.data.Find(x => x._id == quest._id);
|
if (questBlacklist.Contains(quest._id))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Already has quest, skip
|
||||||
|
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
|
||||||
@ -60,7 +68,7 @@ namespace AssortGenerator.Common.Helpers
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
LoggingHelpers.LogWarning($"missing quest {quest._id} {QuestNames.GetNameById(quest._id)} found in subsequent live quest dump");
|
LoggingHelpers.LogWarning($"Missing quest {quest._id} {QuestNames.GetNameById(quest._id)} found in subsequent live quest dump");
|
||||||
mergedResult.data.Add(quest);
|
mergedResult.data.Add(quest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -131,5 +139,22 @@ namespace AssortGenerator.Common.Helpers
|
|||||||
var filesInPath = Directory.GetFiles(iconPath);
|
var filesInPath = Directory.GetFiles(iconPath);
|
||||||
return filesInPath.Any(x => x.Contains(imageId));
|
return filesInPath.Any(x => x.Contains(imageId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<string> GetQuestBlacklist()
|
||||||
|
{
|
||||||
|
if (_questBlacklistData is null)
|
||||||
|
{
|
||||||
|
var questBlacklistPath = InputFileHelper.GetInputFilePaths().FirstOrDefault(x => x.Contains("blacklist"));
|
||||||
|
if (questBlacklistPath is null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var questBlacklistJson = File.ReadAllText(questBlacklistPath);
|
||||||
|
_questBlacklistData = JsonSerializer.Deserialize<List<string>>(questBlacklistJson);
|
||||||
|
}
|
||||||
|
|
||||||
|
return _questBlacklistData;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user