Esempio n. 1
0
        public void TestToString()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            var quat = new Vector4(1.1f, 2.0f, 0f, 4.0f);

            Assert.AreEqual("X: 1.1 Y: 2 Z: 0 O: 4", quat.ToString());
        }
Esempio n. 2
0
        public void TestGetHashCode()
        {
            var vect1 = new Vector4(1.1f, 2.0f, 0f, 4.0f);
            var vect15 = new Vector4(1.1f, 2.0f, 0f, 4.0f);
            var vect2 = new Vector4(1.1f, 2.0f, 0.0001f, 4.0f);

            Assert.AreEqual(vect1.GetHashCode(), vect15.GetHashCode());
            Assert.AreNotEqual(vect1.GetHashCode(), vect2.GetHashCode());
        }
Esempio n. 3
0
 public void TestConstructor()
 {
     var vect = new Vector4(1.0f, 2.0f, 3.0f, 4.0f);
     Assert.IsNotNull(vect);
     Assert.AreEqual(1.0f, vect.X);
     Assert.AreEqual(2.0f, vect.Y);
     Assert.AreEqual(3.0f, vect.Z);
     Assert.AreEqual(4.0f, vect.O);
 }
Esempio n. 4
0
        public void TestEquals()
        {
            var vect1 = new Vector4(1.1f, 2.0f, 0f, 4.0f);
            var vect15 = new Vector4(1.1f, 2.0f, 0f, 4.0f);
            var vect2 = new Vector4(1.1f, 2.0f, 3.0f, 4.0f);

            Assert.IsTrue(vect1.Equals(vect15));
            Assert.IsTrue(vect1.Equals(vect1));
            Assert.IsFalse(vect1.Equals(vect2));
        }
Esempio n. 5
0
        public void TestOperators()
        {
            var vect1 = new Vector4(1.1f, 2.0f, 0f, 4.0f);
            var vect15 = new Vector4(1.1f, 2.0f, 0f, 4.0f);
            var vect2 = new Vector4(1.1f, 2.0f, 3.0f, 4.0f);

            Assert.IsTrue(vect1 == vect15);
            #pragma warning disable 1718
            Assert.IsTrue(vect1 == vect1);
            #pragma warning restore 1718
            Assert.IsFalse(vect1 == vect2);
        }
Esempio n. 6
0
        public static void HandleLoginVerifyWorld(Packet packet)
        {
            var pos = new Vector4();

            pos.Z = packet.ReadSingle();
            packet.ReadInt32<MapId>("Map");
            pos.Y = packet.ReadSingle();
            pos.X = packet.ReadSingle();
            pos.O = packet.ReadSingle();

            packet.AddValue("Position", pos);
        }
Esempio n. 7
0
        public static void HandleLoginVerifyWorld(Packet packet)
        {
            var pos = new Vector4();

            pos.X = packet.ReadSingle();
            pos.O = packet.ReadSingle();
            pos.Y = packet.ReadSingle();
            CoreParsers.MovementHandler.CurrentMapId = (uint)packet.ReadInt32<MapId>("Map");
            pos.Z = packet.ReadSingle();

            packet.AddValue("Position", pos);
            packet.AddSniffData(StoreNameType.Map, (int)CoreParsers.MovementHandler.CurrentMapId, "NEW_WORLD");
        }
Esempio n. 8
0
        public void TestOperators()
        {
            var vect1 = new Vector4(1.1f, 2.0f, 0f, 4.0f);
            var vect15 = new Vector4(1.1f, 2.0f, 0f, 4.0f);
            var vect2 = new Vector4(1.1f, 2.0f, 3.0f, 4.0f);

            Assert.IsTrue(vect1 == vect15);
            #pragma warning disable 1718
            // ReSharper disable once EqualExpressionComparison
            Assert.IsTrue(vect1 == vect1);
            #pragma warning restore 1718
            Assert.IsFalse(vect1 == vect2);
        }
