mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-11-27 15:57:13 +09:00
Included migrated playtime and join count in stats table
This commit is contained in:
2 files changed
+5
-5
No files matched your search
@@ -42,11 +42,11 @@ export class PlayerStatistics {
|
||||
}
|
||||
}
|
||||
|
||||
/** Statistics clusterio already keeps for every user, shown with the others but never added to */
|
||||
export function userStatistics(user?: Pick<lib.UserDetails, "playerStats">): Record<string, number> {
|
||||
/** Statistics clusterio already keeps for every user, shown with the others but never added to, existing stats may contain legacy values */
|
||||
export function userStatistics(user?: Pick<lib.UserDetails, "playerStats">, stats: Record<string, number> = {}): Record<string, number> {
|
||||
return {
|
||||
Playtime: Math.floor((user?.playerStats.onlineTimeMs ?? 0) / 60e3),
|
||||
JoinCount: user?.playerStats.joinCount ?? 0,
|
||||
Playtime: (stats.Playtime ?? 0) + Math.floor((user?.playerStats.onlineTimeMs ?? 0) / 60e3),
|
||||
JoinCount: (stats.JoinCount ?? 0) + (user?.playerStats.joinCount ?? 0),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user