public void Execute() { if (this.m_player != null) { if (this.m_player.CurrentRoom != null) { RoomMgr.ExitRoom(this.m_player.CurrentRoom, this.m_player); } BaseWaitingRoom room = RoomMgr.WaitingRoom; if (room.AddPlayer(this.m_player)) { List <BaseRoom> list = RoomMgr.GetWaitingRoom(this.m_hallType, 0, 9, 0); this.m_player.Out.SendUpdateRoomList(list); GamePlayer[] players = room.GetPlayersSafe(); GamePlayer[] array = players; for (int i = 0; i < array.Length; i++) { GamePlayer p = array[i]; if (p != this.m_player) { this.m_player.Out.SendSceneAddPlayer(p); } } } } }
public void Execute() { bool result = true; if (this.m_player.IsActive) { if (this.m_player.CurrentRoom != null) { this.m_player.CurrentRoom.RemovePlayerUnsafe(this.m_player); } BaseRoom[] rooms = RoomMgr.Rooms; BaseRoom rm; if (this.m_roomId == -1) { rm = this.FindRandomRoom(rooms); if (rm == null) { this.m_player.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("EnterRoomAction.noroom", new object[0])); this.m_player.Out.SendRoomLoginResult(false); List <BaseRoom> list = RoomMgr.GetWaitingRoom(this.m_hallType, 0, 9, 0); this.m_player.Out.SendUpdateRoomList(list); return; } } else { if (this.m_roomId > rooms.Length || this.m_roomId <= 0) { this.m_player.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("EnterRoomAction.noexist", new object[0])); return; } rm = rooms[this.m_roomId - 1]; } if (!rm.IsUsing) { this.m_player.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("EnterRoomAction.noexist", new object[0])); List <BaseRoom> list = RoomMgr.GetWaitingRoom(this.m_hallType, 0, 9, 0); this.m_player.Out.SendUpdateRoomList(list); } else { if (this.m_hallType == 1 && (rm.RoomType == eRoomType.Boss || rm.RoomType == eRoomType.Exploration || rm.RoomType == eRoomType.Treasure)) { this.m_player.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("EnterRoomAction.NotInPve", new object[0])); } else { if (this.m_hallType == 2 && (rm.RoomType == eRoomType.Freedom || rm.RoomType == eRoomType.Match)) { this.m_player.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("EnterRoomAction.NotInPvp", new object[0])); } else { if (rm.IsPlaying) { if (rm.Game is PVEGame) { PVEGame pveGame = rm.Game as PVEGame; if (pveGame.GameState != eGameState.SessionPrepared || !this.m_isInvite) { this.m_player.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("EnterRoomAction.start", new object[0])); result = false; } } else { this.m_player.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("EnterRoomAction.start", new object[0])); result = false; } } if (result) { if (rm.PlayerCount == rm.PlacesCount) { result = false; this.m_player.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("EnterRoomAction.full", new object[0])); } else { if (!rm.NeedPassword || rm.Password == this.m_pwd) { if (rm.Game == null || rm.Game.CanAddPlayer()) { if (rm.RoomType == eRoomType.Exploration && rm.LevelLimits > (int)rm.GetLevelLimit(this.m_player)) { this.m_player.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("EnterRoomAction.level", new object[0])); return; } RoomMgr.WaitingRoom.RemovePlayer(this.m_player); this.m_player.Out.SendRoomLoginResult(true); this.m_player.Out.SendRoomCreate(rm); if (rm.AddPlayerUnsafe(this.m_player)) { if (rm.Game != null) { rm.Game.AddPlayer(this.m_player); } } RoomMgr.WaitingRoom.SendUpdateRoom(rm); this.m_player.Out.SendRoomChange(rm); } } else { string msg; if (rm.NeedPassword && string.IsNullOrEmpty(this.m_pwd)) { msg = LanguageMgr.GetTranslation("EnterRoomAction.EnterPassword", new object[0]); } else { msg = LanguageMgr.GetTranslation("EnterRoomAction.passworderror", new object[0]); } this.m_player.Out.SendMessage(eMessageType.ERROR, msg); this.m_player.Out.SendRoomLoginResult(false); } } } if (!result) { if (this.m_roomId != -1) { List <BaseRoom> list = RoomMgr.GetWaitingRoom(this.m_hallType, 0, 8, this.m_roomId); list.Add(rooms[this.m_roomId - 1]); this.m_player.Out.SendUpdateRoomList(list); } } } } } } }