diff --git a/GenerateQuestFile/Program.cs b/GenerateQuestFile/Program.cs
index d95d080..a05cf47 100644
--- a/GenerateQuestFile/Program.cs
+++ b/GenerateQuestFile/Program.cs
@@ -73,6 +73,8 @@ namespace GenerateQuestFile
continue;
}
+ AddMissingFields(quest);
+
// quest has start conditions, check to ensure they're carried over
if (originalQuest.conditions.AvailableForStart.Count > 0)
{
@@ -128,50 +130,49 @@ namespace GenerateQuestFile
JsonWriter.WriteJson(questsToOutputToFile, "output", Directory.GetCurrentDirectory(), "quests");
}
+ ///
+ /// 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
+ ///
+ /// quest to add missing fields to
+ private static void AddMissingFields(KeyValuePair 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 quest)
{
quest.Value.rewards.Fail.AddRange(originalQuest.rewards.Fail);
}
- private static void CheckAndFixMissingProperties(Quest missingQuest)
- {
- if (missingQuest.description is null)
- {
- missingQuest.description = $"{missingQuest._id} description";
- }
-
- 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";
- }
- }
-
+ ///
+ /// Check original quest for start conditions and if missing from new quest, add them
+ ///
+ ///
+ /// quest to add to output json
private static void AddMissingAvailableForStartConditions(Quest originalQuest, KeyValuePair questToUpdate)
{
// Iterate over quest requirements in existing quest file