using DumpCleaner; using QuestValidator.Common; using QuestValidator.Common.Helpers; using System.Text.Json; public class LocationParser { private readonly Dictionary locations = new(); private readonly string outputPath; public LocationParser(string outputPath) { this.outputPath = outputPath; } internal void AddLocalLootDump(Dump dumpFile) { var locationData = JsonSerializer.Deserialize(dumpFile.data.ToString()); var locationName = locationData.Id; // already parsed, skip if (locations.ContainsKey(locationName)) { return; } // remove loot as not needed for base.json locationData.Loot?.Clear(); locations.Add(locationName, locationData); } internal void CreateLocationFile() { foreach (var location in locations) { if (string.Equals(location.Value.Id, "lighthouse2", StringComparison.CurrentCultureIgnoreCase)) { continue; } JsonWriter.WriteJson(location.Value, $"{outputPath}/{location.Value.Id.ToLower()}", Directory.GetCurrentDirectory(), "base"); LoggingHelpers.LogToConsole($"Found map file: {location.Value.Id} wrote file to output folder"); } } }