예제 #1
0
        private void TeleportHandler(WoWReader wr)
        {
            float x, y, z, orient;
            byte  mask = wr.ReadByte();

            WoWGuid guid = new WoWGuid(mask, wr.ReadBytes(WoWGuid.BitCount8(mask)));

            wr.ReadUInt32(); // flags

            wr.ReadUInt32(); // time?
            wr.ReadByte();   // unk 2.3.0

            wr.ReadSingle(); // unk2
            x      = wr.ReadSingle();
            y      = wr.ReadSingle();
            z      = wr.ReadSingle();
            orient = wr.ReadSingle();
            wr.ReadUInt16(); // unk3
            wr.ReadByte();   // unk4
            BoogieCore.Log(LogType.SystemDebug, "Got teleport to: {0} {1} {2} {3}", x, y, z, orient);

            BoogieCore.world.getPlayerObject().SetCoordinates(new Coordinate(x, y, z, orient));

            WoWWriter ww = new WoWWriter(OpCode.MSG_MOVE_TELEPORT_ACK);

            ww.Write(BoogieCore.world.getPlayerObject().GUID.GetOldGuid());
            Send(ww.ToArray());
            SendMoveHeartBeat(BoogieCore.world.getPlayerObject().GetCoordinates());
        }
예제 #2
0
        private void Handle_FriendStatus(WoWReader wr)
        {
            FriendsListItem friendStatus = new FriendsListItem();

            friendStatus.guid   = new WoWGuid(wr.ReadUInt64());
            friendStatus.online = wr.ReadBoolean();

            BoogieCore.Player.friendStatusUpdate(friendStatus);
        }
예제 #3
0
        private void Handle_ActionButtons(WoWReader wr)
        {
            ActionButton[] actionButtonList = new ActionButton[ActionBars.MaxButtons];

            for (int i = 0; i < ActionBars.MaxButtons; i++)
            {
                actionButtonList[i].action = wr.ReadUInt16();
                actionButtonList[i].type   = wr.ReadByte();
                actionButtonList[i].misc   = wr.ReadByte();
            }

            BoogieCore.Player.setActionBars(actionButtonList);
        }
예제 #4
0
        private void Handle_InitializeFactions(WoWReader wr)
        {
            UInt32 count = wr.ReadUInt32();     // always 64

            ReputationItem[] reputationList = new ReputationItem[count];

            for (int i = 0; i < count; i++)
            {
                reputationList[i].flag     = wr.ReadByte();
                reputationList[i].standing = wr.ReadUInt32();
            }

            BoogieCore.Player.setReputation(reputationList);
        }
예제 #5
0
        private void Handle_IgnoreList(WoWReader wr)
        {
            byte count = wr.ReadByte();

            IgnoreListItem[] ignoreList = new IgnoreListItem[count];

            for (int i = 0; i < count; i++)
            {
                ignoreList[i]      = new IgnoreListItem();
                ignoreList[i].guid = new WoWGuid(wr.ReadUInt64());
                QueryName(ignoreList[i].guid);
            }

            BoogieCore.Player.setIgnoreList(ignoreList);
        }
예제 #6
0
        private void Handle_CreatureQuery(WoWReader wr)
        {
            Entry entry = new Entry();

            entry.entry   = wr.ReadUInt32();
            entry.name    = wr.ReadString();
            entry.blarg   = wr.ReadBytes(3);
            entry.subname = wr.ReadString();
            entry.flags   = wr.ReadUInt32();
            entry.subtype = wr.ReadUInt32();
            entry.family  = wr.ReadUInt32();
            entry.rank    = wr.ReadUInt32();

            BoogieCore.Log(LogType.NeworkComms, "Got CreatureQuery Response - Entry: {0} - Name: {1} - SubName {2}", entry.entry, entry.name, entry.subname);
            if (EntryList.ContainsKey(entry.entry) == false)
            {
                EntryList.Add(entry.entry, entry);
            }

            if (EntryQueue.ContainsKey(entry.entry))
            {
                EntryQueue.Remove(entry.entry);
            }

            foreach (Object obj in BoogieCore.world.getObjectList())
            {
                if (obj.Fields != null)
                {
                    if (obj.Fields[(int)UpdateFields.OBJECT_FIELD_ENTRY] == entry.entry)
                    {
                        if (entry.name.Contains("Auctioneer") && SentHello == false)
                        {
                            WoWWriter ww = new WoWWriter(OpCode.MSG_AUCTION_HELLO);
                            ww.Write(obj.GUID.GetOldGuid());
                            Send(ww.ToArray());
                            BoogieCore.Log(LogType.SystemDebug, "Sent AH Hello!");
                            SentHello = true;
                        }

                        obj.Name    = entry.name;
                        obj.SubName = entry.subname;
                        obj.SubType = entry.subtype;
                        obj.Family  = entry.family;
                        obj.Rank    = entry.rank;
                    }
                }
            }
        }
