public static async Task Handle(PacketReader _, Presence user) { user.InLobby = true; await Global.Channels["#lobby"].JoinUser(user); foreach (var(_, match) in Global.Rooms) { user.WaitingPackets.Enqueue(await FastPackets.NewMatch(match.Foreign())); } XConsole.Log($"{user} joined to lobby", ConsoleColor.Cyan); }
public static async Task Handle(PacketReader reader, Presence user) { if (user.Match is not null) { await user.Match.Leave(user); } var match = reader.ReadBanchoObject <Match>(); Global.Rooms[match.Id] = match; await match.Join(user, match.Password); await match.Update(); await Global.OnlineManager.AddPacketToAllUsers(await FastPackets.NewMatch(match.Foreign())); XConsole.Log($"{user} created multiplayer room {match}", ConsoleColor.Green); }