Improved where logic inside RemoveFiRStatusFromItemsInContainer

This commit is contained in:
Chomp
2025-05-30 20:05:39 +01:00
parent 0f3411d656
commit 7ebafa402b
@@ -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;
}
}