leaderboard v2, filtro por round, game, datos historicos, salas activas
This commit is contained in:
@@ -816,18 +816,28 @@ async function sendPlayersActionsUpdate(client?: Response) {
|
||||
const players = uuids.map((uuid: string) => {
|
||||
const history = nameManager.getSystemHistory(uuid) || [];
|
||||
const counts: any = Object.fromEntries(ACTION_EVENTS.map(k => [k, 0]));
|
||||
const detailedHistory: any[] = [];
|
||||
|
||||
for (const entry of history) {
|
||||
const kind = (entry as any)?.kind || '';
|
||||
if (!ACTION_EVENTS.includes(kind)) continue;
|
||||
if (!isActionMade(kind, (entry as any)?.role)) continue;
|
||||
counts[kind] = (counts[kind] || 0) + 1;
|
||||
|
||||
// Include detailed event info
|
||||
detailedHistory.push({
|
||||
kind,
|
||||
round: (entry as any)?.round,
|
||||
gameVariant: (entry as any)?.gameVariant || (entry as any)?.variant
|
||||
});
|
||||
}
|
||||
const total = ACTION_EVENTS.reduce((acc, k) => acc + (counts[k] || 0), 0);
|
||||
return {
|
||||
uuid,
|
||||
name: nameManager.getPlayerName(uuid) || null,
|
||||
counts,
|
||||
total
|
||||
total,
|
||||
detailedHistory
|
||||
};
|
||||
}).filter((p: any) => p.total > 0 || p.name);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user