2021-02-01 03:01:37 +00:00
|
|
|
const osu = require("osu-packet"),
|
2022-01-04 03:39:53 +00:00
|
|
|
UserPresence = require("./UserPresence.js"),
|
|
|
|
StatusUpdate = require("./StatusUpdate.js");
|
2021-02-01 03:01:37 +00:00
|
|
|
|
|
|
|
module.exports = function(CurrentUser, MatchID) {
|
2022-01-04 03:39:53 +00:00
|
|
|
const matchData = global.MultiplayerManager.getMatch(MatchID);
|
2021-02-01 03:01:37 +00:00
|
|
|
|
2022-01-04 03:39:53 +00:00
|
|
|
if (matchData != null) {
|
|
|
|
const osuPacketWriter = new osu.Bancho.Writer();
|
2021-02-01 03:01:37 +00:00
|
|
|
|
2022-01-04 03:39:53 +00:00
|
|
|
osuPacketWriter.MatchUpdate(matchData.createOsuMatchJSON());
|
2021-02-01 03:01:37 +00:00
|
|
|
|
2022-01-04 03:39:53 +00:00
|
|
|
// Queue info on all the users in the match to the client
|
|
|
|
for (let slot in matchData.slots) {
|
|
|
|
CurrentUser.addActionToQueue(UserPresence(CurrentUser, slot.playerId, false));
|
|
|
|
CurrentUser.addActionToQueue(StatusUpdate(CurrentUser, slot.playerId, false));
|
|
|
|
}
|
2021-02-01 03:01:37 +00:00
|
|
|
|
2022-01-04 03:39:53 +00:00
|
|
|
// Queue data
|
|
|
|
CurrentUser.addActionToQueue(osuPacketWriter.toBuffer);
|
|
|
|
}
|
2021-02-01 03:01:37 +00:00
|
|
|
}
|