diff --git a/Libraries/SPTarkov.Server.Assets/SPT_Data/configs/core.json b/Libraries/SPTarkov.Server.Assets/SPT_Data/configs/core.json index 5b49e941..5816f087 100644 --- a/Libraries/SPTarkov.Server.Assets/SPT_Data/configs/core.json +++ b/Libraries/SPTarkov.Server.Assets/SPT_Data/configs/core.json @@ -25,7 +25,8 @@ ], "removeModItemsFromProfile": false, "removeInvalidTradersFromProfile": false, - "fixProfileBreakingInventoryItemIssues": false + "fixProfileBreakingInventoryItemIssues": false, + "renamePreRaidLocales": true }, "survey": { "locale": { diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/CoreConfig.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/CoreConfig.cs index cb4a6171..c59a6303 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/CoreConfig.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/CoreConfig.cs @@ -244,6 +244,12 @@ public record GameFixes /// [JsonPropertyName("fixProfileBreakingInventoryItemIssues")] public bool FixProfileBreakingInventoryItemIssues { get; set; } + + /// + /// Should pre-raid english locales be renamed during raid start + /// + [JsonPropertyName("renamePreRaidLocales")] + public bool RenamePreRaidLocales { get; set; } } public record ServerFeatures diff --git a/Libraries/SPTarkov.Server.Core/Services/PostDbLoadService.cs b/Libraries/SPTarkov.Server.Core/Services/PostDbLoadService.cs index a3392f79..5304ca37 100644 --- a/Libraries/SPTarkov.Server.Core/Services/PostDbLoadService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/PostDbLoadService.cs @@ -136,6 +136,28 @@ public class PostDbLoadService( { ReplaceScavWavesWithRole(BotConfig.ReplaceScavWith); } + + if (CoreConfig.Fixes.RenamePreRaidLocales) + { + RenamePreraidLocales(); + } + + } + + protected void RenamePreraidLocales() + { + if (databaseService.GetLocales().Global.TryGetValue("en", out var lazyloadedValue)) + { + // We have to add a transformer here, because locales are lazy loaded due to them taking up huge space in memory + // The transformer will make sure that each time the locales are requested, the ones changed or added below are included + lazyloadedValue.AddTransformer(lazyloadedLocaleData => + { + lazyloadedLocaleData["Offline raid test mode"] = "SPT"; + lazyloadedLocaleData["Offline raid description"] = " "; + + return lazyloadedLocaleData; + }); + } } protected void ReplaceScavWavesWithRole(WildSpawnType newScavRole)