Esempio n. 9
0
        public static void ReadPlayerMovementInfo(Packet packet, params MovementStatusElements[] movementStatusElements)
        {
            var guid = new byte[8];
            var transportGUID = new byte[8];

            var pos = new Vector4();
            var transportPos = new Vector4();

            bool hasMovementFlags = false;
            bool hasMovementFlags2 = false;
            bool hasTimestamp = false;
            bool hasOrientation = false;
            bool hasTransportData = false;
            bool hasTransportTime2 = false;
            bool hasTransportTime3 = false;
            bool hasPitch = false;
            bool hasFallData = false;
            bool hasFallDirection = false;
            bool hasSplineElevation = false;
            bool hasUnkTime = false;
            bool hasUnkBitA = false;

            uint count = 0;

            foreach (var movementInfo in movementStatusElements)
            {
                switch (movementInfo)
                {
                    case MovementStatusElements.MSEHasGuidByte0:
                        guid[0] = packet.ReadBit();
                        break;
                    case MovementStatusElements.MSEHasGuidByte1:
                        guid[1] = packet.ReadBit();
                        break;
                    case MovementStatusElements.MSEHasGuidByte2:
                        guid[2] = packet.ReadBit();
                        break;
                    case MovementStatusElements.MSEHasGuidByte3:
                        guid[3] = packet.ReadBit();
                        break;
                    case MovementStatusElements.MSEHasGuidByte4:
                        guid[4] = packet.ReadBit();
                        break;
                    case MovementStatusElements.MSEHasGuidByte5:
                        guid[5] = packet.ReadBit();
                        break;
                    case MovementStatusElements.MSEHasGuidByte6:
                        guid[6] = packet.ReadBit();
                        break;
                    case MovementStatusElements.MSEHasGuidByte7:
                        guid[7] = packet.ReadBit();
                        break;
                    case MovementStatusElements.MSEHasTransportGuidByte0:
                        if (hasTransportData)
                            transportGUID[0] = packet.ReadBit();
                        break;
                    case MovementStatusElements.MSEHasTransportGuidByte1:
                        if (hasTransportData)
                            transportGUID[1] = packet.ReadBit();
                        break;
                    case MovementStatusElements.MSEHasTransportGuidByte2:
                        if (hasTransportData)
                            transportGUID[2] = packet.ReadBit();
                        break;
                    case MovementStatusElements.MSEHasTransportGuidByte3:
                        if (hasTransportData)
                            transportGUID[3] = packet.ReadBit();
                        break;
                    case MovementStatusElements.MSEHasTransportGuidByte4:
                        if (hasTransportData)
                            transportGUID[4] = packet.ReadBit();
                        break;
                    case MovementStatusElements.MSEHasTransportGuidByte5:
                        if (hasTransportData)
                            transportGUID[5] = packet.ReadBit();
                        break;
                    case MovementStatusElements.MSEHasTransportGuidByte6:
                        if (hasTransportData)
                            transportGUID[6] = packet.ReadBit();
                        break;
                    case MovementStatusElements.MSEHasTransportGuidByte7:
                        if (hasTransportData)
                            transportGUID[7] = packet.ReadBit();
                        break;
                    case MovementStatusElements.MSEGuidByte0:
                        packet.ReadXORByte(guid, 0);
                        break;
                    case MovementStatusElements.MSEGuidByte1:
                        packet.ReadXORByte(guid, 1);
                        break;
                    case MovementStatusElements.MSEGuidByte2:
                        packet.ReadXORByte(guid, 2);
                        break;
                    case MovementStatusElements.MSEGuidByte3:
                        packet.ReadXORByte(guid, 3);
                        break;
                    case MovementStatusElements.MSEGuidByte4:
                        packet.ReadXORByte(guid, 4);
                        break;
                    case MovementStatusElements.MSEGuidByte5:
                        packet.ReadXORByte(guid, 5);
                        break;
                    case MovementStatusElements.MSEGuidByte6:
                        packet.ReadXORByte(guid, 6);
                        break;
                    case MovementStatusElements.MSEGuidByte7:
                        packet.ReadXORByte(guid, 7);
                        break;
                    case MovementStatusElements.MSETransportGuidByte0:
                        if (hasTransportData)
                            packet.ReadXORByte(transportGUID, 0);
                        break;
                    case MovementStatusElements.MSETransportGuidByte1:
                        if (hasTransportData)
                            packet.ReadXORByte(transportGUID, 1);
                        break;
                    case MovementStatusElements.MSETransportGuidByte2:
                        if (hasTransportData)
                            packet.ReadXORByte(transportGUID, 2);
                        break;
                    case MovementStatusElements.MSETransportGuidByte3:
                        if (hasTransportData)
                            packet.ReadXORByte(transportGUID, 3);
                        break;
                    case MovementStatusElements.MSETransportGuidByte4:
                        if (hasTransportData)
                            packet.ReadXORByte(transportGUID, 4);
                        break;
                    case MovementStatusElements.MSETransportGuidByte5:
                        if (hasTransportData)
                            packet.ReadXORByte(transportGUID, 5);
                        break;
                    case MovementStatusElements.MSETransportGuidByte6:
                        if (hasTransportData)
                            packet.ReadXORByte(transportGUID, 6);
                        break;
                    case MovementStatusElements.MSETransportGuidByte7:
                        if (hasTransportData)
                            packet.ReadXORByte(transportGUID, 7);
                        break;
                    case MovementStatusElements.MSEHasMovementFlags:
                        hasMovementFlags = !packet.ReadBit();
                        break;
                    case MovementStatusElements.MSEHasMovementFlags2:
                        hasMovementFlags2 = !packet.ReadBit();
                        break;
                    case MovementStatusElements.MSEHasTimestamp:
                        hasTimestamp = !packet.ReadBit();
                        break;
                    case MovementStatusElements.MSEHasOrientation:
                        hasOrientation = !packet.ReadBit();
                        break;
                    case MovementStatusElements.MSEHasTransportData:
                        hasTransportData = packet.ReadBit();
                        break;
                    case MovementStatusElements.MSEHasTransportTime2:
                        if (hasTransportData)
                            hasTransportTime2 = packet.ReadBit();
                        break;
                    case MovementStatusElements.MSEHasTransportTime3:
                        if (hasTransportData)
                            hasTransportTime3 = packet.ReadBit();
                        break;
                    case MovementStatusElements.MSEHasPitch:
                        hasPitch = !packet.ReadBit();
                        break;
                    case MovementStatusElements.MSEHasFallData:
                        hasFallData = packet.ReadBit();
                        break;
                    case MovementStatusElements.MSEHasFallDirection:
                        if (hasFallData)
                            hasFallDirection = packet.ReadBit();
                        break;
                    case MovementStatusElements.MSEHasSplineElevation:
                        hasSplineElevation = !packet.ReadBit();
                        break;
                    case MovementStatusElements.MSEHasSpline:
                        packet.ReadBit("hasSpline");
                        break;
                    case MovementStatusElements.MSECounterCount:
                        count = packet.ReadBits(22);
                        break;
                    case MovementStatusElements.MSECount:
                        packet.ReadInt32("Counter");
                        break;
                    case MovementStatusElements.MSECounter:
                        for (var i = 0; i < count; i++)
                            packet.ReadInt32("Unk Int", i);
                        break;
                    case MovementStatusElements.MSEMovementFlags:
                        if (hasMovementFlags)
                            packet.ReadBitsE<MovementFlag>("Movement Flags", 30);
                        break;
                    case MovementStatusElements.MSEMovementFlags2:
                        if (hasMovementFlags2)
                            packet.ReadBitsE<MovementFlagExtra>("Extra Movement Flags", 13);
                        break;
                    case MovementStatusElements.MSETimestamp:
                        if (hasTimestamp)
                            packet.ReadInt32("Timestamp");
                        break;
                    case MovementStatusElements.MSEPositionX:
                        pos.X = packet.ReadSingle();
                        break;
                    case MovementStatusElements.MSEPositionY:
                        pos.Y = packet.ReadSingle();
                        break;
                    case MovementStatusElements.MSEPositionZ:
                        pos.Z = packet.ReadSingle();
                        break;
                    case MovementStatusElements.MSEOrientation:
                        if (packet.Opcode == CoreOpcode.GetOpcode(Opcode.SMSG_MOVE_TELEPORT, Direction.ServerToClient))
                            pos.O = packet.ReadSingle();
                        else
                        {
                            if (hasOrientation)
                                pos.O = packet.ReadSingle();
                        }
                        break;
                    case MovementStatusElements.MSETransportPositionX:
                        if (hasTransportData)
                            transportPos.X = packet.ReadSingle();
                        break;
                    case MovementStatusElements.MSETransportPositionY:
                        if (hasTransportData)
                            transportPos.Y = packet.ReadSingle();
                        break;
                    case MovementStatusElements.MSETransportPositionZ:
                        if (hasTransportData)
                            transportPos.Z = packet.ReadSingle();
                        break;
                    case MovementStatusElements.MSETransportOrientation:
                        if (hasTransportData)
                            transportPos.O = packet.ReadSingle();
                        break;
                    case MovementStatusElements.MSETransportSeat:
                        if (hasTransportData)
                            packet.ReadByte("Seat");
                        break;
                    case MovementStatusElements.MSETransportTime:
                        if (hasTransportData)
                            packet.ReadInt32("Transport Time");
                        break;
                    case MovementStatusElements.MSETransportTime2:
                        if (hasTransportData && hasTransportTime2)
                            packet.ReadInt32("Transport Time 2");
                        break;
                    case MovementStatusElements.MSETransportTime3:
                        if (hasTransportData && hasTransportTime3)
                            packet.ReadInt32("Transport Time 3");
                        break;
                    case MovementStatusElements.MSEPitch:
                        if (hasPitch)
                            packet.ReadSingle("Pitch");
                        break;
                    case MovementStatusElements.MSEFallTime:
                        if (hasFallData)
                            packet.ReadInt32("Fall time");
                        break;
                    case MovementStatusElements.MSEFallVerticalSpeed:
                        if (hasFallData)
                            packet.ReadSingle("Vertical Speed");
                        break;
                    case MovementStatusElements.MSEFallCosAngle:
                        if (hasFallData && hasFallDirection)
                            packet.ReadSingle("Fall Angle");
                        break;
                    case MovementStatusElements.MSEFallSinAngle:
                        if (hasFallData && hasFallDirection)
                            packet.ReadSingle("Fall Sin");
                        break;
                    case MovementStatusElements.MSEFallHorizontalSpeed:
                        if (hasFallData && hasFallDirection)
                            packet.ReadSingle("Horizontal Speed");
                        break;
                    case MovementStatusElements.MSESplineElevation:
                        if (hasSplineElevation)
                            packet.ReadSingle("Spline elevation");
                        break;
                    case MovementStatusElements.MSEHasUnkTime:
                        hasUnkTime = !packet.ReadBit();
                        break;
                    case MovementStatusElements.MSEUnkTime:
                        if (hasUnkTime)
                            packet.ReadInt32("Unk Time");
                        break;
                    case MovementStatusElements.MSEZeroBit:
                    case MovementStatusElements.MSEOneBit:
                        packet.ReadBit();
                        break;
                    case MovementStatusElements.MSEHasUnkBitA:
                        hasUnkBitA = packet.ReadBit();
                        break;
                    case MovementStatusElements.MSEUnkBitABit:
                        if (hasUnkBitA)
                            packet.ReadBit("UnkBitABit");
                        break;
                    case MovementStatusElements.MSEUnkBitAByte:
                        if (hasUnkBitA)
                            packet.ReadByte("MSEUnkBitAByte");
                        break;
                }
            }

            if (hasTransportData)
            {
                packet.WriteGuid("Transport Guid", transportGUID);
                packet.AddValue("Transport Position", transportPos);
            }

            if (pos.X != 0 && pos.Y != 0 && pos.Z != 0)
                packet.AddValue("Position", pos);

            packet.WriteGuid("Guid", guid);
        }
Esempio n. 10
0
        public static void HandleSubmitComplain(Packet packet)
        {
            var pos = new Vector4();
            var guid = new byte[8];

            guid[5] = packet.ReadBit();
            guid[0] = packet.ReadBit();
            guid[1] = packet.ReadBit();

            var length = packet.ReadBits(12);

            guid[3] = packet.ReadBit();
            guid[2] = packet.ReadBit();
            guid[4] = packet.ReadBit();
            guid[7] = packet.ReadBit();

            packet.ReadBits("Unk bits", 4); // ##

            guid[6] = packet.ReadBit();

            packet.ReadXORByte(guid, 3);
            packet.ReadXORByte(guid, 5);
            packet.ReadXORByte(guid, 1);
            packet.ReadXORByte(guid, 2);
            packet.ReadXORByte(guid, 6);
            packet.ReadXORByte(guid, 0);

            packet.ReadWoWString("Text", length);

            packet.ReadXORByte(guid, 7);
            packet.ReadXORByte(guid, 4);

            pos.Y = packet.ReadSingle();
            pos.Z = packet.ReadSingle();
            pos.X = packet.ReadSingle();
            packet.ReadInt32("Unk Int32 1"); // ##
            pos.O = packet.ReadSingle();

            packet.ReadBit("Unk bit"); // ##

            var count = packet.ReadBits("Count", 22);
            var strLength = new uint[count];
            for (int i = 0; i < count; ++i)
                strLength[i] = packet.ReadBits(13);

            for (int i = 0; i < count; ++i)
            {
                packet.ReadTime("Time", i);
                packet.ReadWoWString("Data", strLength[i], i);
            }

            packet.ReadInt32("Unk Int32 2");  // ##

            packet.WriteGuid("Guid", guid);
            packet.AddValue("Position", pos);
        }
