add name of user to player route

This commit is contained in:
2023-04-20 11:35:38 +02:00
parent 924cd692ed
commit 01be7d8dd1
3 changed files with 8 additions and 0 deletions
+4
View File
@@ -37,6 +37,8 @@ router.get(
kills: number
max_distance: number
total_distance: number
username?: string
host?: number
}
} = {}
let index: 'cause_of_death' | 'attacker_id' | 'map' | 'servername'
@@ -66,6 +68,8 @@ router.get(
max_distance: 0,
total_distance: 0
}
if (index === 'attacker_id') data[e[index]].username = e.attacker_name
if (index === 'servername') data[e[index]].host = e.host
data[e[index]].deaths += Number(e.deaths)
data[e[index]].kills += Number(e.kills)
data[e[index]].total_distance += Number(e.total_distance)
+2
View File
@@ -39,6 +39,7 @@ export default async function listenKills() {
deaths: 0,
max_distance: 0,
total_distance: 0,
attacker_name: payload.attacker_name,
attacker_id: payload.attacker_id,
cause_of_death: payload.cause_of_death,
game_mode: payload.game_mode,
@@ -55,6 +56,7 @@ export default async function listenKills() {
deaths: 0,
max_distance: 0,
total_distance: 0,
attacker_name: payload.victim_name,
attacker_id: payload.victim_id,
cause_of_death: payload.victim_current_weapon,
game_mode: payload.game_mode,
+2
View File
@@ -39,6 +39,7 @@ async function processGlobalStats() {
'total_distance'
),
'attacker_id',
sql<string>`last(attacker_name)`.as('attacker_name'),
'cause_of_death',
'map',
'game_mode',
@@ -62,6 +63,7 @@ async function processGlobalStats() {
count<number>('id').as('deaths'),
'victim_id',
'victim_current_weapon',
sql<string>`last(attacker_name)`.as('attacker_name'),
'map',
'game_mode',
'servername',