diff --git a/Libraries/Core/Services/BotEquipmentFilterService.cs b/Libraries/Core/Services/BotEquipmentFilterService.cs
index 1f41006a..c8b490bb 100644
--- a/Libraries/Core/Services/BotEquipmentFilterService.cs
+++ b/Libraries/Core/Services/BotEquipmentFilterService.cs
@@ -344,9 +344,11 @@ public class BotEquipmentFilterService
/// Bot item dictionary to adjust
protected void AdjustWeighting(
AdjustmentDetails weightingAdjustments,
- Dictionary> botItemPool,
+ Dictionary> botItemPool,
bool showEditWarnings = true)
{
+ //TODO, bad typing by key with method below due to, EquipmentSlots
+ // MAKE CONSISTENT BEFORE IMPLEMENTING
throw new NotImplementedException();
}
@@ -355,12 +357,51 @@ public class BotEquipmentFilterService
///
/// Weighting change to apply to bot
/// Bot item dictionary to adjust
+ ///
protected void AdjustWeighting(
- AdjustmentDetails weightingAdjustments,
- Dictionary> botItemPool,
+ AdjustmentDetails? weightingAdjustments,
+ Dictionary> botItemPool,
bool showEditWarnings = true)
{
- throw new NotImplementedException();
+ if (weightingAdjustments is null)
+ {
+ return;
+ }
+
+ if (weightingAdjustments.Add?.Count > 0)
+ {
+ foreach (var poolAdjustmentKvP in weightingAdjustments.Add)
+ {
+ var locationToUpdate = botItemPool[poolAdjustmentKvP.Key];
+ foreach (var itemToAddKvP in poolAdjustmentKvP.Value)
+ {
+ locationToUpdate[itemToAddKvP.Key] = itemToAddKvP.Value;
+ }
+ }
+ }
+
+ if (weightingAdjustments.Edit?.Count > 0)
+ {
+ foreach (var poolAdjustmentKvP in weightingAdjustments.Edit)
+ {
+ var locationToUpdate = botItemPool[poolAdjustmentKvP.Key];
+ foreach (var itemToEditKvP in poolAdjustmentKvP.Value)
+ {
+ // Only make change if item exists as we're editing, not adding
+ if (locationToUpdate[itemToEditKvP.Key] != null || locationToUpdate[itemToEditKvP.Key] == 0)
+ {
+ locationToUpdate[itemToEditKvP.Key] = itemToEditKvP.Value;
+ }
+ else
+ {
+ if (showEditWarnings)
+ {
+ _logger.Debug($"Tried to edit a non - existent item for slot: {poolAdjustmentKvP} {itemToEditKvP}");
+ }
+ }
+ }
+ }
+ }
}
///