Esempio n. 11
0
        public static void HandleMoveHeartbeat(Packet packet)
        {
            var guid = new byte[8];
            var transportGuid = new byte[8];

            var pos = new Vector4();

            var hasTransportTime2 = false;
            var hasTransportTime3 = false;
            var hasFallDirection = false;

            pos.X = packet.ReadSingle();
            pos.Y = packet.ReadSingle();
            pos.Z = packet.ReadSingle();

            guid[2] = packet.ReadBit();
            guid[6] = packet.ReadBit();
            var hasPitch = !packet.ReadBit();
            var hasFallData = packet.ReadBit();
            var bits98 = (int)packet.ReadBits(22);
            var bit95 = packet.ReadBit();
            guid[1] = packet.ReadBit();
            guid[3] = packet.ReadBit();
            var hasTrans = packet.ReadBit();
            guid[5] = packet.ReadBit();
            guid[7] = packet.ReadBit();
            guid[4] = packet.ReadBit();
            var hasOrientation = !packet.ReadBit();
            var bit94 = packet.ReadBit();
            var bitA8 = !packet.ReadBit();
            var hasTimestamp = !packet.ReadBit();
            guid[0] = packet.ReadBit();
            var bitAC = packet.ReadBit();
            var hasMovementFlagExtra = !packet.ReadBit();
            var bit90 = !packet.ReadBit();
            var hasMovementFlag = !packet.ReadBit();

            if (hasMovementFlagExtra)
                packet.ReadBitsE<MovementFlagExtra>("Extra Movement Flags", 13);

            if (hasTrans)
            {
                transportGuid[3] = packet.ReadBit();
                hasTransportTime3 = packet.ReadBit();
                transportGuid[4] = packet.ReadBit();
                transportGuid[6] = packet.ReadBit();
                transportGuid[7] = packet.ReadBit();
                transportGuid[0] = packet.ReadBit();
                transportGuid[2] = packet.ReadBit();
                hasTransportTime2 = packet.ReadBit();
                transportGuid[1] = packet.ReadBit();
                transportGuid[5] = packet.ReadBit();
            }

            if (hasFallData)
                hasFallDirection = packet.ReadBit();

            if (hasMovementFlag)
                packet.ReadBitsE<MovementFlag>("Movement Flags", 30);

            packet.ReadXORByte(guid, 3);
            packet.ReadXORByte(guid, 5);
            packet.ReadXORByte(guid, 4);
            packet.ReadXORByte(guid, 6);
            packet.ReadXORByte(guid, 1);
            packet.ReadXORByte(guid, 2);
            packet.ReadXORByte(guid, 7);

            for (var i = 0; i < bits98; ++i)
                packet.ReadInt32("IntED", i);

            packet.ReadXORByte(guid, 0);

            if (hasTrans)
            {
                var tpos = new Vector4();

                tpos.Y = packet.ReadSingle();
                tpos.X = packet.ReadSingle();
                packet.ReadByte("Transport Seat");
                packet.ReadXORByte(transportGuid, 7);
                tpos.O = packet.ReadSingle();
                packet.ReadXORByte(transportGuid, 1);
                packet.ReadXORByte(transportGuid, 0);
                packet.ReadXORByte(transportGuid, 2);

                if (hasTransportTime3)
                    packet.ReadUInt32("Transport Time 3");

                packet.ReadXORByte(transportGuid, 3);
                packet.ReadUInt32("Transport Time");

                if (hasTransportTime2)
                    packet.ReadUInt32("Transport Time 2");

                packet.ReadXORByte(transportGuid, 5);
                tpos.Z = packet.ReadSingle();
                packet.ReadXORByte(transportGuid, 4);
                packet.ReadXORByte(transportGuid, 6);

                packet.WriteGuid("Transport Guid", transportGuid);
                packet.AddValue("Transport Position", tpos);
            }

            if (hasFallData)
            {
                packet.ReadUInt32("Fall time");
                packet.ReadSingle("Vertical Speed");

                if (hasFallDirection)
                {
                    packet.ReadSingle("Fall Cos");
                    packet.ReadSingle("Horizontal Speed");
                    packet.ReadSingle("Fall Sin");
                }
            }

            if (bit90)
                packet.ReadSingle("Float90");

            if (hasTimestamp)
                packet.ReadUInt32("Timestamp");

            if (hasOrientation)
                pos.O = packet.ReadSingle();

            if (bitA8)
                packet.ReadInt32("IntA8");

            if (hasPitch)
                packet.ReadSingle("Pitch");

            packet.WriteGuid("Guid2", guid);
            packet.AddValue("Position", pos);
        }
Esempio n. 12
0
        public static void HandleMoveTeleport434(Packet packet)
        {
            var guid = new byte[8];
            var transGuid = new byte[8];
            var pos = new Vector4();

            guid[6] = packet.ReadBit();
            guid[0] = packet.ReadBit();
            guid[3] = packet.ReadBit();
            guid[2] = packet.ReadBit();
            var bit48 = packet.ReadBit();
            if (bit48)
            {
                packet.ReadBit("Unk bit 50");
                packet.ReadBit("Unk bit 51");
            }

            var onTransport = packet.ReadBit("On transport");
            guid[1] = packet.ReadBit();
            if (onTransport)
                transGuid = packet.StartBitStream(1, 3, 2, 5, 0, 7, 6, 4);

            guid[4] = packet.ReadBit();
            guid[7] = packet.ReadBit();
            guid[5] = packet.ReadBit();
            if (onTransport)
            {
                packet.ParseBitStream(transGuid, 5, 6, 1, 7, 0, 2, 4, 3);
                packet.WriteGuid("Transport Guid", transGuid);
            }

            packet.ReadUInt32("Time");
            packet.ReadXORByte(guid, 1);
            packet.ReadXORByte(guid, 2);
            packet.ReadXORByte(guid, 3);
            packet.ReadXORByte(guid, 5);
            pos.X = packet.ReadSingle();
            packet.ReadXORByte(guid, 4);
            pos.O = packet.ReadSingle();
            packet.ReadXORByte(guid, 7);
            pos.Z = packet.ReadSingle();
            if (bit48)
                packet.ReadUInt32("Unk int");

            packet.ReadXORByte(guid, 0);
            packet.ReadXORByte(guid, 6);
            pos.Y = packet.ReadSingle();

            packet.AddValue("Destination", pos);
            packet.WriteGuid("Guid", guid);
        }
