Added functionality to force PMCs to wear specific armband - default enabled

usec = blue
bear = red
This commit is contained in:
Chomp
2025-08-16 14:37:06 +01:00
parent bb649e6748
commit d94490b52f
3 changed files with 50 additions and 4 deletions
@@ -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": {
@@ -60,6 +60,7 @@ public class BotInventoryGenerator(
];
private readonly BotConfig _botConfig = configServer.GetConfig<BotConfig>();
private readonly PmcConfig _pmcConfig = configServer.GetConfig<PmcConfig>();
private readonly FrozenSet<string> _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
@@ -79,6 +79,12 @@ public record PmcConfig : BaseConfig
[JsonPropertyName("isUsec")]
public required double IsUsec { get; set; }
/// <summary>
/// Force PMCs to use specific armband Tpls
/// </summary>
[JsonPropertyName("forceArmband")]
public required ForceArmbandSettings ForceArmband { get; set; }
/// <summary>
/// WildSpawnType enum value USEC PMCs use
/// </summary>
@@ -143,6 +149,18 @@ public record PmcConfig : BaseConfig
public required Dictionary<string, List<BossLocationSpawn>> 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")]