Exemple #1
0
        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);
        }
Exemple #2
0
 public bool SendInfoMove()
 {
     try
     {
         SendingPacket data = new SendingPacket(PacketType.SERVER_INFO_MOVE);
         data.AddObjectMove(this);
         return Session.SendPacket(data, true);
     }
     catch
     {
         return false;
     }
 }
Exemple #3
0
 public Boolean Send(SendingPacket packet)
 {
     return packet.Send(Bw);
 }
Exemple #4
0
        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;
        }
Exemple #5
0
        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;
        }
Exemple #6
0
        /// <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;
            }
        }
 public PacketNotSentException(String login, SendingPacket packet)
     : base()
 {
     Login = login;
     Packet = packet;
 }