diff --git a/server/interfaces/MatchScoreData.ts b/server/interfaces/MatchScoreData.ts deleted file mode 100644 index 5a10306..0000000 --- a/server/interfaces/MatchScoreData.ts +++ /dev/null @@ -1,19 +0,0 @@ -export default 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 -} \ No newline at end of file diff --git a/server/interfaces/OsuPacketWriter.ts b/server/interfaces/OsuPacketWriter.ts index faf5f26..21ffc63 100644 --- a/server/interfaces/OsuPacketWriter.ts +++ b/server/interfaces/OsuPacketWriter.ts @@ -1,7 +1,7 @@ import ChannelData from "./ChannelData" import MatchData from "./MatchData" -import MatchScoreData from "./MatchScoreData" import MessageData from "./MessageData" +import ScoreFrameData from "./ScoreFrameData" import SpectateFramesData from "./SpectateFramesData" import StatusUpdateData from "./StatusUpdateData" import UserPresenceData from "./UserPresenceData" @@ -32,7 +32,7 @@ export default interface OsuPacketWriter { FellowSpectatorJoined(data:number) : OsuPacketWriter, FellowSpectatorLeft(data:number) : OsuPacketWriter, MatchStart(data:MatchData) : OsuPacketWriter, - MatchScoreUpdate(data:MatchScoreData) : OsuPacketWriter, + MatchScoreUpdate(data:ScoreFrameData) : OsuPacketWriter, MatchTransferHost() : OsuPacketWriter, MatchAllPlayersLoaded() : OsuPacketWriter, MatchPlayerFailed(data:number) : OsuPacketWriter, diff --git a/server/interfaces/PlayerScore.ts b/server/interfaces/PlayerScore.ts index 2fdcec3..0dee2ee 100644 --- a/server/interfaces/PlayerScore.ts +++ b/server/interfaces/PlayerScore.ts @@ -1,12 +1,12 @@ import Slot from "../objects/Slot"; import User from "../objects/User"; -import MatchScoreData from "./MatchScoreData"; +import ScoreFrameData from "./ScoreFrameData"; export default interface PlayerScore { - player:User, - slot:Slot, - score:number, - isCurrentlyFailed:boolean, - hasFailed:boolean, - _raw?:MatchScoreData + player: User, + slot: Slot, + score: number, + isCurrentlyFailed: boolean, + hasFailed: boolean, + _raw?: ScoreFrameData } \ No newline at end of file diff --git a/server/interfaces/ScoreFrameData.ts b/server/interfaces/ScoreFrameData.ts index af8792b..c448b4a 100644 --- a/server/interfaces/ScoreFrameData.ts +++ b/server/interfaces/ScoreFrameData.ts @@ -14,4 +14,7 @@ export default interface ScoreFrameData { currentHp: number, tagByte: number, usingScoreV2: boolean, + // Only exists if usingScoreV2 = true + comboPortion?: number, + bonusPortion?: number } \ No newline at end of file diff --git a/server/interfaces/SpectateFramesData.ts b/server/interfaces/SpectateFramesData.ts index e2d4c87..cf798c1 100644 --- a/server/interfaces/SpectateFramesData.ts +++ b/server/interfaces/SpectateFramesData.ts @@ -1,4 +1,3 @@ -import MatchScoreData from "./MatchScoreData"; import ReplayFrameData from "./ReplayFrameData"; import ScoreFrameData from "./ScoreFrameData"; diff --git a/server/objects/Match.ts b/server/objects/Match.ts index 0e35290..a560e41 100644 --- a/server/objects/Match.ts +++ b/server/objects/Match.ts @@ -10,9 +10,9 @@ 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"; import { enumHasFlag } from "../Util"; import osu from "../../osuTyping"; +import ScoreFrameData from "../interfaces/ScoreFrameData"; // Mods which need to be applied to the match during freemod. const matchFreemodGlobalMods:Array = [ @@ -649,31 +649,31 @@ export default class Match { this.playerScores = undefined; } - updatePlayerScore(user:User, matchScoreData:MatchScoreData) { + updatePlayerScore(user:User, scoreFrameData:ScoreFrameData) { const osuPacketWriter = osu.Bancho.Writer(); if (user.matchSlot === undefined || user.matchSlot.player === undefined || this.playerScores === undefined) { return; } - matchScoreData.id = user.matchSlot.slotId; + scoreFrameData.id = user.matchSlot.slotId; // Update playerScores for (const playerScore of this.playerScores) { if (playerScore.player?.id === user.id) { - playerScore.score = matchScoreData.totalScore; - const isCurrentlyFailed = matchScoreData.currentHp == 254; + playerScore.score = scoreFrameData.totalScore; + const isCurrentlyFailed = scoreFrameData.currentHp == 254; playerScore.isCurrentlyFailed = isCurrentlyFailed; if (!playerScore.hasFailed && isCurrentlyFailed) { playerScore.hasFailed = true; } - playerScore._raw = matchScoreData; + playerScore._raw = scoreFrameData; break; } } - osuPacketWriter.MatchScoreUpdate(matchScoreData); + osuPacketWriter.MatchScoreUpdate(scoreFrameData); // Send the newly updated score to all users in the match this.matchStream.Send(osuPacketWriter.toBuffer);