Binato/server/packets/UserPresenceBundle.ts
2023-09-10 12:59:22 +01:00

27 lines
No EOL
643 B
TypeScript

import osu from "../../osuTyping";
import Shared from "../objects/Shared";
import User from "../objects/User";
export default function UserPresenceBundle(arg0:User | Shared) : Buffer {
const osuPacketWriter = osu.Bancho.Writer();
let shared:Shared;
if (arg0 instanceof User) {
shared = arg0.shared;
} else {
shared = arg0;
}
let userIds:Array<number> = new Array<number>();
for (let userData of shared.users.getIterableItems()) {
userIds.push(userData.id);
}
osuPacketWriter.UserPresenceBundle(userIds);
if (arg0 instanceof User) {
arg0.addActionToQueue(osuPacketWriter.toBuffer);
}
return osuPacketWriter.toBuffer;
}