Set assorts StackObjectsCount value wih a UnlimitedCount true value to 9999999

This commit is contained in:
Dev 2024-02-03 09:59:54 +00:00
parent b5c4ba5708
commit 70b5c33e01

View File

@ -44,6 +44,8 @@ namespace AssortGenerator
// Fix items that have ran out of stock in the dump and give stack size
FixZeroSizedStackAssorts(items, 100);
UpdateunlimitedCountItemStackSize(items);
FixFullyPurchasedStackLimits(items);
// Find barter scheme node and parse into dictionary
@ -60,12 +62,26 @@ namespace AssortGenerator
JsonWriter.WriteJson(finalisedQuestData, "", Directory.GetCurrentDirectory(), "quests");
}
private static void UpdateunlimitedCountItemStackSize(List<Item> items)
{
foreach (var item in items
.Where(item => (item.upd?.UnlimitedCount.GetValueOrDefault(false) ?? false) && item.slotId == "hideout"))
{
item.upd.StackObjectsCount = 9999999;
}
}
private static void FixZeroSizedStackAssorts(List<Item> items, int defaultStackSize)
{
foreach (var item in items
.Where(item => item.upd?.StackObjectsCount == 0 && item.slotId == "hideout"))
{
LoggingHelpers.LogError($"item {item._tpl} found with stack count of 0, changing to {defaultStackSize}");
if ((bool)(item.upd?.UnlimitedCount.GetValueOrDefault(false)))
{
// Handled elsewhere
continue;
}
if (item.upd?.BuyRestrictionMax != null)
{