diff --git a/Libraries/SPTarkov.Server.Core/Extensions/ProfileExtensions.cs b/Libraries/SPTarkov.Server.Core/Extensions/ProfileExtensions.cs index 33b42e28..a1e43ac7 100644 --- a/Libraries/SPTarkov.Server.Core/Extensions/ProfileExtensions.cs +++ b/Libraries/SPTarkov.Server.Core/Extensions/ProfileExtensions.cs @@ -241,5 +241,23 @@ namespace SPTarkov.Server.Core.Extensions return quest?.Status ?? QuestStatusEnum.Locked; } + + /// + /// Use values from the profiles template to reset all body part max values + /// + /// Profile to update + /// Template used to create profile + public static void ResetMaxLimbHp(this PmcData profile, TemplateSide profileTemplate) + { + foreach (var (partKey, bodyPart) in profile.Health.BodyParts) + { + bodyPart.Health.Maximum = profileTemplate + .Character + .Health + .BodyParts[partKey] + .Health + .Maximum; + } + } } } diff --git a/Libraries/SPTarkov.Server.Core/Services/LocationLifecycleService.cs b/Libraries/SPTarkov.Server.Core/Services/LocationLifecycleService.cs index 11430ec7..6ed8c314 100644 --- a/Libraries/SPTarkov.Server.Core/Services/LocationLifecycleService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/LocationLifecycleService.cs @@ -895,6 +895,13 @@ public class LocationLifecycleService( isDead ); + // Required when player loses limb in-raid and fixes it, max now stuck at 50% or less if lost multiple times + var profileTemplate = profileHelper.GetProfileTemplateForSide( + fullServerProfile.ProfileInfo.Edition, + serverPmcProfile.Info.Side + ); + serverPmcProfile.ResetMaxLimbHp(profileTemplate); + if (isTransfer) { // Adjust limb hp and effects while transiting