Esempio n. 13
0
        public static void HandleMoveUpdateRunSpeed(Packet packet)
        {
            var guid = new byte[8];
            var transportGuid = new byte[8];
            var pos = new Vector4();

            var hasTransportTime3 = false;
            var hasTransportTime2 = false;

            guid[7] = packet.ReadBit();

            var hasPitch = !packet.ReadBit();

            guid[0] = packet.ReadBit();
            var hasFallData = packet.ReadBit();
            packet.StartBitStream(guid, 1, 4, 5);

            var hasMovementFlags = !packet.ReadBit();

            var hasFallDirection = false;
            if (hasFallData)
                hasFallDirection = packet.ReadBit();

            guid[2] = packet.ReadBit();

            packet.ReadBit("Has spline data");

            var hasMovementFlagsExtra = !packet.ReadBit();
            var hasTransport = packet.ReadBit();
            var hasSplineElevation = !packet.ReadBit();
            var bitA8 = !packet.ReadBit();
            var hasTime = !packet.ReadBit();

            if (hasTransport)
            {
                hasTransportTime3 = packet.ReadBit();
                hasTransportTime2 = packet.ReadBit();
                packet.StartBitStream(transportGuid, 4, 5, 3, 2, 7, 0, 1, 6);
            }

            var bit95 = packet.ReadBit();

            if (hasMovementFlagsExtra)
                packet.ReadBitsE<MovementFlagExtra>("Extra Movement Flags", 13);

            if (hasMovementFlags)
                packet.ReadBitsE<MovementFlag>("Movement flags", 30);

            var hasO = !packet.ReadBit();

            guid[3] = packet.ReadBit();

            var counter = packet.ReadBits(22);
            var bit94 = packet.ReadBit();

            guid[6] = packet.ReadBit();
            packet.ReadXORByte(guid, 2);
            packet.ReadXORByte(guid, 4);

            if (hasTransport)
            {
                var tpos = new Vector4();

                packet.ReadXORByte(transportGuid, 7);

                if (hasTransportTime3)
                    packet.ReadUInt32("Transport Time 3");

                tpos.O = packet.ReadSingle();

                packet.ReadXORByte(transportGuid, 1);
                packet.ReadXORByte(transportGuid, 6);
                packet.ReadXORByte(transportGuid, 0);

                if (hasTransportTime2)
                    packet.ReadUInt32("Transport Time 2");

                packet.ReadSByte("Transport Seat");
                tpos.Z = packet.ReadSingle();
                tpos.Y = packet.ReadSingle();

                packet.ReadXORByte(transportGuid, 2);

                tpos.X = packet.ReadSingle();
                packet.ReadUInt32("Transport Time");

                packet.ReadXORByte(transportGuid, 4);
                packet.ReadXORByte(transportGuid, 5);
                packet.ReadXORByte(transportGuid, 3);

                packet.WriteGuid("Transport GUID", transportGuid);
                packet.AddValue("Transport Position", tpos);
            }

            if (hasFallData)
            {
                if (hasFallDirection)
                {
                    packet.ReadSingle("Fall Cos");
                    packet.ReadSingle("Fall Sin");
                    packet.ReadSingle("Horizontal speed");
                }

                packet.ReadSingle("Vertical speed");
                packet.ReadUInt32("Fall time");
            }

            pos.Y = packet.ReadSingle();
            packet.ReadXORByte(guid, 7);

            if (hasTime)
                packet.ReadInt32("Timestamp");

            pos.Z = packet.ReadSingle();
            packet.ReadXORByte(guid, 3);

            for (var i = 0; i < counter; i++)
                packet.ReadInt32("IntEA");

            packet.ReadXORByte(guid, 0);

            if (hasO)
                pos.O = packet.ReadSingle();

            pos.X = packet.ReadSingle();
            packet.ReadXORByte(guid, 1);

            if (hasPitch)
                packet.ReadSingle("Pitch");

            packet.ReadSingle("Speed");
            packet.ReadXORByte(guid, 5);

            if (bitA8)
                packet.ReadInt32("IntA8");

            if (hasSplineElevation)
                packet.ReadSingle("Spline elevation");

            packet.ReadXORByte(guid, 6);

            packet.WriteGuid("Guid", guid);
            packet.AddValue("Position", pos);
        }
Esempio n. 14
0
        public static void HandleUnknown6754(Packet packet)
        {
            var guid1 = new byte[8];
            var guid2 = new byte[8];

            var bit64 = false;
            var bit6C = false;
            var bit90 = false;

            var pos = new Vector4();

            pos.O = packet.ReadSingle();
            pos.X = packet.ReadSingle();
            packet.ReadSingle("Float10");
            pos.X = packet.ReadSingle();
            pos.Z = packet.ReadSingle();

            var hasMovementFlags = !packet.ReadBit();
            guid1[1] = packet.ReadBit();
            var bit70 = packet.ReadBit();
            guid1[0] = packet.ReadBit();
            var bit94 = packet.ReadBit();

            if (hasMovementFlags)
                packet.ReadBitsE<MovementFlag>("Movement flags", 30);

            var bitB4 = packet.ReadBit();
            if (bit70)
            {
                bit6C = packet.ReadBit();
                packet.StartBitStream(guid2, 2, 7);
                bit64 = packet.ReadBit();
                packet.StartBitStream(guid2, 5, 4, 6, 0, 1, 3);
            }

            var bit98 = !packet.ReadBit();
            var bit9C = packet.ReadBit();
            packet.StartBitStream(guid1, 3, 5, 4);
            var bit78 = !packet.ReadBit();
            var bit38 = !packet.ReadBit();
            if (bit94)
                bit90 = packet.ReadBit();
            guid1[6] = packet.ReadBit();
            var bitsA0 = packet.ReadBits(22);
            var bit9D = packet.ReadBit();
            guid1[7] = packet.ReadBit();
            var bitB0 = !packet.ReadBit();
            guid1[2] = packet.ReadBit();
            var hasExtraMovementFlags = !packet.ReadBit();
            var bit28 = !packet.ReadBit();

            if (hasExtraMovementFlags)
                packet.ReadBitsE<MovementFlagExtra>("Extra Movement Flags", 13);

            if (bit70)
            {
                packet.ReadXORByte(guid2, 0);
                packet.ReadXORByte(guid2, 6);
                if (bit64)
                    packet.ReadInt32("Int60");
                packet.ReadXORByte(guid2, 1);
                packet.ReadXORByte(guid2, 4);
                packet.ReadInt32("Int5C");
                packet.ReadSingle("Float54");
                packet.ReadXORByte(guid2, 3);
                packet.ReadSingle("Float50");
                packet.ReadByte("Byte58");
                packet.ReadXORByte(guid2, 7);
                packet.ReadXORByte(guid2, 2);
                if (bit6C)
                    packet.ReadInt32("Int68");
                packet.ReadSingle("Float4C");
                packet.ReadXORByte(guid2, 5);
                packet.ReadSingle("Float48");
                packet.WriteGuid("Guid8", guid2);
            }

            packet.ReadXORByte(guid1, 1);
            packet.ReadXORByte(guid1, 6);
            if (bit38)
                packet.ReadSingle("Float38");
            packet.ReadXORByte(guid1, 0);
            if (bit78)
                packet.ReadSingle("Float78");
            packet.ReadXORByte(guid1, 4);
            packet.ReadXORByte(guid1, 5);
            if (bit98)
                packet.ReadSingle("Float98");
            if (bit94)
            {
                packet.ReadSingle("Float80");
                packet.ReadInt32("Int7C");
                if (bit90)
                {
                    packet.ReadSingle("Float88");
                    packet.ReadSingle("Float84");
                    packet.ReadSingle("Float8C");
                }

            }

            packet.ReadXORByte(guid1, 3);
            if (bit28)
                packet.ReadInt32("Int28");
            packet.ReadXORByte(guid1, 2);

            for (var i = 0; i < bitsA0; ++i)
                packet.ReadInt32("IntEA", i);

            if (bitB0)
                packet.ReadInt32("IntB0");
            packet.ReadXORByte(guid1, 7);

            packet.WriteGuid("Guid3", guid1);
            packet.AddValue("Position", pos);
        }
