diff --git a/Benchmarks/ClonerBenchmarks.cs b/Benchmarks/ClonerBenchmarks.cs index 5e4e8992..74eb4e3a 100644 --- a/Benchmarks/ClonerBenchmarks.cs +++ b/Benchmarks/ClonerBenchmarks.cs @@ -3,6 +3,7 @@ using Benchmarks.Mock; using SPTarkov.Server.Core.Models.Spt.Templates; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; +using SPTarkov.Server.Core.Utils.Json; using SPTarkov.Server.Core.Utils.Json.Converters; namespace Benchmarks; diff --git a/Libraries/SPTarkov.Server.Core/Controllers/ProfileController.cs b/Libraries/SPTarkov.Server.Core/Controllers/ProfileController.cs index 5fa2618f..9ededf44 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/ProfileController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/ProfileController.cs @@ -20,6 +20,7 @@ public class ProfileController( ISptLogger logger, SaveServer saveServer, CreateProfileService createProfileService, + ProfileFixerService profileFixerService, PlayerScavGenerator playerScavGenerator, ProfileHelper profileHelper ) @@ -98,7 +99,23 @@ public class ProfileController( /// Return a full profile, scav and pmc profiles + meta data public virtual List GetCompleteProfile(MongoId sessionId) { - return profileHelper.GetCompleteProfile(sessionId); + var profile = profileHelper.GetCompleteProfile(sessionId); + + // Some users like to crank massive skill multipliers and send the client invalid information, + // causing a json exception during parsing + if (profile[0].Skills != null) + { + // Pmc profile is index 0 + profileFixerService.CheckForSkillsOverMaxLevel(profile[0]); + } + + if (profile[1].Skills != null) + { + // We also do the scav profile here because it is also affected by the skill multipliers + profileFixerService.CheckForSkillsOverMaxLevel(profile[1]); + } + + return profile; } /// diff --git a/Libraries/SPTarkov.Server.Core/Services/ProfileFixerService.cs b/Libraries/SPTarkov.Server.Core/Services/ProfileFixerService.cs index 2d4b0054..3da3e142 100644 --- a/Libraries/SPTarkov.Server.Core/Services/ProfileFixerService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/ProfileFixerService.cs @@ -624,7 +624,7 @@ public class ProfileFixerService( /// Check for and cap profile skills at 5100. /// /// Profile to check and fix - protected void CheckForSkillsOverMaxLevel(PmcData pmcProfile) + public void CheckForSkillsOverMaxLevel(PmcData pmcProfile) { var skills = pmcProfile.Skills.Common;