예제 #7
0
        private void Handle_FriendsList(WoWReader wr)
        {
            byte count = wr.ReadByte();

            FriendsListItem[] friendsList = new FriendsListItem[count];

            for (int i = 0; i < count; i++)
            {
                friendsList[i]        = new FriendsListItem();
                friendsList[i].guid   = new WoWGuid(wr.ReadUInt64());
                friendsList[i].online = wr.ReadBoolean();
                QueryName(friendsList[i].guid);
            }

            BoogieCore.Player.setFriendList(friendsList);
        }
예제 #8
0
        private void Handle_NameQuery(WoWReader wr)
        {
            WoWGuid guid   = new WoWGuid(wr.ReadUInt64());
            string  name   = wr.ReadString();
            UInt16  unk    = wr.ReadByte();
            UInt32  Race   = wr.ReadUInt32();
            UInt32  Gender = wr.ReadUInt32();
            UInt32  Level  = wr.ReadUInt32();

            BoogieCore.Log(LogType.NeworkComms, "Got NameQuery Response - GUID: {4} Name: {0} - Race: {1} - Gender: {2} - Level: {3}", name, Race, Gender, Level, BitConverter.ToUInt64(guid.GetNewGuid(), 0));

            Object obj = BoogieCore.world.getObject(guid);

            if (obj != null)    // Update existing object
            {
                obj.Name   = name;
                obj.Race   = Race;
                obj.Gender = Gender;
                obj.Level  = Level;
                BoogieCore.world.updateObject(obj);
            }
            else                // Create new Object        -- FIXME: Add to new 'names only' list?
            {
                obj        = new Object();
                obj.GUID   = guid;
                obj.Name   = name;
                obj.Race   = Race;
                obj.Gender = Gender;
                obj.Level  = Level;
                BoogieCore.world.newObject(obj, true);
            }

            /* Process chat message if we looked them up now */
            for (int i = 0; i < ChatQueued.Count; i++)
            {
                ChatQueue message = (ChatQueue)ChatQueued[i];
                if (message.GUID.GetOldGuid() == guid.GetOldGuid())
                {
                    BoogieCore.Event(new Event(EventType.EVENT_CHAT, Time.GetTime(), message, name));
                    ChatQueued.Remove(message);
                }
            }

            // WoWChat uses this to retrive names on friends and ignore list.
            BoogieCore.Event(new Event(EventType.EVENT_NAMEQUERY_RESPONSE, Time.GetTime(), guid, name));
        }
예제 #9
0
        private void Handle_InitialSpells(WoWReader wr)
        {
            byte   unknown = wr.ReadByte();         // Dunno. wowd sends a 0.
            UInt16 count   = wr.ReadUInt16();

            SpellItem[] spellList = new SpellItem[count];

            for (int i = 0; i < count; i++)
            {
                spellList[i].spellID = wr.ReadUInt16();
                spellList[i].unknown = wr.ReadUInt16(); // 0xeeee
            }

            wr.ReadUInt16();              // Another 0 according to wowd.

            BoogieCore.Player.setSpells(spellList);
        }
예제 #10
0
        private void Handle_NewWorld(WoWReader wr)
        {
            Object obj = BoogieCore.world.getPlayerObject();

            WorldZone(obj.GUID.GetOldGuid());

            UInt32 mapid = wr.ReadUInt32();

            BoogieCore.world.zoned(mapid);          // Tell World we zoned, and give new mapid
            obj.coord = new Coordinate(wr.ReadSingle(), wr.ReadSingle(), wr.ReadSingle(), wr.ReadSingle());
            WoWWriter ww = new WoWWriter(OpCode.MSG_MOVE_WORLDPORT_ACK);

            //ww.Write(BoogieCore.world.getPlayerObject().GUID.GetOldGuid());
            Send(ww.ToArray());
            SendMoveHeartBeat(obj.coord);
            BoogieCore.Log(LogType.System, "Got worldport for mapid: {0} xyz: {1} {2} {3}", mapid, obj.coord.X, obj.coord.Y, obj.coord.Z);
            BoogieCore.world.updatePlayerLocationUI();
        }
예제 #11
0
        private void Handle_AuthResponse(WoWReader wr)
        {
            byte error = wr.ReadByte();

            if (error != 0x0C)
            {
                BoogieCore.Log(LogType.Error, "WS: Authentication Failed: Error = {0}", error);
                return;
            }
            BoogieCore.Log(LogType.System, "WS: Authentication Successful!");

            BoogieCore.Log(LogType.System, "WS: Requesting Character List...");

            WoWWriter ww = new WoWWriter(OpCode.CMSG_CHAR_ENUM);

            Send(ww.ToArray());
            PingTimer.Enabled = true;
        }
예제 #12
0
        public MovementInfo(WoWReader wr)
        {
            transGuid = 0;
            flags     = wr.ReadUInt32();
            wr.ReadByte();
            time = wr.ReadUInt32();

            x           = wr.ReadFloat();
            y           = wr.ReadFloat();
            z           = wr.ReadFloat();
            orientation = wr.ReadFloat();

            if ((flags & 0x2000000) >= 1) // Transport
            {
                transGuid = wr.ReadUInt64();

                transX = wr.ReadFloat();
                transY = wr.ReadFloat();
                transZ = wr.ReadFloat();
                transO = wr.ReadFloat();
            }

            if ((flags & 0x200000) >= 1) // Swimming
            {
                unk6 = wr.ReadFloat();
            }

            if ((flags & 0x2000) >= 1) // Falling
            {
                FallTime = wr.ReadUInt32();
                unk8     = wr.ReadUInt32();
                unk9     = wr.ReadUInt32();
                unk10    = wr.ReadUInt32();
            }

            if ((flags & 0x4000000) >= 1)
            {
                unk12 = wr.ReadUInt32();
            }

            //if (wr.Remaining >= 4) unklast = wr.ReadUInt32();
        }
예제 #13
0
        private void MovementHandler(WoWReader wr)
        {
            WoWGuid guid;
            byte    mask = wr.ReadByte();

            if (mask == 0x00)
            {
                return;
            }

            guid = new WoWGuid(mask, wr.ReadBytes(WoWGuid.BitCount8(mask)));

            MovementInfo mi = new MovementInfo(wr);

            if (BoogieCore.world.getObject(guid) != null)
            {
                //BoogieCore.Log(LogType.Error, "Updating coordinates for object {0}, x={1} y={2} z={3}", BoogieCore.world.getObject(guid).Name, mi.x, mi.y, mi.z);
                BoogieCore.world.getObject(guid).SetCoordinates(mi.GetCoordinates());
            }
        }
예제 #14
0
        private void decryptData(byte[] Data)
        {
            mCrypt.Decrypt(Data, mRecvCryptSize);
#if (LOG)
            WoWReader wr   = new WoWReader(Data);
            UInt16    Op2  = wr.ReadUInt16();
            OpCode    Op   = (OpCode)Op2;
            int       left = wr.Remaining;
            tw.Write("{");
            tw.Write("SERVER");
            tw.Write("}");
            tw.WriteLine(" Packet: (0x{2:x4}) {1} PacketSize = {0} TimeStamp = 0", Data.Length, Op, Op2);
            tw.WriteLine("|------------------------------------------------|----------------|");
            tw.WriteLine("|00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F |0123456789ABCDEF|");
            tw.WriteLine("|------------------------------------------------|----------------|");
            Debug.DumpBuffer(wr.ReadRemaining(), left, tw);
            tw.WriteLine("-------------------------------------------------------------------");
            tw.WriteLine();
            tw.Flush();
#endif
        }
예제 #15
0
        public bool Connect(IPEndPoint ep)
        {
            try
            {
                mSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);

                mSocket.Connect(ep);

                ns   = new NetworkStream(mSocket, true);
                win  = new WoWReader(ns);
                wout = new WoWWriter(ns);

                BoogieCore.Log(LogType.System, "Connected successfully.");
                return(true);
            }
            catch (Exception ex)
            {
                BoogieCore.Log(LogType.System, "Failed to open connection to realm list server. Details below:\n{0}", ex.Message);
                return(false);
            }
        }
예제 #16
0
        private void Handle_GameObjectQuery(WoWReader wr)
        {
            Entry entry = new Entry();

            entry.entry = wr.ReadUInt32();
            if (entry.entry < 1 || wr.Remaining < 4)
            {
                BoogieCore.Log(LogType.System, "Got {1} in GameObject query response for entryid or remaining in packet too small {0}", wr.Remaining, entry.entry);
                return;
            }

            entry.Type      = wr.ReadUInt32();
            entry.DisplayID = wr.ReadUInt32();
            entry.name      = wr.ReadString();

            BoogieCore.Log(LogType.NeworkComms, "Got GameObject Query Response - Entry: {0} - Name: {1} - Type {2}", entry.entry, entry.name, entry.Type);
            if (EntryList.ContainsKey(entry.entry) == false)
            {
                EntryList.Add(entry.entry, entry);
            }

            if (EntryQueue.ContainsKey(entry.entry))
            {
                EntryQueue.Remove(entry.entry);
            }

            foreach (Object obj in BoogieCore.world.getObjectList())
            {
                if (obj.Fields != null)
                {
                    if (obj.Fields[(int)UpdateFields.OBJECT_FIELD_ENTRY] == entry.entry)
                    {
                        obj.Type = (byte)entry.Type;
                        obj.Name = entry.name;
                    }
                }
            }
        }
