diff --git a/project/assets/configs/seasonalevents.json b/project/assets/configs/seasonalevents.json index b7955109..8962aa22 100644 --- a/project/assets/configs/seasonalevents.json +++ b/project/assets/configs/seasonalevents.json @@ -671,7 +671,7 @@ "type": "NEW_YEARS", "startDay": "1", "startMonth": "1", - "endDay": "7", + "endDay": "9", "endMonth": "1" } ] diff --git a/project/assets/configs/weather.json b/project/assets/configs/weather.json index 805f9316..dac029b8 100644 --- a/project/assets/configs/weather.json +++ b/project/assets/configs/weather.json @@ -1,6 +1,6 @@ { "acceleration": 7, - "enableWinterEvent": false, + "forceWinterEvent": false, "weather": { "clouds": { "values": [-1.5, -1, 0, 0.5, 1, 1.5], diff --git a/project/src/controllers/WeatherController.ts b/project/src/controllers/WeatherController.ts index d2d6410c..8a102a83 100644 --- a/project/src/controllers/WeatherController.ts +++ b/project/src/controllers/WeatherController.ts @@ -24,7 +24,12 @@ export class WeatherController /** Handle client/weather */ public generate(): IWeatherData { - let result: IWeatherData = { acceleration: 0, time: "", date: "", weather: null, winterEventEnabled: this.weatherConfig.enableWinterEvent }; + let result: IWeatherData = { + acceleration: 0, + time: "", + date: "", + weather: null, + winterEventEnabled: this.weatherConfig.forceWinterEvent }; result = this.weatherGenerator.calculateGameTime(result); result.weather = this.weatherGenerator.generateWeather(); diff --git a/project/src/generators/WeatherGenerator.ts b/project/src/generators/WeatherGenerator.ts index 9ef21da9..19627dda 100644 --- a/project/src/generators/WeatherGenerator.ts +++ b/project/src/generators/WeatherGenerator.ts @@ -42,7 +42,7 @@ export class WeatherGenerator data.date = formattedDate; data.time = this.getBsgFormattedInRaidTime(computedDate); data.acceleration = this.weatherConfig.acceleration; - data.winterEventEnabled = this.weatherConfig.enableWinterEvent; + data.winterEventEnabled = this.weatherConfig.forceWinterEvent; return data; } diff --git a/project/src/models/spt/config/IWeatherConfig.ts b/project/src/models/spt/config/IWeatherConfig.ts index 3a5eb703..0a19d6eb 100644 --- a/project/src/models/spt/config/IWeatherConfig.ts +++ b/project/src/models/spt/config/IWeatherConfig.ts @@ -7,7 +7,7 @@ export interface IWeatherConfig extends IBaseConfig kind: "aki-weather"; acceleration: number; weather: Weather; - enableWinterEvent: boolean; + forceWinterEvent: boolean; } export interface Weather diff --git a/project/src/services/SeasonalEventService.ts b/project/src/services/SeasonalEventService.ts index de759ab4..3cd63bb2 100644 --- a/project/src/services/SeasonalEventService.ts +++ b/project/src/services/SeasonalEventService.ts @@ -27,8 +27,11 @@ export class SeasonalEventService protected httpConfig: IHttpConfig; protected weatherConfig: IWeatherConfig; - protected halloweenEventActive = undefined; - protected christmasEventActive = undefined; + protected halloweenEventActive: boolean = undefined; + protected christmasEventActive: boolean = undefined; + + /** All events active at this point in time */ + protected currentlyActiveEvents: SeasonalEventType[] = undefined; constructor( @inject("WinstonLogger") protected logger: ILogger, @@ -217,14 +220,13 @@ export class SeasonalEventService public enableSeasonalEvents(sessionId: string): void { const globalConfig = this.databaseServer.getTables().globals.config; - if (this.christmasEventActive) - { - this.updateGlobalEvents(sessionId, globalConfig, SeasonalEventType.CHRISTMAS); - } - if (this.halloweenEventActive) + if (this.currentlyActiveEvents) { - this.updateGlobalEvents(sessionId, globalConfig, SeasonalEventType.HALLOWEEN); + for (const event of this.currentlyActiveEvents) + { + this.updateGlobalEvents(sessionId, globalConfig, event); + } } } @@ -241,8 +243,17 @@ export class SeasonalEventService // Current date is between start/end dates if (currentDate >= eventStartDate && currentDate <= eventEndDate) { - this.christmasEventActive = SeasonalEventType[event.type] === SeasonalEventType.CHRISTMAS; - this.halloweenEventActive = SeasonalEventType[event.type] === SeasonalEventType.HALLOWEEN; + this.currentlyActiveEvents.push(SeasonalEventType[event.type]); + + if (SeasonalEventType[event.type] === SeasonalEventType.CHRISTMAS) + { + this.christmasEventActive = true; + } + + if (SeasonalEventType[event.type] === SeasonalEventType.HALLOWEEN) + { + this.halloweenEventActive = true; + } } } } @@ -558,6 +569,6 @@ export class SeasonalEventService public enableSnow(): void { - this.weatherConfig.enableWinterEvent = true; + this.weatherConfig.forceWinterEvent = true; } }