Implement multiplayer invites
This commit is contained in:
parent
76050657d1
commit
e9fd3993a8
3 changed files with 24 additions and 3 deletions
|
@ -3,14 +3,13 @@ An implementation of osu!bancho in Javascript
|
|||
<hr>
|
||||
|
||||
### Features:
|
||||
- Multiplayer
|
||||
- Multiplayer + Invites
|
||||
- Spectator
|
||||
- User Panel (Missing Friends)
|
||||
- Chat & Channels
|
||||
- Private Messages
|
||||
|
||||
### Currently unimplemented things:
|
||||
- Multiplayer Invites
|
||||
- Friends List
|
||||
- Bot
|
||||
|
||||
|
|
17
server/Packets/MultiplayerInvite.js
Normal file
17
server/Packets/MultiplayerInvite.js
Normal 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);
|
||||
}
|
|
@ -89,7 +89,8 @@ const ChangeAction = require("./Packets/ChangeAction.js"),
|
|||
ChannelPart = require("./Packets/ChannelPart.js"),
|
||||
UserPresenceBundle = require("./Packets/UserPresenceBundle.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) {
|
||||
// Add to requests for logging
|
||||
|
@ -249,6 +250,10 @@ module.exports = function(req, res) {
|
|||
UserStatsRequest(userClass, CurrentPacket.data);
|
||||
break;
|
||||
|
||||
case packetIDs.client_invite:
|
||||
MultiplayerInvite(userClass, CurrentPacket.data);
|
||||
break;
|
||||
|
||||
case packetIDs.client_userPresenceRequest:
|
||||
UserPresence(userClass, userClass.id);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue