Reset buy restriction current to 0

This commit is contained in:
Chomp 2023-01-08 15:06:37 +00:00
parent bee8f35955
commit b839987cd4

View File

@ -4,6 +4,7 @@ using AssortGenerator.Models.Input;
using AssortGenerator.Models.Other;
using AssortGenerator.Models.Output;
using Common;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@ -40,6 +41,8 @@ namespace AssortGenerator
// Fix items that have ran out of stock in the dump and give stack size
FixZeroSizedStackAssorts(items, 100);
FixFullyPurchasedStackLimits(items);
// Find barter scheme node and parse into dictionary
var barterSchemeJson = data.GetProperty("barter_scheme").ToString();
var barterSchemeItems = JsonSerializer.Deserialize<Dictionary<string, object>>(barterSchemeJson);
@ -62,6 +65,16 @@ namespace AssortGenerator
}
}
private static void FixFullyPurchasedStackLimits(List<Item> items)
{
foreach (var item in items
.Where(item => item.upd?.BuyRestrictionCurrent > 0 && item.slotId == "hideout"))
{
LoggingHelpers.LogError($"item {item._tpl} found with stack count > 0, changing to 0");
item.upd.BuyRestrictionCurrent = 0;
}
}
/// <summary>
/// Create input/assorts/output/traders folders
/// </summary>