Converted StoreHydrationEnergyTempInProfile into extension method

This commit is contained in:
Chomp
2025-06-28 09:06:16 +01:00
parent 65d8d7432d
commit 667995be37
2 changed files with 20 additions and 15 deletions
@@ -0,0 +1,19 @@
using SPTarkov.Server.Core.Models.Eft.Profile;
namespace SPTarkov.Server.Core.Extensions
{
public static class FullProfileExtensions
{
public static void StoreHydrationEnergyTempInProfile(
this SptProfile fullProfile,
double hydration,
double energy,
double temperature
)
{
fullProfile.VitalityData.Hydration = hydration;
fullProfile.VitalityData.Energy = energy;
fullProfile.VitalityData.Temperature = temperature;
}
}
}
@@ -58,8 +58,7 @@ public class HealthHelper(
var defaultTemperature =
matchingSide?.Character?.Health?.Temperature ?? new CurrentMinMax { Current = 36.6 };
StoreHydrationEnergyTempInProfile(
fullProfile,
fullProfile.StoreHydrationEnergyTempInProfile(
postRaidHealth.Hydration.Current ?? 0,
postRaidHealth.Energy.Current ?? 0,
defaultTemperature.Current ?? 0 // Reset profile temp to the default to prevent very cold/hot temps persisting into next raid
@@ -104,18 +103,6 @@ public class HealthHelper(
pmcData.Health.UpdateTime = _timeUtil.GetTimeStamp();
}
protected void StoreHydrationEnergyTempInProfile(
SptProfile fullProfile,
double hydration,
double energy,
double temperature
)
{
fullProfile.VitalityData.Hydration = hydration;
fullProfile.VitalityData.Energy = energy;
fullProfile.VitalityData.Temperature = temperature;
}
/// <summary>
/// Take body part effects from client profile and apply to server profile
/// </summary>
@@ -269,7 +256,6 @@ public class HealthHelper(
/// Add effect to body part in profile
/// </summary>
/// <param name="pmcData">Player profile</param>
/// <param name="effectBodyPart">Body part to edit</param>
/// <param name="effectType">Effect to add to body part</param>
/// <param name="duration">How long the effect has left in seconds (-1 by default, no duration).</param>
protected void AddEffect(