From d5514c6bb421095468ace2945cc046d30645ce08 Mon Sep 17 00:00:00 2001 From: Archangel Date: Tue, 5 Aug 2025 16:59:45 +0200 Subject: [PATCH] Only write InvalidOrUnloadableProfile if it's not null --- .../Models/Eft/Profile/SptProfile.cs | 5 +++-- Libraries/SPTarkov.Server.Core/Servers/SaveServer.cs | 10 ++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Profile/SptProfile.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Profile/SptProfile.cs index b91b1b2a..0b9f0648 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Profile/SptProfile.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Profile/SptProfile.cs @@ -104,8 +104,9 @@ public record Info [JsonPropertyName("edition")] public string? Edition { get; set; } - [JsonIgnore] - public bool InvalidOrUnloadableProfile { get; internal set; } = false; + [JsonPropertyName("invalidOrUnloadableProfile")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public bool? InvalidOrUnloadableProfile { get; internal set; } } public record Characters diff --git a/Libraries/SPTarkov.Server.Core/Servers/SaveServer.cs b/Libraries/SPTarkov.Server.Core/Servers/SaveServer.cs index 6b0cb91d..6451e69f 100644 --- a/Libraries/SPTarkov.Server.Core/Servers/SaveServer.cs +++ b/Libraries/SPTarkov.Server.Core/Servers/SaveServer.cs @@ -215,7 +215,10 @@ public class SaveServer( } // We don't proceed further here as only one object in the profile has data in it. - if (profiles[sessionID].ProfileInfo!.InvalidOrUnloadableProfile) + if ( + profiles[sessionID].ProfileInfo!.InvalidOrUnloadableProfile is not null + && profiles[sessionID].ProfileInfo!.InvalidOrUnloadableProfile!.Value + ) { return; } @@ -236,7 +239,10 @@ public class SaveServer( public async Task SaveProfileAsync(MongoId sessionID) { // No need to save profiles that have been marked as invalid - if (profiles[sessionID].ProfileInfo!.InvalidOrUnloadableProfile) + if ( + profiles[sessionID].ProfileInfo!.InvalidOrUnloadableProfile is not null + && profiles[sessionID].ProfileInfo!.InvalidOrUnloadableProfile!.Value + ) { return 0; }