Binato/server/Packets/UserPresenceBundle.js

16 lines
440 B
JavaScript
Raw Normal View History

const osu = require("osu-packet");
2020-08-27 13:09:35 +01:00
2021-01-26 12:26:46 +00:00
module.exports = function(currentUser, sendImmidiate = true) {
const osuPacketWriter = new osu.Bancho.Writer;
2020-08-27 13:09:35 +01:00
let userIds = [];
2020-08-27 13:09:35 +01:00
for (let i = 0; i < global.userKeys.length; i++) {
userIds.push(global.users[global.userKeys[i]].id);
}
2020-08-27 13:09:35 +01:00
osuPacketWriter.UserPresenceBundle(userIds);
2020-08-27 13:09:35 +01:00
if (sendImmidiate) currentUser.addActionToQueue(osuPacketWriter.toBuffer);
else return osuPacketWriter.toBuffer;
2020-08-27 13:09:35 +01:00
}