Update generator to add missing fields to quest json

default all quests to pmc quests
all reward items are find in raid = true (we have no way to tell if that's correct or not until we get more quest dumps)
This commit is contained in:
Chomp 2022-06-30 12:16:08 +01:00
parent 19c65814b2
commit c783292278

View File

@ -73,6 +73,8 @@ namespace GenerateQuestFile
continue; continue;
} }
AddMissingFields(quest);
// quest has start conditions, check to ensure they're carried over // quest has start conditions, check to ensure they're carried over
if (originalQuest.conditions.AvailableForStart.Count > 0) if (originalQuest.conditions.AvailableForStart.Count > 0)
{ {
@ -128,50 +130,49 @@ namespace GenerateQuestFile
JsonWriter.WriteJson(questsToOutputToFile, "output", Directory.GetCurrentDirectory(), "quests"); JsonWriter.WriteJson(questsToOutputToFile, "output", Directory.GetCurrentDirectory(), "quests");
} }
/// <summary>
/// Latest version of eft has changed the quest json structure, this method adds missing fields
/// Mega hack as we dont have a full dump as of 30/06/2022
/// </summary>
/// <param name="quest">quest to add missing fields to</param>
private static void AddMissingFields(KeyValuePair<string, Quest> quest)
{
//side
if (String.IsNullOrEmpty(quest.Value.side))
{
quest.Value.side = "Pmc";
LoggingHelpers.LogInfo($"Updated quest {quest.Value.QuestName} to have a side of 'pmc'");
}
//changeQuestMessageText
if (String.IsNullOrEmpty(quest.Value.changeQuestMessageText))
{
quest.Value.changeQuestMessageText = $"{quest.Value._id} changeQuestMessageText";
LoggingHelpers.LogInfo($"Updated quest {quest.Value.QuestName} to have a changeQuestMessageText value");
}
// findInRaid
foreach (var success in quest.Value.rewards.Success)
{
if (string.Equals(success.type, "item", StringComparison.OrdinalIgnoreCase)
&& success.findInRaid == null)
{
success.findInRaid = true;
LoggingHelpers.LogInfo($"Updated quest {quest.Value.QuestName} to have a success item reward findInRaid value of 'true'");
}
}
}
private static void AddMissingFailRewards(Quest originalQuest, KeyValuePair<string, Quest> quest) private static void AddMissingFailRewards(Quest originalQuest, KeyValuePair<string, Quest> quest)
{ {
quest.Value.rewards.Fail.AddRange(originalQuest.rewards.Fail); quest.Value.rewards.Fail.AddRange(originalQuest.rewards.Fail);
} }
private static void CheckAndFixMissingProperties(Quest missingQuest) /// <summary>
{ /// Check original quest for start conditions and if missing from new quest, add them
if (missingQuest.description is null) /// </summary>
{ /// <param name="originalQuest"></param>
missingQuest.description = $"{missingQuest._id} description"; /// <param name="questToUpdate">quest to add to output json</param>
}
if (missingQuest.failMessageText is null)
{
missingQuest.failMessageText = $"{missingQuest._id} failMessageText";
}
if (missingQuest.name is null)
{
missingQuest.name = $"{missingQuest._id} name";
}
if (missingQuest.note is null)
{
missingQuest.note = $"{missingQuest._id} note";
}
if (missingQuest.startedMessageText is null)
{
missingQuest.startedMessageText = $"{missingQuest._id} startedMessageText";
}
if (missingQuest.successMessageText is null)
{
missingQuest.successMessageText = $"{missingQuest._id} successMessageText";
}
if (missingQuest.templateId is null)
{
missingQuest.templateId = $"{missingQuest._id} successMessageText";
}
}
private static void AddMissingAvailableForStartConditions(Quest originalQuest, KeyValuePair<string, Quest> questToUpdate) private static void AddMissingAvailableForStartConditions(Quest originalQuest, KeyValuePair<string, Quest> questToUpdate)
{ {
// Iterate over quest requirements in existing quest file // Iterate over quest requirements in existing quest file