leaderboard v2, filtro por round, game, datos historicos, salas activas

This commit is contained in:
2025-08-27 21:45:10 -06:00
parent f5082219a3
commit 0877fe1448
5 changed files with 633 additions and 145 deletions

View File

@@ -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);