diff --git a/Libraries/Core/Generators/BotEquipmentModGenerator.cs b/Libraries/Core/Generators/BotEquipmentModGenerator.cs index 4343a7f8..b0e06cc9 100644 --- a/Libraries/Core/Generators/BotEquipmentModGenerator.cs +++ b/Libraries/Core/Generators/BotEquipmentModGenerator.cs @@ -435,7 +435,7 @@ public class BotEquipmentModGenerator( _botConfig.Equipment.TryGetValue(request.BotData.EquipmentRole, out var botEquipConfig); var botEquipBlacklist = _botEquipmentFilterService.GetBotEquipmentBlacklist( request.BotData.EquipmentRole, - pmcProfile.Info.Level ?? 0 + pmcProfile?.Info?.Level ?? 0 ); var botWeaponSightWhitelist = _botEquipmentFilterService.GetBotWeaponSightWhitelist( request.BotData.EquipmentRole diff --git a/Libraries/Core/Generators/BotInventoryGenerator.cs b/Libraries/Core/Generators/BotInventoryGenerator.cs index ada984ef..045d6a2e 100644 --- a/Libraries/Core/Generators/BotInventoryGenerator.cs +++ b/Libraries/Core/Generators/BotInventoryGenerator.cs @@ -120,8 +120,8 @@ public class BotInventoryGenerator( QuestRaidItems = questRaidItemsId, QuestStashItems = questStashItemsId, SortingTable = sortingTableId, - HideoutAreaStashes = { }, - FastPanel = { }, + HideoutAreaStashes = new Dictionary(), + FastPanel = new Dictionary(), FavoriteItems = [], HideoutCustomizationStashId = hideoutCustomizationStashId, }; @@ -203,7 +203,7 @@ public class BotInventoryGenerator( Inventory = botInventory, BotEquipmentConfig = botEquipConfig, RandomisationDetails = randomistionDetails, - GeneratingPlayerLevel = pmcProfile.Info.Level + GeneratingPlayerLevel = pmcProfile?.Info?.Level ?? 1 } ); } @@ -225,7 +225,7 @@ public class BotInventoryGenerator( BotEquipmentConfig = botEquipConfig, RandomisationDetails = randomistionDetails, GenerateModsBlacklist = [ItemTpl.POCKETS_1X4_TUE, ItemTpl.POCKETS_LARGE], - GeneratingPlayerLevel = pmcProfile.Info.Level, + GeneratingPlayerLevel = pmcProfile?.Info?.Level ?? 1, } ); @@ -240,7 +240,7 @@ public class BotInventoryGenerator( Inventory = botInventory, BotEquipmentConfig = botEquipConfig, RandomisationDetails = randomistionDetails, - GeneratingPlayerLevel = pmcProfile.Info.Level, + GeneratingPlayerLevel = pmcProfile?.Info?.Level ?? 1, } ); @@ -255,7 +255,7 @@ public class BotInventoryGenerator( Inventory = botInventory, BotEquipmentConfig = botEquipConfig, RandomisationDetails = randomistionDetails, - GeneratingPlayerLevel = pmcProfile.Info.Level, + GeneratingPlayerLevel = pmcProfile?.Info?.Level ?? 1, } ); @@ -270,7 +270,7 @@ public class BotInventoryGenerator( Inventory = botInventory, BotEquipmentConfig = botEquipConfig, RandomisationDetails = randomistionDetails, - GeneratingPlayerLevel = pmcProfile.Info.Level, + GeneratingPlayerLevel = pmcProfile?.Info?.Level ?? 1, } ); @@ -285,7 +285,7 @@ public class BotInventoryGenerator( Inventory = botInventory, BotEquipmentConfig = botEquipConfig, RandomisationDetails = randomistionDetails, - GeneratingPlayerLevel = pmcProfile.Info.Level, + GeneratingPlayerLevel = pmcProfile?.Info?.Level ?? 1, } ); @@ -320,7 +320,7 @@ public class BotInventoryGenerator( Inventory = botInventory, BotEquipmentConfig = botEquipConfig, RandomisationDetails = randomistionDetails, - GeneratingPlayerLevel = pmcProfile.Info.Level, + GeneratingPlayerLevel = pmcProfile?.Info?.Level ?? 1, } ); } diff --git a/Libraries/Core/Generators/BotLevelGenerator.cs b/Libraries/Core/Generators/BotLevelGenerator.cs index 5899bf76..68b005ba 100644 --- a/Libraries/Core/Generators/BotLevelGenerator.cs +++ b/Libraries/Core/Generators/BotLevelGenerator.cs @@ -74,6 +74,9 @@ public class BotLevelGenerator( ) : Math.Min(levelDetails.Min.Value, maxAvailableLevel); // Not pmc with override or non-pmc + // Force min level to be 1 + minPossibleLevel = Math.Max(1, minPossibleLevel); + var maxPossibleLevel = isPmc && pmcOverride is not null ? Math.Min(pmcOverride.Max.Value, maxAvailableLevel) // Was a PMC and they have a level override : Math.Min(levelDetails.Max.Value, maxAvailableLevel); // Not pmc with override or non-pmc diff --git a/Libraries/Core/Services/BotEquipmentFilterService.cs b/Libraries/Core/Services/BotEquipmentFilterService.cs index 603d1309..a6339dfc 100644 --- a/Libraries/Core/Services/BotEquipmentFilterService.cs +++ b/Libraries/Core/Services/BotEquipmentFilterService.cs @@ -51,7 +51,7 @@ public class BotEquipmentFilterService var botWeightingAdjustments = GetBotWeightingAdjustments(botRole, botLevel); var botWeightingAdjustmentsByPlayerLevel = GetBotWeightingAdjustmentsByPlayerLevel( botRole, - pmcProfile.Info.Level ?? 0 + pmcProfile?.Info?.Level ?? 0 ); var botEquipConfig = _botEquipmentConfig[botRole.ToLower()];