MatchScoreData type
This commit is contained in:
parent
f08e34dc82
commit
bb6d86ebbd
3 changed files with 27 additions and 7 deletions
19
server/interfaces/MatchScoreData.ts
Normal file
19
server/interfaces/MatchScoreData.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
export interface MatchScoreData {
|
||||
time:number,
|
||||
id:number,
|
||||
count300:number,
|
||||
count100:number,
|
||||
count50:number,
|
||||
countGeki:number,
|
||||
countKatu:number,
|
||||
countMiss:number,
|
||||
totalScore:number,
|
||||
maxCombo:number,
|
||||
currentCombo:number,
|
||||
perfect:boolean,
|
||||
currentHp:number,
|
||||
tagByte:number,
|
||||
usingScoreV2:boolean,
|
||||
comboPortion:number,
|
||||
bonusPortion:number
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
import { Slot } from "../objects/Slot";
|
||||
import { User } from "../objects/User";
|
||||
import { MatchScoreData } from "./MatchScoreData";
|
||||
|
||||
export interface PlayerScore {
|
||||
player:User,
|
||||
|
@ -7,5 +8,5 @@ export interface PlayerScore {
|
|||
score:number,
|
||||
isCurrentlyFailed:boolean,
|
||||
hasFailed:boolean,
|
||||
_raw:any
|
||||
_raw?:MatchScoreData
|
||||
}
|
|
@ -10,6 +10,7 @@ import { Team } from "../enums/Team";
|
|||
import { MatchStartSkipData } from "../interfaces/MatchStartSkipData";
|
||||
import { Mods } from "../enums/Mods";
|
||||
import { PlayerScore } from "../interfaces/PlayerScore";
|
||||
import { MatchScoreData } from "../interfaces/MatchScoreData";
|
||||
|
||||
const osu = require("osu-packet");
|
||||
|
||||
|
@ -512,7 +513,7 @@ export class Match {
|
|||
score: 0,
|
||||
isCurrentlyFailed: false,
|
||||
hasFailed: false,
|
||||
_raw: {}
|
||||
_raw: undefined,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -586,7 +587,7 @@ export class Match {
|
|||
}
|
||||
|
||||
for (let _playerScore of this.playerScores) {
|
||||
if (_playerScore.player?.id === slot.player?.id) {
|
||||
if (_playerScore.player?.id === slot.player?.id && _playerScore._raw !== undefined) {
|
||||
const score = _playerScore._raw;
|
||||
queryData.push(`${slot.player?.id}|${score.totalScore}|${score.maxCombo}|${score.count300}|${score.count100}|${score.count50}|${score.countGeki}|${score.countKatu}|${score.countMiss}|${(score.currentHp == 254) ? 1 : 0}${(this.specialModes === 1) ? `|${slot.mods}` : ""}|${score.usingScoreV2 ? 1 : 0}${score.usingScoreV2 ? `|${score.comboPortion}|${score.bonusPortion}` : ""}`);
|
||||
break;
|
||||
|
@ -613,15 +614,14 @@ export class Match {
|
|||
this.playerScores = undefined;
|
||||
}
|
||||
|
||||
// TODO: Interface type for matchScoreData
|
||||
updatePlayerScore(user:User, matchScoreData:any) {
|
||||
updatePlayerScore(user:User, matchScoreData:MatchScoreData) {
|
||||
const osuPacketWriter = new osu.Bancho.Writer;
|
||||
|
||||
if (user.matchSlot === undefined || this.playerScores === undefined) {
|
||||
if (user.matchSlot === undefined || user.matchSlot.player === undefined || this.playerScores === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
matchScoreData.id = user.matchSlot;
|
||||
matchScoreData.id = user.matchSlot.player.id;
|
||||
|
||||
// Update playerScores
|
||||
for (let playerScore of this.playerScores) {
|
||||
|
|
Loading…
Reference in a new issue