From b2c63d07d97a66cb664cc2d0273ad06ad788e649 Mon Sep 17 00:00:00 2001 From: Skillet Date: Wed, 26 Apr 2023 14:58:21 -0400 Subject: [PATCH] properly get a list of layers --- squad-server/plugins/db-log.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/squad-server/plugins/db-log.js b/squad-server/plugins/db-log.js index 477ffd9..2d66639 100644 --- a/squad-server/plugins/db-log.js +++ b/squad-server/plugins/db-log.js @@ -138,6 +138,9 @@ export default class DBLog extends BasePlugin { }, lastName: { type: DataTypes.STRING + }, + discordID: { + type: DataTypes.BIGINT } }, { @@ -421,7 +424,7 @@ export default class DBLog extends BasePlugin { id: this.options.overrideServerID || this.server.id, name: this.server.serverName }); - + await this.repairDB(); this.server.on('TICK_RATE', this.onTickRate); @@ -433,7 +436,7 @@ export default class DBLog extends BasePlugin { this.server.on('PLAYER_DIED', this.onPlayerDied); this.server.on('PLAYER_REVIVED', this.onPlayerRevived); } - + async repairDB() { this.match = await this.models.Match.findOne({ where: { server: this.options.overrideServerID || this.server.id, endTime: null } @@ -471,7 +474,7 @@ export default class DBLog extends BasePlugin { } async onNewGame(info) { - this.verbose(1, "New Game") + this.verbose(1, 'New Game'); await this.models.Match.update( { endTime: info.time, winner: info.winner }, { where: { server: this.options.overrideServerID || this.server.id, endTime: null } } @@ -488,16 +491,16 @@ export default class DBLog extends BasePlugin { }); } - async onRoundEnd(info){ - this.verbose(1, "Round End"); + async onRoundEnd(info) { + this.verbose(1, 'Round End'); await this.models.Match.update( - { endTime: info.time, winner: info.winnerFaction }, - { where: { server: this.options.overrideServerID || this.server.id, endTime: null } } + { endTime: info.time, winner: info.winnerFaction }, + { where: { server: this.options.overrideServerID || this.server.id, endTime: null } } ); } - + async onPlayerNameChange(info) { - if(info.player) + if (info.player) await this.models.SteamUser.upsert({ steamID: info.player.steamID, lastName: info.player.name