예제 #17
0
        public void Send(byte[] Data)
        {
#if (LOG)
            WoWReader wr   = new WoWReader(Data);
            UInt16    Op2  = wr.ReadUInt16();
            OpCode    Op   = (OpCode)Op2;
            int       left = wr.Remaining;

            tw.Write("{");
            tw.Write("CLIENT");
            tw.Write("}");
            tw.WriteLine(" Packet: (0x{2:x4}) {1} PacketSize = {0} TimeStamp = 0", Data.Length, Op, Op2);
            tw.WriteLine("|------------------------------------------------|----------------|");
            tw.WriteLine("|00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F |0123456789ABCDEF|");
            tw.WriteLine("|------------------------------------------------|----------------|");
            Debug.DumpBuffer(wr.ReadRemaining(), left, tw);
            tw.WriteLine("-------------------------------------------------------------------");
            tw.WriteLine();
            tw.Flush();
#endif
            int    Length = Data.Length;
            byte[] Packet = new byte[2 + Length];
            Packet[0] = (byte)(Length >> 8);
            Packet[1] = (byte)(Length & 0xff);
            Data.CopyTo(Packet, 2);
            mCrypt.Encrypt(Packet, mSendCryptSize);

            try
            {
                mSocket.Send(Packet);
            }
            catch (SocketException e)
            {
                BoogieCore.Log(LogType.Error, "Unable to send packet! Error: {0}", e.Message);
                isRunning = false;
            }
        }
예제 #18
0
 private void Handle_SpellLogExecute(WoWReader wr)
 {
     BoogieCore.Log(LogType.NeworkComms, "WS: Recieved Spell Log Execute..");
     SMSG_Debug(wr);
 }
