2022-01-04 03:39:53 +00:00
|
|
|
const osu = require("osu-packet"),
|
|
|
|
consoleHelper = require("./consoleHelper.js");
|
2021-02-01 03:01:37 +00:00
|
|
|
|
|
|
|
module.exports = function(CurrentUser, MatchID) {
|
2022-01-04 03:39:53 +00:00
|
|
|
const match = global.MultiplayerManager.getMatch(MatchID);
|
2021-02-01 03:01:37 +00:00
|
|
|
|
2022-01-04 03:39:53 +00:00
|
|
|
if (match != null) {
|
2021-02-01 03:01:37 +00:00
|
|
|
|
2022-01-04 03:39:53 +00:00
|
|
|
match.isTourneyMatch = true;
|
2022-02-23 05:35:10 +00:00
|
|
|
for (let user of global.users.getIterableItems()) {
|
|
|
|
if (user.id == CurrentUser.id) {
|
|
|
|
match.tourneyClientUsers.push(user);
|
2022-01-04 03:39:53 +00:00
|
|
|
}
|
|
|
|
}
|
2021-02-01 03:01:37 +00:00
|
|
|
|
2022-01-04 03:39:53 +00:00
|
|
|
if (global.StreamsHandler.isUserInStream(match.matchChatStreamName, CurrentUser.uuid))
|
|
|
|
return consoleHelper.printBancho(`Did not add user to channel ${match.matchChatStreamName} because they are already in it`);
|
2021-02-01 03:01:37 +00:00
|
|
|
|
2022-01-04 03:39:53 +00:00
|
|
|
const osuPacketWriter = new osu.Bancho.Writer;
|
2021-02-01 03:01:37 +00:00
|
|
|
|
2022-01-04 03:39:53 +00:00
|
|
|
osuPacketWriter.ChannelJoinSuccess("#multiplayer");
|
|
|
|
if (!global.StreamsHandler.isUserInStream(match.matchChatStreamName, CurrentUser.uuid))
|
|
|
|
global.StreamsHandler.addUserToStream(match.matchChatStreamName, CurrentUser.uuid);
|
2021-02-01 03:01:37 +00:00
|
|
|
|
2022-01-04 03:39:53 +00:00
|
|
|
CurrentUser.addActionToQueue(osuPacketWriter.toBuffer);
|
|
|
|
}
|
2021-02-01 03:01:37 +00:00
|
|
|
}
|