Wired up transit whitelist system for use in Khorvod event

This commit is contained in:
Chomp
2025-12-20 15:41:16 +00:00
parent e46474fdd2
commit ce2fc8a56e
3 changed files with 38 additions and 1 deletions
@@ -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]
}
}
@@ -47,6 +47,9 @@ public record SeasonalEventConfig : BaseConfig
[JsonPropertyName("hostilitySettingsForEvent")]
public required Dictionary<string, Dictionary<string, List<AdditionalHostilitySettings>>> HostilitySettingsForEvent { get; set; }
[JsonPropertyName("khorvodEventTransitWhitelist")]
public required Dictionary<string, List<int>> KhorvodEventTransitWhitelist { get; set; }
/// <summary>
/// Ids of containers on locations that only have Christmas loot
/// </summary>
@@ -143,6 +146,9 @@ public record SeasonalEventSettings
[JsonPropertyName("enableRundansEvent")]
public bool? EnableRundansEvent { get; set; }
[JsonPropertyName("enableKhorvodEvent")]
public bool? EnableKhorvodEvent { get; set; }
}
public record ZombieSettings
@@ -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;