Remove duplicate interface
This commit is contained in:
parent
5e1106e488
commit
4ec4cb1c1f
6 changed files with 19 additions and 36 deletions
|
@ -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
|
|
||||||
}
|
|
|
@ -1,7 +1,7 @@
|
||||||
import ChannelData from "./ChannelData"
|
import ChannelData from "./ChannelData"
|
||||||
import MatchData from "./MatchData"
|
import MatchData from "./MatchData"
|
||||||
import MatchScoreData from "./MatchScoreData"
|
|
||||||
import MessageData from "./MessageData"
|
import MessageData from "./MessageData"
|
||||||
|
import ScoreFrameData from "./ScoreFrameData"
|
||||||
import SpectateFramesData from "./SpectateFramesData"
|
import SpectateFramesData from "./SpectateFramesData"
|
||||||
import StatusUpdateData from "./StatusUpdateData"
|
import StatusUpdateData from "./StatusUpdateData"
|
||||||
import UserPresenceData from "./UserPresenceData"
|
import UserPresenceData from "./UserPresenceData"
|
||||||
|
@ -32,7 +32,7 @@ export default interface OsuPacketWriter {
|
||||||
FellowSpectatorJoined(data:number) : OsuPacketWriter,
|
FellowSpectatorJoined(data:number) : OsuPacketWriter,
|
||||||
FellowSpectatorLeft(data:number) : OsuPacketWriter,
|
FellowSpectatorLeft(data:number) : OsuPacketWriter,
|
||||||
MatchStart(data:MatchData) : OsuPacketWriter,
|
MatchStart(data:MatchData) : OsuPacketWriter,
|
||||||
MatchScoreUpdate(data:MatchScoreData) : OsuPacketWriter,
|
MatchScoreUpdate(data:ScoreFrameData) : OsuPacketWriter,
|
||||||
MatchTransferHost() : OsuPacketWriter,
|
MatchTransferHost() : OsuPacketWriter,
|
||||||
MatchAllPlayersLoaded() : OsuPacketWriter,
|
MatchAllPlayersLoaded() : OsuPacketWriter,
|
||||||
MatchPlayerFailed(data:number) : OsuPacketWriter,
|
MatchPlayerFailed(data:number) : OsuPacketWriter,
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import Slot from "../objects/Slot";
|
import Slot from "../objects/Slot";
|
||||||
import User from "../objects/User";
|
import User from "../objects/User";
|
||||||
import MatchScoreData from "./MatchScoreData";
|
import ScoreFrameData from "./ScoreFrameData";
|
||||||
|
|
||||||
export default interface PlayerScore {
|
export default interface PlayerScore {
|
||||||
player:User,
|
player: User,
|
||||||
slot:Slot,
|
slot: Slot,
|
||||||
score:number,
|
score: number,
|
||||||
isCurrentlyFailed:boolean,
|
isCurrentlyFailed: boolean,
|
||||||
hasFailed:boolean,
|
hasFailed: boolean,
|
||||||
_raw?:MatchScoreData
|
_raw?: ScoreFrameData
|
||||||
}
|
}
|
|
@ -14,4 +14,7 @@ export default interface ScoreFrameData {
|
||||||
currentHp: number,
|
currentHp: number,
|
||||||
tagByte: number,
|
tagByte: number,
|
||||||
usingScoreV2: boolean,
|
usingScoreV2: boolean,
|
||||||
|
// Only exists if usingScoreV2 = true
|
||||||
|
comboPortion?: number,
|
||||||
|
bonusPortion?: number
|
||||||
}
|
}
|
|
@ -1,4 +1,3 @@
|
||||||
import MatchScoreData from "./MatchScoreData";
|
|
||||||
import ReplayFrameData from "./ReplayFrameData";
|
import ReplayFrameData from "./ReplayFrameData";
|
||||||
import ScoreFrameData from "./ScoreFrameData";
|
import ScoreFrameData from "./ScoreFrameData";
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,9 @@ import { Team } from "../enums/Team";
|
||||||
import MatchStartSkipData from "../interfaces/MatchStartSkipData";
|
import MatchStartSkipData from "../interfaces/MatchStartSkipData";
|
||||||
import { Mods } from "../enums/Mods";
|
import { Mods } from "../enums/Mods";
|
||||||
import PlayerScore from "../interfaces/PlayerScore";
|
import PlayerScore from "../interfaces/PlayerScore";
|
||||||
import MatchScoreData from "../interfaces/MatchScoreData";
|
|
||||||
import { enumHasFlag } from "../Util";
|
import { enumHasFlag } from "../Util";
|
||||||
import osu from "../../osuTyping";
|
import osu from "../../osuTyping";
|
||||||
|
import ScoreFrameData from "../interfaces/ScoreFrameData";
|
||||||
|
|
||||||
// Mods which need to be applied to the match during freemod.
|
// Mods which need to be applied to the match during freemod.
|
||||||
const matchFreemodGlobalMods:Array<Mods> = [
|
const matchFreemodGlobalMods:Array<Mods> = [
|
||||||
|
@ -649,31 +649,31 @@ export default class Match {
|
||||||
this.playerScores = undefined;
|
this.playerScores = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePlayerScore(user:User, matchScoreData:MatchScoreData) {
|
updatePlayerScore(user:User, scoreFrameData:ScoreFrameData) {
|
||||||
const osuPacketWriter = osu.Bancho.Writer();
|
const osuPacketWriter = osu.Bancho.Writer();
|
||||||
|
|
||||||
if (user.matchSlot === undefined || user.matchSlot.player === undefined || this.playerScores === undefined) {
|
if (user.matchSlot === undefined || user.matchSlot.player === undefined || this.playerScores === undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
matchScoreData.id = user.matchSlot.slotId;
|
scoreFrameData.id = user.matchSlot.slotId;
|
||||||
|
|
||||||
// Update playerScores
|
// Update playerScores
|
||||||
for (const playerScore of this.playerScores) {
|
for (const playerScore of this.playerScores) {
|
||||||
if (playerScore.player?.id === user.id) {
|
if (playerScore.player?.id === user.id) {
|
||||||
playerScore.score = matchScoreData.totalScore;
|
playerScore.score = scoreFrameData.totalScore;
|
||||||
const isCurrentlyFailed = matchScoreData.currentHp == 254;
|
const isCurrentlyFailed = scoreFrameData.currentHp == 254;
|
||||||
playerScore.isCurrentlyFailed = isCurrentlyFailed;
|
playerScore.isCurrentlyFailed = isCurrentlyFailed;
|
||||||
if (!playerScore.hasFailed && isCurrentlyFailed) {
|
if (!playerScore.hasFailed && isCurrentlyFailed) {
|
||||||
playerScore.hasFailed = true;
|
playerScore.hasFailed = true;
|
||||||
}
|
}
|
||||||
playerScore._raw = matchScoreData;
|
playerScore._raw = scoreFrameData;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
osuPacketWriter.MatchScoreUpdate(matchScoreData);
|
osuPacketWriter.MatchScoreUpdate(scoreFrameData);
|
||||||
|
|
||||||
// Send the newly updated score to all users in the match
|
// Send the newly updated score to all users in the match
|
||||||
this.matchStream.Send(osuPacketWriter.toBuffer);
|
this.matchStream.Send(osuPacketWriter.toBuffer);
|
||||||
|
|
Loading…
Reference in a new issue