From 24cc70b225364aa724f9d6c6edf02c95a01174d8 Mon Sep 17 00:00:00 2001 From: Chomp Date: Mon, 2 Jun 2025 11:12:50 +0100 Subject: [PATCH] Improved `containerType` secure container string compare Split out kvp into variables --- .../Services/BotLootCacheService.cs | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Libraries/SPTarkov.Server.Core/Services/BotLootCacheService.cs b/Libraries/SPTarkov.Server.Core/Services/BotLootCacheService.cs index db50ca9c..b10a0347 100644 --- a/Libraries/SPTarkov.Server.Core/Services/BotLootCacheService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/BotLootCacheService.cs @@ -188,41 +188,41 @@ public class BotLootCacheService( }; - foreach (var kvp in poolsToProcess) + foreach (var (containerType, itemPool) in poolsToProcess) { // No items to add, skip - if (kvp.Value.Count == 0) + if (itemPool.Count == 0) { continue; } // Sort loot pool into separate buckets - switch (kvp.Key) + switch (containerType) { case "SpecialLoot": - AddItemsToPool(specialLootPool, kvp.Value); + AddItemsToPool(specialLootPool, itemPool); break; case "Pockets": - AddItemsToPool(pocketLootPool, kvp.Value); + AddItemsToPool(pocketLootPool, itemPool); break; case "TacticalVest": - AddItemsToPool(vestLootPool, kvp.Value); + AddItemsToPool(vestLootPool, itemPool); break; case "SecuredContainer": - AddItemsToPool(secureLootPool, kvp.Value); + AddItemsToPool(secureLootPool, itemPool); break; case "Backpack": - AddItemsToPool(backpackLootPool, kvp.Value); + AddItemsToPool(backpackLootPool, itemPool); break; default: - _logger.Warning($"How did you get here {kvp.Key}"); + _logger.Warning($"How did you get here {containerType}"); break; } // Add all items (if any) to combined pool (excluding secure) - if (kvp.Value.Count > 0 && kvp.Key.ToLower() != "securedcontainer") + if (itemPool.Count > 0 && containerType.Equals("securedcontainer", StringComparison.OrdinalIgnoreCase)) { - AddItemsToPool(combinedLootPool, kvp.Value); + AddItemsToPool(combinedLootPool, itemPool); } }