Binato/server/Packets/UserPresenceBundle.js

16 lines
467 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) {
2020-08-27 13:09:35 +01:00
const osuPacketWriter = new osu.Bancho.Writer;
let userIds = [];
2021-05-15 00:24:39 +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);
2021-01-26 12:26:46 +00:00
if (sendImmidiate) currentUser.addActionToQueue(osuPacketWriter.toBuffer);
else return osuPacketWriter.toBuffer;
2020-08-27 13:09:35 +01:00
}