Beispiel #1
0
 public static void SwitchRooms(int roomNumber, Direction dir, bool isNewGame)
 {
     CurrentGame.Rooms[roomNumber].AddPlayer(CurrentRoom.CurrentPlayer, dir, isNewGame);
     CurrentRoom.RemovePlayer();
     CurrentRoom       = CurrentGame.Rooms[roomNumber];
     CurrentGame.RoomI = roomNumber;
 }
Beispiel #2
0
        public void Close(int time, bool kicked = false)
        {
            if (!closed)
            {
                try
                {
                    closed = true;
                    GameManager.RemoveSocket(this);
                    Account p = _player;
                    if (player_id > 0 && p != null)
                    {
                        Channel ch    = p.getChannel();
                        Room    room  = p._room;
                        Match   match = p._match;
                        p.setOnlineStatus(false);
                        if (room != null)
                        {
                            room.RemovePlayer(p, false, kicked ? 1 : 0);
                        }
                        if (match != null)
                        {
                            match.RemovePlayer(p);
                        }
                        if (ch != null)
                        {
                            ch.RemovePlayer(p);
                        }
                        p._status.ResetData(player_id);

                        AllUtils.syncPlayerToFriends(p, false);
                        AllUtils.syncPlayerToClanMembers(p);

                        p.SimpleClear();
                        p.updateCacheInfo();
                        _player = null;
                    }
                    player_id = 0;
                }
                catch (Exception ex)
                {
                    SaveLog.fatal("Error by: " + player_id + "\n" + ex.ToString());
                    Printf.b_danger("[GameClient.Close] Erro fatal!");
                }
            }
            if (_client != null)
            {
                _client.Close(time);
            }
            Dispose();
        }
Beispiel #3
0
 public void Close(int time, bool kicked = false)
 {
     if (!this.closed)
     {
         try
         {
             this.closed = true;
             GameManager.RemoveSocket(this);
             Account player = this._player;
             if (this.player_id > 0L && player != null)
             {
                 Channel channel = player.getChannel();
                 Room    room    = player._room;
                 Match   match   = player._match;
                 player.setOnlineStatus(false);
                 room.RemovePlayer(player, false, kicked ? 1 : 0);
                 match.RemovePlayer(player);
                 channel.RemovePlayer(player);
                 player._status.ResetData(this.player_id);
                 AllUtils.syncPlayerToFriends(player, false);
                 AllUtils.syncPlayerToClanMembers(player);
                 player.SimpleClear();
                 player.updateCacheInfo();
                 this._player = (Account)null;
             }
             this.player_id = 0L;
         }
         catch (Exception ex)
         {
             Logger.warning("Error by: " + (object)this.player_id + "\n" + ex.ToString());
         }
     }
     if (this._client != null)
     {
         this._client.Close(time);
     }
     this.Dispose();
 }