Esempio n. 15
0
        public static void HandleMoveForceFlightSpeedChangeAck434(Packet packet)
        {
            var guid = new byte[8];
            var transportGuid = new byte[8];
            var hasTransTime2 = false;
            var hasTransTime3 = false;
            var hasFallDirection = false;
            var pos = new Vector4();

            packet.ReadInt32("Unk Int32 1"); // ##
            pos.Z = packet.ReadSingle();
            pos.X = packet.ReadSingle();
            pos.Y = packet.ReadSingle();
            packet.ReadSingle("Speed");
            guid[4] = packet.ReadBit();
            guid[5] = packet.ReadBit();
            packet.ReadBit();
            var hasMovementFlags = !packet.ReadBit();
            var hasSplineElev = !packet.ReadBit("Has Spline Elevation");
            guid[3] = packet.ReadBit();
            var hasMovementFlags2 = !packet.ReadBit();
            guid[7] = packet.ReadBit();
            var hasTrans = packet.ReadBit("Has transport");
            guid[0] = packet.ReadBit();
            var hasFallData = packet.ReadBit("Has fall data");
            var hasTime = !packet.ReadBit("Has timestamp");
            var hasPitch = !packet.ReadBit("Has pitch");
            packet.ReadBit("Has Spline");
            var hasO = !packet.ReadBit();
            guid[6] = packet.ReadBit();
            guid[2] = packet.ReadBit();
            guid[1] = packet.ReadBit();

            if (hasTrans)
            {
                transportGuid[6] = packet.ReadBit();
                transportGuid[1] = packet.ReadBit();
                transportGuid[7] = packet.ReadBit();
                hasTransTime2 = packet.ReadBit();
                transportGuid[0] = packet.ReadBit();
                hasTransTime3 = packet.ReadBit();
                transportGuid[3] = packet.ReadBit();
                transportGuid[2] = packet.ReadBit();
                transportGuid[5] = packet.ReadBit();
                transportGuid[4] = packet.ReadBit();
            }

            if (hasFallData)
                hasFallDirection = packet.ReadBit();

            if (hasMovementFlags2)
                packet.ReadBitsE<MovementFlagExtra>("Extra Movement Flags", 12);

            if (hasMovementFlags)
                packet.ReadBitsE<MovementFlag>("Movement Flags", 30);

            packet.ParseBitStream(guid, 5, 6, 1, 7, 3, 0, 2, 4);

            if (hasTrans)
            {
                var tpos = new Vector4();

                packet.ReadXORByte(transportGuid, 6);
                packet.ReadXORByte(transportGuid, 0);
                packet.ReadSByte("Transport Seat");

                if (hasTransTime2)
                    packet.ReadUInt32("Transport Time 2");

                tpos.O = packet.ReadSingle();
                packet.ReadXORByte(transportGuid, 1);
                packet.ReadXORByte(transportGuid, 5);

                if (hasTransTime3)
                    packet.ReadUInt32("Transport Time 3");

                packet.ReadXORByte(transportGuid, 2);
                tpos.Z = packet.ReadSingle();
                packet.ReadXORByte(transportGuid, 7);
                packet.ReadXORByte(transportGuid, 3);
                packet.ReadXORByte(transportGuid, 4);
                tpos.X = packet.ReadSingle();
                packet.ReadUInt32("Transport Time");
                tpos.Y = packet.ReadSingle();

                packet.WriteGuid("Transport Guid", transportGuid);
                packet.AddValue("Transport Position", tpos);
            }

            if (hasTime)
                packet.ReadUInt32("Timestamp");
            if (hasSplineElev)
                packet.ReadSingle("Spline elevation");

            if (hasFallData)
            {
                if (hasFallDirection)
                {
                    packet.ReadSingle("Fall Cos");
                    packet.ReadSingle("Fall Sin");
                    packet.ReadSingle("Horizontal Speed");
                }

                packet.ReadUInt32("Fall time");
                packet.ReadSingle("Vertical Speed");
            }

            if (hasPitch)
                packet.ReadSingle("Pitch");
            if (hasO)
                pos.O = packet.ReadSingle();

            packet.WriteGuid("Guid", guid);
            packet.AddValue("Position", pos);
        }
Esempio n. 16
0
        public static void HandlePlayerMove434(Packet packet)
        {
            var guid = new byte[8];
            var transportGuid = new byte[8];
            var hasFallDirection = false;
            var pos = new Vector4();

            var hasFallData = packet.ReadBit();
            guid[3] = packet.ReadBit();
            guid[6] = packet.ReadBit();
            var hasMovementFlagsExtra = !packet.ReadBit();
            packet.ReadBit("Has spline data");
            var hasTime = !packet.ReadBit();
            guid[0] = packet.ReadBit();
            guid[1] = packet.ReadBit();
            if (hasMovementFlagsExtra)
                packet.ReadBitsE<MovementFlagExtra>("Extra Movement Flags", 12);

            guid[7] = packet.ReadBit();
            var hasMovementFlags = !packet.ReadBit();
            var hasO = !packet.ReadBit();
            guid[2] = packet.ReadBit();
            var hasSplineElevation = !packet.ReadBit();
            packet.ReadBit();
            guid[4] = packet.ReadBit();
            if (hasFallData)
                hasFallDirection = packet.ReadBit();

            guid[5] = packet.ReadBit();
            var hasTransport = packet.ReadBit();
            if (hasMovementFlags)
                packet.ReadBitsE<MovementFlag>("Movement flags", 30);

            var hasTransportTime3 = false;
            var hasTransportTime2 = false;
            if (hasTransport)
            {
                transportGuid[3] = packet.ReadBit();
                hasTransportTime3 = packet.ReadBit();
                transportGuid[6] = packet.ReadBit();
                transportGuid[1] = packet.ReadBit();
                transportGuid[7] = packet.ReadBit();
                transportGuid[0] = packet.ReadBit();
                transportGuid[4] = packet.ReadBit();
                hasTransportTime2 = packet.ReadBit();
                transportGuid[5] = packet.ReadBit();
                transportGuid[2] = packet.ReadBit();
            }

            var hasPitch = !packet.ReadBit();
            packet.ReadXORByte(guid, 5);
            if (hasFallData)
            {
                if (hasFallDirection)
                {
                    packet.ReadSingle("Horizontal speed");
                    packet.ReadSingle("Fall Cos");
                    packet.ReadSingle("Fall Sin");
                }

                packet.ReadSingle("Vertical speed");
                packet.ReadUInt32("Fall time");
            }

            if (hasSplineElevation)
                packet.ReadSingle("Spline elevation");

            packet.ReadXORByte(guid, 7);
            pos.Y = packet.ReadSingle();
            packet.ReadXORByte(guid, 3);
            if (hasTransport)
            {
                var tpos = new Vector4();
                if (hasTransportTime3)
                    packet.ReadUInt32("Transport Time 3");

                packet.ReadXORByte(transportGuid, 6);
                packet.ReadSByte("Transport Seat");
                packet.ReadXORByte(transportGuid, 5);
                tpos.X = packet.ReadSingle();
                packet.ReadXORByte(transportGuid, 1);
                tpos.O = packet.ReadSingle();
                packet.ReadXORByte(transportGuid, 2);
                if (hasTransportTime2)
                    packet.ReadUInt32("Transport Time 2");

                packet.ReadXORByte(transportGuid, 0);
                tpos.Z = packet.ReadSingle();
                packet.ReadXORByte(transportGuid, 7);
                packet.ReadXORByte(transportGuid, 4);
                packet.ReadXORByte(transportGuid, 3);
                tpos.Y = packet.ReadSingle();
                packet.ReadUInt32("Transport Time");

                packet.WriteGuid("Transport Guid", transportGuid);
                packet.AddValue("Transport Position", tpos);
            }

            packet.ReadXORByte(guid, 4);
            pos.X = packet.ReadSingle();
            packet.ReadXORByte(guid, 6);
            pos.Z = packet.ReadSingle();
            if (hasTime)
                packet.ReadUInt32("Timestamp");

            packet.ReadXORByte(guid, 2);
            if (hasPitch)
                packet.ReadSingle("Pitch");

            packet.ReadXORByte(guid, 0);
            if (hasO)
                pos.O = packet.ReadSingle();

            packet.ReadXORByte(guid, 1);
            packet.WriteGuid("Guid", guid);
            packet.AddValue("Position", pos);
        }
