More prestige fixes (#471)

* Only send message if there's items to be sent

* Update variable name

* Fix up incrementing a null integer
This commit is contained in:
Jesse
2025-07-11 15:52:33 +02:00
committed by GitHub
parent 533a7356fd
commit a00b5c51d2
3 changed files with 15 additions and 6 deletions
@@ -66,7 +66,7 @@ public class PrestigeController(
{
var pendingPrestige = new PendingPrestige
{
PrestigeLevel = profile.CharacterData.PmcData.Info.PrestigeLevel + 1,
PrestigeLevel = (profile.CharacterData?.PmcData?.Info?.PrestigeLevel ?? 0) + 1,
Items = request,
};
@@ -129,10 +129,11 @@ namespace SPTarkov.Server.Core.Extensions
break;
}
var pretigeLevel = fullProfile?.CharacterData?.PmcData?.Info?.PrestigeLevel;
if (pretigeLevel is not null)
var prestigeLevel = fullProfile?.CharacterData?.PmcData?.Info?.PrestigeLevel;
if (prestigeLevel is not null)
{
if (pretigeLevel >= 1)
if (prestigeLevel >= 1)
{
fullProfile.CustomisationUnlocks.Add(
new CustomisationStorage
@@ -144,7 +145,7 @@ namespace SPTarkov.Server.Core.Extensions
);
}
if (pretigeLevel >= 2)
if (prestigeLevel >= 2)
{
fullProfile.CustomisationUnlocks.Add(
new CustomisationStorage
@@ -112,7 +112,15 @@ public class PrestigeHelper(
itemsToTransfer.Add(item);
}
mailSendService.SendSystemMessageToPlayer(sessionId.Value, "", itemsToTransfer, 31536000);
if (itemsToTransfer.Count > 0)
{
mailSendService.SendSystemMessageToPlayer(
sessionId.Value,
"",
itemsToTransfer,
31536000
);
}
newProfile.CharacterData.PmcData.Info.PrestigeLevel = prestige.PrestigeLevel;
}