Пример #1
0
 public void CreatureQuery(GameGuid guid, UInt32 entry)
 {
     PacketOut packet = new PacketOut(WorldServerOpCode.CMSG_CREATURE_QUERY);
     packet.Write(entry);
     packet.Write(guid.GetOldGuid());
     Send(packet);
 }
Пример #2
0
    public void BuildMovePacket()
    {
        PacketOut outpacket = new PacketOut(WorldServerOpCode.MSG_MOVE_JUMP);
           /// outpacket.Write(netLogicCore.ObjectMgr.GetPlayerObject().GUID.GetOldGuid());

        outpacket.Write((UInt32)0);
        outpacket.Write((byte)255);
        outpacket.Write((UInt32)0);

        outpacket.Write(0);
        outpacket.Write(0);
        outpacket.Write(0);
        outpacket.Write(0);

        outpacket.Write((UInt32)0);

        //netInstance.GetWSession().Send(outpacket);
    }
Пример #3
0
 public void SendEmoteMsg(ChatMsg Type, Languages Language, string Message, string To)
 {
     PacketOut packet = new PacketOut(WorldServerOpCode.CMSG_TEXT_EMOTE);
     packet.Write((UInt32)Type);
     packet.Write((UInt32)Language);
     packet.Write(Message);
     Send(packet);
 }
Пример #4
0
 public void SendChatMsg(ChatMsg Type, Languages Language, string Message, string To)
 {
     PacketOut packet = new PacketOut(WorldServerOpCode.CMSG_MESSAGECHAT);
     packet.Write((UInt32)Type);
     packet.Write((UInt32)Language);
     if ((Type == ChatMsg.CHAT_MSG_WHISPER || Type == ChatMsg.CHAT_MSG_CHANNEL) && To != "")
         packet.Write(To);
     packet.Write(Message);
     Send(packet);
 }
Пример #5
0
 public void JoinChannel(string channel, string password)
 {
     PacketOut packet = new PacketOut(WorldServerOpCode.CMSG_JOIN_CHANNEL);
     packet.Write((UInt32)0);
     packet.Write((UInt16)0);
     packet.Write(channel);
     packet.Write("");
     Send(packet);
 }
Пример #6
0
        public void LoginPlayer()
        {
            PlayerEnum chr = _myPlayerEnum;

            GetInstance().GetLSession().Disconnect();

            _OnEnterWorld();

            PacketOut outpacket = new PacketOut(WorldServerOpCode.CMSG_PLAYER_LOGIN);
            outpacket.Write(chr.GUID.GetOldGuid());
            Send(outpacket);

            outpacket = new PacketOut(WorldServerOpCode.CMSG_UPDATE_ACCOUNT_DATA);
            outpacket.Write((UInt32)7);
            outpacket.Write((UInt32)5144);
            outpacket.Write(account_data);
            //outpacket.Write((UInt32)7);
            Send(outpacket);

              //  netLogicCore.ObjectMgr.MapID = chr.MapID;
               //     netLogicCore.ObjectMgr.setPlayer(chr.MapID, chr.GUID.GetOldGuid());
            //netLogicCore.Player.setPlayer(chr);
             //   StartHeartbeat();

              /*  outpacket = new PacketOut(WorldServerOpCode.CMSG_CREATURE_QUERY);
            outpacket.Write(chr.GUID.GetOldGuid());
            Send(outpacket);*/

             /* outpacket = new PacketOut(WorldServerOpCode.CMSG_NAME_QUERY);
            outpacket.Write(netLogicCore.Player.Character.GUID.GetOldGuid());
            Send(outpacket);
            */
               /* outpacket = new PacketOut(WorldServerOpCode.CMSG_SET_ACTIVE_MOVER);
            outpacket.Write(chr.GUID.GetOldGuid());
            Send(outpacket);

            QueryName(chr.GUID);*/
            //fixme
            //            netLogicCore.MovementMgr.Start();
             //           netLogicCore.CombatMgr.Start();
            //            netLogicCore.TerrainMgr.ChangeMap(chr.MapID);

            Log.WriteLine(netLogic.Shared.LogType.Success, "Logged into world as {0}.", chr.Name);
        }
