import { OutPacketBase } from 'packets/out/packet' ; class export class OutRoomSetUserTeam { public static build ( userIds , newTeams , outPacket ) { if ( userIds . length !== newTeams . length ) { throw new Error ( 'The size of userIds and newTeams array must be the same!' ) ; } const usersTeam = new Map < number , number > ( ) ; for ( let i = 0 ; i < userIds . length ; i ++ ) { usersTeam . set ( userIds [ i ] , newTeams [ i ] ) ; } outPacket . writeUInt8 ( usersTeam . size ) ; usersTeam . forEach ( ( newTeam , actualUserId ) : void => { outPacket . writeUInt32 ( actualUserId ) ; outPacket . writeUInt8 ( newTeam ) ; } ) ; } }