diff --git a/Libraries/SPTarkov.Server.Core/Helpers/ItemHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/ItemHelper.cs index af534bbd..32fcd9e8 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/ItemHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/ItemHelper.cs @@ -774,48 +774,6 @@ public class ItemHelper( return rootAndChildren; } - /// - /// Splits the item stack if it exceeds its items StackMaxSize property into child items of the passed parent. - /// TODO: untested - /// - /// Item (with children) to split into smaller stacks. - /// List of root item + children. - public List> SplitStack(List itemWithChildren) - { - var originRootItem = itemWithChildren.FirstOrDefault(); - if (originRootItem?.Upd?.StackObjectsCount is null) - { - return [itemWithChildren]; - } - - var maxStackSize = GetItem(originRootItem.Template).Value?.Properties?.StackMaxSize; - var remainingCount = originRootItem.Upd.StackObjectsCount; - List> result = []; - - // If the current count is already equal or less than the max - // return the item as is. - if (remainingCount <= maxStackSize) - { - result.Add(itemWithChildren); - - return result; - } - - while (remainingCount > 0) - { - // Clone item and make IDs unique - var itemWithChildrenClone = cloner.Clone(itemWithChildren)!.ReplaceIDs().ToList(); - - // Set stack count to new value - var amount = Math.Min(remainingCount.Value, maxStackSize ?? 0); - itemWithChildrenClone[0].Upd!.StackObjectsCount = amount; - remainingCount -= amount; - result.Add(itemWithChildrenClone); - } - - return result; - } - /// /// Turns items like money into separate stacks that adhere to max stack size. /// @@ -879,30 +837,6 @@ public class ItemHelper( return matchingItems; } - /// - /// Replaces the _id value for the base item + all children that are children of it. - /// REPARENTS ROOT ITEM ID, NOTHING ELSE. - /// - /// Item with mods to update. - /// New id to add on children of base item. - public void ReplaceRootItemId(IEnumerable itemWithChildren, MongoId newId) - { - // original id on base item - var oldId = itemWithChildren.First().Id; - - // Update base item to use new id - itemWithChildren.First().Id = newId; - - // Update all parentIds of items attached to base item to use new id - foreach (var item in itemWithChildren) - { - if (item.ParentId != null && item.ParentId == oldId) - { - item.ParentId = newId; - } - } - } - /// /// Regenerate all GUIDs with new IDs, except special item types (e.g. quest, sorting table, etc.) /// This function mutates the bot inventory list. @@ -1299,23 +1233,6 @@ public class ItemHelper( }; } - /// - /// Get a random cartridge from an items Filter property - /// - /// Db item template to look up Cartridge filter values from - /// Valid caliber for cartridge - public MongoId? GetRandomCompatibleCaliberTemplateId(TemplateItem item) - { - var cartridges = item.Properties?.Cartridges?.FirstOrDefault()?.Properties?.Filters?.FirstOrDefault()?.Filter; - if (cartridges is null) - { - logger.Warning($"Failed to find cartridge for item: {item.Id} {item.Name}"); - return null; - } - - return randomUtil.GetArrayValue(cartridges); - } - /// /// Add cartridges to the ammo box with correct max stack sizes /// @@ -1361,18 +1278,6 @@ public class ItemHelper( } } - /// - /// Add a single stack of cartridges to the ammo box - /// - /// Box item to add cartridges to - /// Item template from items db - public void AddSingleStackCartridgesToAmmoBox(List ammoBox, TemplateItem ammoBoxDetails) - { - var ammoBoxMaxCartridgeCount = ammoBoxDetails.Properties?.StackSlots?.First().MaxCount ?? 0; - var cartridgeTpl = ammoBoxDetails.Properties?.StackSlots?.First().Properties?.Filters?.First().Filter?.FirstOrDefault(); - ammoBox.Add(CreateCartridges(ammoBox[0].Id, cartridgeTpl!.Value, (int)ammoBoxMaxCartridgeCount, 0)); - } - /// /// Add child items (cartridges) to a magazine ///