Correctly supply ID of voice not name of voice when generating bot

This commit is contained in:
Chomp
2025-07-09 17:16:17 +01:00
parent 736057e892
commit 4ba9a9f0d4
2 changed files with 8 additions and 2 deletions
@@ -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)
@@ -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;