예제 #1
0
파일: Game.cs 프로젝트: eickegao/Blazera
        private void SendDeco()
        {
            GameSession.Instance.Deco();
            SendingPacket packet = new SendingPacket(PacketType.CLIENT_INFO_DECONNECTION);
            packet.AddString(GameSession.Instance.GetLogin());
            GameSession.Instance.SendPacket(packet);

            Log.Clear();
            Log.Cl("You are now disconnected", ConsoleColor.Red);
            Thread.Sleep(1000);
            Log.Cl("Good bye...", ConsoleColor.White);
        }
예제 #2
0
파일: SPlayer.cs 프로젝트: eickegao/Blazera
 public bool SendInfoMove()
 {
     try
     {
         SendingPacket data = new SendingPacket(PacketType.SERVER_INFO_MOVE);
         data.AddObjectMove(this);
         return Session.SendPacket(data, true);
     }
     catch
     {
         return false;
     }
 }
예제 #3
0
 public Boolean Send(SendingPacket packet)
 {
     return packet.Send(Bw);
 }
예제 #4
0
파일: GameSession.cs 프로젝트: jpx/blazera
        bool HandleLoginValidation(ReceptionPacket data)
        {
            Guid = data.ReadGuid();

            Log.Cldebug("Logged as " + GetLogin() + " with Guid " + Guid.ToString(), ConsoleColor.Green);

            SendingPacket sndData = new SendingPacket(PacketType.CLIENT_REQUEST_MAP_LOADING);
            SendPacket(sndData);

            return true;
        }
예제 #5
0
파일: GameSession.cs 프로젝트: jpx/blazera
        Boolean ConnectionTest()
        {
            if (!ClientConnection.IsConnected)
            {
                Console.Write("Enter a login : "******"0x" + RandomHelper.Get(0, 10000);//Console.ReadLine();
                Log.Cl(ClientConnection.Login, ConsoleColor.Green);
                try
                {
                    if (ClientConnection.Connect(GameData.SERVER_IP, GameData.SERVER_PORT))
                    {
                        Log.Cl("Connected.", ConsoleColor.Green);

                        SendingPacket packet = new SendingPacket(PacketType.CLIENT_REQUEST_LOGIN_VALIDATION);
                        packet.AddString(ClientConnection.Login);
                        return SendPacket(packet);
                    }

                    throw new ConnectionFailedException();
                }
                catch
                {
                    Log.Cl("Connection failed");
                    return false;
                }
            }

            return false;
        }
예제 #6
0
파일: GameSession.cs 프로젝트: jpx/blazera
        /// <summary>
        /// Sends a packet of data to the game server
        /// </summary>
        /// <param name="data">Packet of data to send</param>
        /// <returns>If the sending was successful</returns>
        public Boolean SendPacket(SendingPacket data)
        {
            try
            {
                if (!ClientConnection.Send(data))
                    return false;

                Log.Cl("Packet sent : " + data.Type.ToString(), ConsoleColor.DarkYellow);
                return true;
            }
            catch (Exception ex)
            {
                Deco();
                return false;
            }
        }
예제 #7
0
 public PacketNotSentException(String login, SendingPacket packet)
     : base()
 {
     Login = login;
     Packet = packet;
 }