From d5fc9be33966b38519062a407235f5f13bf32495 Mon Sep 17 00:00:00 2001 From: Chomp Date: Wed, 9 Jul 2025 17:02:31 +0100 Subject: [PATCH] Removed `Voice` `from profile.info` Added 'voice' to `profile.Customisation` --- .../Controllers/ProfileController.cs | 3 ++- .../Generators/BotGenerator.cs | 4 ++- .../Models/Eft/Common/Tables/BotBase.cs | 26 ++++++++----------- .../Eft/Profile/GetOtherProfileResponse.cs | 3 +++ .../Services/CreateProfileService.cs | 2 +- 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/Libraries/SPTarkov.Server.Core/Controllers/ProfileController.cs b/Libraries/SPTarkov.Server.Core/Controllers/ProfileController.cs index 0fc3820d..f631e4bc 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/ProfileController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/ProfileController.cs @@ -186,7 +186,7 @@ public class ProfileController( public virtual void ChangeVoice(ProfileChangeVoiceRequestData request, MongoId sessionID) { var pmcData = profileHelper.GetPmcProfile(sessionID); - pmcData.Info.Voice = request.Voice; + pmcData.Customization.Voice = request.Voice; } /// @@ -328,6 +328,7 @@ public class ProfileController( Feet = profileToViewPmc.Customization.Feet, Hands = profileToViewPmc.Customization.Hands, Dogtag = profileToViewPmc.Customization.DogTag, + Voice = profileToViewPmc.Customization.Voice, }, Skills = profileToViewPmc.Skills, Equipment = new OtherProfileEquipment diff --git a/Libraries/SPTarkov.Server.Core/Generators/BotGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/BotGenerator.cs index f37bb594..090dddeb 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/BotGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/BotGenerator.cs @@ -272,7 +272,9 @@ public class BotGenerator( ); bot.Info.Settings.UseSimpleAnimator = botJsonTemplate.BotExperience.UseSimpleAnimator ?? false; - bot.Info.Voice = weightedRandomHelper.GetWeightedValue(botJsonTemplate.BotAppearance.Voice); + bot.Customization.Voice = weightedRandomHelper.GetWeightedValue( + botJsonTemplate.BotAppearance.Voice + ); bot.Health = GenerateHealth( botJsonTemplate.BotHealth, botGenerationDetails.IsPlayerScav.GetValueOrDefault(false) diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/BotBase.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/BotBase.cs index d89eb5bc..452a6b26 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/BotBase.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/BotBase.cs @@ -176,8 +176,6 @@ public record Info private string? _side; - private string? _voice; - public string? EntryPoint { get; set; } public string? Nickname { get; set; } @@ -192,12 +190,6 @@ public record Info set { _side = string.Intern(value); } } - public string? Voice - { - get { return _voice; } - set { _voice = value == null ? null : string.Intern(value); } - } - public int? Level { get; set; } //Experience the bot has gained @@ -327,14 +319,12 @@ public record Customization [JsonExtensionData] public Dictionary? ExtensionData { get; set; } - private string? _body; - - private string? _dogtag; - - private string? _feet; - - private string? _hands; private string? _head; + private string? _body; + private string? _feet; + private string? _dogtag; + private string? _hands; + private string? _voice; public string? Head { @@ -365,6 +355,12 @@ public record Customization get { return _dogtag; } set { _dogtag = value == null ? null : string.Intern(value); } } + + public string? Voice + { + get { return _voice; } + set { _voice = value == null ? null : string.Intern(value); } + } } public record BotBaseHealth diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Profile/GetOtherProfileResponse.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Profile/GetOtherProfileResponse.cs index 22957876..f6680030 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Profile/GetOtherProfileResponse.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Profile/GetOtherProfileResponse.cs @@ -98,6 +98,9 @@ public record OtherProfileCustomization [JsonPropertyName("dogtag")] public string? Dogtag { get; set; } + + [JsonPropertyName("voice")] + public string? Voice { get; set; } } public record OtherProfileEquipment diff --git a/Libraries/SPTarkov.Server.Core/Services/CreateProfileService.cs b/Libraries/SPTarkov.Server.Core/Services/CreateProfileService.cs index 780ad248..075256b9 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.Info.Voice = databaseService.GetCustomization()[request.VoiceId].Name; + pmcData.Customization.Voice = databaseService.GetCustomization()[request.VoiceId].Name; pmcData.Stats = profileHelper.GetDefaultCounters(); pmcData.Info.NeedWipeOptions = []; pmcData.Customization.Head = request.HeadId;