mirror of
https://github.com/AsgardEternal/SquadJS.git
synced 2024-09-28 16:24:25 -05:00
Add match to TickRate and PlayerCount
This commit is contained in:
parent
325c21b857
commit
daee6f50db
@ -55,6 +55,39 @@ export default class DBLog extends BasePlugin {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.createModel('Match', {
|
||||||
|
id: {
|
||||||
|
type: DataTypes.INTEGER,
|
||||||
|
primaryKey: true,
|
||||||
|
autoIncrement: true
|
||||||
|
},
|
||||||
|
dlc: {
|
||||||
|
type: DataTypes.STRING
|
||||||
|
},
|
||||||
|
mapClassname: {
|
||||||
|
type: DataTypes.STRING
|
||||||
|
},
|
||||||
|
layerClassname: {
|
||||||
|
type: DataTypes.STRING
|
||||||
|
},
|
||||||
|
map: {
|
||||||
|
type: DataTypes.STRING
|
||||||
|
},
|
||||||
|
layer: {
|
||||||
|
type: DataTypes.STRING
|
||||||
|
},
|
||||||
|
startTime: {
|
||||||
|
type: DataTypes.DATE,
|
||||||
|
notNull: true
|
||||||
|
},
|
||||||
|
endTime: {
|
||||||
|
type: DataTypes.DATE
|
||||||
|
},
|
||||||
|
winner: {
|
||||||
|
type: DataTypes.STRING
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
this.createModel('TickRate', {
|
this.createModel('TickRate', {
|
||||||
id: {
|
id: {
|
||||||
type: DataTypes.INTEGER,
|
type: DataTypes.INTEGER,
|
||||||
@ -96,39 +129,6 @@ export default class DBLog extends BasePlugin {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.createModel('Match', {
|
|
||||||
id: {
|
|
||||||
type: DataTypes.INTEGER,
|
|
||||||
primaryKey: true,
|
|
||||||
autoIncrement: true
|
|
||||||
},
|
|
||||||
dlc: {
|
|
||||||
type: DataTypes.STRING
|
|
||||||
},
|
|
||||||
mapClassname: {
|
|
||||||
type: DataTypes.STRING
|
|
||||||
},
|
|
||||||
layerClassname: {
|
|
||||||
type: DataTypes.STRING
|
|
||||||
},
|
|
||||||
map: {
|
|
||||||
type: DataTypes.STRING
|
|
||||||
},
|
|
||||||
layer: {
|
|
||||||
type: DataTypes.STRING
|
|
||||||
},
|
|
||||||
startTime: {
|
|
||||||
type: DataTypes.DATE,
|
|
||||||
notNull: true
|
|
||||||
},
|
|
||||||
endTime: {
|
|
||||||
type: DataTypes.DATE
|
|
||||||
},
|
|
||||||
winner: {
|
|
||||||
type: DataTypes.STRING
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.createModel('SteamUser', {
|
this.createModel('SteamUser', {
|
||||||
steamID: {
|
steamID: {
|
||||||
type: DataTypes.STRING,
|
type: DataTypes.STRING,
|
||||||
@ -336,6 +336,16 @@ export default class DBLog extends BasePlugin {
|
|||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.models.Match.hasMany(this.models.TickRate, {
|
||||||
|
foreignKey: { name: 'match' },
|
||||||
|
onDelete: 'CASCADE'
|
||||||
|
});
|
||||||
|
|
||||||
|
this.models.Match.hasMany(this.models.PlayerCount, {
|
||||||
|
foreignKey: { name: 'match' },
|
||||||
|
onDelete: 'CASCADE'
|
||||||
|
});
|
||||||
|
|
||||||
this.models.Match.hasMany(this.models.Wound, {
|
this.models.Match.hasMany(this.models.Wound, {
|
||||||
foreignKey: { name: 'match' },
|
foreignKey: { name: 'match' },
|
||||||
onDelete: 'CASCADE'
|
onDelete: 'CASCADE'
|
||||||
@ -367,9 +377,9 @@ export default class DBLog extends BasePlugin {
|
|||||||
|
|
||||||
async prepareToMount() {
|
async prepareToMount() {
|
||||||
await this.models.Server.sync();
|
await this.models.Server.sync();
|
||||||
|
await this.models.Match.sync();
|
||||||
await this.models.TickRate.sync();
|
await this.models.TickRate.sync();
|
||||||
await this.models.PlayerCount.sync();
|
await this.models.PlayerCount.sync();
|
||||||
await this.models.Match.sync();
|
|
||||||
await this.models.SteamUser.sync();
|
await this.models.SteamUser.sync();
|
||||||
await this.models.Wound.sync();
|
await this.models.Wound.sync();
|
||||||
await this.models.Death.sync();
|
await this.models.Death.sync();
|
||||||
@ -406,6 +416,7 @@ export default class DBLog extends BasePlugin {
|
|||||||
async onTickRate(info) {
|
async onTickRate(info) {
|
||||||
await this.models.TickRate.create({
|
await this.models.TickRate.create({
|
||||||
server: this.options.overrideServerID || this.server.id,
|
server: this.options.overrideServerID || this.server.id,
|
||||||
|
match: this.match ? this.match.id : null,
|
||||||
time: info.time,
|
time: info.time,
|
||||||
tickRate: info.tickRate
|
tickRate: info.tickRate
|
||||||
});
|
});
|
||||||
@ -414,6 +425,7 @@ export default class DBLog extends BasePlugin {
|
|||||||
async onUpdatedA2SInformation() {
|
async onUpdatedA2SInformation() {
|
||||||
await this.models.PlayerCount.create({
|
await this.models.PlayerCount.create({
|
||||||
server: this.options.overrideServerID || this.server.id,
|
server: this.options.overrideServerID || this.server.id,
|
||||||
|
match: this.match ? this.match.id : null,
|
||||||
players: this.server.a2sPlayerCount,
|
players: this.server.a2sPlayerCount,
|
||||||
publicQueue: this.server.publicQueue,
|
publicQueue: this.server.publicQueue,
|
||||||
reserveQueue: this.server.reserveQueue
|
reserveQueue: this.server.reserveQueue
|
||||||
|
Loading…
Reference in New Issue
Block a user