diff --git a/Libraries/SPTarkov.Server.Assets/SPT_Data/configs/pmc.json b/Libraries/SPTarkov.Server.Assets/SPT_Data/configs/pmc.json index 3165a135..f0cb1c1d 100644 --- a/Libraries/SPTarkov.Server.Assets/SPT_Data/configs/pmc.json +++ b/Libraries/SPTarkov.Server.Assets/SPT_Data/configs/pmc.json @@ -171,7 +171,12 @@ "min": 70, "max": 10 }, - "isUsec": 60, + "isUsec": 50, + "forceArmband": { + "enabled": true, + "usec": "5b3f3af486f774679e752c1f", + "bear": "5b3f3ade86f7746b6b790d8e" + }, "_pmcType": "Controls what bot brain can be chosen for each PMC bot type, the number is the weighting to be picked", "pmcType": { "pmcbear": { diff --git a/Libraries/SPTarkov.Server.Core/Generators/BotInventoryGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/BotInventoryGenerator.cs index 7b4fb82c..76a954c1 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/BotInventoryGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/BotInventoryGenerator.cs @@ -60,6 +60,7 @@ public class BotInventoryGenerator( ]; private readonly BotConfig _botConfig = configServer.GetConfig(); + private readonly PmcConfig _pmcConfig = configServer.GetConfig(); private readonly FrozenSet _slotsToCheck = [nameof(EquipmentSlots.Pockets), nameof(EquipmentSlots.SecuredContainer)]; @@ -193,7 +194,12 @@ public class BotInventoryGenerator( GetRaidConfigurationRequestData? raidConfig ) { - _botConfig.Equipment.TryGetValue(botGeneratorHelper.GetBotEquipmentRole(botRole), out var botEquipConfig); + if (!_botConfig.Equipment.TryGetValue(botGeneratorHelper.GetBotEquipmentRole(botRole), out var botEquipConfig)) + { + logger.Error($"Bot Equipment generation failed, unable to find equipment filters for: {botRole}"); + + return; + } var randomistionDetails = botHelper.GetBotRandomizationDetails(botLevel, botEquipConfig); // Apply nighttime changes if its nighttime + there's changes to make @@ -211,6 +217,23 @@ public class BotInventoryGenerator( } } + // Is PMC + generating armband + armband forcing is enabled + if (_pmcConfig.ForceArmband.Enabled && isPmc) + { + // Replace armband pool with single tpl from config + if (templateInventory.Equipment.TryGetValue(EquipmentSlots.ArmBand, out var armbands)) + { + // Get tpl based on pmc side + var armbandTpl = botRole == "pmcusec" ? _pmcConfig.ForceArmband.Usec : _pmcConfig.ForceArmband.Bear; + + armbands.Clear(); + armbands.Add(armbandTpl, 1); + + // Force armband spawn to 100% + wornItemChances.EquipmentChances["Armband"] = 100; + } + } + // Get profile of player generating bots, we use their level later on var pmcProfile = profileHelper.GetPmcProfile(sessionId); var botEquipmentRole = botGeneratorHelper.GetBotEquipmentRole(botRole); @@ -218,7 +241,7 @@ public class BotInventoryGenerator( // Iterate over all equipment slots of bot, do it in specific order to reduce conflicts // e.g. ArmorVest should be generated after TacticalVest // or FACE_COVER before HEADWEAR - foreach (var (equipmentSlot, value) in templateInventory.Equipment) + foreach (var (equipmentSlot, itemsWithWeightPool) in templateInventory.Equipment) { // Skip some slots as they need to be done in a specific order + with specific parameter values // e.g. Weapons @@ -232,7 +255,7 @@ public class BotInventoryGenerator( { BotId = botId, RootEquipmentSlot = equipmentSlot, - RootEquipmentPool = value, + RootEquipmentPool = itemsWithWeightPool, ModPool = templateInventory.Mods, SpawnChances = wornItemChances, BotData = new BotData diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/PmcConfig.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/PmcConfig.cs index 8a4c70ae..9e9d6c19 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/PmcConfig.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/PmcConfig.cs @@ -79,6 +79,12 @@ public record PmcConfig : BaseConfig [JsonPropertyName("isUsec")] public required double IsUsec { get; set; } + /// + /// Force PMCs to use specific armband Tpls + /// + [JsonPropertyName("forceArmband")] + public required ForceArmbandSettings ForceArmband { get; set; } + /// /// WildSpawnType enum value USEC PMCs use /// @@ -143,6 +149,18 @@ public record PmcConfig : BaseConfig public required Dictionary> CustomPmcWaves { get; set; } } +public record ForceArmbandSettings +{ + [JsonPropertyName("enabled")] + public bool Enabled { get; set; } + + [JsonPropertyName("usec")] + public MongoId Usec { get; set; } + + [JsonPropertyName("bear")] + public MongoId Bear { get; set; } +} + public record PmcLootSettings { [JsonPropertyName("pocket")]