예제 #19
0
        private void Handle_ObjUpdate(WoWReader wr, bool Compressed)
        {
            if (Compressed)
            {
                Int32  size     = wr.ReadInt32();
                byte[] decomped = Foole.Utils.Compression.Decompress(size, wr.ReadRemaining());
                wr = new WoWReader(decomped);
            }

            WoWGuid guid;
            UInt32  blockCount;
            byte    unk1;
            byte    blockType;
            byte    objTypeId;

            blockCount = wr.ReadUInt32();
            unk1       = wr.ReadByte();

            BoogieCore.Log(LogType.Error, "Got obj update with {0} blocks", blockCount);
            for (UInt32 i = 0; i < blockCount; i++)
            {
                blockType = wr.ReadByte();
                #if (DEBUG)
                BoogieCore.Log(LogType.NeworkComms, "Block #{0}/{1} Type: {2}", i + 1, blockCount, blockType);
                #endif

                switch (blockType)
                {
                case 0:     // Fields update
                {
                    byte mask = wr.ReadByte();

                    if (mask == 0x00)
                    {
                        break;
                    }

                    guid = new WoWGuid(mask, wr.ReadBytes(WoWGuid.BitCount8(mask)));

                    UpdateMask UpdateMask = new UpdateMask();
                    byte       bc         = wr.ReadByte(); // Block Count

                    UpdateMask.SetCount((ushort)(bc * 32));
                    UpdateMask.SetMask(wr.ReadBytes(bc * 4), bc);
#if (DEBUG)
                    BoogieCore.Log(LogType.Error, "Field Update! FieldCount: {0}", UpdateMask.GetCount());
#endif
                    UInt32[] Fields = new UInt32[UpdateMask.GetCount()];

                    Object obj = BoogieCore.World.getObject(guid);

                    if (obj == null)
                    {
                        BoogieCore.Log(LogType.Error, "Object with the guid {0} not recognized in field update.", guid.GetOldGuid());
                    }

                    for (ushort x = 0; x < UpdateMask.GetCount(); x++)
                    {
                        if (UpdateMask.GetBit(x))
                        {
                            if (obj == null)         // FixMe
                            {
                                wr.ReadUInt32();
                            }
                            else
                            {
                                obj.Fields[x] = wr.ReadUInt32();
                            }
                        }
                    }

                    // Update Player Class if these are Player Fields being changed.
                    if (obj != null)
                    {
                        if (obj.GUID.GetOldGuid() == BoogieCore.Player.Character.GUID)
                        {
                            BoogieCore.Player.updatePlayer(obj);
                        }
                    }

                    break;
                }

                case 1:     // Movement Update
                {
                    byte mask = wr.ReadByte();

                    if (mask == 0x00)
                    {
                        break;
                    }

                    guid = new WoWGuid(mask, wr.ReadBytes(WoWGuid.BitCount8(mask)));
#if (DEBUG)
                    BoogieCore.Log(LogType.NeworkComms, "Got Movement update for GUID {0}", BitConverter.ToUInt64(guid.GetNewGuid(), 0));
#endif
                    UInt32 flags2 = 0, unk3;
                    float  posX = 0;
                    float  posY = 0;
                    float  posZ = 0;
                    float  facing = 0;
                    float  walkSpeed, runSpeed, backWalkSpeed, swimSpeed, backSwimSpeed, turnRate = 0;

                    byte flags = wr.ReadByte();

                    if ((flags & 0x20) >= 1)
                    {
                                #if (DEBUG)
                        BoogieCore.Log(LogType.NeworkComms, "(flags & 20)");
#endif
                        flags2 = wr.ReadUInt32();
                        wr.ReadByte();         // 2.3.3
                        unk3 = wr.ReadUInt32();
                    }

                    if ((flags & 0x40) >= 1)
                    {
                                #if (DEBUG)
                        BoogieCore.Log(LogType.NeworkComms, "(flags & 40)");
#endif
                        posX   = wr.ReadSingle();
                        posY   = wr.ReadSingle();
                        posZ   = wr.ReadSingle();
                        facing = wr.ReadSingle();
#if (DEBUG)
                        BoogieCore.Log(LogType.NeworkComms, "Position - X: {0} Y: {1} Z: {2} Orient: {3} ", posX, posY, posZ, facing);
#endif
                        if ((flags2 & 0x02000000) >= 1)         // player being transported
                        {
#if (DEBUG)
                            BoogieCore.Log(LogType.NeworkComms, "(flags2 & 0x02000000)");
#endif
                            wr.ReadUInt32();            //guidlow
                            wr.ReadUInt32();            //guidhigh
                            wr.ReadSingle();            //x
                            wr.ReadSingle();            //y
                            wr.ReadSingle();            //z
                            wr.ReadSingle();            //o
                            wr.ReadSingle();            // unk
                        }
                    }


                    if ((flags & 0x20) >= 1)
                    {
                                #if (DEBUG)
                        BoogieCore.Log(LogType.NeworkComms, "(flags & 20)");
#endif
                        wr.ReadSingle();         //unk
                        if ((flags2 & 0x2000) >= 1)
                        {
#if (DEBUG)
                            BoogieCore.Log(LogType.NeworkComms, "(flags & 2000)");
#endif
                            wr.ReadSingle();         // pos unk1
                            wr.ReadSingle();         // pos unk1
                            wr.ReadSingle();         // pos unk1
                            wr.ReadSingle();         // pos unk1
                            //BoogieCore.Log(LogType.NeworkComms, "Position 2 - X: {0} Y: {1} Z: {2} Orient: {3} ", punk1, punk2, punk3, punk1);
                        }
                    }

                    if ((flags & 0x20) >= 1)
                    {
                                #if (DEBUG)
                        BoogieCore.Log(LogType.NeworkComms, "(flags & 20)");
#endif
                        walkSpeed     = wr.ReadSingle();
                        runSpeed      = wr.ReadSingle();
                        backWalkSpeed = wr.ReadSingle();
                        swimSpeed     = wr.ReadSingle();
                        backSwimSpeed = wr.ReadSingle();
                        wr.ReadSingle();         //unk1
                        wr.ReadSingle();         //unk2
                        turnRate = wr.ReadSingle();
                        //BoogieCore.Log(LogType.NeworkComms, "Speed - (flags & 0x20)");
                    }

                    if ((flags & 0x20) >= 1)
                    {
                        //BoogieCore.Log(LogType.NeworkComms, "(flags & 0x20)");
                        if ((flags2 & 0x00400000) >= 1)
                        {
                            //BoogieCore.Log(LogType.NeworkComms, "(flags2 & 0x00400000)");
                            UInt32 splineFlags;

                            splineFlags = wr.ReadUInt32();

                            if ((splineFlags & 0x00010000) >= 1)
                            {
                                //BoogieCore.Log(LogType.NeworkComms, "(splineFlags & 0x00010000)");
                                posX = wr.ReadSingle();
                                posY = wr.ReadSingle();
                                posZ = wr.ReadSingle();
                                //BoogieCore.Log(LogType.NeworkComms, "Position 3 - X: {0} Y: {1} Z: {2} Orient: {3} ", posX, posY, posZ, facing);
                            }

                            if ((splineFlags & 0x00020000) >= 1)
                            {
                                //BoogieCore.Log(LogType.NeworkComms, "(splineFlags & 0x00020000)");
                                wr.ReadUInt64();
                            }

                            if ((splineFlags & 0x00040000) >= 1)
                            {
                                //BoogieCore.Log(LogType.NeworkComms, "(splineFlags & 0x00040000)");
                                float f;
                                f = wr.ReadSingle();
                            }

                            UInt32 time1, time2, splineCount, unk4;

                            //1.8
                            time1       = wr.ReadUInt32();
                            time2       = wr.ReadUInt32();
                            unk4        = wr.ReadUInt32();
                            splineCount = wr.ReadUInt32();
                            //BoogieCore.Log(LogType.NeworkComms, "splineCount = {0}", splineCount);

                            for (UInt32 j = 0; j < splineCount + 1; j++)
                            {
                                posX = wr.ReadSingle();
                                posY = wr.ReadSingle();
                                posZ = wr.ReadSingle();
                                //BoogieCore.Log(LogType.NeworkComms, "Position 4 - X: {0} Y: {1} Z: {2} Orient: {3} ", posX, posY, posZ, facing);
                            }
                        }
                    }

                    if ((flags & 0x8) >= 1)
                    {
                                #if (DEBUG)
                        BoogieCore.Log(LogType.NeworkComms, "(flags & 8)");
#endif
                        wr.ReadUInt32();
                        if ((flags & 0x10) >= 1)
                        {
#if (DEBUG)
                            BoogieCore.Log(LogType.NeworkComms, "(flags & 10)");
#endif
                            wr.ReadUInt32();
                        }
                    }
                    else if ((flags & 0x10) >= 1)
                    {
                                #if (DEBUG)
                        BoogieCore.Log(LogType.NeworkComms, "(flags & 10)");
#endif
                        wr.ReadUInt32();
                    }

                    if ((flags & 0x2) >= 1)
                    {
                                #if (DEBUG)
                        BoogieCore.Log(LogType.NeworkComms, "(flags & 0x2)");
#endif
                        wr.ReadUInt32();
                    }

                    break;
                }

                case 2:     // ObjCreate
                case 3:     // ObjCreate
                {
                    byte mask = wr.ReadByte();

                    guid      = new WoWGuid(mask, wr.ReadBytes(WoWGuid.BitCount8(mask)));
                    objTypeId = wr.ReadByte();
                            #if (DEBUG)
                    BoogieCore.Log(LogType.NeworkComms, "Got Object Create Mask: 0x{0:x2} GUID: {1} ObjTypeID: {2} ", mask, BitConverter.ToUInt64(guid.GetNewGuid(), 0), objTypeId);
#endif
                    UInt32 flags2 = 0, unk3;
                    float  posX = 0;
                    float  posY = 0;
                    float  posZ = 0;
                    float  facing = 0;
                    float  walkSpeed = 0, runSpeed = 0, backWalkSpeed = 0, swimSpeed = 0, backSwimSpeed = 0, turnRate = 0;

                    byte flags = wr.ReadByte();

                    if ((flags & 0x20) >= 1)
                    {
                        //BoogieCore.Log(LogType.NeworkComms, "(flags & 20)");
                        flags2 = wr.ReadUInt32();
                        wr.ReadByte();         // 2.3.3
                        unk3 = wr.ReadUInt32();
                    }

                    if ((flags & 0x40) >= 1)
                    {
                        //BoogieCore.Log(LogType.NeworkComms, "(flags & 40)");
                        posX   = wr.ReadSingle();
                        posY   = wr.ReadSingle();
                        posZ   = wr.ReadSingle();
                        facing = wr.ReadSingle();
                        //BoogieCore.Log(LogType.NeworkComms, "Position - X: {0} Y: {1} Z: {2} Orient: {3} ", posX, posY, posZ, facing);

                        if (((flags & 0x20) >= 1 && (flags2 & 0x0200) >= 1))            // player being transported
                        {
                            //BoogieCore.Log(LogType.NeworkComms, "(flags & 0x20 && flags2 & 0x0200)");
                            wr.ReadUInt32();            //guidlow
                            wr.ReadUInt32();            //guidhigh
                            wr.ReadSingle();            //x
                            wr.ReadSingle();            //y
                            wr.ReadSingle();            //z
                            wr.ReadSingle();            //o
                            wr.ReadSingle();            // unk
                        }
                    }


                    if ((flags & 0x20) >= 1)
                    {
                        //BoogieCore.Log(LogType.NeworkComms, "(flags & 20)");
                        wr.ReadSingle();         //unk
                        if ((flags2 & 0x2000) >= 1)
                        {
                            //BoogieCore.Log(LogType.NeworkComms, "(flags & 2000)");
                            wr.ReadSingle();         // pos unk1
                            wr.ReadSingle();         // pos unk1
                            wr.ReadSingle();         // pos unk1
                            wr.ReadSingle();         // pos unk1
                            //BoogieCore.Log(LogType.NeworkComms, "Position 2 - X: {0} Y: {1} Z: {2} Orient: {3} ", punk1, punk2, punk3, punk1);
                        }
                    }

                    if ((flags & 0x20) >= 1)
                    {
                        //BoogieCore.Log(LogType.NeworkComms, "(flags & 20)");
                        walkSpeed     = wr.ReadSingle();
                        runSpeed      = wr.ReadSingle();
                        backWalkSpeed = wr.ReadSingle();
                        swimSpeed     = wr.ReadSingle();
                        backSwimSpeed = wr.ReadSingle();
                        wr.ReadSingle();         //unk1
                        wr.ReadSingle();         //unk2
                        turnRate = wr.ReadSingle();
                        //BoogieCore.Log(LogType.NeworkComms, "Speed - (flags & 0x20)");
                    }

                    if ((flags & 0x20) >= 1)
                    {
                        //BoogieCore.Log(LogType.NeworkComms, "(flags & 0x20)");
                        if ((flags2 & 0x08000000) >= 1)
                        {
                            //BoogieCore.Log(LogType.NeworkComms, "(flags2 & 0x00400000)");
                            UInt32 splineFlags;

                            splineFlags = wr.ReadUInt32();

                            if ((splineFlags & 0x00010000) >= 1)
                            {
                                BoogieCore.Log(LogType.NeworkComms, "(splineFlags & 0x00010000)");
                                posX = wr.ReadSingle();
                                posY = wr.ReadSingle();
                                posZ = wr.ReadSingle();
                                BoogieCore.Log(LogType.NeworkComms, "Position 3 - X: {0} Y: {1} Z: {2} Orient: {3} ", posX, posY, posZ, facing);
                            }

                            if ((splineFlags & 0x00020000) >= 1)
                            {
                                BoogieCore.Log(LogType.NeworkComms, "(splineFlags & 0x00020000)");
                                wr.ReadUInt64();
                            }

                            if ((splineFlags & 0x00040000) >= 1)
                            {
                                BoogieCore.Log(LogType.NeworkComms, "(splineFlags & 0x00040000)");
                                float f;
                                f = wr.ReadSingle();
                            }

                            UInt32 time1, time2, splineCount, unk4;

                            //1.8
                            time1       = wr.ReadUInt32();
                            time2       = wr.ReadUInt32();
                            unk4        = wr.ReadUInt32();
                            splineCount = wr.ReadUInt32();
                            BoogieCore.Log(LogType.NeworkComms, "splineCount = {0}", splineCount);

                            for (UInt32 j = 0; j < splineCount + 1; j++)
                            {
                                posX = wr.ReadSingle();
                                posY = wr.ReadSingle();
                                posZ = wr.ReadSingle();
                                //BoogieCore.Log(LogType.NeworkComms, "Position 4 - X: {0} Y: {1} Z: {2} Orient: {3} ", posX, posY, posZ, facing);
                            }
                        }
                    }

                    if ((flags & 0x8) >= 1)
                    {
                        //BoogieCore.Log(LogType.NeworkComms, "(flags & 8)");
                        wr.ReadUInt32();
                        if ((flags & 0x10) >= 1)
                        {
                            //BoogieCore.Log(LogType.NeworkComms, "(flags & 10)");
                            wr.ReadUInt32();
                        }
                    }
                    else if ((flags & 0x10) >= 1)
                    {
                        //BoogieCore.Log(LogType.NeworkComms, "(flags & 10)");
                        wr.ReadUInt32();
                    }

                    if ((flags & 0x2) >= 1)
                    {
                        //BoogieCore.Log(LogType.NeworkComms, "(flags & 0x2)");
                        wr.ReadUInt32();
                    }

                    UpdateMask UpdateMask = new UpdateMask();

                    byte bc = wr.ReadByte();         // Block Count
                    //BoogieCore.Log(LogType.Error, "Block Count = {0}, Mask = {1}, flags = {2}, flags2 = {3}", bc * 32, mask, flags, flags2);


                    UpdateMask.SetCount((ushort)(bc * 32));
                    UpdateMask.SetMask(wr.ReadBytes(bc * 4), bc);

                    if (UpdateMask.GetCount() > 2500)
                    {
                        int count = UpdateMask.GetCount();
                        BoogieCore.Log(LogType.Error, "Bad mask count = {0} ! aborting parse", count);
                        return;
                    }

                    //BoogieCore.Log(LogType.NeworkComms, "(ObjCreate) FieldCount: {0}", UpdateMask.GetCount());
                    UInt32[] Fields = new UInt32[UpdateMask.GetCount()];

                    for (ushort x = 0; x < UpdateMask.GetCount(); x++)
                    {
                        if (UpdateMask.GetBit(x))
                        {
                            Fields[x] = wr.ReadUInt32();
                        }
                    }



                    if (!BoogieCore.world.objectExists(guid))           // Add new Object
                    {
                        UInt32 entryid = Fields[(int)UpdateFields.OBJECT_FIELD_ENTRY];
                        Object NewObj  = new Object();
                        NewObj.GUID          = guid;
                        NewObj.coord         = new Coordinate(posX, posY, posZ, facing);
                        NewObj.Type          = flags;
                        NewObj.Fields        = Fields;
                        NewObj.walkSpeed     = walkSpeed;
                        NewObj.runSpeed      = runSpeed;
                        NewObj.backWalkSpeed = backWalkSpeed;
                        NewObj.swimSpeed     = swimSpeed;
                        NewObj.backSwimSpeed = backSwimSpeed;
                        NewObj.turnRate      = turnRate;

                        BoogieCore.world.newObject(NewObj, false);
                        //MoveUpdateTimer.Enabled = true;

                        if (objTypeId == 4)
                        {
                            QueryName(guid);
                            BoogieCore.Log(LogType.NeworkComms, "Adding new Player {0}", BitConverter.ToUInt64(guid.GetNewGuid(), 0));
                        }
                        if (objTypeId == 3 || objTypeId == 5)
                        {
                            BoogieCore.Log(LogType.System, "Querying for name of object with an entry of {0} and type of {1}", entryid, objTypeId);
                            if (EntryList.ContainsKey(entryid) == false && EntryQueue.ContainsKey(entryid) == false)
                            {
                                EntryQueue.Add(entryid, true);
                                if (objTypeId == 3)
                                {
                                    WoWWriter wr2 = CreatureQuery(guid, entryid);
                                    Send(wr2.ToArray());
                                    BoogieCore.Log(LogType.NeworkComms, "Adding new Unit {0}", BitConverter.ToUInt64(guid.GetNewGuid(), 0));
                                }
                                if (objTypeId == 5)
                                {
                                    WoWWriter wr2 = GameObjectQuery(guid, entryid);
                                    Send(wr2.ToArray());
                                    BoogieCore.Log(LogType.NeworkComms, "Adding new GameObject {0}", BitConverter.ToUInt64(guid.GetNewGuid(), 0));
                                }
                            }
                        }
                    }
                    else            // Update Existing Object
                    {
                        Object updateObj = BoogieCore.world.getObject(guid);

                        updateObj.coord  = new Coordinate(posX, posY, posZ, facing);
                        updateObj.Type   = flags;
                        updateObj.Fields = Fields;
                        BoogieCore.world.updateObject(updateObj);
                    }
                    break;
                }

                case 4:     // Out Of Range update
                {
                    UInt32 count = wr.ReadUInt32();

                    for (UInt32 j = 0; j < count; j++)
                    {
                        byte mask = wr.ReadByte();

                        guid = new WoWGuid(mask, wr.ReadBytes(WoWGuid.BitCount8(mask)));

                        BoogieCore.world.delObject(guid);
                    }

                    break;
                }
                }
            }
        }
