Moved logic to better location

This commit is contained in:
Chomp
2025-12-20 15:59:52 +00:00
parent 1d2168af72
commit c7155630a3
2 changed files with 13 additions and 27 deletions
@@ -58,6 +58,7 @@ public class LocationLifecycleService(
protected readonly PmcConfig PMCConfig = configServer.GetConfig<PmcConfig>(); protected readonly PmcConfig PMCConfig = configServer.GetConfig<PmcConfig>();
protected readonly BotConfig BotConfig = configServer.GetConfig<BotConfig>(); protected readonly BotConfig BotConfig = configServer.GetConfig<BotConfig>();
protected readonly LostOnDeathConfig LostOnDeathConfig = configServer.GetConfig<LostOnDeathConfig>(); protected readonly LostOnDeathConfig LostOnDeathConfig = configServer.GetConfig<LostOnDeathConfig>();
protected readonly SeasonalEventConfig SeasonalEventConfig = configServer.GetConfig<SeasonalEventConfig>();
protected const string Pmc = "pmc"; protected const string Pmc = "pmc";
protected const string Savage = "savage"; protected const string Savage = "savage";
@@ -118,7 +119,18 @@ public class LocationLifecycleService(
// Handle Runddans / Khorovod event // Handle Runddans / Khorovod event
if (transitionType == TransitionType.EVENT && isRundansActive) if (transitionType == TransitionType.EVENT && isRundansActive)
{ {
foreach (var transits in location.Transits ?? []) // TODO - wire up this first part to EnableKhorvodEvent in Seasonal config + move isRundansActive check to below block
if (location.Transits != null)
{
// Get whitelist for maps transits, event should have 1 only
var matchingTransitWhitelist = SeasonalEventConfig.KhorvodEventTransitWhitelist?.GetValueOrDefault(location.Id, null);
if (matchingTransitWhitelist != null)
{
location.Transits = location.Transits.Where(transit => matchingTransitWhitelist.Contains(transit.Id.Value)).ToList();
}
}
foreach (var transits in location.Transits)
{ {
transits.ActivateAfterSeconds = 300; transits.ActivateAfterSeconds = 300;
transits.Events = true; transits.Events = true;
@@ -519,35 +519,9 @@ public class SeasonalEventService(
EnableRunnansEvent(databaseService.GetGlobals()); EnableRunnansEvent(databaseService.GetGlobals());
} }
if (eventType.Settings?.EnableKhorvodEvent ?? false)
{
AdjustTransitsToKhorvodEvent();
}
ChangeBtrToTarColaSkin(); 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) protected void EnableRunnansEvent(Globals globals)
{ {
globals.Configuration.RunddansSettings.Active = true; globals.Configuration.RunddansSettings.Active = true;