Skip to content

Commit 1ac6e3f

Browse files
author
Vliegenier04
committed
Fix(cvc):missing file
1 parent b8dc12c commit 1ac6e3f

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# Extensions - Ignore everything in extensions folder
2-
extensions/
3-
42

53
# Logs
64
logs
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* Cops and Crims Stats Handler
3+
*/
4+
5+
import { Achievements, MCGO, StatsHandler } from '../types';
6+
import { getRandomHexColor, calculateRatio, formatNumber } from '../utils';
7+
8+
export const copsAndCrimsHandler: StatsHandler = {
9+
gameMode: 'MCGO',
10+
command: 'cvc',
11+
description: 'Check Cops and Crims stats',
12+
buildStatsMessage: (playerName: string, achievements?: Achievements, stats?: MCGO): string => {
13+
if (!stats) {
14+
return `No Cops and Crims stats found for ${playerName}. | ${getRandomHexColor()}`;
15+
}
16+
17+
const kills = stats.kills ?? 0;
18+
const deaths = stats.deaths ?? 0;
19+
const wins = stats.game_wins ?? 0;
20+
const roundWins = stats.round_wins ?? 0;
21+
const headshots = stats.headshot_kills ?? 0;
22+
const shots = stats.shots_fired ?? 0;
23+
const copKills = stats.cop_kills ?? 0;
24+
const criminalKills = stats.criminal_kills ?? 0;
25+
26+
// Calculate ratios
27+
const kdr = calculateRatio(kills, deaths);
28+
const headshotPercent = calculateRatio(headshots, kills, 1);
29+
30+
return `[Cops and Crims] IGN: ${playerName} | WINS: ${wins} | KDR: ${kdr} | KILLS: ${formatNumber(kills)} | HS: ${headshotPercent}% | ROUNDS: ${roundWins} | ${getRandomHexColor()}`;
31+
}
32+
};

0 commit comments

Comments
 (0)