Пример #7
0
        public void HandleCharEnum(PacketIn packet)
        {
            byte count = packet.ReadByte();

            PlayerEnum[] chr = new PlayerEnum[10];
            for (int i = 0; i < count; i++)
            {

                chr[i].GUID = new GameGuid(packet.ReadUInt64());
                chr[i].Name = packet.ReadString();
                chr[i].Race = packet.ReadByte();
                chr[i].Class = packet.ReadByte();
                chr[i].Gender = packet.ReadByte();
                chr[i].Skin = packet.ReadByte();
                chr[i].Face = packet.ReadByte();
                chr[i].HairStyle = packet.ReadByte();
                chr[i].HairColor = packet.ReadByte();
                chr[i].FacialHair = packet.ReadByte();
                chr[i].Level = packet.ReadByte();
                chr[i].ZoneID = packet.ReadUInt32();
                chr[i].MapID = packet.ReadUInt32();
                chr[i].X = packet.ReadFloat();
                chr[i].Y = packet.ReadFloat();
                chr[i].Z = packet.ReadFloat();

                chr[i].Guild = packet.ReadUInt32();
                chr[i].CharacterFlags = packet.ReadUInt32();
                chr[i].CustomizationFlags = packet.ReadUInt32();
                chr[i].FirstLogin = packet.ReadByte();
                chr[i].PetInfoID = packet.ReadUInt32();
                chr[i].PetLevel = packet.ReadUInt32();
                chr[i].PetFamilyID = packet.ReadUInt32();
                chr[i]._items = new PlayerEnumItem[23];
                for (int x = 0; x <= 22; x++)
                {
                    chr[i]._items[x].displayId = packet.ReadUInt32();
                    chr[i]._items[x].inventorytype = packet.ReadByte();
                    chr[i]._items[x].enchant = packet.ReadUInt32(); // enchant (2.4 patch)
                }

               /* packet.ReadByte();
                packet.ReadByte();
                packet.ReadByte();
                packet.ReadByte();*/

                CharacterListExt cx;
                cx.p = chr[i];
                cx.class_ = "classname";
                cx.race = "racename";
                cx.zone = "zonename";
                cx.map_ = "mapname";

                Global.GetInstance().GetWSession().GetCharList().Add(cx);

            }

            #region Default Char Create
            if (count == 0)
            {
                PacketOut outpacket = new PacketOut(WorldServerOpCode.CMSG_CHAR_CREATE);

                outpacket.Write("qweqwe");
                outpacket.Write((byte)1); // race - human
                outpacket.Write((byte)1); // class - warrior
                outpacket.Write((byte)0); // gender - male
                outpacket.Write((byte)1); // skin
                outpacket.Write((byte)1); // face
                outpacket.Write((byte)1); // hair style
                outpacket.Write((byte)1); // hair color
                outpacket.Write((byte)1); // facial hair
                outpacket.Write((byte)1); // outfit id
                Send(outpacket);
                outpacket = new PacketOut(WorldServerOpCode.CMSG_CHAR_ENUM);
                Send(outpacket);
                // return;
            }
            else {

            }
            #endregion

            Log.WriteLine(netLogic.Shared.LogType.Success, "Received info about {0} characters", count);

            PingLoop();
            LevelManager.Load("CharactersList");
        }
Пример #8
0
        public void GotMOTD(PacketIn packet)
        {
            var vari = packet.ReadUInt32();
            var str = packet.ReadCString();
            //Console.WriteLine(packet.ToHex());
            var guid = Global.GetInstance().GetWSession().GetMyGuid().GetOldGuid();
            QueryName(guid);
            PacketOut outpacket = new PacketOut(WorldServerOpCode.CMSG_SET_ACTIVE_MOVER);
            outpacket.Write(guid);
            Send(outpacket);

              //  LevelManager.Load("DEMO_WORLD");
        }
