From 4ba9a9f0d4ab48c539284b4606340ab796c90ea4 Mon Sep 17 00:00:00 2001 From: Chomp Date: Wed, 9 Jul 2025 17:16:17 +0100 Subject: [PATCH] Correctly supply ID of voice not name of voice when generating bot --- Libraries/SPTarkov.Server.Core/Generators/BotGenerator.cs | 8 +++++++- .../SPTarkov.Server.Core/Services/CreateProfileService.cs | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Libraries/SPTarkov.Server.Core/Generators/BotGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/BotGenerator.cs index 090dddeb..eaa3eb0f 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/BotGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/BotGenerator.cs @@ -272,9 +272,15 @@ public class BotGenerator( ); bot.Info.Settings.UseSimpleAnimator = botJsonTemplate.BotExperience.UseSimpleAnimator ?? false; - bot.Customization.Voice = weightedRandomHelper.GetWeightedValue( + var chosenVoiceName = weightedRandomHelper.GetWeightedValue( botJsonTemplate.BotAppearance.Voice ); + bot.Customization.Voice = databaseService + .GetCustomization() + .FirstOrDefault(customisation => + customisation.Value.Name.Equals(chosenVoiceName, StringComparison.OrdinalIgnoreCase) + ) + .Key; bot.Health = GenerateHealth( botJsonTemplate.BotHealth, botGenerationDetails.IsPlayerScav.GetValueOrDefault(false) diff --git a/Libraries/SPTarkov.Server.Core/Services/CreateProfileService.cs b/Libraries/SPTarkov.Server.Core/Services/CreateProfileService.cs index 404da1a2..eb602308 100644 --- a/Libraries/SPTarkov.Server.Core/Services/CreateProfileService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/CreateProfileService.cs @@ -61,7 +61,7 @@ public class CreateProfileService( pmcData.Info.Nickname = request.Nickname; pmcData.Info.LowerNickname = request.Nickname.ToLowerInvariant(); pmcData.Info.RegistrationDate = (int)timeUtil.GetTimeStamp(); - pmcData.Customization.Voice = databaseService.GetCustomization()[request.VoiceId].Name; + pmcData.Customization.Voice = databaseService.GetCustomization()[request.VoiceId].Id; pmcData.Stats = profileHelper.GetDefaultCounters(); pmcData.Info.NeedWipeOptions = []; pmcData.Customization.Head = request.HeadId;