diff --git a/project/src/controllers/WeatherController.ts b/project/src/controllers/WeatherController.ts index 40993ed2..51802efa 100644 --- a/project/src/controllers/WeatherController.ts +++ b/project/src/controllers/WeatherController.ts @@ -35,14 +35,6 @@ export class WeatherController { return result; } - /** - * Get the current in-raid time (MUST HAVE PLAYER LOGGED INTO CLIENT TO WORK) - * @returns Date object - */ - public getCurrentInRaidTime(): Date { - return this.weatherHelper.getInRaidTime(); - } - /** Handle client/localGame/weather */ public generateLocal(sesssionId: string): IGetLocalWeatherResponseData { const result: IGetLocalWeatherResponseData = { diff --git a/project/src/generators/WeatherGenerator.ts b/project/src/generators/WeatherGenerator.ts index 5f2cfecf..5e918977 100644 --- a/project/src/generators/WeatherGenerator.ts +++ b/project/src/generators/WeatherGenerator.ts @@ -133,7 +133,7 @@ export class WeatherGenerator { protected setCurrentDateTime(weather: IWeather, timestamp?: number): void { const inRaidTime = this.weatherHelper.getInRaidTime(timestamp); const normalTime = this.getBSGFormattedTime(inRaidTime); - const formattedDate = this.timeUtil.formatDate(inRaidTime); + const formattedDate = this.timeUtil.formatDate(timestamp ? new Date(timestamp) : new Date()); const datetimeBsgFormat = `${formattedDate} ${normalTime}`; weather.timestamp = Math.floor(timestamp ? timestamp : inRaidTime.getTime() / 1000); // matches weather.date diff --git a/project/src/helpers/WeatherHelper.ts b/project/src/helpers/WeatherHelper.ts index 4f3f1d01..90271ee0 100644 --- a/project/src/helpers/WeatherHelper.ts +++ b/project/src/helpers/WeatherHelper.ts @@ -19,7 +19,7 @@ export class WeatherHelper { } /** - * Get the current in-raid time + * Get the current in-raid time - does not include an accurate date, only time * @param currentDate (new Date()) * @returns Date object of current in-raid time */ @@ -30,9 +30,8 @@ export class WeatherHelper { const currentTimestampMilliSeconds = timestamp ? timestamp : new Date().getTime(); return new Date( - ((russiaOffsetMilliseconds + currentTimestampMilliSeconds * this.weatherConfig.acceleration) % - twentyFourHoursMilliseconds) + - this.timeUtil.getStartOfDayTimestamp(timestamp), + (russiaOffsetMilliseconds + currentTimestampMilliSeconds * this.weatherConfig.acceleration) % + twentyFourHoursMilliseconds, ); }