From ce2fc8a56e539afdcac15450ad6bbe348d1c3e69 Mon Sep 17 00:00:00 2001 From: Chomp Date: Sat, 20 Dec 2025 15:41:16 +0000 Subject: [PATCH] Wired up transit whitelist system for use in Khorvod event --- .../SPT_Data/configs/seasonalevents.json | 7 ++++- .../Models/Spt/Config/SeasonalEventConfig.cs | 6 +++++ .../Services/SeasonalEventService.cs | 26 +++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/Libraries/SPTarkov.Server.Assets/SPT_Data/configs/seasonalevents.json b/Libraries/SPTarkov.Server.Assets/SPT_Data/configs/seasonalevents.json index cb298be6..7eb84a59 100644 --- a/Libraries/SPTarkov.Server.Assets/SPT_Data/configs/seasonalevents.json +++ b/Libraries/SPTarkov.Server.Assets/SPT_Data/configs/seasonalevents.json @@ -9930,7 +9930,8 @@ "adjustBotAppearances": true, "enableChristmasHideout": true, "enableSanta": true, - "enableRundansEvent": true + "enableRundansEvent": true, + "enableKhorvodEvent": true }, "startDay": "13", "startMonth": "12", @@ -9944,6 +9945,7 @@ "settings": { "adjustBotAppearances": true, "enableChristmasHideout": true, + "enableKhorvodEvent": true, "enableSanta": true }, "startDay": "1", @@ -13997,5 +13999,8 @@ } ] } + }, + "khorvodEventTransitWhitelist": { + "bigmap": [9] } } diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/SeasonalEventConfig.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/SeasonalEventConfig.cs index b60278f5..cdfefef7 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/SeasonalEventConfig.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/SeasonalEventConfig.cs @@ -47,6 +47,9 @@ public record SeasonalEventConfig : BaseConfig [JsonPropertyName("hostilitySettingsForEvent")] public required Dictionary>> HostilitySettingsForEvent { get; set; } + [JsonPropertyName("khorvodEventTransitWhitelist")] + public required Dictionary> KhorvodEventTransitWhitelist { get; set; } + /// /// Ids of containers on locations that only have Christmas loot /// @@ -143,6 +146,9 @@ public record SeasonalEventSettings [JsonPropertyName("enableRundansEvent")] public bool? EnableRundansEvent { get; set; } + + [JsonPropertyName("enableKhorvodEvent")] + public bool? EnableKhorvodEvent { get; set; } } public record ZombieSettings diff --git a/Libraries/SPTarkov.Server.Core/Services/SeasonalEventService.cs b/Libraries/SPTarkov.Server.Core/Services/SeasonalEventService.cs index 3656a68a..94667985 100644 --- a/Libraries/SPTarkov.Server.Core/Services/SeasonalEventService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/SeasonalEventService.cs @@ -519,9 +519,35 @@ public class SeasonalEventService( EnableRunnansEvent(databaseService.GetGlobals()); } + if (eventType.Settings?.EnableKhorvodEvent ?? false) + { + AdjustTransitsToKhorvodEvent(); + } + ChangeBtrToTarColaSkin(); } + protected void AdjustTransitsToKhorvodEvent() + { + var locations = databaseService.GetLocations().GetDictionary(); + + foreach (var (locationName, locationBase) in locations) + { + if (LocationConfig.NonMaps.Contains(locationName)) + { + continue; + } + + var matchingTransitWhitelist = SeasonalEventConfig.KhorvodEventTransitWhitelist.GetValueOrDefault(locationBase.Base.Id, null); + if (matchingTransitWhitelist is null ) + { + continue; + } + + locationBase.Base.Transits = locationBase.Base.Transits.Where(t => matchingTransitWhitelist.Contains(t.Id.Value)).ToList(); + } + } + protected void EnableRunnansEvent(Globals globals) { globals.Configuration.RunddansSettings.Active = true;