Implement multiplayer invites

This commit is contained in:
tgpethan 2020-09-02 11:31:06 +01:00
parent 76050657d1
commit e9fd3993a8
3 changed files with 24 additions and 3 deletions

View file

@ -3,14 +3,13 @@ An implementation of osu!bancho in Javascript
<hr> <hr>
### Features: ### Features:
- Multiplayer - Multiplayer + Invites
- Spectator - Spectator
- User Panel (Missing Friends) - User Panel (Missing Friends)
- Chat & Channels - Chat & Channels
- Private Messages - Private Messages
### Currently unimplemented things: ### Currently unimplemented things:
- Multiplayer Invites
- Friends List - Friends List
- Bot - Bot

View file

@ -0,0 +1,17 @@
const osu = require("osu-packet"),
getUserById = require("../util/getUserById.js");
module.exports = function(CurrentUser, InvitedUser) {
let osuPacketWriter = new osu.Bancho.Writer;
const InvitedUserClass = getUserById(InvitedUser);
osuPacketWriter.SendMessage({
sendingClient: CurrentUser.username,
message: `Come join my multiplayer match: [osump://${CurrentUser.currentMatch}/ ${global.matches[CurrentUser.currentMatch][1].gameName}]`,
target: CurrentUser.username,
senderId: CurrentUser.id
});
InvitedUserClass.addActionToQueue(osuPacketWriter.toBuffer);
}

View file

@ -89,7 +89,8 @@ const ChangeAction = require("./Packets/ChangeAction.js"),
ChannelPart = require("./Packets/ChannelPart.js"), ChannelPart = require("./Packets/ChannelPart.js"),
UserPresenceBundle = require("./Packets/UserPresenceBundle.js"), UserPresenceBundle = require("./Packets/UserPresenceBundle.js"),
UserPresence = require("./Packets/UserPresence.js"), UserPresence = require("./Packets/UserPresence.js"),
UserStatsRequest = require("./Packets/UserStatsRequest.js"); UserStatsRequest = require("./Packets/UserStatsRequest.js"),
MultiplayerInvite = require("./Packets/MultiplayerInvite.js");
module.exports = function(req, res) { module.exports = function(req, res) {
// Add to requests for logging // Add to requests for logging
@ -249,6 +250,10 @@ module.exports = function(req, res) {
UserStatsRequest(userClass, CurrentPacket.data); UserStatsRequest(userClass, CurrentPacket.data);
break; break;
case packetIDs.client_invite:
MultiplayerInvite(userClass, CurrentPacket.data);
break;
case packetIDs.client_userPresenceRequest: case packetIDs.client_userPresenceRequest:
UserPresence(userClass, userClass.id); UserPresence(userClass, userClass.id);
break; break;