From 7ebafa402bd178d0aeb30b2a8de5acbe2aa80d83 Mon Sep 17 00:00:00 2001 From: Chomp Date: Fri, 30 May 2025 20:05:39 +0100 Subject: [PATCH] Improved where logic inside `RemoveFiRStatusFromItemsInContainer` --- .../SPTarkov.Server.Core/Helpers/InRaidHelper.cs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Libraries/SPTarkov.Server.Core/Helpers/InRaidHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/InRaidHelper.cs index 3891b6ad..a86e0aa0 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/InRaidHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/InRaidHelper.cs @@ -131,15 +131,15 @@ public class InRaidHelper( // Try to find index of item to determine if we should add or replace var existingItemIndex = serverInventoryItems.FindIndex(inventoryItem => inventoryItem.Id == itemToAdd.Id ); - if (existingItemIndex == -1) + if (existingItemIndex != -1) { - // Not found, add + // Replace item with one from client + serverInventoryItems.RemoveAt(existingItemIndex); serverInventoryItems.Add(itemToAdd); } else { - // Replace item with one from client - serverInventoryItems.RemoveAt(existingItemIndex); + // Not found, add serverInventoryItems.Add(itemToAdd); } } @@ -190,12 +190,9 @@ public class InRaidHelper( } } - foreach (var item in itemsInsideContainer) + foreach (var item in itemsInsideContainer.Where(item => item.Upd?.SpawnedInSession ?? false)) { - if (item.Upd.SpawnedInSession ?? false) - { - item.Upd.SpawnedInSession = false; - } + item.Upd.SpawnedInSession = false; } }