diff --git a/Libraries/SPTarkov.Server.Core/Controllers/ProfileController.cs b/Libraries/SPTarkov.Server.Core/Controllers/ProfileController.cs index 2d12770c..bd186684 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/ProfileController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/ProfileController.cs @@ -292,21 +292,21 @@ public class ProfileController( itemsToReturn.AddRange(itemWithChildren); } - return new GetOtherProfileResponse + var profile = new GetOtherProfileResponse { Id = profileToViewPmc.Id, Aid = profileToViewPmc.Aid, - Info = + Info = new OtherProfileInfo { Nickname = profileToViewPmc.Info.Nickname, Side = profileToViewPmc.Info.Side, Experience = profileToViewPmc.Info.Experience, - MemberCategory = profileToViewPmc.Info.MemberCategory as int?, + MemberCategory = (int)(profileToViewPmc.Info.MemberCategory ?? MemberCategory.Default), BannedState = profileToViewPmc.Info.BannedState, BannedUntil = profileToViewPmc.Info.BannedUntil, RegistrationDate = profileToViewPmc.Info.RegistrationDate }, - Customization = + Customization = new OtherProfileCustomization { Head = profileToViewPmc.Customization.Head, Body = profileToViewPmc.Customization.Body, @@ -315,24 +315,24 @@ public class ProfileController( Dogtag = profileToViewPmc.Customization.DogTag }, Skills = profileToViewPmc.Skills, - Equipment = + Equipment = new OtherProfileEquipment { Id = profileToViewPmc.Inventory.Equipment, Items = profileToViewPmc.Inventory.Items }, Achievements = profileToViewPmc.Achievements, FavoriteItems = _profileHelper.GetOtherProfileFavorites(profileToViewPmc), - PmcStats = + PmcStats = new OtherProfileStats { - Eft = + Eft = new OtherProfileSubStats { TotalInGameTime = profileToViewPmc.Stats.Eft.TotalInGameTime, OverAllCounters = profileToViewPmc.Stats.Eft.OverallCounters } }, - ScavStats = + ScavStats = new OtherProfileStats { - Eft = + Eft = new OtherProfileSubStats { TotalInGameTime = profileToViewScav.Stats.Eft.TotalInGameTime, OverAllCounters = profileToViewScav.Stats.Eft.OverallCounters @@ -343,6 +343,8 @@ public class ProfileController( HideoutAreaStashes = profileToViewPmc.Inventory.HideoutAreaStashes, Items = itemsToReturn }; + + return profile; } /// diff --git a/Libraries/SPTarkov.Server.Core/Helpers/ProfileHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/ProfileHelper.cs index 391b6565..7644b51a 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/ProfileHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/ProfileHelper.cs @@ -662,11 +662,11 @@ public class ProfileHelper( { var fullFavorites = new List(); - foreach (var itemId in profile.Inventory.FavoriteItems ?? new List()) + foreach (var itemId in profile.Inventory?.FavoriteItems ?? []) { // When viewing another users profile, the client expects a full item with children, so get that var itemAndChildren = _itemHelper.FindAndReturnChildrenAsItems(profile.Inventory.Items, itemId); - if (itemAndChildren != null && itemAndChildren.Count > 0) + if (itemAndChildren?.Count > 0) { // To get the client to actually see the items, we set the main item's parent to null, so it's treated as a root item var clonedItems = _cloner.Clone(itemAndChildren);