Improve accuracy of total game time

This commit is contained in:
Dev 2023-12-21 22:12:55 +00:00
parent f451920fb7
commit c7572fdaf2

View File

@ -420,6 +420,7 @@ export class GameController
public getGameConfig(sessionID: string): IGameConfigResponse
{
const profile = this.profileHelper.getPmcProfile(sessionID);
const gameTime = profile.Stats?.Eft.OverallCounters.Items?.find(counter => counter.Key.includes("LifeTime") && counter.Key.includes("Pmc"))?.Value ?? 0;
const config: IGameConfigResponse = {
languages: this.databaseServer.getTables().locales.languages,
@ -440,7 +441,7 @@ export class GameController
useProtobuf: false,
// eslint-disable-next-line @typescript-eslint/naming-convention
utc_time: new Date().getTime() / 1000,
totalInGame: profile.Stats?.Eft?.TotalInGameTime ?? 0,
totalInGame: gameTime,
};
return config;