Improve raid time emulation of live

This commit is contained in:
Dev 2024-11-18 21:27:45 +00:00
parent bda8f3fda2
commit ab488bd22f
3 changed files with 4 additions and 13 deletions

View File

@ -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 = {

View File

@ -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

View File

@ -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,
);
}