Пример #1
0
        public void Authenticate()
        {
            PacketOut packet = new PacketOut(LogonServerOpCode.AUTH_LOGON_CHALLENGE);

            packet.Write((byte)3);
            packet.Write((UInt16)(30 + mUsername.Length));
            packet.Write((byte)'W'); packet.Write((byte)'o'); packet.Write((byte)'W'); packet.Write((byte)'\0');        // WoW

            packet.Write((byte)Config.Version.major);
            packet.Write((byte)Config.Version.minor);
            packet.Write((byte)Config.Version.update);
            packet.Write((UInt16)Config.Version.build);

            packet.Write((byte)'6'); packet.Write((byte)'8'); packet.Write((byte)'x'); packet.Write((byte)'\0'); // 68x
            packet.Write((byte)'n'); packet.Write((byte)'i'); packet.Write((byte)'W'); packet.Write((byte)'\0'); // niW

            packet.Write((byte)'B'); packet.Write((byte)'G'); packet.Write((byte)'n'); packet.Write((byte)'e');  // SUne

            packet.Write(1);

            packet.Write((byte)127); packet.Write((byte)0); packet.Write((byte)0); packet.Write((byte)1);       // Interestingly, mac sends IPs in reverse order.

            packet.Write((byte)mUsername.Length);
            packet.Write(Encoding.Default.GetBytes(mUsername)); // Name - NOT null terminated
            Send(packet);

            pLoop.Start();
        }
Пример #2
0
        public void Connect()
        {
            string[] address = realm.Address.Split(':');
            byte[]   test    = new byte[1];
            test[0] = 10;
            mCrypt  = new PacketCrypt(test);
            IPAddress  WSAddr = Dns.GetHostAddresses(address[0])[0];
            int        WSPort = Int32.Parse(address[1]);
            IPEndPoint ep     = new IPEndPoint(WSAddr, WSPort);

            try
            {
                mSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);
                mSocket.Connect(ep);
                Log.WriteLine(LogType.Success, "Successfully connected to WorldServer at: {0}!", realm.Address);
            }
            catch (SocketException ex)
            {
                Log.WriteLine(LogType.Error, "Failed to connect to realm: {0}", ex.Message);
                Disconnect();
                return;
            }

            byte[] nullA = new byte[24];
            mCrypt    = new PacketCrypt(nullA);
            Connected = true;
            pHandler  = new PacketHandler(this);
            pLoop     = new PacketLoop(this, mSocket);
            pLoop.Start();
            pHandler.Initialize();
        }
Пример #3
0
        public void Connect()
        {
            string[] address = realm.Address.Split(':');
            byte[] test = new byte[1];
            test[0] = 10;
            mCrypt = new PacketCrypt(test);
            IPAddress WSAddr = Dns.GetHostAddresses(address[0])[0];
            IPAddress wWSAddr = Dns.GetHostAddresses(WardenHost)[0];
            int WSPort = Int32.Parse(address[1]);
            IPEndPoint ep = new IPEndPoint(WSAddr, WSPort);
            IPEndPoint wep = new IPEndPoint(wWSAddr, WardenPort);

            try
            {
                mSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);
                mSocket.Connect(ep);
                Log.WriteLine(netLogic.Shared.LogType.Success, "Successfully connected to WorldServer at: {0}!", realm.Address);

            }
            catch (SocketException ex)
            {
                Log.WriteLine(netLogic.Shared.LogType.Error, "Failed to connect to realm: {0}", ex.Message);
                Disconnect();
                return;
            }

               /* try
            {
                mWardenSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);
                mWardenSocket.Connect(wep);
            }
            catch (SocketException ex)
            {
                Log.WriteLine(LogType.Error, "Failed to connect to WardenServer: {0}", ex.Message);
                return;
            }*/

            byte[] nullA = new byte[24];
            mCrypt = new PacketCrypt(nullA);
            Connected = true;
            pHandler = new PacketHandler(this);
            pHandler.Initialize();

            pLoop = new PacketLoop(this, mSocket);
            pLoop.Start();
            Thread.Sleep(1000);
        }