@@ -11,6 +11,14 @@ import { PlayerId } from 'gateway/shared-types/player-id';
11
11
import { PlayerBanEntity } from 'gameserver/model/player-ban.entity' ;
12
12
import { MatchmakingMode } from 'gateway/shared-types/matchmaking-mode' ;
13
13
14
+ const ABANDON_PUNISHMENTS = [
15
+ 1000 * 60 * 60 * 12 , // 12 hours
16
+ 1000 * 60 * 60 * 24 , // 24 hours
17
+ 1000 * 60 * 60 * 24 * 5 , // 5 days
18
+ 1000 * 60 * 60 * 24 * 14 , // 2 weeks
19
+ 1000 * 60 * 60 * 24 * 30 , // 1 month
20
+ ] ;
21
+
14
22
export const getBasePunishment = ( crime : BanReason ) => {
15
23
switch ( crime ) {
16
24
case BanReason . INFINITE_BAN :
@@ -35,7 +43,7 @@ export const getPunishmentCumulativeInterval = (crime: BanReason): string => {
35
43
case BanReason . LOAD_FAILURE :
36
44
return "24h" ;
37
45
case BanReason . ABANDON :
38
- return "7d " ;
46
+ return "21d " ;
39
47
default :
40
48
return "1m" ;
41
49
}
@@ -129,17 +137,19 @@ export class CrimeLogCreatedHandler
129
137
130
138
// We do `+1` because it doesn't count current crime, but we want to
131
139
let totalPunishmentCount = ( countedCrimes . get ( thisCrime . crime ) || 0 ) + 1 ;
132
- const basePunishment = getBasePunishment ( thisCrime . crime ) ;
133
- let punishmentDuration = basePunishment * totalPunishmentCount ;
134
-
135
- // console.log(
136
- // countedCrimes,
137
- // totalPunishmentCount,
138
- // basePunishment,
139
- // punishmentDuration,
140
- // thisCrime,
141
- // );
142
140
141
+ let punishmentDuration : number ;
142
+ if ( thisCrime . crime === BanReason . ABANDON ) {
143
+ // Use predefined punishments
144
+ const punishmentIdx = Math . min (
145
+ totalPunishmentCount ,
146
+ ABANDON_PUNISHMENTS . length - 1 ,
147
+ ) ;
148
+ punishmentDuration = ABANDON_PUNISHMENTS [ punishmentIdx ] ;
149
+ } else {
150
+ const basePunishment = getBasePunishment ( thisCrime . crime ) ;
151
+ punishmentDuration = basePunishment * totalPunishmentCount ;
152
+ }
143
153
this . logger . log (
144
154
`Punishment: ${ punishmentDuration / 1000 / 60 } minutes for ${
145
155
thisCrime . steam_id
0 commit comments