2021-02-01 03:01:37 +00:00
|
|
|
const osu = require("osu-packet");
|
|
|
|
|
|
|
|
module.exports = function(CurrentUser, MatchID) {
|
|
|
|
const match = global.MultiplayerManager.getMatch(MatchID);
|
|
|
|
|
|
|
|
if (match != null) {
|
|
|
|
|
|
|
|
match.isTourneyMatch = true;
|
2021-05-15 00:24:39 +01:00
|
|
|
for (let i = 0; i < global.userKeys.length; i++) {
|
|
|
|
if (global.users[global.userKeys[i]].id == CurrentUser.id) {
|
|
|
|
match.tourneyClientUsers.push(global.users[global.userKeys[i]]);
|
2021-02-01 03:01:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-06 01:27:43 +00:00
|
|
|
if (global.StreamsHandler.isUserInStream(match.matchChatStreamName, CurrentUser.uuid))
|
|
|
|
return global.consoleHelper.printBancho(`Did not add user to channel ${match.matchChatStreamName} because they are already in it`);
|
2021-02-01 03:01:37 +00:00
|
|
|
|
|
|
|
const osuPacketWriter = new osu.Bancho.Writer;
|
|
|
|
|
|
|
|
osuPacketWriter.ChannelJoinSuccess("#multiplayer");
|
2021-02-06 01:27:43 +00:00
|
|
|
if (!global.StreamsHandler.isUserInStream(match.matchChatStreamName, CurrentUser.uuid))
|
|
|
|
global.StreamsHandler.addUserToStream(match.matchChatStreamName, CurrentUser.uuid);
|
2021-02-01 03:01:37 +00:00
|
|
|
|
|
|
|
CurrentUser.addActionToQueue(osuPacketWriter.toBuffer);
|
|
|
|
}
|
|
|
|
}
|