forked from chomp/ChompQuestVerifier
New project for generating a quest file
This commit is contained in:
parent
3255f7df93
commit
81761b6ee8
13
GenerateQuestFile/GenerateQuestFile.csproj
Normal file
13
GenerateQuestFile/GenerateQuestFile.csproj
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\QuestValidator.Common\QuestValidator.Common.csproj" />
|
||||||
|
<ProjectReference Include="..\QuestValidator.Models\QuestValidator.Models.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
125
GenerateQuestFile/Program.cs
Normal file
125
GenerateQuestFile/Program.cs
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
using AssortGenerator.Common.Helpers;
|
||||||
|
using QuestValidator.Common;
|
||||||
|
using QuestValidator.Common.Helpers;
|
||||||
|
using QuestValidator.Helpers;
|
||||||
|
using QuestValidator.Models;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
namespace GenerateQuestFile
|
||||||
|
{
|
||||||
|
class Program
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Generate a quests.json file in /output/
|
||||||
|
/// Uses every quest from the live quest dump file
|
||||||
|
/// If any quests are missing, it will use the quests.json file to fill in the blanks
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="args"></param>
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
var inputPath = DiskHelpers.CreateWorkingFolders();
|
||||||
|
InputFileHelper.SetInputFiles(inputPath);
|
||||||
|
|
||||||
|
//read in quest files
|
||||||
|
var questData = QuestHelper.GetQuestData();
|
||||||
|
var liveQuestData = QuestHelper.GetLiveQuestData();
|
||||||
|
//var oldQuestData = QuestHelper.GetQuestData("oldQuests");
|
||||||
|
|
||||||
|
// Find the quests that are missing from the live file
|
||||||
|
var missingQuests = new List<Quest>();
|
||||||
|
foreach (var quest in questData.Values)
|
||||||
|
{
|
||||||
|
if (quest._id == "5936da9e86f7742d65037edf")
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var liveQuest = liveQuestData.data.Find(x => x._id == quest._id);
|
||||||
|
if (liveQuest == null)
|
||||||
|
{
|
||||||
|
missingQuests.Add(quest);
|
||||||
|
LoggingHelpers.LogError($"ERROR Quest {quest._id} {QuestHelper.GetQuestNameById(quest._id)} missing in live");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a list of quests to output
|
||||||
|
// use all quests in live file
|
||||||
|
// Use quests from quests.json to fill in missing quests
|
||||||
|
var questsToOutputToFile = new Dictionary<string, Quest>();
|
||||||
|
//create live version of quests.json
|
||||||
|
foreach (var quest in liveQuestData.data)
|
||||||
|
{
|
||||||
|
var questName = QuestHelper.GetQuestNameById(quest._id); // special characters like ", brake the client when it parses it
|
||||||
|
var rgx = new Regex("[^a-zA-Z0-9 -]");
|
||||||
|
quest.QuestName = rgx.Replace(questName, "");
|
||||||
|
questsToOutputToFile.Add(quest._id, quest);
|
||||||
|
}
|
||||||
|
foreach (var missingQuest in missingQuests)
|
||||||
|
{
|
||||||
|
missingQuest.QuestName = QuestHelper.GetQuestNameById(missingQuest._id);
|
||||||
|
questsToOutputToFile.Add(missingQuest._id, missingQuest);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
foreach (var quest in questsToOutputToFile)
|
||||||
|
{
|
||||||
|
if (quest.Key == "5c0d4c12d09282029f539173")
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var originalQuest = questData.FirstOrDefault(x => x.Key == quest.Key).Value;
|
||||||
|
if (originalQuest.conditions.AvailableForStart.Count > 0)
|
||||||
|
{
|
||||||
|
// Iterate over quest requirements in existing qeust file
|
||||||
|
foreach (var questRequirementToAdd in originalQuest.conditions.AvailableForStart.ToList())
|
||||||
|
{
|
||||||
|
//Exists already
|
||||||
|
if (quest.Value.conditions.AvailableForStart.Any(x => x._parent == questRequirementToAdd._parent
|
||||||
|
&& x._props.target?.ToString() == questRequirementToAdd._props.target?.ToString()))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
quest.Value.conditions.AvailableForStart.Add(questRequirementToAdd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// iterate over qeust objects a final time and add hard coded quest requirements if they dont already exist
|
||||||
|
foreach (var quest in questsToOutputToFile)
|
||||||
|
{
|
||||||
|
if (quest.Key == "5c0d4c12d09282029f539173")
|
||||||
|
{
|
||||||
|
//fishin gear
|
||||||
|
}
|
||||||
|
|
||||||
|
var questRequirement = QuestHelper.GetQuestDependancy(quest.Key);
|
||||||
|
if (questRequirement != null
|
||||||
|
&& !string.IsNullOrEmpty(questRequirement.PreceedingQuest)
|
||||||
|
&& !quest.Value.conditions.AvailableForStart.Any(x => x._parent == "Quest" && x._props.target.ToString() == questRequirement.PreceedingQuest))
|
||||||
|
{
|
||||||
|
quest.Value.conditions.AvailableForStart.Add(new AvailableFor
|
||||||
|
{
|
||||||
|
_parent = "Quest",
|
||||||
|
_props = new AvailableForProps
|
||||||
|
{
|
||||||
|
id = "",
|
||||||
|
index = quest.Value.conditions.AvailableForStart.Count,
|
||||||
|
parentId = "",
|
||||||
|
status = new[] { questRequirement.QuestStatus },
|
||||||
|
target = questRequirement.PreceedingQuest
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonWriter.WriteJson(questsToOutputToFile, "output", Directory.GetCurrentDirectory(), "quests");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
using QuestValidator.Models;
|
using QuestValidator.Common.Models;
|
||||||
|
using QuestValidator.Models;
|
||||||
using QuestValidator.Models.Other;
|
using QuestValidator.Models.Other;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@ -242,6 +243,85 @@ namespace AssortGenerator.Common.Helpers
|
|||||||
{ "60e71c9ad54b755a3b53eb66", "Mutual Interest" }
|
{ "60e71c9ad54b755a3b53eb66", "Mutual Interest" }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Quest to lookup is key, previous quest is value
|
||||||
|
private static readonly Dictionary<string, QuestRequirement> questWithPreceedingQuest = new Dictionary<string, QuestRequirement>
|
||||||
|
{
|
||||||
|
//{ "5936d90786f7742b1420ba5b", "" }, // Debut
|
||||||
|
{ "5936da9e86f7742d65037edf", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5936d90786f7742b1420ba5b"}}, // checking, debut
|
||||||
|
{ "59674cd986f7744ab26e32f2", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5936da9e86f7742d65037edf"}}, //Shootout picnic, checking
|
||||||
|
{ "59674eb386f774539f14813a", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5936da9e86f7742d65037edf"}}, //Delivery from the past, checking
|
||||||
|
{ "5967530a86f77462ba22226b", new QuestRequirement{QuestStatus = 4, PreceedingQuest="59c124d686f774189b3c843f"}}, // Bad rep evidence, bp depot
|
||||||
|
{ "59675d6c86f7740a842fc482", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5967530a86f77462ba22226b"}}, // Ice cream cones, Bad rep evidence
|
||||||
|
{ "59675ea386f77414b32bded2", new QuestRequirement{QuestStatus = 4, PreceedingQuest="59675d6c86f7740a842fc482"}}, // Postman Pat pt 1, ice cream cones
|
||||||
|
{ "596760e186f7741e11214d58", new QuestRequirement{QuestStatus = 4, PreceedingQuest="59675ea386f77414b32bded2" } }, // Postman Pat, p. 2
|
||||||
|
{ "5967725e86f774601a446662", new QuestRequirement{QuestStatus = 4, PreceedingQuest="59675ea386f77414b32bded2"} }, // Shaking up teller, postman part pt 1
|
||||||
|
{ "5967733e86f774602332fc84", new QuestRequirement{QuestStatus = 4, PreceedingQuest="" } }, // Shortage
|
||||||
|
{ "59689ee586f7740d1570bbd5", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5967733e86f774602332fc84"}}, //Sanitary Standards, pt1, Shortage
|
||||||
|
{ "59689fbd86f7740d137ebfc4", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5967733e86f774602332fc84"}}, // Operation Aquarius pt1, Shortage
|
||||||
|
{ "5968eb3186f7741dde183a4d", new QuestRequirement{QuestStatus = 4, PreceedingQuest="59689fbd86f7740d137ebfc4"}}, // Operation Aquarius, pt2, Operation Aquarius pt1
|
||||||
|
{ "5969f90786f77420d2328015", new QuestRequirement{QuestStatus = 4, PreceedingQuest="596a204686f774576d4c95de"}}, // Painkiller, sanitary standards pt2
|
||||||
|
{ "5969f9e986f7741dde183a50", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5969f90786f77420d2328015"}}, // Pharmacist, Painkiller
|
||||||
|
{ "596a0e1686f7741ddf17dbee", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5969f9e986f7741dde183a50"}}, // Supply plans, Pharmacist
|
||||||
|
{ "596a101f86f7741ddb481582", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5969f9e986f7741dde183a50"}}, //Kind of sabotage, Pharmacist
|
||||||
|
{ "596a1e6c86f7741ddc2d3206", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5969f9e986f7741dde183a50"}}, // General wares, Pharmacist
|
||||||
|
{ "596a204686f774576d4c95de", new QuestRequirement{QuestStatus = 4, PreceedingQuest="59689ee586f7740d1570bbd5"}}, // Sanitary Standards, pt2
|
||||||
|
{ "596a218586f77420d232807c", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5969f9e986f7741dde183a50"} } , // Car repair
|
||||||
|
{ "596b36c586f77450d6045ad2", new QuestRequirement{QuestStatus = 4, PreceedingQuest=""} }, // Supplier
|
||||||
|
{ "596b43fb86f77457ca186186", new QuestRequirement{QuestStatus = 4, PreceedingQuest="596b36c586f77450d6045ad2"} }, // The Extortionist, Supplier
|
||||||
|
{ "596b455186f77457cb50eccb", new QuestRequirement{QuestStatus = 4, PreceedingQuest="596b43fb86f77457ca186186"}}, // Stirrup, The Extortionist
|
||||||
|
{ "5979ed3886f77431307dc512", new QuestRequirement{QuestStatus = 4, PreceedingQuest="596b43fb86f77457ca186186"}}, // What’s on the flash drive?, The Extortionist
|
||||||
|
{ "5979eee086f774311955e614", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5979ed3886f77431307dc512"} }, // Golden swag, What’s on the flash drive?
|
||||||
|
{ "5979f8bb86f7743ec214c7a6", new QuestRequirement{QuestStatus = 2, PreceedingQuest="5979f9ba86f7740f6c3fe9f2"} }, // Polikhim hobo
|
||||||
|
{ "5979f9ba86f7740f6c3fe9f2", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5979eee086f774311955e614"}}, // Chemical pt1, Golden swag
|
||||||
|
{ "597a0b2986f77426d66c0633", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5979f9ba86f7740f6c3fe9f2"}}, // Chemical pt2, Chemical, p.1
|
||||||
|
{ "597a0e5786f77426d66c0636", new QuestRequirement{QuestStatus = 4, PreceedingQuest="597a0b2986f77426d66c0633"}}, // Chemical pt3, Chemical, p. 2
|
||||||
|
{ "597a0f5686f774273b74f676", new QuestRequirement{QuestStatus = 4, PreceedingQuest="597a0e5786f77426d66c0636"}}, // Chemical pt4, Chemical, p. 3
|
||||||
|
{ "597a160786f77477531d39d2", new QuestRequirement{QuestStatus = 4, PreceedingQuest="597a0e5786f77426d66c0636"}}, // Out of curiosity, Chemical, p. 3
|
||||||
|
{ "597a171586f77405ba6887d3", new QuestRequirement{QuestStatus = 4, PreceedingQuest="597a0e5786f77426d66c0636"}}, // Big customer, Chemical, p. 3
|
||||||
|
{ "59c124d686f774189b3c843f", new QuestRequirement{QuestStatus = 4, PreceedingQuest="59674eb386f774539f14813a"}}, // bp depot, delivery from the past
|
||||||
|
{ "59c50a9e86f7745fef66f4ff", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5967725e86f774601a446662"}}, // The Punisher part 1, shaking up teller
|
||||||
|
{ "59c50c8886f7745fed3193bf", new QuestRequirement{QuestStatus = 4, PreceedingQuest="59c50a9e86f7745fef66f4ff"}}, // The Punisher. Part 2
|
||||||
|
{ "59c512ad86f7741f0d09de9b", new QuestRequirement{QuestStatus = 4, PreceedingQuest="59c50c8886f7745fed3193bf"}}, // The Punisher. Part 3,
|
||||||
|
{ "59c9392986f7742f6923add2", new QuestRequirement{QuestStatus = 4, PreceedingQuest="597a0f5686f774273b74f676"}}, // Trust regain, chemical p4
|
||||||
|
{ "59c93e8e86f7742a406989c4", new QuestRequirement{QuestStatus = 4, PreceedingQuest="597a0e5786f77426d66c0636"}}, // Loyalty buyout, Chemical, pt3
|
||||||
|
{ "59ca1a6286f774509a270942", new QuestRequirement{QuestStatus = 4, PreceedingQuest="597a0f5686f774273b74f676"}}, // No offence, Chemical pt4
|
||||||
|
{ "59ca264786f77445a80ed044", new QuestRequirement{QuestStatus = 4, PreceedingQuest="59c512ad86f7741f0d09de9b"}}, // The Punisher. Part 4, The Punisher. Part 3
|
||||||
|
{ "59ca29fb86f77445ab465c87", new QuestRequirement{QuestStatus = 4, PreceedingQuest="59ca264786f77445a80ed044"}}, // The Punisher. Part 5, The Punisher. Part 4
|
||||||
|
{ "59ca2eb686f77445a80ed049", new QuestRequirement{QuestStatus = 4, PreceedingQuest="59ca29fb86f77445ab465c87"}}, // The Punisher. Part 6, The Punisher. Part 5
|
||||||
|
{ "59f9da6786f774714230d751", new QuestRequirement{QuestStatus = 4, PreceedingQuest=""} }, // no idea
|
||||||
|
{ "5a03153686f77442d90e2171", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5a27b87686f77460de0252a8"}}, // Spa Tour. Part 1, Humanitarian Supplies
|
||||||
|
{ "5a03173786f77451cb427172", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5a03153686f77442d90e2171"}}, // Spa Tour. Part 2, Spa Tour. Part 1
|
||||||
|
{ "5a0327ba86f77456b9154236", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5a03173786f77451cb427172"}},// Spa Tour. Part 3, Spa Tour. Part 2
|
||||||
|
{ "5a03296886f774569778596a", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5a0327ba86f77456b9154236"}}, // Spa Tour. Part 4, Spa Tour. Part 3
|
||||||
|
{ "5a0449d586f77474e66227b7", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5a03296886f774569778596a"}}, // Spa Tour. Part 5, Spa Tour. Part 4
|
||||||
|
{ "5a27b75b86f7742e97191958", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5a27d2af86f7744e1115b323"}}, // Fishing Gear, Friend from the west part 2
|
||||||
|
{ "5a27b7a786f774579c3eb376", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5a27b75b86f7742e97191958"}}, // Tigr Safari, Fishing Gear
|
||||||
|
{ "5a27b7d686f77460d847e6a6", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5a27b7a786f774579c3eb376"}}, // Scrap Metal, Tigr Safari
|
||||||
|
{ "5a27b80086f774429a5d7e20", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5a27b7d686f77460d847e6a6"}}, // Eagle Eye, Scrap Metal
|
||||||
|
{ "5a27b87686f77460de0252a8", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5a27b80086f774429a5d7e20"}}, // Humanitarian Supplies, Eagle Eye
|
||||||
|
{ "5a27b9de86f77464e5044585", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5a27b87686f77460de0252a8"}}, // The Cult. Part 1, Humanitarian Supplies
|
||||||
|
{ "5a27ba1c86f77461ea5a3c56", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5a27b9de86f77464e5044585"}}, // The Cult. Part 2, The Cult. Part 1
|
||||||
|
{ "5a27ba9586f7741b543d8e85", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5a0449d586f77474e66227b7"}}, // Spa Tour. Part 6, Spa Tour. Part 5
|
||||||
|
{ "5a27bafb86f7741c73584017", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5a27ba9586f7741b543d8e85"}}, // Spa Tour. Part 7, Spa Tour. Part 6
|
||||||
|
{ "5a27bb1e86f7741f27621b7e", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5a27bafb86f7741c73584017"}}, // Cargo X. Part 1, Spa Tour. Part 7
|
||||||
|
{ "5a27bb3d86f77411ea361a21", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5a27bb1e86f7741f27621b7e"}}, // Cargo X. Part 2, Cargo X. Part 1
|
||||||
|
{ "5a27bb5986f7741dfb660900", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5a27bb3d86f77411ea361a21"}}, // Cargo X. Part 3, Cargo X. Part 2
|
||||||
|
{ "5a27bb8386f7741c770d2d0a", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5a27bafb86f7741c73584017"}}, // Wet Job. Part 1, Spa Tour. Part 7
|
||||||
|
{ "5a27bbf886f774333a418eeb", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5a27bb8386f7741c770d2d0a"}}, // Wet Job. Part 2, Wet Job. Part 1
|
||||||
|
{ "5a27bc1586f7741f6d40fa2f", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5a27bbf886f774333a418eeb"}}, // Wet Job. Part 3, Wet Job. Part 2
|
||||||
|
{ "5a27bc3686f7741c73584026", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5a27bc1586f7741f6d40fa2f"}}, // Wet Job. Part 4, Wet Job. Part 3
|
||||||
|
{ "5a27bc6986f7741c7358402b", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5a27bc3686f7741c73584026"}}, // Wet Job. Part 5, Wet Job. Part 4
|
||||||
|
{ "5a27bc8586f7741b543d8ea4", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5a27bc6986f7741c7358402b"}}, // Wet Job. Part 6, Wet Job. Part 5
|
||||||
|
{ "5a27c99a86f7747d2c6bdd8e", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5979eee086f774311955e614"} }, // Friend from the West. Part 1, golden swag
|
||||||
|
{ "5a27d2af86f7744e1115b323", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5a27c99a86f7747d2c6bdd8e"} }, // Friend from the West. Part 2, Friend from the West. Part 1
|
||||||
|
{ "5a5642ce86f77445c63c3419", new QuestRequirement{QuestStatus = 4, PreceedingQuest=""} }, // Hippocratic Oath,
|
||||||
|
{ "5a68661a86f774500f48afb0", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5969f9e986f7741dde183a50"}}, // Health Care Privacy. Part 1,
|
||||||
|
{ "5a68663e86f774501078f78a", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5a68661a86f774500f48afb0"}}, // Health Care Privacy. Part 2, Health Care Privacy. Part 1
|
||||||
|
{ "5a68665c86f774255929b4c7", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5a68663e86f774501078f78a"}}, // Health Care Privacy. Part 3, Health Care Privacy. Part 2
|
||||||
|
{ "5a68667486f7742607157d28", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5a68665c86f774255929b4c7"}}, // Health Care Privacy. Part 4, Health Care Privacy. Part 3
|
||||||
|
{ "5a68669a86f774255929b4d4", new QuestRequirement{QuestStatus = 4, PreceedingQuest="5a68667486f7742607157d28"} }, // Health Care Privacy. Part 5, Health Care Privacy. Part 4
|
||||||
|
};
|
||||||
|
|
||||||
private static QuestRoot _liveQuestData;
|
private static QuestRoot _liveQuestData;
|
||||||
private static Dictionary<string, Quest> _questData;
|
private static Dictionary<string, Quest> _questData;
|
||||||
private static List<AssortUnlocks> _assortUnlocks;
|
private static List<AssortUnlocks> _assortUnlocks;
|
||||||
@ -297,8 +377,6 @@ namespace AssortGenerator.Common.Helpers
|
|||||||
_assortUnlocks = new List<AssortUnlocks>();
|
_assortUnlocks = new List<AssortUnlocks>();
|
||||||
foreach (var quest in GetQuestData())
|
foreach (var quest in GetQuestData())
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
foreach (var reward in quest.Value.rewards.Success)
|
foreach (var reward in quest.Value.rewards.Success)
|
||||||
{
|
{
|
||||||
if (string.Equals(reward.type, "assortmentunlock", System.StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(reward.type, "assortmentunlock", System.StringComparison.OrdinalIgnoreCase))
|
||||||
@ -323,5 +401,15 @@ namespace AssortGenerator.Common.Helpers
|
|||||||
|
|
||||||
return _assortUnlocks;
|
return _assortUnlocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static QuestRequirement GetQuestDependancy(string questId)
|
||||||
|
{
|
||||||
|
if (questWithPreceedingQuest.ContainsKey(questId))
|
||||||
|
{
|
||||||
|
return questWithPreceedingQuest[questId];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
30
QuestValidator.Common/JsonWriter.cs
Normal file
30
QuestValidator.Common/JsonWriter.cs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
using QuestValidator.Helpers;
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text.Encodings.Web;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Unicode;
|
||||||
|
|
||||||
|
namespace QuestValidator.Common
|
||||||
|
{
|
||||||
|
public static class JsonWriter
|
||||||
|
{
|
||||||
|
public static void WriteJson<T>(T itemToSerialise, string outputFolderName, string workingPath, string fileName)
|
||||||
|
{
|
||||||
|
var outputPath = $"{workingPath}\\output\\{outputFolderName}";
|
||||||
|
DiskHelpers.CreateDirIfDoesntExist(outputPath);
|
||||||
|
|
||||||
|
Console.WriteLine($"Writing json file to {outputPath}");
|
||||||
|
|
||||||
|
var options = new JsonSerializerOptions
|
||||||
|
{
|
||||||
|
WriteIndented = true,
|
||||||
|
IgnoreNullValues = true,
|
||||||
|
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
|
||||||
|
|
||||||
|
};
|
||||||
|
var json = JsonSerializer.Serialize(itemToSerialise, options);
|
||||||
|
File.WriteAllText($"{outputPath}\\{fileName}.json", json);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
QuestValidator.Common/Models/QuestRequirement.cs
Normal file
11
QuestValidator.Common/Models/QuestRequirement.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
namespace QuestValidator.Common.Models
|
||||||
|
{
|
||||||
|
public class QuestRequirement
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// // success = 4, fail = 5, started = 2
|
||||||
|
/// </summary>
|
||||||
|
public int QuestStatus { get; set; }
|
||||||
|
public string PreceedingQuest { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -11,6 +11,7 @@ namespace QuestValidator.Models
|
|||||||
|
|
||||||
public class Quest
|
public class Quest
|
||||||
{
|
{
|
||||||
|
public string QuestName { get; set; }
|
||||||
public string _id { get; set; }
|
public string _id { get; set; }
|
||||||
public bool canShowNotificationsInGame { get; set; }
|
public bool canShowNotificationsInGame { get; set; }
|
||||||
public Conditions conditions { get; set; }
|
public Conditions conditions { get; set; }
|
||||||
@ -32,7 +33,7 @@ namespace QuestValidator.Models
|
|||||||
public ConditionProps _props { get; set; }
|
public ConditionProps _props { get; set; }
|
||||||
public List<AvailableFor> AvailableForFinish { get; set; }
|
public List<AvailableFor> AvailableForFinish { get; set; }
|
||||||
public List<AvailableFor> AvailableForStart { get; set; }
|
public List<AvailableFor> AvailableForStart { get; set; }
|
||||||
//public List<object> Fail { get; set; }
|
public List<AvailableFor> Fail { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ConditionProps
|
public class ConditionProps
|
||||||
@ -54,7 +55,6 @@ namespace QuestValidator.Models
|
|||||||
|
|
||||||
public class Counter
|
public class Counter
|
||||||
{
|
{
|
||||||
//public List<Condition> conditions { get; set; }
|
|
||||||
public string id { get; set; }
|
public string id { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,16 +66,46 @@ namespace QuestValidator.Models
|
|||||||
|
|
||||||
public class AvailableForProps
|
public class AvailableForProps
|
||||||
{
|
{
|
||||||
public int dogtagLevel { get; set; }
|
public object counter { get; set;}
|
||||||
|
public int? dogtagLevel { get; set; }
|
||||||
public string id { get; set; }
|
public string id { get; set; }
|
||||||
public int? index { get; set; }
|
public int? index { get; set; }
|
||||||
public int? maxDurability { get; set; }
|
public int? maxDurability { get; set; }
|
||||||
public int? minDurability { get; set; }
|
public int? minDurability { get; set; }
|
||||||
public string parentId { get; set; }
|
public string parentId { get; set; }
|
||||||
public bool resetOnSessionEnd { get; set; }
|
public bool? resetOnSessionEnd { get; set; }
|
||||||
|
public bool? onlyFoundInRaid { get; set; }
|
||||||
|
public bool? oneSessionOnly { get; set; }
|
||||||
|
public int? plantTime { get; set; }
|
||||||
|
public string zoneId { get; set; }
|
||||||
public object target { get; set; }
|
public object target { get; set; }
|
||||||
//public int value { get; set; }
|
public string type { get;set;}
|
||||||
|
public object status { get; set;}
|
||||||
|
public bool? unknown { get; set; }
|
||||||
|
public bool? doNotResetIfCounterCompleted { get; set; }
|
||||||
|
public object value { get; set; }
|
||||||
|
public int? availableAfter { get; set; }
|
||||||
|
public string compareMethod { get;set;}
|
||||||
public List<object> visibilityConditions { get; set; }
|
public List<object> visibilityConditions { get; set; }
|
||||||
|
public SkillCondition baseAccuracy { get;set;}
|
||||||
|
public SkillCondition durability { get; set; }
|
||||||
|
public SkillCondition effectiveDistance { get; set; }
|
||||||
|
public SkillCondition emptyTacticalSlot { get; set; }
|
||||||
|
public SkillCondition ergonomics { get; set; }
|
||||||
|
public SkillCondition height { get; set; }
|
||||||
|
public SkillCondition magazineCapacity { get; set; }
|
||||||
|
public SkillCondition muzzleVelocity { get; set; }
|
||||||
|
public SkillCondition recoil { get; set; }
|
||||||
|
public SkillCondition weight { get; set; }
|
||||||
|
public SkillCondition width { get; set; }
|
||||||
|
public object containsItems { get; set; }
|
||||||
|
public object hasItemFromCategory { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SkillCondition
|
||||||
|
{
|
||||||
|
public string compareMethod { get; set; }
|
||||||
|
public object value { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Rewards
|
public class Rewards
|
||||||
@ -92,6 +122,7 @@ namespace QuestValidator.Models
|
|||||||
public string type { get; set; }
|
public string type { get; set; }
|
||||||
public int index { get; set; }
|
public int index { get; set; }
|
||||||
public string target { get; set; }
|
public string target { get; set; }
|
||||||
|
public bool? unknown { get; set; }
|
||||||
public List<QuestRewardItem> items { get; set; }
|
public List<QuestRewardItem> items { get; set; }
|
||||||
public int? loyaltyLevel { get; set; }
|
public int? loyaltyLevel { get; set; }
|
||||||
public string traderId { get; set; }
|
public string traderId { get; set; }
|
||||||
@ -108,6 +139,19 @@ namespace QuestValidator.Models
|
|||||||
|
|
||||||
public class QuestRewardUpd
|
public class QuestRewardUpd
|
||||||
{
|
{
|
||||||
public int StackObjectsCount { get; set; }
|
public int? StackObjectsCount { get; set; }
|
||||||
|
public FireModeReward FireMode { get; set; }
|
||||||
|
public FoldeableReward Foldable { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class FireModeReward
|
||||||
|
{
|
||||||
|
public string FireMode { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FoldeableReward
|
||||||
|
{
|
||||||
|
public bool? Folded { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio Version 16
|
# Visual Studio Version 16
|
||||||
VisualStudioVersion = 16.0.31624.102
|
VisualStudioVersion = 16.0.31624.102
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuestValidator", "QuestValidator\QuestValidator.csproj", "{52D43AB5-26C2-4C82-82F2-F63ED911E7F4}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QuestValidator", "QuestValidator\QuestValidator.csproj", "{52D43AB5-26C2-4C82-82F2-F63ED911E7F4}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuestValidator.Common", "QuestValidator.Common\QuestValidator.Common.csproj", "{3F753E26-069F-43EB-979C-B89EE07AB658}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QuestValidator.Common", "QuestValidator.Common\QuestValidator.Common.csproj", "{3F753E26-069F-43EB-979C-B89EE07AB658}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuestValidator.Models", "QuestValidator.Models\QuestValidator.Models.csproj", "{5897813D-96DB-42E2-A436-0CF4472F9C40}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QuestValidator.Models", "QuestValidator.Models\QuestValidator.Models.csproj", "{5897813D-96DB-42E2-A436-0CF4472F9C40}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GenerateQuestFile", "GenerateQuestFile\GenerateQuestFile.csproj", "{ED2CDA5D-F4BC-4655-808A-F46B722437CD}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@ -27,6 +29,10 @@ Global
|
|||||||
{5897813D-96DB-42E2-A436-0CF4472F9C40}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{5897813D-96DB-42E2-A436-0CF4472F9C40}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{5897813D-96DB-42E2-A436-0CF4472F9C40}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{5897813D-96DB-42E2-A436-0CF4472F9C40}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{5897813D-96DB-42E2-A436-0CF4472F9C40}.Release|Any CPU.Build.0 = Release|Any CPU
|
{5897813D-96DB-42E2-A436-0CF4472F9C40}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{ED2CDA5D-F4BC-4655-808A-F46B722437CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{ED2CDA5D-F4BC-4655-808A-F46B722437CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{ED2CDA5D-F4BC-4655-808A-F46B722437CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{ED2CDA5D-F4BC-4655-808A-F46B722437CD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -26,6 +26,8 @@ namespace QuestValidator
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ListMissingQuestsInLive(questData, liveQuestData);
|
||||||
|
|
||||||
CheckForMissingQuestsInAkiFile(liveQuestData, questData);
|
CheckForMissingQuestsInAkiFile(liveQuestData, questData);
|
||||||
|
|
||||||
foreach (var item in questData)
|
foreach (var item in questData)
|
||||||
@ -44,10 +46,11 @@ namespace QuestValidator
|
|||||||
CheckRootItemValues(quest, relatedLiveQuest);
|
CheckRootItemValues(quest, relatedLiveQuest);
|
||||||
|
|
||||||
CheckSuccessRewardItems(quest, relatedLiveQuest);
|
CheckSuccessRewardItems(quest, relatedLiveQuest);
|
||||||
|
|
||||||
CheckStartedRewardItems(quest, relatedLiveQuest);
|
CheckStartedRewardItems(quest, relatedLiveQuest);
|
||||||
|
|
||||||
CheckAvailableForFinishConditionItems(quest, relatedLiveQuest);
|
CheckAvailableForFinishConditionItems(quest, relatedLiveQuest);
|
||||||
|
CheckAvailableForStartConditionItems(quest, relatedLiveQuest);
|
||||||
|
CheckFailConditionItems(quest, relatedLiveQuest);
|
||||||
|
|
||||||
LoggingHelpers.LogInfo("");
|
LoggingHelpers.LogInfo("");
|
||||||
LoggingHelpers.LogInfo("-----");
|
LoggingHelpers.LogInfo("-----");
|
||||||
@ -55,6 +58,61 @@ namespace QuestValidator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void ListMissingQuestsInLive(Dictionary<string, Quest> questData, QuestRoot liveQuestData)
|
||||||
|
{
|
||||||
|
var missingQuests = new List<Quest>();
|
||||||
|
foreach (var quest in questData.Values)
|
||||||
|
{
|
||||||
|
var liveQuest = liveQuestData.data.FirstOrDefault(x=>x._id == quest._id);
|
||||||
|
|
||||||
|
if (liveQuest == null)
|
||||||
|
{
|
||||||
|
missingQuests.Add(quest);
|
||||||
|
LoggingHelpers.LogError($"ERROR Quest {quest._id} {QuestHelper.GetQuestNameById(quest._id)} missing in live");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void CheckFailConditionItems(Quest quest, Quest relatedLiveQuest)
|
||||||
|
{
|
||||||
|
var liveFailConditions = relatedLiveQuest.conditions.Fail;
|
||||||
|
|
||||||
|
// Check count
|
||||||
|
CheckValuesMatch(quest.conditions.Fail.Count, liveFailConditions.Count, "FailCondition mismatch");
|
||||||
|
|
||||||
|
foreach (var failItem in quest.conditions.Fail)
|
||||||
|
{
|
||||||
|
var liveFailItem = liveFailConditions.FirstOrDefault(x => x._props.id == failItem._props.id);
|
||||||
|
if (!ItemExists(liveFailItem, "condition fail item", failItem._props.index.Value))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check parentId
|
||||||
|
CheckValuesMatch(failItem._props.parentId, liveFailItem._props.parentId, "AvailableForFinish parentId mismatch", failItem._props.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void CheckAvailableForStartConditionItems(Quest quest, Quest relatedLiveQuest)
|
||||||
|
{
|
||||||
|
var liveStartConditions = relatedLiveQuest.conditions.AvailableForStart;
|
||||||
|
|
||||||
|
// Check count
|
||||||
|
CheckValuesMatch(quest.conditions.AvailableForStart.Count, liveStartConditions.Count, "AvailableForStartCondition mismtch");
|
||||||
|
|
||||||
|
foreach (var availableForStartItem in quest.conditions.AvailableForStart)
|
||||||
|
{
|
||||||
|
var liveStartItem = liveStartConditions.FirstOrDefault(x=>x._props.id == availableForStartItem._props.id);
|
||||||
|
if (!ItemExists(liveStartItem, "AvailableForStart item", availableForStartItem._props.index.Value))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check parentId
|
||||||
|
CheckValuesMatch(availableForStartItem._props.parentId, liveStartItem._props.parentId, "AvailableForFinish parentId mismatch", availableForStartItem._props.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void LogQuestDetails(Quest quest)
|
private static void LogQuestDetails(Quest quest)
|
||||||
{
|
{
|
||||||
var questName = QuestHelper.GetQuestNameById(quest._id);
|
var questName = QuestHelper.GetQuestNameById(quest._id);
|
||||||
@ -71,7 +129,7 @@ namespace QuestValidator
|
|||||||
//Check image id contains quest id
|
//Check image id contains quest id
|
||||||
if (!quest.image.Contains(quest._id))
|
if (!quest.image.Contains(quest._id))
|
||||||
{
|
{
|
||||||
LoggingHelpers.LogWarning($"WARNING Quest image path does not contain quest id");
|
LoggingHelpers.LogInfo($"INFO Quest image path does not contain quest id");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check started reward count matches
|
// Check started reward count matches
|
||||||
@ -126,7 +184,7 @@ namespace QuestValidator
|
|||||||
// Check item stack count
|
// Check item stack count
|
||||||
if (questSuccessRewardItem.items[0]?.upd != null && relatedLiveRewardItem.items[0]?.upd != null)
|
if (questSuccessRewardItem.items[0]?.upd != null && relatedLiveRewardItem.items[0]?.upd != null)
|
||||||
{
|
{
|
||||||
CheckValuesMatch(questSuccessRewardItem.items[0].upd.StackObjectsCount, relatedLiveRewardItem.items[0].upd.StackObjectsCount, "mismatch for success item StackObjectsCount", questSuccessRewardItem.items[0]._id);
|
CheckValuesMatch(questSuccessRewardItem.items[0].upd.StackObjectsCount.Value, relatedLiveRewardItem.items[0].upd.StackObjectsCount.Value, "mismatch for success item StackObjectsCount", questSuccessRewardItem.items[0]._id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check sub items match
|
// check sub items match
|
||||||
@ -327,7 +385,7 @@ namespace QuestValidator
|
|||||||
// Check item stack count
|
// Check item stack count
|
||||||
if (questStartedRewardItem.items[0] != null && questStartedRewardItem.items[0].upd != null)
|
if (questStartedRewardItem.items[0] != null && questStartedRewardItem.items[0].upd != null)
|
||||||
{
|
{
|
||||||
CheckValuesMatch(questStartedRewardItem.items[0].upd.StackObjectsCount, relatedLiveRewardItem.items[0].upd.StackObjectsCount, "mismatch for started item StackObjectsCount", questStartedRewardItem.items[0]._id);
|
CheckValuesMatch(questStartedRewardItem.items[0].upd.StackObjectsCount.Value, relatedLiveRewardItem.items[0].upd.StackObjectsCount.Value, "mismatch for started item StackObjectsCount", questStartedRewardItem.items[0]._id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -362,6 +420,9 @@ namespace QuestValidator
|
|||||||
|
|
||||||
private static void CheckAvailableForFinishConditionItems(Quest quest, Quest relatedLiveQuest)
|
private static void CheckAvailableForFinishConditionItems(Quest quest, Quest relatedLiveQuest)
|
||||||
{
|
{
|
||||||
|
// Check count
|
||||||
|
CheckValuesMatch(quest.conditions.AvailableForFinish.Count, relatedLiveQuest.conditions.AvailableForFinish.Count, "AvailableForFinish mismtch");
|
||||||
|
|
||||||
foreach (var availableForFinishItem in quest.conditions.AvailableForFinish)
|
foreach (var availableForFinishItem in quest.conditions.AvailableForFinish)
|
||||||
{
|
{
|
||||||
AvailableFor liveFinishItem = relatedLiveQuest.conditions.AvailableForFinish.Find(x => x._props.id == availableForFinishItem._props.id);
|
AvailableFor liveFinishItem = relatedLiveQuest.conditions.AvailableForFinish.Find(x => x._props.id == availableForFinishItem._props.id);
|
||||||
@ -374,7 +435,7 @@ namespace QuestValidator
|
|||||||
CheckValuesMatch(availableForFinishItem._props.parentId, liveFinishItem._props.parentId, "AvailableForFinish parentId mismatch", availableForFinishItem._props.id);
|
CheckValuesMatch(availableForFinishItem._props.parentId, liveFinishItem._props.parentId, "AvailableForFinish parentId mismatch", availableForFinishItem._props.id);
|
||||||
|
|
||||||
// check AvailableForFinish resetOnSessionEnd
|
// check AvailableForFinish resetOnSessionEnd
|
||||||
CheckValuesMatch(availableForFinishItem._props.resetOnSessionEnd, liveFinishItem._props.resetOnSessionEnd, "AvailableForFinish resetOnSessionEnd value mismatch", availableForFinishItem._props.id);
|
CheckValuesMatch(availableForFinishItem._props.resetOnSessionEnd.Value, liveFinishItem._props.resetOnSessionEnd.Value, "AvailableForFinish resetOnSessionEnd value mismatch", availableForFinishItem._props.id);
|
||||||
|
|
||||||
// check AvailableForFinish target
|
// check AvailableForFinish target
|
||||||
CheckValuesMatch(Convert.ToString(availableForFinishItem._props.target), Convert.ToString(liveFinishItem._props.target), "AvailableForFinish target value mismatch", availableForFinishItem._props.id);
|
CheckValuesMatch(Convert.ToString(availableForFinishItem._props.target), Convert.ToString(liveFinishItem._props.target), "AvailableForFinish target value mismatch", availableForFinishItem._props.id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user