Fixed pre-raid locales that can be confusing to players

This commit is contained in:
Chomp
2025-11-12 16:02:11 +00:00
parent ec7dbdf2bc
commit 969e10aa80
3 changed files with 30 additions and 1 deletions
@@ -25,7 +25,8 @@
],
"removeModItemsFromProfile": false,
"removeInvalidTradersFromProfile": false,
"fixProfileBreakingInventoryItemIssues": false
"fixProfileBreakingInventoryItemIssues": false,
"renamePreRaidLocales": true
},
"survey": {
"locale": {
@@ -244,6 +244,12 @@ public record GameFixes
/// </summary>
[JsonPropertyName("fixProfileBreakingInventoryItemIssues")]
public bool FixProfileBreakingInventoryItemIssues { get; set; }
/// <summary>
/// Should pre-raid english locales be renamed during raid start
/// </summary>
[JsonPropertyName("renamePreRaidLocales")]
public bool RenamePreRaidLocales { get; set; }
}
public record ServerFeatures
@@ -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)