Updated server to match raid times with live
This commit is contained in:
parent
68e73e4d86
commit
386aeee9d7
@ -44,6 +44,6 @@ export class WeatherController
|
|||||||
*/
|
*/
|
||||||
public getCurrentInRaidTime(): Date
|
public getCurrentInRaidTime(): Date
|
||||||
{
|
{
|
||||||
return this.weatherGenerator.getInRaidTime(new Date());
|
return this.weatherGenerator.getInRaidTime();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ export class WeatherGenerator
|
|||||||
const formattedDate = this.timeUtil.formatDate(computedDate);
|
const formattedDate = this.timeUtil.formatDate(computedDate);
|
||||||
|
|
||||||
data.date = formattedDate;
|
data.date = formattedDate;
|
||||||
data.time = this.getBsgFormattedInRaidTime(computedDate);
|
data.time = this.getBsgFormattedInRaidTime();
|
||||||
data.acceleration = this.weatherConfig.acceleration;
|
data.acceleration = this.weatherConfig.acceleration;
|
||||||
data.winterEventEnabled = this.weatherConfig.forceWinterEvent;
|
data.winterEventEnabled = this.weatherConfig.forceWinterEvent;
|
||||||
|
|
||||||
@ -57,9 +57,9 @@ export class WeatherGenerator
|
|||||||
* @param currentDate current date
|
* @param currentDate current date
|
||||||
* @returns formatted time
|
* @returns formatted time
|
||||||
*/
|
*/
|
||||||
protected getBsgFormattedInRaidTime(currentDate: Date): string
|
protected getBsgFormattedInRaidTime(): string
|
||||||
{
|
{
|
||||||
const clientAcceleratedDate = this.getInRaidTime(currentDate);
|
const clientAcceleratedDate = this.getInRaidTime();
|
||||||
|
|
||||||
return this.getBSGFormattedTime(clientAcceleratedDate);
|
return this.getBSGFormattedTime(clientAcceleratedDate);
|
||||||
}
|
}
|
||||||
@ -69,11 +69,16 @@ export class WeatherGenerator
|
|||||||
* @param currentDate (new Date())
|
* @param currentDate (new Date())
|
||||||
* @returns Date object of current in-raid time
|
* @returns Date object of current in-raid time
|
||||||
*/
|
*/
|
||||||
public getInRaidTime(currentDate: Date): Date
|
public getInRaidTime(): Date
|
||||||
{
|
{
|
||||||
const timeSinceServerStartMS = currentDate.getTime() - this.serverStartTimestampMS;
|
// tarkov time = (real time * 7 % 24 hr) + 3 hour
|
||||||
const acceleratedMS = timeSinceServerStartMS * (this.weatherConfig.acceleration);
|
const russiaOffset = (this.timeUtil.getHoursAsSeconds(3)) * 1000;
|
||||||
return new Date(this.serverStartTimestampMS + acceleratedMS);
|
const tarkovTime = new Date(
|
||||||
|
(russiaOffset + (new Date().getTime() * this.weatherConfig.acceleration))
|
||||||
|
% (this.timeUtil.getHoursAsSeconds(24) * 1000),
|
||||||
|
);
|
||||||
|
|
||||||
|
return new Date(tarkovTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -120,7 +125,7 @@ export class WeatherGenerator
|
|||||||
*/
|
*/
|
||||||
protected setCurrentDateTime(weather: IWeather): void
|
protected setCurrentDateTime(weather: IWeather): void
|
||||||
{
|
{
|
||||||
const currentDate = this.getInRaidTime(new Date());
|
const currentDate = this.getInRaidTime();
|
||||||
const normalTime = this.getBSGFormattedTime(currentDate);
|
const normalTime = this.getBSGFormattedTime(currentDate);
|
||||||
const formattedDate = this.timeUtil.formatDate(currentDate);
|
const formattedDate = this.timeUtil.formatDate(currentDate);
|
||||||
const datetime = `${formattedDate} ${normalTime}`;
|
const datetime = `${formattedDate} ${normalTime}`;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user