Binato/server/packets/UserPresenceBundle.ts

17 lines
498 B
TypeScript
Raw Normal View History

2022-11-19 01:06:03 +00:00
import { User } from "../objects/User";
const osu = require("osu-packet");
export function UserPresenceBundle(user:User, sendImmidiate:boolean = true) {
const osuPacketWriter = new osu.Bancho.Writer;
let userIds:Array<number> = new Array<number>();
for (let userData of user.users.getIterableItems()) {
userIds.push(userData.id);
}
osuPacketWriter.UserPresenceBundle(userIds);
if (sendImmidiate) user.addActionToQueue(osuPacketWriter.toBuffer);
else return osuPacketWriter.toBuffer;
}