Esempio n. 17
0
        public static void HandleSpellMove(Packet packet)
        {
            if (ClientVersion.AddedInVersion(ClientVersionBuild.V5_1_0_16309))
            {
                HandleSpellMove510(packet);
                return;
            }

            var hasMovement = packet.ReadBool("Has Movement Data");
            if (hasMovement)
            {
                var guid = new byte[8];
                var transportGuid = new byte[8];
                var hasTransTime2 = false;
                var hasTransTime3 = false;
                var hasFallDirection = false;
                var pos = new Vector4();

                pos.Z = packet.ReadSingle();
                pos.Y = packet.ReadSingle();
                pos.X = packet.ReadSingle();

                var bytes = new byte[8];
                var hasFallData = packet.ReadBit("Has fall data");
                var hasTime = !packet.ReadBit("Has timestamp");
                var hasO = !packet.ReadBit("Has O");
                packet.ReadBit("Has Spline");
                packet.ReadBit();
                guid[6] = bytes[4] = packet.ReadBit(); //6
                guid[4] = bytes[5] = packet.ReadBit(); //4
                var hasMovementFlags2 = !packet.ReadBit();
                var bytes2 = new byte[8];
                guid[3] = bytes2[0] = packet.ReadBit(); //3
                guid[5] = bytes2[1] = packet.ReadBit(); //5
                var hasSplineElev = !packet.ReadBit("Has Spline Elevation");
                var hasPitch = !packet.ReadBit("Has Pitch");
                guid[7] = bytes2[6] = packet.ReadBit(); //7
                var hasTrans = packet.ReadBit("Has transport");
                guid[2] = bytes2[5] = packet.ReadBit(); //2
                var hasMovementFlags = !packet.ReadBit();
                guid[1] = packet.ReadBit();
                guid[0] = packet.ReadBit();
                if (hasTrans)
                {
                    transportGuid[6] = packet.ReadBit();//54
                    transportGuid[2] = packet.ReadBit();//50
                    transportGuid[5] = packet.ReadBit();//53
                    hasTransTime2 = packet.ReadBit();
                    transportGuid[7] = packet.ReadBit();//55
                    transportGuid[4] = packet.ReadBit();//52
                    hasTransTime3 = packet.ReadBit();
                    transportGuid[0] = packet.ReadBit();//48
                    transportGuid[1] = packet.ReadBit();//49
                    transportGuid[3] = packet.ReadBit();//51
                }

                if (hasMovementFlags2)
                    packet.ReadBitsE<MovementFlagExtra>("Movement flags extra", 12);

                if (hasMovementFlags)
                    packet.ReadBitsE<MovementFlag>("Movement flags", 30);

                if (hasFallData)
                    hasFallDirection = packet.ReadBit("hasFallDirection");

                packet.ParseBitStream(guid, 1, 4, 7, 3, 0, 2, 5, 6);

                if (hasTrans)
                {
                    var tpos = new Vector4();
                    packet.ReadSByte("Transport Seat");
                    tpos.O = packet.ReadSingle();
                    packet.ReadUInt32("Transport Time");

                    packet.ReadXORByte(transportGuid, 6);
                    packet.ReadXORByte(transportGuid, 5);

                    if (hasTransTime2)
                        packet.ReadUInt32("Transport Time 2");

                    tpos.X = packet.ReadSingle();

                    packet.ReadXORByte(transportGuid, 4);

                    tpos.Z = packet.ReadSingle();

                    packet.ReadXORByte(transportGuid, 2);
                    packet.ReadXORByte(transportGuid, 0);

                    if (hasTransTime3)
                        packet.ReadUInt32("Transport Time 3");

                    packet.ReadXORByte(transportGuid, 1);
                    packet.ReadXORByte(transportGuid, 3);

                    tpos.Y = packet.ReadSingle();

                    packet.ReadXORByte(transportGuid, 7);

                    packet.WriteGuid("Transport Guid", transportGuid);
                    packet.AddValue("Transport Position", tpos);
                }

                if (hasO)
                    pos.O = packet.ReadSingle();

                if (hasSplineElev)
                    packet.ReadSingle("Spline elevation");

                if (hasFallData)
                {
                    packet.ReadUInt32("Fall time");
                    if (hasFallDirection)
                    {
                        packet.ReadSingle("Fall Cos");
                        packet.ReadSingle("Fall Sin");
                        packet.ReadSingle("Horizontal Speed");
                    }
                    packet.ReadSingle("Vertical Speed");
                }

                if (hasTime)
                    packet.ReadUInt32("Timestamp");

                if (hasPitch)
                    packet.ReadSingle("Pitch");

                packet.WriteGuid("Guid", guid);
                packet.AddValue("Position", pos);
            }
        }
Esempio n. 18
0
        public static void HandlePlayerMove(Packet packet)
        {
            var guid = new byte[8];
            var transportGUID = new byte[8];
            var pos = new Vector4();

            var bit95 = packet.ReadBit();
            var hasPitch = !packet.ReadBit();
            guid[4] = packet.ReadBit();
            guid[2] = packet.ReadBit();
            var bitAC = packet.ReadBit();
            var hasFallData = packet.ReadBit();
            guid[7] = packet.ReadBit();
            var counter2 = (int)packet.ReadBits(22);
            guid[5] = packet.ReadBit();
            guid[3] = packet.ReadBit();
            var hasTimeStamp = !packet.ReadBit();
            var hasTransportData = packet.ReadBit();
            var hasTransportTime2 = false;
            var hasTransportTime3 = false;

            if (hasTransportData)
            {
                packet.StartBitStream(transportGUID, 1, 2, 3, 4, 5);
                hasTransportTime3 = packet.ReadBit();
                hasTransportTime2 = packet.ReadBit();
                packet.StartBitStream(transportGUID, 0, 7, 6);
            }

            var hasMovementFlags = !packet.ReadBit();

            if (hasMovementFlags)
                packet.ReadBitsE<MovementFlag>("Movement Flags", 30);

            var hasOrientation = !packet.ReadBit();
            var isAlive = !packet.ReadBit();
            var hasFallDirection = false;
            if (hasFallData)
                hasFallDirection = packet.ReadBit();

            var hasExtraMovementFlags = !packet.ReadBit();
            guid[6] = packet.ReadBit();
            guid[0] = packet.ReadBit();
            guid[1] = packet.ReadBit();
            var bit94 = packet.ReadBit();

            if (hasExtraMovementFlags)
                packet.ReadBitsE<MovementFlagExtra>("Extra Movement Flags", 13);

            var hasSplineElevation = !packet.ReadBit();

            pos.X = packet.ReadSingle();

            if (hasFallData)
            {
                if (hasFallDirection)
                {
                    packet.ReadSingle("Fall Sin");
                    packet.ReadSingle("Horizontal Speed");
                    packet.ReadSingle("Fall Cos");
                }

                packet.ReadInt32("Fall Time");
                packet.ReadSingle("Velocity Speed");
            }

            packet.ReadXORByte(guid, 3);

            if (hasTransportData)
            {
                var transPos = new Vector4();

                packet.ReadXORByte(transportGUID, 2);
                packet.ReadXORByte(transportGUID, 0);
                packet.ReadXORByte(transportGUID, 5);
                packet.ReadByte("Seat");
                packet.ReadXORByte(transportGUID, 4);
                packet.ReadXORByte(transportGUID, 3);
                if (hasTransportTime2)
                    packet.ReadInt32("Transport Time 2");

                packet.ReadXORByte(transportGUID, 6);
                packet.ReadXORByte(transportGUID, 7);
                transPos.X = packet.ReadSingle();
                if (hasTransportTime3)
                    packet.ReadInt32("Transport Time 3");

                packet.ReadInt32("Transport Time");
                transPos.Z = packet.ReadSingle();
                packet.ReadXORByte(transportGUID, 1);
                transPos.Y = packet.ReadSingle();
                transPos.O = packet.ReadSingle();

                packet.WriteGuid("Transport Guid", transportGUID);
                packet.AddValue("Transport Position", transPos);
            }

            packet.ReadXORByte(guid, 2);
            packet.ReadXORByte(guid, 6);

            for (var i = 0; i < counter2; ++i)
                packet.ReadInt32("Int9C", i);

            packet.ReadXORByte(guid, 1);

            if (hasPitch)
                packet.ReadSingle("Pitch");

            pos.Y = packet.ReadSingle();
            pos.Z = packet.ReadSingle();

            packet.ReadXORByte(guid, 4);

            if (isAlive)
                packet.ReadInt32("time(isAlive)");

            if (hasSplineElevation)
                packet.ReadSingle("Spline Elevation");

            if (hasTimeStamp)
                packet.ReadInt32("Timestamp");

            packet.ReadXORByte(guid, 0);
            packet.ReadXORByte(guid, 5);
            packet.ReadXORByte(guid, 7);

            if (hasOrientation)
                pos.O = packet.ReadSingle();

            packet.WriteGuid("Guid", guid);
            packet.AddValue("Position", pos);
        }
