diff --git a/Libraries/SPTarkov.Server.Core/Generators/BotLootGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/BotLootGenerator.cs
index 0a1b3711..617407be 100644
--- a/Libraries/SPTarkov.Server.Core/Generators/BotLootGenerator.cs
+++ b/Libraries/SPTarkov.Server.Core/Generators/BotLootGenerator.cs
@@ -62,7 +62,7 @@ public class BotLootGenerator(
/// Add loot to bots containers
///
/// Session id
- /// Base json db file for the bot having its loot generated
+ /// Clone of Base JSON db file for the bot having its loot generated
/// Will bot be a pmc
/// Role of bot, e.g. asssult
/// Inventory to add loot to
@@ -371,12 +371,12 @@ public class BotLootGenerator(
{
HashSet result = [EquipmentSlots.Pockets];
- if ((botInventory.Items ?? []).Any(item => item.SlotId == EquipmentSlots.TacticalVest.ToString()))
+ if ((botInventory.Items ?? []).Any(item => item.SlotId == nameof(EquipmentSlots.TacticalVest)))
{
result.Add(EquipmentSlots.TacticalVest);
}
- if ((botInventory.Items ?? []).Any(item => item.SlotId == EquipmentSlots.Backpack.ToString()))
+ if ((botInventory.Items ?? []).Any(item => item.SlotId == nameof(EquipmentSlots.Backpack)))
{
result.Add(EquipmentSlots.Backpack);
}
diff --git a/Libraries/SPTarkov.Server.Core/Services/BotLootCacheService.cs b/Libraries/SPTarkov.Server.Core/Services/BotLootCacheService.cs
index 6e1059f0..7f70d0ff 100644
--- a/Libraries/SPTarkov.Server.Core/Services/BotLootCacheService.cs
+++ b/Libraries/SPTarkov.Server.Core/Services/BotLootCacheService.cs
@@ -28,6 +28,8 @@ public class BotLootCacheService(
private readonly Lock _currencyLock = new();
private readonly Lock _stimLock = new();
private readonly Lock _grenadeLock = new();
+ private readonly Lock _specialLock = new();
+ private readonly Lock _healingLock = new();
///
/// Remove cached bot loot data
@@ -44,7 +46,9 @@ public class BotLootCacheService(
/// is the bot a pmc
/// what type of loot is needed (backpack/pocket/stim/vest etc)
/// Base json db file for the bot having its loot generated
- /// Dictionary
+ /// OPTIONAL - item price min and max value filter
+ /// THIS IS NOT A THREAD SAFE METHOD
+ /// dictionary
public Dictionary GetLootFromCache(
string botRole,
bool isPmc,
@@ -238,7 +242,10 @@ public class BotLootCacheService(
var itemTemplate = _itemHelper.GetItem(itemKvP.Key).Value;
if (!(IsBulletOrGrenade(itemTemplate.Properties) || IsMagazine(itemTemplate.Properties)))
{
- specialLootItems.TryAdd(itemKvP.Key, itemKvP.Value);
+ lock (_specialLock)
+ {
+ specialLootItems.TryAdd(itemKvP.Key, itemKvP.Value);
+ }
}
}
}
@@ -259,7 +266,10 @@ public class BotLootCacheService(
itemTemplate.Parent != BaseClasses.DRUGS
)
{
- healingItems.TryAdd(itemKvP.Key, itemKvP.Value);
+ lock (_healingLock)
+ {
+ healingItems.TryAdd(itemKvP.Key, itemKvP.Value);
+ }
}
}
}