forked from chomp/ChompQuestVerifier
Dump cleaner now handles:
trader base files Location base files
This commit is contained in:
parent
267b8a8d43
commit
055a6f901a
@ -40,6 +40,9 @@ namespace DumpCleaner
|
|||||||
new DumpData{InputName = "resp.client.hideout.production.scavcase.recipes", OutputName = "scavcase", OutputFolder = "hideout"},
|
new DumpData{InputName = "resp.client.hideout.production.scavcase.recipes", OutputName = "scavcase", OutputFolder = "hideout"},
|
||||||
new DumpData{InputName = "resp.client.hideout.settings", OutputName = "settings", OutputFolder = "hideout"},
|
new DumpData{InputName = "resp.client.hideout.settings", OutputName = "settings", OutputFolder = "hideout"},
|
||||||
|
|
||||||
|
new DumpData{InputName = "resp.client.locations", OutputName = "locations", OutputFolder = "locations", SpecialCase = true},
|
||||||
|
|
||||||
|
new DumpData{InputName = "resp.client.trading.api.traderSettings", OutputName = "traders", OutputFolder = "traders", SpecialCase = true},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,6 +51,7 @@ namespace DumpCleaner
|
|||||||
public string InputName { get; set; }
|
public string InputName { get; set; }
|
||||||
public string OutputName { get; set; }
|
public string OutputName { get; set; }
|
||||||
public string OutputFolder { get; set; }
|
public string OutputFolder { get; set; }
|
||||||
|
public bool SpecialCase { get; internal set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Dump
|
public class Dump
|
||||||
|
149
DumpCleaner/Helpers/TraderSellCategories.cs
Normal file
149
DumpCleaner/Helpers/TraderSellCategories.cs
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
// read contents of input folder
|
||||||
|
public static class TraderSellCategories
|
||||||
|
{
|
||||||
|
private static readonly Dictionary<string, List<string>> _dict = new Dictionary<string, List<string>>
|
||||||
|
{
|
||||||
|
{ "5a7c2eca46aef81a7ca2145d", new List<string> { "5b5f78dc86f77409407a7f8e",
|
||||||
|
"5b5f71b386f774093f2ecf11",
|
||||||
|
"5b5f71c186f77409407a7ec0",
|
||||||
|
"5b5f71de86f774093f2ecf13",
|
||||||
|
"5b5f724186f77447ed5636ad",
|
||||||
|
"5b5f736886f774094242f193",
|
||||||
|
"5b5f73ec86f774093e6cb4fd",
|
||||||
|
"5b5f74cc86f77447ec5d770a",
|
||||||
|
"5b5f750686f774093e6cb503",
|
||||||
|
"5b5f751486f77447ec5d770c",
|
||||||
|
"5b5f752e86f774093e6cb505",
|
||||||
|
"5b5f754a86f774094242f19b",
|
||||||
|
"5b5f755f86f77447ec5d770e",
|
||||||
|
"5b5f757486f774093e6cb507",
|
||||||
|
"5b5f75b986f77447ec5d7710",
|
||||||
|
"5b5f75c686f774094242f19f",
|
||||||
|
"5b5f75e486f77447ec5d7712",
|
||||||
|
"5b5f760586f774093e6cb509",
|
||||||
|
"5b5f761f86f774094242f1a1",
|
||||||
|
"5b5f764186f77447ec5d7714",
|
||||||
|
"5b47574386f77428ca22b33e",
|
||||||
|
"5b47574386f77428ca22b341",
|
||||||
|
"5b47574386f77428ca22b345",
|
||||||
|
"5b47574386f77428ca22b2ef",
|
||||||
|
"5b47574386f77428ca22b343" } },
|
||||||
|
{ "5ac3b934156ae10c4430e83c", new List<string> { "5b47574386f77428ca22b33f" } },
|
||||||
|
{ "5c0647fdd443bc2504c2d371", new List<string> {"5b5f78e986f77447ed5636b1",
|
||||||
|
"5b5f791486f774093f2ed3be",
|
||||||
|
"5b5f792486f77447ed5636b3",
|
||||||
|
"5b5f794b86f77409407a7f92",
|
||||||
|
"5b5f798886f77447ed5636b5",
|
||||||
|
"5b5f7a0886f77409407a7f96",
|
||||||
|
"5b5f75b986f77447ec5d7710",
|
||||||
|
"5b47574386f77428ca22b346",
|
||||||
|
"5b47574386f77428ca22b340",
|
||||||
|
"5b47574386f77428ca22b2ed",
|
||||||
|
"5b47574386f77428ca22b2f2"} },
|
||||||
|
{ "54cb50c76803fa8b248b4571", new List<string> {"5b5f71b386f774093f2ecf11",
|
||||||
|
"5b5f71c186f77409407a7ec0",
|
||||||
|
"5b5f71de86f774093f2ecf13",
|
||||||
|
"5b5f724186f77447ed5636ad",
|
||||||
|
"5b5f736886f774094242f193",
|
||||||
|
"5b5f73ec86f774093e6cb4fd",
|
||||||
|
"5b5f74cc86f77447ec5d770a",
|
||||||
|
"5b5f750686f774093e6cb503",
|
||||||
|
"5b5f751486f77447ec5d770c",
|
||||||
|
"5b5f752e86f774093e6cb505",
|
||||||
|
"5b5f754a86f774094242f19b",
|
||||||
|
"5b5f755f86f77447ec5d770e",
|
||||||
|
"5b5f757486f774093e6cb507",
|
||||||
|
"5b5f75b986f77447ec5d7710",
|
||||||
|
"5b5f75c686f774094242f19f",
|
||||||
|
"5b5f75e486f77447ec5d7712",
|
||||||
|
"5b5f760586f774093e6cb509",
|
||||||
|
"5b5f761f86f774094242f1a1",
|
||||||
|
"5b5f764186f77447ec5d7714",
|
||||||
|
"5b5f78dc86f77409407a7f8e",
|
||||||
|
"5b47574386f77428ca22b346",
|
||||||
|
"5b47574386f77428ca22b345"} },
|
||||||
|
{ "54cb57776803fa99248b456e", new List<string> {"5b47574386f77428ca22b344",
|
||||||
|
"5b47574386f77428ca22b2f1",
|
||||||
|
"5b47574386f77428ca22b340",
|
||||||
|
"5b47574386f77428ca22b2f4",
|
||||||
|
"5b47574386f77428ca22b2f3",
|
||||||
|
"5b47574386f77428ca22b342",
|
||||||
|
"5b47574386f77428ca22b341",
|
||||||
|
"5b5f6fa186f77409407a7eb7",
|
||||||
|
"5b47574386f77428ca22b343"} },
|
||||||
|
{ "579dc571d53a0658a154fbec", new List<string> {"5b47574386f77428ca22b33e",
|
||||||
|
"5b47574386f77428ca22b33f",
|
||||||
|
"5b5f78dc86f77409407a7f8e",
|
||||||
|
"5b47574386f77428ca22b346",
|
||||||
|
"5b47574386f77428ca22b340",
|
||||||
|
"5b47574386f77428ca22b344",
|
||||||
|
"5b47574386f77428ca22b342",
|
||||||
|
"5b47574386f77428ca22b341",
|
||||||
|
"5b47574386f77428ca22b345",
|
||||||
|
"5b47574386f77428ca22b343",
|
||||||
|
"5b5f71b386f774093f2ecf11",
|
||||||
|
"5b5f71c186f77409407a7ec0",
|
||||||
|
"5b5f71de86f774093f2ecf13",
|
||||||
|
"5b5f724186f77447ed5636ad",
|
||||||
|
"5b5f736886f774094242f193",
|
||||||
|
"5b5f73ec86f774093e6cb4fd",
|
||||||
|
"5b5f74cc86f77447ec5d770a",
|
||||||
|
"5b5f750686f774093e6cb503",
|
||||||
|
"5b5f751486f77447ec5d770c",
|
||||||
|
"5b5f752e86f774093e6cb505",
|
||||||
|
"5b5f754a86f774094242f19b",
|
||||||
|
"5b5f755f86f77447ec5d770e",
|
||||||
|
"5b5f757486f774093e6cb507",
|
||||||
|
"5b5f75b986f77447ec5d7710",
|
||||||
|
"5b5f75c686f774094242f19f",
|
||||||
|
"5b5f75e486f77447ec5d7712",
|
||||||
|
"5b5f760586f774093e6cb509",
|
||||||
|
"5b5f761f86f774094242f1a1",
|
||||||
|
"5b5f764186f77447ec5d7714"} },
|
||||||
|
{ "5935c25fb3acc3127c3d8cd9", new List<string> {"5b47574386f77428ca22b33f",
|
||||||
|
"5b5f78dc86f77409407a7f8e",
|
||||||
|
"5b5f71b386f774093f2ecf11",
|
||||||
|
"5b5f71c186f77409407a7ec0",
|
||||||
|
"5b5f71de86f774093f2ecf13",
|
||||||
|
"5b5f724186f77447ed5636ad",
|
||||||
|
"5b5f736886f774094242f193",
|
||||||
|
"5b5f73ec86f774093e6cb4fd",
|
||||||
|
"5b5f74cc86f77447ec5d770a",
|
||||||
|
"5b5f750686f774093e6cb503",
|
||||||
|
"5b5f751486f77447ec5d770c",
|
||||||
|
"5b5f752e86f774093e6cb505",
|
||||||
|
"5b5f754a86f774094242f19b",
|
||||||
|
"5b5f755f86f77447ec5d770e",
|
||||||
|
"5b5f757486f774093e6cb507",
|
||||||
|
"5b5f75b986f77447ec5d7710",
|
||||||
|
"5b5f75c686f774094242f19f",
|
||||||
|
"5b5f75e486f77447ec5d7712",
|
||||||
|
"5b5f760586f774093e6cb509",
|
||||||
|
"5b5f761f86f774094242f1a1",
|
||||||
|
"5b5f764186f77447ec5d7714",
|
||||||
|
"5b47574386f77428ca22b346",
|
||||||
|
"5b47574386f77428ca22b340",
|
||||||
|
"5b47574386f77428ca22b344",
|
||||||
|
"5b47574386f77428ca22b341"} },
|
||||||
|
{ "58330581ace78e27b8b10cee", new List<string> {"5b5f71b386f774093f2ecf11",
|
||||||
|
"5b5f71c186f77409407a7ec0",
|
||||||
|
"5b5f71de86f774093f2ecf13",
|
||||||
|
"5b5f724186f77447ed5636ad",
|
||||||
|
"5b5f736886f774094242f193",
|
||||||
|
"5b5f73ec86f774093e6cb4fd",
|
||||||
|
"5b5f74cc86f77447ec5d770a",
|
||||||
|
"5b5f750686f774093e6cb503",
|
||||||
|
"5b5f751486f77447ec5d770c",
|
||||||
|
"5b5f752e86f774093e6cb505",
|
||||||
|
"5b5f754a86f774094242f19b",
|
||||||
|
"5b5f755f86f77447ec5d770e",
|
||||||
|
"5b5f757486f774093e6cb507",
|
||||||
|
"5b5f78e986f77447ed5636b1",
|
||||||
|
"5b5f78fc86f77409407a7f90"} },
|
||||||
|
};
|
||||||
|
|
||||||
|
public static List<string> GetCategoriesByTraderId(string id)
|
||||||
|
{
|
||||||
|
return _dict[id];
|
||||||
|
}
|
||||||
|
}
|
5
DumpCleaner/Models/Location.cs
Normal file
5
DumpCleaner/Models/Location.cs
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
// read contents of input folder
|
||||||
|
public class Location
|
||||||
|
{
|
||||||
|
public string Id { get; set; }
|
||||||
|
}
|
26
DumpCleaner/Models/Trader.cs
Normal file
26
DumpCleaner/Models/Trader.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// read contents of input folder
|
||||||
|
public class Trader
|
||||||
|
{
|
||||||
|
public string _id { get; set; }
|
||||||
|
public bool customization_seller { get; set; }
|
||||||
|
public string name { get; set; }
|
||||||
|
public string surname { get; set; }
|
||||||
|
public string nickname { get; set; }
|
||||||
|
public string location { get; set; }
|
||||||
|
public string avatar { get; set; }
|
||||||
|
public int balance_rub { get; set; }
|
||||||
|
public int balance_dol { get; set; }
|
||||||
|
public int balance_eur { get; set; }
|
||||||
|
public bool unlockedByDefault { get; set; }
|
||||||
|
public int discount { get; set; }
|
||||||
|
public int discount_end { get; set; }
|
||||||
|
public bool buyer_up { get; set; }
|
||||||
|
public string currency { get; set; }
|
||||||
|
public int nextResupply { get; set; }
|
||||||
|
public object repair { get; set; }
|
||||||
|
public object insurance { get; set; }
|
||||||
|
public bool medic { get; set; }
|
||||||
|
public int gridHeight { get; set; }
|
||||||
|
public List<object> loyaltyLevels { get; set; }
|
||||||
|
public List<string> sell_category { get; set; }
|
||||||
|
}
|
@ -1,7 +1,4 @@
|
|||||||
|
using AssortGenerator.Common.Helpers;
|
||||||
|
|
||||||
// read contents of input folder
|
|
||||||
using AssortGenerator.Common.Helpers;
|
|
||||||
using DumpCleaner;
|
using DumpCleaner;
|
||||||
using QuestValidator.Common;
|
using QuestValidator.Common;
|
||||||
using QuestValidator.Common.Helpers;
|
using QuestValidator.Common.Helpers;
|
||||||
@ -11,10 +8,7 @@ using System.Text.Json;
|
|||||||
var inputPath = DiskHelpers.CreateWorkingFolders();
|
var inputPath = DiskHelpers.CreateWorkingFolders();
|
||||||
InputFileHelper.SetInputFiles(inputPath);
|
InputFileHelper.SetInputFiles(inputPath);
|
||||||
|
|
||||||
var filePaths = InputFileHelper.GetInputFilePaths();
|
foreach (var path in InputFileHelper.GetInputFilePaths())
|
||||||
|
|
||||||
//create list of paths
|
|
||||||
foreach (var path in filePaths)
|
|
||||||
{
|
{
|
||||||
var filename = Path.GetFileNameWithoutExtension(path);
|
var filename = Path.GetFileNameWithoutExtension(path);
|
||||||
var names = DumpFiles.filenames.FirstOrDefault(x => filename.StartsWith(x.InputName));
|
var names = DumpFiles.filenames.FirstOrDefault(x => filename.StartsWith(x.InputName));
|
||||||
@ -34,15 +28,66 @@ foreach (var path in filePaths)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Special case, Do special tasks with it
|
||||||
|
if (names.SpecialCase)
|
||||||
|
{
|
||||||
|
HandleSpecialCase(names, dumpFile);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
JsonWriter.WriteJson(dumpFile.data, names.OutputFolder, Directory.GetCurrentDirectory(), names.OutputName);
|
JsonWriter.WriteJson(dumpFile.data, names.OutputFolder, Directory.GetCurrentDirectory(), names.OutputName);
|
||||||
LoggingHelpers.LogToConsole($"Found file: {filename} wrote file to output folder");
|
LoggingHelpers.LogToConsole($"Found file: {filename} wrote file to output folder");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HandleSpecialCase(DumpData names, Dump dumpFile)
|
||||||
|
{
|
||||||
|
if (names.InputName == "resp.client.locations")
|
||||||
|
{
|
||||||
|
HandleLocationsFile(names, dumpFile);
|
||||||
|
}
|
||||||
|
|
||||||
// iterate over paths
|
if (names.InputName == "resp.client.trading.api.traderSettings")
|
||||||
|
{
|
||||||
|
HandleTraderSettingsFile(names, dumpFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// check if filename matches a file in a list of files we want
|
void HandleLocationsFile(DumpData names, Dump dumpFile)
|
||||||
// it matches: clean up file and output to 'output'
|
{
|
||||||
// get data object from it, save this into new file
|
var locationsRoot = JsonSerializer.Deserialize<Dictionary<string, object>>(dumpFile.data.ToString());
|
||||||
|
var locations = JsonSerializer.Deserialize<Dictionary<string, object>>(locationsRoot.First().Value.ToString());
|
||||||
|
|
||||||
// doesnt match: ignore it with warning
|
foreach (var location in locations)
|
||||||
|
{
|
||||||
|
var locationData = JsonSerializer.Deserialize<Location>(location.Value.ToString());
|
||||||
|
|
||||||
|
var mapName = locationData.Id.ToLower();
|
||||||
|
if (mapName == "lighthouse2")
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (new string[] { "bigmap", "interchange", "lighthouse", "rezervbase", "shoreline", "woods" }.Contains(mapName))
|
||||||
|
{
|
||||||
|
// TODO: add back airdrop chance
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonWriter.WriteJson(mapdata, $"{names.OutputFolder}/{locationData.Id.ToLower()}", Directory.GetCurrentDirectory(), "base");
|
||||||
|
LoggingHelpers.LogToConsole($"Found map file: {locationData.Id} wrote file to output folder");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HandleTraderSettingsFile(DumpData names, Dump dumpFile)
|
||||||
|
{
|
||||||
|
var traders = JsonSerializer.Deserialize<List<object>>(dumpFile.data.ToString());
|
||||||
|
|
||||||
|
foreach (var trader in traders)
|
||||||
|
{
|
||||||
|
var traderData = JsonSerializer.Deserialize<Trader>(trader.ToString());
|
||||||
|
traderData.sell_category = TraderSellCategories.GetCategoriesByTraderId(traderData._id);
|
||||||
|
|
||||||
|
JsonWriter.WriteJson(traderData, $"{names.OutputFolder}/{traderData._id}", Directory.GetCurrentDirectory(), "base");
|
||||||
|
LoggingHelpers.LogToConsole($"Found trader file: {traderData._id} wrote file to output folder");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 16
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 16.0.31624.102
|
VisualStudioVersion = 17.0.32002.185
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user