Improve raid time emulation of live
This commit is contained in:
parent
bda8f3fda2
commit
ab488bd22f
@ -35,14 +35,6 @@ export class WeatherController {
|
|||||||
return result;
|
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 */
|
/** Handle client/localGame/weather */
|
||||||
public generateLocal(sesssionId: string): IGetLocalWeatherResponseData {
|
public generateLocal(sesssionId: string): IGetLocalWeatherResponseData {
|
||||||
const result: IGetLocalWeatherResponseData = {
|
const result: IGetLocalWeatherResponseData = {
|
||||||
|
@ -133,7 +133,7 @@ export class WeatherGenerator {
|
|||||||
protected setCurrentDateTime(weather: IWeather, timestamp?: number): void {
|
protected setCurrentDateTime(weather: IWeather, timestamp?: number): void {
|
||||||
const inRaidTime = this.weatherHelper.getInRaidTime(timestamp);
|
const inRaidTime = this.weatherHelper.getInRaidTime(timestamp);
|
||||||
const normalTime = this.getBSGFormattedTime(inRaidTime);
|
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}`;
|
const datetimeBsgFormat = `${formattedDate} ${normalTime}`;
|
||||||
|
|
||||||
weather.timestamp = Math.floor(timestamp ? timestamp : inRaidTime.getTime() / 1000); // matches weather.date
|
weather.timestamp = Math.floor(timestamp ? timestamp : inRaidTime.getTime() / 1000); // matches weather.date
|
||||||
|
@ -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())
|
* @param currentDate (new Date())
|
||||||
* @returns Date object of current in-raid time
|
* @returns Date object of current in-raid time
|
||||||
*/
|
*/
|
||||||
@ -30,9 +30,8 @@ export class WeatherHelper {
|
|||||||
const currentTimestampMilliSeconds = timestamp ? timestamp : new Date().getTime();
|
const currentTimestampMilliSeconds = timestamp ? timestamp : new Date().getTime();
|
||||||
|
|
||||||
return new Date(
|
return new Date(
|
||||||
((russiaOffsetMilliseconds + currentTimestampMilliSeconds * this.weatherConfig.acceleration) %
|
(russiaOffsetMilliseconds + currentTimestampMilliSeconds * this.weatherConfig.acceleration) %
|
||||||
twentyFourHoursMilliseconds) +
|
twentyFourHoursMilliseconds,
|
||||||
this.timeUtil.getStartOfDayTimestamp(timestamp),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user