2023-09-10 12:59:22 +01:00
|
|
|
import osu from "../../osuTyping";
|
|
|
|
import Match from "../objects/Match";
|
|
|
|
import User from "../objects/User";
|
|
|
|
import StatusUpdate from "./StatusUpdate";
|
|
|
|
import UserPresence from "./UserPresence";
|
2023-08-20 13:03:01 +01:00
|
|
|
|
2023-09-10 12:59:22 +01:00
|
|
|
export default function TourneyMatchSpecialInfo(user:User, matchId:number) {
|
2023-08-20 13:03:01 +01:00
|
|
|
const match = user.shared.multiplayerManager.GetMatchById(matchId);
|
|
|
|
if (!(match instanceof Match)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const osuPacketWriter = osu.Bancho.Writer();
|
2023-09-10 18:32:24 +01:00
|
|
|
osuPacketWriter.MatchUpdate(match.serialiseMatch());
|
2023-08-20 13:03:01 +01:00
|
|
|
|
|
|
|
for (const slot of match.slots) {
|
|
|
|
if (slot.player === undefined) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
const presenceBuffer = UserPresence(user, slot.player.id);
|
|
|
|
const statusBuffer = StatusUpdate(user, slot.player.id);
|
|
|
|
|
|
|
|
if (presenceBuffer instanceof Buffer && statusBuffer instanceof Buffer) {
|
|
|
|
user.addActionToQueue(presenceBuffer);
|
|
|
|
user.addActionToQueue(statusBuffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
user.addActionToQueue(osuPacketWriter.toBuffer);
|
|
|
|
}
|
|
|
|
}
|