From 08b52398807cbed88378099eb8be9382f03f1d70 Mon Sep 17 00:00:00 2001 From: Robert Paciorek Date: Sun, 3 Mar 2024 19:38:49 +0000 Subject: [PATCH] bugfix: set gender in profile when no saved avatar --- src/Controllers/Common/ProfileController.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Controllers/Common/ProfileController.cs b/src/Controllers/Common/ProfileController.cs index 52eff1a..dd12c0d 100644 --- a/src/Controllers/Common/ProfileController.cs +++ b/src/Controllers/Common/ProfileController.cs @@ -84,9 +84,11 @@ public class ProfileController : Controller { private UserProfileData GetProfileDataFromViking(Viking viking, [FromForm] string apiKey) { // Get the avatar data AvatarData avatarData = null; + Gender gender = Gender.Male; if (viking.AvatarSerialized is not null) { avatarData = XmlUtil.DeserializeXml(viking.AvatarSerialized); avatarData.Id = viking.Id; + gender = avatarData.GenderType; } if (avatarData != null && ClientVersion.GetVersion(apiKey) == 0xa3a12a0a) { // TODO adjust version number: we don't know for which versions it is required (for 3.12 it is, for 3.19 and 3.0 it's not) @@ -114,7 +116,7 @@ public class ProfileController : Controller { FirstName = viking.Name, MultiplayerEnabled = ClientVersion.IsMultiplayerSupported(apiKey), Locale = "en-US", // placeholder - GenderID = avatarData.GenderType, + GenderID = gender, OpenChatEnabled = true, IsApproved = true, RegistrationDate = new DateTime(DateTime.Now.Ticks), // placeholder