Skip to content

Commit c2a63b0

Browse files
committed
Eshkere
1 parent f8f0676 commit c2a63b0

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/gameserver/event-handler/crime-log-created.handler.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const getBasePunishment = (crime: BanReason) => {
1919
return LIGHT_PUNISHMENT;
2020
case BanReason.LOAD_FAILURE:
2121
return MEDIUM_PUNISHMENT;
22-
case BanReason.REPORTS:
22+
case BanReason.ABANDON:
2323
return HARD_PUNISHMENT;
2424
default:
2525
return 0;
@@ -29,7 +29,7 @@ export const getBasePunishment = (crime: BanReason) => {
2929
export const countCrimes = (crimes: PlayerCrimeLogEntity[]) => {
3030
const grouped: Map<BanReason, number> = new Map();
3131
for (let crime of crimes) {
32-
grouped.set(crime.crime, +grouped.get(crime.crime) + 1);
32+
grouped.set(crime.crime, (grouped.get(crime.crime) || 0) + 1);
3333
}
3434
return grouped;
3535
};
@@ -86,11 +86,17 @@ export class CrimeLogCreatedHandler
8686
const basePunishment = getBasePunishment(thisCrime.crime);
8787
let punishmentDuration = basePunishment * totalPunishmentCount;
8888

89+
console.log(countedCrimes, totalPunishmentCount, basePunishment, punishmentDuration, thisCrime)
90+
8991
this.logger.log(
9092
`Punishment: ${punishmentDuration / 1000 / 60} minutes for ${
9193
thisCrime.steam_id
9294
}. Total punishment count: ${totalPunishmentCount}`,
9395
);
96+
thisCrime.banTime = punishmentDuration;
97+
thisCrime.handled = true;
98+
await this.playerCrimeLogEntityRepository.save(thisCrime);
99+
94100
await this.applyBan(
95101
thisCrime.steam_id,
96102
punishmentDuration,

src/rest/dto/crime.dto.ts

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ export class CrimeLogDto {
1616
readonly lobby_type: MatchmakingMode
1717
readonly created_at: string;
1818

19+
readonly banTime: number;
20+
1921
}
2022
export class CrimeLogPageDto extends Page<CrimeLogDto> {
2123
data: CrimeLogDto[];

0 commit comments

Comments
 (0)