From b6d6c06c6ce26ea5da7785eea7a3aad8a40ddfce Mon Sep 17 00:00:00 2001 From: Chomp Date: Mon, 27 Jan 2025 11:26:41 +0000 Subject: [PATCH] Removed debugging code --- .../Core/Generators/LocationLootGenerator.cs | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/Libraries/Core/Generators/LocationLootGenerator.cs b/Libraries/Core/Generators/LocationLootGenerator.cs index 9e459292..211b4239 100644 --- a/Libraries/Core/Generators/LocationLootGenerator.cs +++ b/Libraries/Core/Generators/LocationLootGenerator.cs @@ -471,13 +471,43 @@ public class LocationLootGenerator( // Add loot to container before returning containerClone.Template.Items.AddRange(items); - - itemAddedCount++; } return containerClone; } + protected ItemSize? GetItemSize(List? items) + { + var rootItem = items[0]; + if (items.Count == 1) + { + var itemTemplate = _itemHelper.GetItem(rootItem.Template).Value; + if (itemTemplate.Properties is null) + { + _logger.Error($"Unable to process item: ${{chosenTpl}}. it lacks _props"); + + return null; + } + + // Single item, get items properties + return new ItemSize + { + Width = itemTemplate.Properties.Width.Value, + Height = itemTemplate.Properties.Height.Value + }; + } + + + // Multi-mod-item, use helper to get size of item + mods + var result = _inventoryHelper.GetItemSize(rootItem.Template, rootItem.Id, items); + return new ItemSize + { + Width = result[0], + Height = result[1] + }; + + } + /// /// Get a 2D grid of a container's item slots ///