Esempio n. 19
0
        public static void HandleMoveSetFacing(Packet packet)
        {
            var guid = new byte[8];
            var transportGuid = new byte[8];

            var pos = new Vector4();

            var bit5C = false;
            var bit64 = false;
            var hasFallDirection = false;

            pos.Y = packet.ReadSingle();
            pos.X = packet.ReadSingle();
            pos.Z = packet.ReadSingle();

            var hasSplineElevation  = !packet.ReadBit();

            guid[6] = packet.ReadBit();
            guid[0] = packet.ReadBit();

            var hasRotation = packet.ReadBit();
            var hasTime = !packet.ReadBit();
            var bit20 = !packet.ReadBit();
            var hasTrans = packet.ReadBit();
            var bits98 = (int)packet.ReadBits(22);
            var hasFallData = packet.ReadBit();

            guid[4] = packet.ReadBit();

            var bitAC = packet.ReadBit();

            guid[3] = packet.ReadBit();

            var hasPitch = !packet.ReadBit();

            guid[1] = packet.ReadBit();

            var bitA8 = !packet.ReadBit();
            var bit94 = packet.ReadBit();

            guid[7] = packet.ReadBit();
            guid[2] = packet.ReadBit();
            guid[5] = packet.ReadBit();

            var hasMovementFlags = !packet.ReadBit();
            var hasMovementFlagsExtra = !packet.ReadBit();

            if (hasTrans)
            {
                transportGuid[3] = packet.ReadBit();
                bit64 = packet.ReadBit();
                transportGuid[2] = packet.ReadBit();
                bit5C = packet.ReadBit();
                transportGuid[5] = packet.ReadBit();
                transportGuid[7] = packet.ReadBit();
                transportGuid[6] = packet.ReadBit();
                transportGuid[1] = packet.ReadBit();
                transportGuid[4] = packet.ReadBit();
                transportGuid[0] = packet.ReadBit();
            }

            if (hasMovementFlagsExtra)
                packet.ReadBitsE<MovementFlagExtra>("Extra Movement Flags", 13);

            if (hasFallData)
                hasFallDirection = packet.ReadBit();

            if (hasMovementFlags)
                packet.ReadBitsE<MovementFlag>("Movement Flags", 30);

            packet.ParseBitStream(guid, 3, 6, 4, 7, 0, 2, 5, 1);

            for (var i = 0; i < bits98; ++i)
                packet.ReadInt32("IntED", i);

            if (hasTrans)
            {
                packet.ReadSingle("Float48");

                packet.ReadXORByte(transportGuid, 2);
                packet.ReadXORByte(transportGuid, 6);
                packet.ReadXORByte(transportGuid, 7);

                if (bit5C)
                    packet.ReadInt32("Int58");

                packet.ReadXORByte(transportGuid, 4);

                packet.ReadInt32("Int54");
                packet.ReadByte("Byte50");

                packet.ReadXORByte(transportGuid, 1);
                packet.ReadXORByte(transportGuid, 5);

                if (bit64)
                    packet.ReadInt32("Int60");

                packet.ReadSingle("Float4C");
                packet.ReadXORByte(transportGuid, 3);
                packet.ReadXORByte(transportGuid, 0);
                packet.ReadSingle("Float44");
                packet.ReadSingle("Float40");

                packet.WriteGuid("Transport Guid", transportGuid);
            }

            if (hasFallData)
            {
                packet.ReadSingle("Vertical Speed");

                if (hasFallDirection)
                {
                    packet.ReadSingle("Fall Cos");
                    packet.ReadSingle("Fall Sin");
                    packet.ReadSingle("Horizontal Speed");
                }

                packet.ReadUInt32("Fall time");
            }

            if (hasRotation)
                pos.O = packet.ReadSingle();

            if (hasTime)
                packet.ReadUInt32("Timestamp");

            if (bitA8)
                packet.ReadInt32("IntA8");

            if (bit20)
                packet.ReadInt32("Int20");

            if (hasSplineElevation)
                packet.ReadSingle("Spline elevation");

            if (hasPitch)
                packet.ReadSingle("Pitch");

            packet.WriteGuid("Guid", guid);
            packet.AddValue("Position", pos);
        }
Esempio n. 20
0
        public static void HandleUnknown2874(Packet packet)
        {
            var guid1 = new byte[8];
            var guid2 = new byte[8];

            var bit5C = false;
            var bit64 = false;
            var bit88 = false;

            var pos = new Vector4();

            pos.Y = packet.ReadSingle();
            pos.X = packet.ReadSingle();
            pos.Z = packet.ReadSingle();

            var bit18 = !packet.ReadBit();
            guid1[1] = packet.ReadBit();
            var hasOrientation = !packet.ReadBit();
            var bit94 = packet.ReadBit();
            packet.StartBitStream(guid1, 4, 3);
            var bit1C = !packet.ReadBit();
            var bit70 = !packet.ReadBit();
            var bit68 = packet.ReadBit();
            var bitAC = packet.ReadBit();
            guid1[7] = packet.ReadBit();
            var bits98 = packet.ReadBits(22);
            guid1[5] = packet.ReadBit();
            var bitA8 = !packet.ReadBit();
            var bit95 = packet.ReadBit();
            packet.StartBitStream(guid1, 6, 2);
            var bit90 = !packet.ReadBit();
            var hasTime = !packet.ReadBit();
            guid1[0] = packet.ReadBit();
            var bit8C = packet.ReadBit();

            var bits18 = 0u;
            if (bit18)
                bits18 = packet.ReadBits(30);

            var bits1C = 0u;
            if (bit1C)
                bits1C = packet.ReadBits(13);

            if (bit68)
            {
                guid2[3] = packet.ReadBit();
                bit5C = packet.ReadBit();
                guid2[1] = packet.ReadBit();
                guid2[0] = packet.ReadBit();
                bit64 = packet.ReadBit();
                guid2[7] = packet.ReadBit();
                guid2[5] = packet.ReadBit();
                guid2[2] = packet.ReadBit();
                guid2[4] = packet.ReadBit();
                guid2[6] = packet.ReadBit();
            }

            if (bit8C)
                bit88 = packet.ReadBit();
            packet.ReadXORByte(guid1, 1);
            packet.ReadXORByte(guid1, 2);
            packet.ReadXORByte(guid1, 6);
            for (var i = 0; i < bits98; ++i)
                packet.ReadInt32("IntED");

            packet.ReadXORByte(guid1, 3);
            packet.ReadXORByte(guid1, 4);
            packet.ReadXORByte(guid1, 7);
            packet.ReadXORByte(guid1, 0);
            packet.ReadXORByte(guid1, 5);
            if (bit68)
            {
                packet.ReadSingle("Float48");
                packet.ReadXORByte(guid2, 2);
                if (bit64)
                    packet.ReadInt32("Int60");
                packet.ReadXORByte(guid2, 6);
                packet.ReadXORByte(guid2, 1);
                if (bit5C)
                    packet.ReadInt32("Int58");
                packet.ReadXORByte(guid2, 5);
                packet.ReadByte("Byte50");
                packet.ReadXORByte(guid2, 3);
                packet.ReadXORByte(guid2, 0);
                packet.ReadSingle("Float44");
                packet.ReadSingle("Float40");
                packet.ReadXORByte(guid2, 4);
                packet.ReadXORByte(guid2, 7);
                packet.ReadSingle("Float4C");
                packet.ReadInt32("Int54");
                packet.WriteGuid("Guid7", guid2);
            }

            if (bitA8)
                packet.ReadInt32("IntA8");
            if (bit8C)
            {
                if (bit88)
                {
                    packet.ReadSingle("Float80");
                    packet.ReadSingle("Float7C");
                    packet.ReadSingle("Float84");
                }

                packet.ReadSingle("Float78");
                packet.ReadInt32("Int74");
            }

            if (bit90)
                packet.ReadSingle("Float90");
            if (hasTime)
                packet.ReadInt32("Time");
            if (bit70)
                packet.ReadSingle("Float70");
            if (hasOrientation)
                pos.O = packet.ReadSingle();

            packet.WriteGuid("Guid", guid1);
            packet.AddValue("Position", pos);
        }
Esempio n. 21
0
        public static void HandleSubmitBug(Packet packet)
        {
            var length = packet.ReadBits(12);
            var pos = new Vector4();

            packet.ReadWoWString("Text", length);
            pos.Y = packet.ReadSingle();
            pos.Z = packet.ReadSingle();
            pos.X = packet.ReadSingle();
            packet.ReadInt32("Map ID");
            pos.O = packet.ReadSingle();
            packet.AddValue("Position", pos);
        }
