Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ protected void FilterEquipment(BotType baseBotNode, EquipmentFilterDetails? blac
var botEquipment = baseBotNode.BotInventory.Equipment[equipmentSlotKvP.Key];

// Skip equipment slot if blacklist doesn't exist / is empty
if (blacklist.Equipment?.TryGetValue(equipmentSlotKvP.Key.ToString(), out var equipmentSlotBlacklist) is null)
if (blacklist.Equipment?.TryGetValue(equipmentSlotKvP.Key.ToString(), out var equipmentSlotBlacklist) is null or false)
{
continue;
}
Expand Down Expand Up @@ -302,7 +302,7 @@ protected void FilterCartridges(BotType baseBotNode, EquipmentFilterDetails? bla
{
// Skip cartridge slot if blacklist doesn't exist / is empty
if (
blacklist.Cartridge?.TryGetValue(caliber, out var cartridgeCaliberBlacklist) is null
blacklist.Cartridge?.TryGetValue(caliber, out var cartridgeCaliberBlacklist) is null or false
|| cartridgeCaliberBlacklist is null
|| cartridgeCaliberBlacklist.Count == 0
)
Expand Down Expand Up @@ -366,13 +366,14 @@ protected void AdjustWeighting(
}
else
{
if (showEditWarnings)
{
if (logger.IsLogEnabled(LogLevel.Debug))
{
logger.Debug($"Tried to edit a non-existent item for slot: {poolAdjustmentKvP} {itemToEditKvP}");
}
}
// Note: Logging disabled for now, because our configs are all kinds of wrong
//if (showEditWarnings)
//{
// if (logger.IsLogEnabled(LogLevel.Debug))
// {
// logger.Debug($"Tried to edit a non-existent item for slot: {poolAdjustmentKvP} {itemToEditKvP}");
// }
//}
}
}
}
Expand Down Expand Up @@ -417,19 +418,20 @@ protected void AdjustWeighting(
foreach (var itemToEditKvP in poolAdjustmentKvP.Value)
// Only make change if item exists as we're editing, not adding
{
if (locationToUpdate.ContainsKey(itemToEditKvP.Key) || locationToUpdate[itemToEditKvP.Key] == 0)
if (locationToUpdate.ContainsKey(itemToEditKvP.Key))
{
locationToUpdate[itemToEditKvP.Key] = itemToEditKvP.Value;
}
else
{
if (showEditWarnings)
{
if (logger.IsLogEnabled(LogLevel.Debug))
{
logger.Debug($"Tried to edit a non - existent item for slot: {poolAdjustmentKvP} {itemToEditKvP}");
}
}
// Note: Logging disabled for now, because our configs are all kinds of wrong
//if (showEditWarnings)
//{
// if (logger.IsLogEnabled(LogLevel.Debug))
// {
// logger.Debug($"Tried to edit a non - existent item for slot: {poolAdjustmentKvP} {itemToEditKvP}");
// }
//}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace SPTarkov.Server.Core.Services;
/// <summary>
/// Service for keeping track of items and their exact position inside a bots container
/// </summary>
[Injectable]
[Injectable(InjectionType.Singleton)]
public class BotInventoryContainerService(ISptLogger<BotGeneratorHelper> logger, ItemHelper itemHelper)
{
// botId/containerName
Expand Down
Loading