public static void HandleStartSession(Packet packet) { CmdStartSession cmd = new CmdStartSession(packet); Room room; bool success = ServerMain.Instance.Server.LobbyManager.Custom.RoomManager.Get(cmd.SessionCode, out room); #region ERROR_CHECKING if (!packet.Sender.IsTeacherClient()) { packet.SendBackError(3); return; } else if (packet.Sender.Character.Permission == 0) { packet.SendBackError(4); return; } else if (packet.Sender.Character.Status.GetState() != typeof(WaitingRoom)) { packet.SendBackError(11); return; } else if (packet.Sender.Character.Status.GetState() == typeof(WaitingRoom) && packet.Sender.Character.Status.GetObject <WaitingRoom>().Owner.GetIdentifier() != packet.Sender.GetIdentifier()) { packet.SendBackError(21); return; } else if (!success) { packet.SendBackError(21); return; } #endregion WaitingRoom wroom = (WaitingRoom)room; Game[] games = wroom.StartSession(); foreach (Game game in games) { game.Broadcast(new StartSessionAck() { Success = true }.CreatePacket()); } wroom.Owner.Send(new StartSessionAck() { Success = true }.CreatePacket()); return; }