コード例 #1
0
 public static void UpdateRoomPos(BaseRoom room, int pos, bool isOpened, int place, int placeView)
 {
     RoomMgr.AddAction(new UpdateRoomPosAction(room, pos, isOpened, place, placeView));
 }
コード例 #2
0
 public static void StartGameMission(BaseRoom room)
 {
     RoomMgr.AddAction(new StartGameMissionAction(room));
 }
コード例 #3
0
 public static void UpdatePlayerState(GamePlayer player, byte state)
 {
     RoomMgr.AddAction(new UpdatePlayerStateAction(player, player.CurrentRoom, state));
 }
コード例 #4
0
 public static void ExitRoom(BaseRoom room, GamePlayer player)
 {
     RoomMgr.AddAction(new ExitRoomAction(room, player));
 }
コード例 #5
0
 public static void EnterRoom(GamePlayer player)
 {
     RoomMgr.EnterRoom(player, -1, null, 1);
 }
コード例 #6
0
 public static void EnterRoom(GamePlayer player, int roomId, string pwd, int type)
 {
     RoomMgr.AddAction(new EnterRoomAction(player, roomId, pwd, type));
 }
コード例 #7
0
 public static void CreateRoom(GamePlayer player, string name, string password, eRoomType roomType, byte timeType)
 {
     RoomMgr.AddAction(new CreateRoomAction(player, name, password, roomType, timeType));
 }
コード例 #8
0
        public bool RemovePlayerUnsafe(GamePlayer player, bool isKick)
        {
            int index = -1;

            GamePlayer[] places;
            Monitor.Enter(places = this.m_places);
            try
            {
                for (int i = 0; i < 8; i++)
                {
                    if (this.m_places[i] == player)
                    {
                        this.m_places[i]      = null;
                        this.m_playerState[i] = 0;
                        this.m_placesState[i] = -1;
                        this.m_playerCount--;
                        index = i;
                        break;
                    }
                }
            }
            finally
            {
                Monitor.Exit(places);
            }
            if (index != -1)
            {
                this.UpdatePosUnsafe(index, true);
                player.CurrentRoom = null;
                GSPacketIn pkg = player.Out.SendRoomPlayerRemove(player);
                this.SendToAll(pkg);
                if (isKick)
                {
                    player.Out.SendMessage(eMessageType.ChatERROR, LanguageMgr.GetTranslation("Game.Server.SceneGames.KickRoom", new object[0]));
                }
                bool isChangeHost = false;
                if (this.m_host == player)
                {
                    if (this.m_playerCount > 0)
                    {
                        for (int i = 0; i < 8; i++)
                        {
                            if (this.m_places[i] != null)
                            {
                                this.SetHost(this.m_places[i]);
                                isChangeHost = true;
                                break;
                            }
                        }
                    }
                    else
                    {
                        this.m_host = null;
                    }
                }
                if (this.IsPlaying)
                {
                    if (this.m_game != null)
                    {
                        if (isChangeHost && this.m_game is PVEGame)
                        {
                            PVEGame pveGame = this.m_game as PVEGame;
                            foreach (Player p in pveGame.Players.Values)
                            {
                                if (p.PlayerDetail == this.m_host)
                                {
                                    p.Ready = false;
                                }
                            }
                        }
                        this.m_game.RemovePlayer(player, isKick);
                    }
                    if (this.BattleServer != null)
                    {
                        if (this.m_game != null)
                        {
                            this.BattleServer.Server.SendPlayerDisconnet(this.Game.Id, player.GamePlayerId, this.RoomId);
                            if (this.PlayerCount == 0)
                            {
                                this.BattleServer.RemoveRoom(this);
                            }
                            player.RemoveGP(player.PlayerCharacter.Grade * 12);
                            if (this.GameType == eGameType.Guild)
                            {
                                player.RemoveOffer(15);
                            }
                            else
                            {
                                if (this.GameType == eGameType.Free)
                                {
                                    player.RemoveOffer(5);
                                }
                            }
                        }
                        else
                        {
                            this.SendMessage(eMessageType.ChatERROR, LanguageMgr.GetTranslation("Game.Server.SceneGames.PairUp.Failed", new object[0]));
                            RoomMgr.AddAction(new CancelPickupAction(this.BattleServer, this));
                            this.BattleServer.RemoveRoom(this);
                            this.IsPlaying = false;
                        }
                    }
                }
                this.UpdateGameStyle();
                if (isChangeHost)
                {
                    if (!(this.m_game is PVEGame) || !this.IsPlaying)
                    {
                        this.ResetRoomSetting();
                    }
                }
            }
            return(index != -1);
        }