diff --git a/AssortGenerator.Common/JsonWriter.cs b/AssortGenerator.Common/JsonWriter.cs index eac9328..bb64f7b 100644 --- a/AssortGenerator.Common/JsonWriter.cs +++ b/AssortGenerator.Common/JsonWriter.cs @@ -19,6 +19,7 @@ namespace AssortGenerator.Common var options = new JsonSerializerOptions { WriteIndented = true, + DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull, Encoder = JavaScriptEncoder.Create(UnicodeRanges.BasicLatin, UnicodeRanges.Cyrillic) }; diff --git a/AssortGenerator.Models/Output/AssortRoot.cs b/AssortGenerator.Models/Output/AssortRoot.cs index 0371590..a9ca514 100644 --- a/AssortGenerator.Models/Output/AssortRoot.cs +++ b/AssortGenerator.Models/Output/AssortRoot.cs @@ -20,8 +20,10 @@ namespace AssortGenerator.Models.Output public class Upd { - public bool UnlimitedCount { get; set; } - public int StackObjectsCount { get; set; } + public Foldable Foldable { get;set;} + public UpdFireMode FireMode { get;set;} + public bool? UnlimitedCount { get; set; } + public int? StackObjectsCount { get; set; } public object BuyRestrictionMax { get; set; } public int? BuyRestrictionCurrent { get; set; } } diff --git a/AssortGenerator.Models/Output/FireMode.cs b/AssortGenerator.Models/Output/FireMode.cs new file mode 100644 index 0000000..2178f55 --- /dev/null +++ b/AssortGenerator.Models/Output/FireMode.cs @@ -0,0 +1,7 @@ +namespace AssortGenerator.Models.Output +{ + public class UpdFireMode + { + public string FireMode { get;set; } + } +} \ No newline at end of file diff --git a/AssortGenerator.Models/Output/Foldable.cs b/AssortGenerator.Models/Output/Foldable.cs new file mode 100644 index 0000000..a47d17a --- /dev/null +++ b/AssortGenerator.Models/Output/Foldable.cs @@ -0,0 +1,7 @@ +namespace AssortGenerator.Models.Output +{ + public class Foldable + { + public bool Folded { get; set; } + } +} \ No newline at end of file diff --git a/AssortGenerator/Program.cs b/AssortGenerator/Program.cs index 4169b82..0778c1e 100644 --- a/AssortGenerator/Program.cs +++ b/AssortGenerator/Program.cs @@ -37,6 +37,16 @@ namespace AssortGenerator string itemsJson = data.GetProperty("items").ToString(); List items = JsonSerializer.Deserialize>(itemsJson); + // fix items that have ran out of stock in the dump and give it some default values + foreach (var item in items) + { + if (item.upd?.StackObjectsCount == 0 && item.slotId == "hideout") + { + LoggingHelpers.LogError($"item {item._tpl} found with stack count of 0, changing to 100"); + item.upd.StackObjectsCount = 100; + } + } + // Find barter scheme node and parse into object var barterSchemeJson = data.GetProperty("barter_scheme").ToString(); var barterSchemeItems = JsonSerializer.Deserialize>(barterSchemeJson);