diff --git a/Libraries/SPTarkov.Server.Core/Helpers/InventoryHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/InventoryHelper.cs index 84cf3c25..359ea8da 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/InventoryHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/InventoryHelper.cs @@ -175,7 +175,10 @@ public class InventoryHelper( // Ensure item has upd object _itemHelper.AddUpdObjectToItem(item); - item.Upd.SpawnedInSession = foundInRaid; + // Ammo / currency can NEVER be FiR or have a 'SpawnedInSession' property + item.Upd.SpawnedInSession = _itemHelper.IsOfBaseclass(item.Template, BaseClasses.AMMO) + ? null + : foundInRaid; } } diff --git a/Libraries/SPTarkov.Server.Core/Helpers/ItemHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/ItemHelper.cs index 10c1cfc3..693070e7 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/ItemHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/ItemHelper.cs @@ -1194,15 +1194,17 @@ public class ItemHelper( /// /// Mark the passed in list of items as found in raid. /// Modifies passed in items + /// Will not flag ammo or currency as FiR /// /// The list of items to mark as FiR - /// Skip adding FiR status to currency items - public void SetFoundInRaid(List items, bool excludeCurrency = true) + public void SetFoundInRaid(List items) { foreach (var item in items) { - if (excludeCurrency && IsOfBaseclass(item.Template, BaseClasses.MONEY)) + if (IsOfBaseclasses(item.Template, [BaseClasses.MONEY, BaseClasses.AMMO])) { + item.Upd.SpawnedInSession = null; + continue; } @@ -1500,8 +1502,7 @@ public class ItemHelper( ammoBox[0].Id, cartridgeTpl, (int) cartridgeCountToAdd, - location, - ammoBox[0].Upd?.SpawnedInSession ?? false + location ); // In live no ammo box has the first cartridge item with a location @@ -1531,8 +1532,7 @@ public class ItemHelper( ammoBox[0].Id, cartridgeTpl, (int) ammoBoxMaxCartridgeCount, - 0, - ammoBox[0].Upd?.SpawnedInSession ?? false + 0 ) ); } @@ -1689,8 +1689,7 @@ public class ItemHelper( magazineWithChildCartridges[0].Id, cartridgeTpl, cartridgeCountToAdd ?? 0, - location, - magazineWithChildCartridges[0].Upd?.SpawnedInSession ?? false + location ) ); @@ -1774,27 +1773,24 @@ public class ItemHelper( /// Cartridge to insert /// Count of cartridges inside parent /// Location inside parent (e.g. 0, 1) - /// OPTIONAL - Are cartridges found in raid (SpawnedInSession) /// Item public Item CreateCartridges( string parentId, - string? ammoTpl, - int? stackCount, - double location, - bool foundInRaid = false + string ammoTpl, + int stackCount, + double location ) { return new Item { Id = _hashUtil.Generate(), - Template = ammoTpl!, + Template = ammoTpl, ParentId = parentId, SlotId = "cartridges", Location = location, Upd = new Upd { - StackObjectsCount = stackCount, - SpawnedInSession = foundInRaid + StackObjectsCount = stackCount } }; }