Пример #9
0
        public void DoAuthSession()
        {
            try
            {
                PacketOut packet = new PacketOut(WorldServerOpCode.CMSG_AUTH_SESSION);

                Sha1Hash sha = new Sha1Hash();
                sha.Update(mUsername);
                sha.Update(new byte[4]); // t
                sha.Update(ClientSeed);
                sha.Update(ServerSeed);
                sha.Update(mKey);

                byte[] Digest = sha.Final();

                packet.Write(12340);
                packet.Write((UInt32)0);
                packet.Write(mUsername);
                packet.Write((UInt32)0);
                packet.Write(ClientSeed);
                packet.Write((UInt32)0);
                packet.Write((UInt32)0);
                packet.Write((UInt32)0);
                packet.Write((UInt64)0);
                packet.Write(Digest);

                bool WantToCrash = false;
                if (WantToCrash)
                {
                    byte[] addons = { (byte)0x00 };
                    byte[] buffer2 = netLogic.Shared.Compression.Compress(addons);
                    UInt32 Size = (UInt32)addons.Length;
                    packet.Write(Size);
                    packet.Write(buffer2);

                }
                else
                {
                    byte[] addons = { (byte)0x00 };
                    byte[] addon_data = { 0x56, 0x01, 0x00, 0x00, 0x78, 0x9c, 0x75, 0xcc, 0xbd, 0x0e, 0xc2, 0x30, 0x0c, 0x04, 0xe0, 0xf2, 0x1e, 0xbc, 0x0c, 0x61, 0x40, 0x95, 0xc8, 0x42, 0xc3, 0x8c, 0x4c, 0xe2, 0x22, 0x0b, 0xc7, 0xa9, 0x8c, 0xcb, 0x4f, 0x9f, 0x1e, 0x16, 0x24, 0x06, 0x73, 0xeb, 0x77, 0x77, 0x81, 0x69, 0x59, 0x40, 0xcb, 0x69, 0x33, 0x67, 0xa3, 0x26, 0xc7, 0xbe, 0x5b, 0xd5, 0xc7, 0x7a, 0xdf, 0x7d, 0x12, 0xbe, 0x16, 0xc0, 0x8c, 0x71, 0x24, 0xe4, 0x12, 0x49, 0xa8, 0xc2, 0xe4, 0x95, 0x48, 0x0a, 0xc9, 0xc5, 0x3d, 0xd8, 0xb6, 0x7a, 0x06, 0x4b, 0xf8, 0x34, 0x0f, 0x15, 0x46, 0x73, 0x67, 0xbb, 0x38, 0xcc, 0x7a, 0xc7, 0x97, 0x8b, 0xbd, 0xdc, 0x26, 0xcc, 0xfe, 0x30, 0x42, 0xd6, 0xe6, 0xca, 0x01, 0xa8, 0xb8, 0x90, 0x80, 0x51, 0xfc, 0xb7, 0xa4, 0x50, 0x70, 0xb8, 0x12, 0xf3, 0x3f, 0x26, 0x41, 0xfd, 0xb5, 0x37, 0x90, 0x19, 0x66, 0x8f };
                    // string str = addon_data.ToString();
                    // packet.Write(addon_data.Length);
                    packet.Write(addon_data);

                }

                Send(packet);

                mCrypt = new PacketCrypt(mKey);
                mCrypt.Init();
            }
            catch (Exception e)
            {
                Log.WriteLine(netLogic.Shared.LogType.Error, e.StackTrace);
            }
        }
Пример #10
0
        public void RequestRealmlist()
        {
            PacketOut packet = new PacketOut(LogonServerOpCode.REALM_LIST);
            packet.Write(0x00);
            Send(packet);

            // Most tricky code ever. It's so because retail server sends a lot of data in this packet...
            byte[] temp = pLoop.OnReceive(3);
            PacketIn p1 = new PacketIn(temp, true);
            byte[] temp2 = pLoop.OnReceive(p1.ReadUInt16());
            byte[] temp3 = new byte[temp.Length + temp2.Length];
            temp.CopyTo(temp3, 0);
            temp2.CopyTo(temp3, temp.Length);

            p1 = new PacketIn(temp3, false);
            HandlePacket(p1);
        }
