Correctly generate upd object + dont add stackobjectscount to mods
This commit is contained in:
parent
9c40f1ae96
commit
dfb30cd86a
@ -19,6 +19,7 @@ namespace AssortGenerator.Common
|
|||||||
var options = new JsonSerializerOptions
|
var options = new JsonSerializerOptions
|
||||||
{
|
{
|
||||||
WriteIndented = true,
|
WriteIndented = true,
|
||||||
|
DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull,
|
||||||
Encoder = JavaScriptEncoder.Create(UnicodeRanges.BasicLatin, UnicodeRanges.Cyrillic)
|
Encoder = JavaScriptEncoder.Create(UnicodeRanges.BasicLatin, UnicodeRanges.Cyrillic)
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -20,8 +20,10 @@ namespace AssortGenerator.Models.Output
|
|||||||
|
|
||||||
public class Upd
|
public class Upd
|
||||||
{
|
{
|
||||||
public bool UnlimitedCount { get; set; }
|
public Foldable Foldable { get;set;}
|
||||||
public int StackObjectsCount { get; set; }
|
public UpdFireMode FireMode { get;set;}
|
||||||
|
public bool? UnlimitedCount { get; set; }
|
||||||
|
public int? StackObjectsCount { get; set; }
|
||||||
public object BuyRestrictionMax { get; set; }
|
public object BuyRestrictionMax { get; set; }
|
||||||
public int? BuyRestrictionCurrent { get; set; }
|
public int? BuyRestrictionCurrent { get; set; }
|
||||||
}
|
}
|
||||||
|
7
AssortGenerator.Models/Output/FireMode.cs
Normal file
7
AssortGenerator.Models/Output/FireMode.cs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
namespace AssortGenerator.Models.Output
|
||||||
|
{
|
||||||
|
public class UpdFireMode
|
||||||
|
{
|
||||||
|
public string FireMode { get;set; }
|
||||||
|
}
|
||||||
|
}
|
7
AssortGenerator.Models/Output/Foldable.cs
Normal file
7
AssortGenerator.Models/Output/Foldable.cs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
namespace AssortGenerator.Models.Output
|
||||||
|
{
|
||||||
|
public class Foldable
|
||||||
|
{
|
||||||
|
public bool Folded { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -37,6 +37,16 @@ namespace AssortGenerator
|
|||||||
string itemsJson = data.GetProperty("items").ToString();
|
string itemsJson = data.GetProperty("items").ToString();
|
||||||
List<Item> items = JsonSerializer.Deserialize<List<Item>>(itemsJson);
|
List<Item> items = JsonSerializer.Deserialize<List<Item>>(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
|
// Find barter scheme node and parse into object
|
||||||
var barterSchemeJson = data.GetProperty("barter_scheme").ToString();
|
var barterSchemeJson = data.GetProperty("barter_scheme").ToString();
|
||||||
var barterSchemeItems = JsonSerializer.Deserialize<Dictionary<string, object>>(barterSchemeJson);
|
var barterSchemeItems = JsonSerializer.Deserialize<Dictionary<string, object>>(barterSchemeJson);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user