File tree Expand file tree Collapse file tree 2 files changed +32
-2
lines changed
extensions/hypixel-stats/handlers Expand file tree Collapse file tree 2 files changed +32
-2
lines changed Original file line number Diff line number Diff line change 11# Extensions - Ignore everything in extensions folder
2- extensions /
3-
42
53# Logs
64logs
Original file line number Diff line number Diff line change 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+ } ;
You can’t perform that action at this time.
0 commit comments