Пример #11
0
        public bool 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);
            try
            {
                pLoop.Start();
            }
            catch(Exception ex)
            {
                throw new Exception("sdfsdfsdf"+ex.Message);
            }
            return true;
        }
Пример #12
0
        public void AuthChallangeRequest(PacketIn packetIn)
        {
            packetIn.ReadByte();
            byte error = packetIn.ReadByte();
            if (error != 0x00)
            {
                Log.WriteLine(LogType.Error, "Authentication error: {0}", (AccountStatus)error);
                Disconnect();
                return;
            }

            B = new BigInteger(packetIn.ReadBytes(32));               // Varies
            byte glen = packetIn.ReadByte();                          // Length = 1
            g = packetIn.ReadBytes(glen);                             // g = 7
            byte Nlen = packetIn.ReadByte();                          // Length = 32
            N = packetIn.ReadBytes(Nlen);                             // N = B79B3E2A87823CAB8F5EBFBF8EB10108535006298B5BADBD5B53E1895E644B89
            Salt = new BigInteger(packetIn.ReadBytes(32));            // Salt = 3516482AC96291B3C84B4FC204E65B623EFC2563C8B4E42AA454D93FCD1B56BA
            crcsalt = packetIn.ReadBytes(16);                         // Varies

            BigInteger S;
            srp = new Srp6(new BigInteger(N), new BigInteger(g));

            do
            {
                a = BigInteger.Random(19 * 8);
                A = srp.GetA(a);

                I = Srp6.GetLogonHash(mUsername, mPassword);

                BigInteger x = Srp6.Getx(Salt, I);
                BigInteger u = Srp6.Getu(A, B);
                S = srp.ClientGetS(a, B, x, u);
            }
            while (S < 0);

            mKey = Srp6.ShaInterleave(S);
            M = srp.GetM(mUsername, Salt, A, B, new BigInteger(mKey));

            packetIn.ReadByte();

            Sha1Hash sha;
            byte[] files_crc;

            // Generate CRC/hashes of the Game Files
            if (Config.Retail)
                files_crc = GenerateCrc(crcsalt);
            else
                files_crc = new byte[20];

            // get crc_hash from files_crc
            sha = new Sha1Hash();
            sha.Update(A);
            sha.Update(files_crc);
            byte[] crc_hash = sha.Final();

            PacketOut packet = new PacketOut(LogonServerOpCode.AUTH_LOGON_PROOF);
            packet.Write(A); // 32 bytes
            packet.Write(M); // 20 bytes
            packet.Write(crc_hash); // 20 bytes
            packet.Write((byte)0); // number of keys
            packet.Write((byte)0); // unk (1.11.x)
            Send(packet);
        }
Пример #13
0
 public void QueryName(UInt64 guid)
 {
     PacketOut packet = new PacketOut(WorldServerOpCode.CMSG_NAME_QUERY);
     packet.Write(guid);
     Send(packet);
 }
Пример #14
0
 public void QueryName(GameGuid guid)
 {
     PacketOut packet = new PacketOut(WorldServerOpCode.CMSG_NAME_QUERY);
     packet.Write(guid.GetOldGuid());
     Send(packet);
 }
Пример #15
0
 public void ObjectQuery(GameGuid guid, UInt32 entry)
 {
     PacketOut packet = new PacketOut(WorldServerOpCode.CMSG_GAMEOBJECT_QUERY);
     packet.Write(entry);
     packet.Write(guid.GetOldGuid());
     Send(packet);
 }
Пример #16
0
        void Ping(object source, ElapsedEventArgs e)
        {
            while(!mSocket.Connected)
            {
                aTimer.Enabled = false;
                aTimer.Stop();
                return;
            }

            Ping_Req_Time = MM_GetTime();

            PacketOut ping = new PacketOut(WorldServerOpCode.CMSG_PING);
            ping.Write(Ping_Seq);
            ping.Write(Latency);
            Send(ping);
        }