Esempio n. 22
0
        public static void HandleSpellMove510(Packet packet)
        {
            var hasMovement = packet.ReadBool("Has Movement Data");
            if (hasMovement)
            {
                var guid = new byte[8];
                var transportGuid = new byte[8];
                var hasTransTime2 = false;
                var hasTransTime3 = false;
                var hasFallDirection = false;
                var pos = new Vector4();

                pos.Z = packet.ReadSingle();
                pos.X = packet.ReadSingle();
                pos.Y = packet.ReadSingle();

                guid[7] = packet.ReadBit();
                var hasTrans = packet.ReadBit("Has Transport");
                var hasFallData = packet.ReadBit("Has Fall Data");
                var hasField152 = !packet.ReadBit("Lacks field152");
                var hasMovementFlags = !packet.ReadBit();
                packet.ReadBit();
                guid[0] = packet.ReadBit();
                var hasMovementFlags2 = !packet.ReadBit();
                var hasO = !packet.ReadBit("Lacks Orientation");
                guid[2] = packet.ReadBit();
                var hasTime = !packet.ReadBit("Lacks Timestamp");
                guid[1] = packet.ReadBit();
                packet.ReadBit("Has Spline");
                guid[3] = packet.ReadBit();
                var unkLoopCounter = packet.ReadBits(24);
                guid[5] = packet.ReadBit();
                guid[6] = packet.ReadBit();
                var hasPitch = !packet.ReadBit("Lacks Pitch");
                guid[4] = packet.ReadBit();
                var hasSplineElev = !packet.ReadBit("Lacks Spline Elevation");
                packet.ReadBit();
                if (hasTrans)
                {
                    hasTransTime2 = packet.ReadBit();
                    transportGuid[2] = packet.ReadBit();
                    transportGuid[3] = packet.ReadBit();
                    transportGuid[4] = packet.ReadBit();
                    transportGuid[0] = packet.ReadBit();
                    transportGuid[5] = packet.ReadBit();
                    hasTransTime3 = packet.ReadBit();
                    transportGuid[6] = packet.ReadBit();
                    transportGuid[7] = packet.ReadBit();
                    transportGuid[1] = packet.ReadBit();
                }

                if (hasMovementFlags2)
                    packet.ReadBitsE<MovementFlagExtra>("Extra Movement Flags", 13);

                if (hasFallData)
                    hasFallDirection = packet.ReadBit("Has Fall Direction");

                if (hasMovementFlags)
                    packet.ReadBitsE<MovementFlag>("Movement Flags", 30);

                packet.ReadXORByte(guid, 1);
                packet.ReadXORByte(guid, 2);
                packet.ReadXORByte(guid, 5);
                for (var i = 0; i < unkLoopCounter; i++)
                    packet.ReadUInt32("Unk UInt32", i);

                packet.ReadXORByte(guid, 6);
                packet.ReadXORByte(guid, 7);
                packet.ReadXORByte(guid, 4);
                packet.ReadXORByte(guid, 0);
                packet.ReadXORByte(guid, 3);

                if (hasTrans)
                {
                    var tpos = new Vector4();
                    packet.ReadUInt32("Transport Time");
                    packet.ReadXORByte(transportGuid, 5);
                    packet.ReadSByte("Transport Seat");
                    tpos.O = packet.ReadSingle();
                    packet.ReadXORByte(transportGuid, 7);
                    packet.ReadXORByte(transportGuid, 1);
                    tpos.Z = packet.ReadSingle();
                    tpos.X = packet.ReadSingle();
                    packet.ReadXORByte(transportGuid, 6);
                    tpos.Y = packet.ReadSingle();
                    packet.ReadXORByte(transportGuid, 4);
                    packet.ReadXORByte(transportGuid, 2);

                    if (hasTransTime3)
                        packet.ReadUInt32("Transport Time 3");

                    if (hasTransTime2)
                        packet.ReadUInt32("Transport Time 2");

                    packet.ReadXORByte(transportGuid, 0);
                    packet.ReadXORByte(transportGuid, 3);

                    packet.WriteGuid("Transport Guid", transportGuid);
                    packet.AddValue("Transport Position", tpos);
                }

                if (hasTime)
                    packet.ReadUInt32("Timestamp");

                if (hasO)
                    pos.O = packet.ReadSingle();

                if (hasFallData)
                {
                    packet.ReadUInt32("Fall Time");
                    if (hasFallDirection)
                    {
                        packet.ReadSingle("Fall Sin");
                        packet.ReadSingle("Fall Cos");
                        packet.ReadSingle("Horizontal Speed");
                    }
                    packet.ReadSingle("Vertical Speed");
                }

                if (hasField152)
                    packet.ReadUInt32("Unk field152");

                if (hasPitch)
                    packet.ReadSingle("Pitch");

                if (hasSplineElev)
                    packet.ReadSingle("Spline Elevation");

                packet.WriteGuid("Guid", guid);
                packet.AddValue("Position", pos);
            }
        }
Esempio n. 23
0
        public static void HandleMoveUpdateWalkSpeed434(Packet packet)
        {
            var guid = new byte[8];
            var transportGuid = new byte[8];
            var pos = new Vector4();

            var bit64 = false;
            var bit6C = false;
            var hasFallDirection = false;

            guid[3] = packet.ReadBit();
            guid[5] = packet.ReadBit();
            guid[7] = packet.ReadBit();
            var bit98 = !packet.ReadBit();
            guid[0] = packet.ReadBit();
            var bitsA0 = (int)packet.ReadBits(22);
            var bit9C = packet.ReadBit();
            guid[6] = packet.ReadBit();
            var hasFallData = packet.ReadBit();
            guid[4] = packet.ReadBit();
            var hasTime = !packet.ReadBit();
            var bitB4 = packet.ReadBit();
            var bit78 = !packet.ReadBit();
            var bit9D = packet.ReadBit();
            if (hasFallData)
                hasFallDirection = packet.ReadBit();
            var hasO = !packet.ReadBit();
            var hasMovementFlags = !packet.ReadBit();
            var hasMovementFlagsExtra = !packet.ReadBit();
            guid[2] = packet.ReadBit();
            var hasTransport = packet.ReadBit();
            if (hasTransport)
            {
                transportGuid[1] = packet.ReadBit();
                transportGuid[0] = packet.ReadBit();
                transportGuid[4] = packet.ReadBit();
                transportGuid[3] = packet.ReadBit();
                transportGuid[7] = packet.ReadBit();
                transportGuid[5] = packet.ReadBit();
                transportGuid[2] = packet.ReadBit();
                bit6C = packet.ReadBit();
                transportGuid[6] = packet.ReadBit();
                bit64 = packet.ReadBit();
            }

            if (hasMovementFlags)
                packet.ReadBitsE<MovementFlag>("Movement flags", 30);

            var bitB0 = !packet.ReadBit();

            if (hasMovementFlagsExtra)
                packet.ReadBitsE<MovementFlagExtra>("Extra Movement Flags", 13);

            guid[1] = packet.ReadBit();
            if (hasTransport)
            {
                packet.ReadXORByte(transportGuid, 2);
                packet.ReadSingle("Float48");
                if (bit6C)
                    packet.ReadInt32("Int68");
                packet.ReadXORByte(transportGuid, 0);
                packet.ReadXORByte(transportGuid, 6);
                packet.ReadSingle("Float50");
                packet.ReadSingle("Float4C");
                packet.ReadXORByte(transportGuid, 7);
                packet.ReadXORByte(transportGuid, 5);
                packet.ReadXORByte(transportGuid, 4);
                packet.ReadXORByte(transportGuid, 3);
                packet.ReadByte("Byte58");
                packet.ReadSingle("Float54");
                packet.ReadXORByte(transportGuid, 1);
                if (bit64)
                    packet.ReadInt32("Int60");
                packet.ReadInt32("Int5C");
                packet.WriteGuid("Guid8", transportGuid);
            }

            packet.ReadSingle("Speed");
            if (hasO)
                pos.O = packet.ReadSingle();
            if (hasTime)
                packet.ReadUInt32("Timestamp");
            packet.ReadXORByte(guid, 5);
            pos.X = packet.ReadSingle();
            packet.ReadXORByte(guid, 2);
            if (bit98)
                packet.ReadSingle("Float98");
            packet.ReadXORByte(guid, 0);
            if (hasFallData)
            {
                if (hasFallDirection)
                {
                    packet.ReadSingle("Fall Cos");
                    packet.ReadSingle("Horizontal speed");
                    packet.ReadSingle("Fall Sin");
                }

                packet.ReadSingle("Vertical speed");
                packet.ReadInt32("Fall time");
            }

            packet.ReadXORByte(guid, 6);
            packet.ReadXORByte(guid, 7);
            packet.ReadXORByte(guid, 1);
            if (bit78)
                packet.ReadSingle("Float78");

            for (int i = 0; i < bitsA0; ++i)
                packet.ReadInt32("IntEA", i);

            pos.Z = packet.ReadSingle();
            packet.ReadXORByte(guid, 3);
            if (bitB0)
                packet.ReadInt32("IntB0");
            packet.ReadXORByte(guid, 4);
            pos.Y = packet.ReadSingle();

            packet.WriteGuid("Guid", guid);
            packet.AddValue("Position", pos);
        }