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