From 9ff175d877b2d3fef1108e3326fc41571da44d01 Mon Sep 17 00:00:00 2001 From: Chomp Date: Mon, 27 Jan 2025 13:59:20 +0000 Subject: [PATCH] Improved logic inside `GenerateModsForWeapon` --- .../Core/Generators/BotEquipmentModGenerator.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Libraries/Core/Generators/BotEquipmentModGenerator.cs b/Libraries/Core/Generators/BotEquipmentModGenerator.cs index cd993657..68c203f1 100644 --- a/Libraries/Core/Generators/BotEquipmentModGenerator.cs +++ b/Libraries/Core/Generators/BotEquipmentModGenerator.cs @@ -409,13 +409,7 @@ public class BotEquipmentModGenerator( /// Weapon + mods array public List GenerateModsForWeapon(string sessionId, GenerateWeaponRequest request) { - if ( - !( - request.ParentTemplate.Properties.Slots.Any() || - request.ParentTemplate.Properties.Cartridges.Any() || - request.ParentTemplate.Properties.Chambers.Any() - ) - ) + if (ItemLacksSlotsCartridgesAndChambers(request.ParentTemplate)) { _logger.Error( _localisationService.GetText( @@ -691,6 +685,13 @@ public class BotEquipmentModGenerator( return request.Weapon; } + protected bool ItemLacksSlotsCartridgesAndChambers(TemplateItem item) + { + return item.Properties.Slots?.Count == 0 + && item.Properties.Cartridges?.Count == 0 + && item.Properties.Chambers?.Count == 0; + } + /// /// Should the provided bot have its stock chance values altered to 100% ///