Validate profiles on server start, can be disabled via core.config

This commit is contained in:
Chomp
2025-08-17 19:56:59 +01:00
parent ca667f6d1b
commit c1522c278e
4 changed files with 26 additions and 1 deletions
@@ -12,6 +12,9 @@
"release": {
"betaDisclaimerTimeoutDelay": 30
},
"onStart": {
"validateProfiles": true
},
"fixes": {
"fixShotgunDispersion": true,
"removeModItemsFromProfile": false,
@@ -2,7 +2,6 @@
using SPTarkov.Server.Core.Exceptions.Items;
using SPTarkov.Server.Core.Extensions;
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Eft.Common;
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
using SPTarkov.Server.Core.Models.Eft.Profile;
using SPTarkov.Server.Core.Models.Enums;
@@ -36,6 +36,9 @@ public record CoreConfig : BaseConfig
[JsonPropertyName("fixes")]
public required GameFixes Fixes { get; set; }
[JsonPropertyName("onStart")]
public required OnStart OnStart { get; set; }
[JsonPropertyName("survey")]
public required SurveyResponseData Survey { get; set; }
@@ -208,6 +211,15 @@ public record GameFixes
public bool FixProfileBreakingInventoryItemIssues { get; set; }
}
public record OnStart
{
/// <summary>
/// Run profile templateId checks on all profiles when server starts
/// </summary>
[JsonPropertyName("validateProfiles")]
public bool ValidateProfiles { get; set; }
}
public record ServerFeatures
{
[JsonExtensionData]
@@ -1,5 +1,6 @@
using SPTarkov.DI.Annotations;
using SPTarkov.Server.Core.Extensions;
using SPTarkov.Server.Core.Helpers;
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Eft.Common;
using SPTarkov.Server.Core.Models.Enums;
@@ -20,6 +21,8 @@ public class PostDbLoadService(
OpenZoneService openZoneService,
ItemBaseClassService itemBaseClassService,
RaidWeatherService raidWeatherService,
ProfileHelper profileHelper,
ProfileValidatorHelper profileValidatorHelper,
ConfigServer configServer,
ICloner cloner
)
@@ -134,6 +137,14 @@ public class PostDbLoadService(
var chosenBoss = GetWeeklyBoss(_botConfig.WeeklyBoss.BossPool, _botConfig.WeeklyBoss.ResetDay);
FlagMapAsGuaranteedBoss(chosenBoss);
}
if (_coreConfig.OnStart.ValidateProfiles)
{
foreach (var (profileId, profile) in profileHelper.GetProfiles())
{
profileValidatorHelper.CheckForOrphanedModdedData(profileId, profile);
}
}
}
/// <summary>