예제 #20
0
        //private void GetTile(float x, float y)
        //{
        //    float X, Y;
        //    X = (x + (32.0f * 533.33333f));
        //    Y = (y + (32.0f * 533.33333f));
        //    int gx = (int)((x + (32.0f * 533.33333f)) / 533.33333f);
        //    int gy = (int)(Y / 533.33333f);
        //}

        private void Handle_ObjDestroy(WoWReader wr)
        {
            WoWGuid guid = new WoWGuid(wr.ReadUInt64());

            BoogieCore.world.delObject(guid);
        }
예제 #21
0
 internal static void Stop()
 {
     WoWReader.Close();
     _threadRunning = false;
     ProcessThread.Abort();
 }
예제 #22
0
 private void Handle_XpGain(WoWReader wr)
 {
     //BoogieCore.Player.xpGain();
     //BoogieCore.AI.xpGain(); ??
 }
예제 #23
0
        private static void ProcessThreadMethod()
        {
            // Process watcher thread
            while (ProcessThread.ThreadState == ThreadState.Running)
            {
                if (GameProcess == null)
                {
                    try
                    {
                        // Acquire a list of all processes
                        var wowProcess =
                            Process.GetProcesses()
                            .FirstOrDefault(
                                process =>
                                WoWProcessNames.Contains(process.ProcessName.ToLower()) &&
                                process.HasExited == false);

                        if (wowProcess != null)
                        {
                            GameProcess = wowProcess;

                            Log.WriteLine($"Found game process: [{GameProcess.Id}: {GameProcess.ProcessName}]");

                            // Attempt to export bindings
                            ConsolePort.BindWriter.WriteBinds();

                            if (Properties.Settings.Default.EnableMemoryReading) // Attach memory reader
                            {
                                WoWReader.Open(wowProcess);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Log.WriteLine($"Exception occurred: {ex.Message}");
                    }
                }

                if (GameProcess != null)
                {
                    // Test process validity
                    if (GameProcess.HasExited)
                    {
                        Log.WriteLine($"Process [{GameProcess.Id}: {GameProcess.ProcessName}] has exited");

                        GameProcess.Dispose();
                        GameProcess = null;
                        continue;
                    }

                    // Attach/detach memory reader as necessary
                    if (Properties.Settings.Default.EnableMemoryReading && !WoWReader.IsAttached)
                    {
                        WoWReader.Open(GameProcess);
                    }

                    if (!Properties.Settings.Default.EnableMemoryReading && WoWReader.IsAttached)
                    {
                        WoWReader.Close();
                    }
                }

                Thread.Sleep(500);
            }
        }
예제 #24
0
 private void Handle_SupercededSpell(WoWReader wr)
 {
     // BoogieCore.Player.Spells.supercededSpell()
 }
예제 #25
0
 private void Handle_LevelUp(WoWReader wr)
 {
     //BoogieCore.Player.levelUp();
 }
예제 #26
0
 private void Handle_LearntSpell(WoWReader wr)
 {
     // BoogieCore.Player.Spells.learntSpell()
 }
예제 #27
0
 private void Handle_MailList(WoWReader wr)
 {
     BoogieCore.Log(LogType.NeworkComms, "WS: Recieved Mail List.. {0} bytes.", wr.Remaining);
     SMSG_Debug(wr);
 }
예제 #28
0
 private void Handle_VendorInventoryList(WoWReader wr)
 {
 }
예제 #29
0
 private void Handle_InitWorldStates(WoWReader wr)
 {
     BoogieCore.Log(LogType.NeworkComms, "WS: Recieved Init World States..");
     SMSG_Debug(wr);
 }
예제 #30
0
 private void Handle_LoginSetTimeSpeed(WoWReader wr)
 {
     BoogieCore.Log(LogType.NeworkComms, "WS: Recieved Login SetTimeSpeed (??)..");
     SMSG_Debug(wr);
 }