Exemplo n.º 1
0
 public static void HandlePartyCommandResult(Packet packet)
 {
     var nameLength = packet.ReadBits(9);
     packet.ReadBitsE<PartyCommand>("Command", 4);
     packet.ReadBitsE<PartyResult>("Result", 6);
     packet.ReadUInt32("ResultData");
     packet.ReadPackedGuid128("ResultGUID");
     packet.ReadWoWString("Name", nameLength);
 }
Exemplo n.º 2
0
        public static void HandleServerUpdateAccountData(Packet packet)
        {
            var guid = new byte[8];

            packet.ReadBitsE<AccountDataType>("Data Type", 3);

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

            packet.ReadXORBytes(guid, 3, 1, 5);

            var decompCount = packet.ReadInt32();
            var compCount = packet.ReadInt32();

            var pkt = packet.Inflate(compCount, decompCount, false);
            var data = pkt.ReadWoWString(decompCount);
            pkt.ClosePacket(false);

            packet.AddValue("Account Data", data);

            packet.ReadXORBytes(guid, 7, 4, 0, 6, 2);

            packet.ReadTime("Login Time");

            packet.WriteGuid("GUID", guid);
        }
Exemplo n.º 3
0
 public static void HandleTradeStatus(Packet packet)
 {
     packet.ReadBit("Unk Bit");
     var status = packet.ReadBitsE<TradeStatus530>("Status", 5);
     switch (status)
     {
         case TradeStatus530.BeginTrade:
             var guid = packet.StartBitStream(0, 3, 2, 4, 1, 6, 7, 5);
             packet.ParseBitStream(guid, 5, 7, 3, 6, 4, 2, 0, 1);
             packet.WriteGuid("GUID", guid);
             break;
         case TradeStatus530.CloseWindow:
             packet.ReadBit("Unk Bit");
             packet.ReadInt32("Unk Int32");
             packet.ReadInt32("Unk Int32");
             break;
         case TradeStatus530.TradeCurrency:
         case TradeStatus530.CurrencyNotTradable:
             packet.ReadInt32("Unk Int32 1");
             packet.ReadInt32("Unk Int32 2");
             break;
         case TradeStatus530.NotEligible:
         case TradeStatus530.OnlyConjured:
             packet.ReadByte("Unk Byte");
             break;
         case TradeStatus530.OpenWindow:
             packet.ReadInt32("Trade Id");
             break;
     }
 }
Exemplo n.º 4
0
        public static void HandleChannelNotify(Packet packet)
        {
            var type = packet.ReadBitsE<ChatNotificationType>("Type", 6);
            var channelLength = packet.ReadBits(7);
            var senderLength = packet.ReadBits(6);

            packet.ReadPackedGuid128("SenderGuid");
            packet.ReadPackedGuid128("BnetAccountID");

            packet.ReadInt32("SenderVirtualRealm");

            packet.ReadPackedGuid128("TargetGuid");

            packet.ReadInt32("TargetVirtualRealm");
            packet.ReadInt32("ChatChannelID");

            if (type == ChatNotificationType.ModeChange)
            {
                packet.ReadByteE<ChannelMemberFlag>("OldFlags");
                packet.ReadByteE<ChannelMemberFlag>("NewFlags");
            }

            packet.ReadWoWString("Channel", channelLength);
            packet.ReadWoWString("Sender", senderLength);
        }
Exemplo n.º 5
0
        public static void HandleClientUpdateAccountData(Packet packet)
        {
            var decompCount = packet.ReadInt32();
            packet.ReadTime("Login Time");
            var compCount = packet.ReadInt32();

            var pkt = packet.Inflate(compCount, decompCount, false);
            var data = pkt.ReadWoWString(decompCount);

            packet.ReadBitsE<AccountDataType>("Data Type", 3);
            packet.WriteLine("Account Data : {0}", data);
        }
Exemplo n.º 6
0
        public static void HandleServerUpdateAccountData(Packet packet)
        {
            packet.ReadPackedGuid128("Guid");
            packet.ReadTime("Time");

            var decompCount = packet.ReadInt32();
            packet.ResetBitReader();
            packet.ReadBitsE<AccountDataType>("Data Type", 3);
            var compCount = packet.ReadInt32();

            var pkt = packet.Inflate(compCount, decompCount, false);
            var data = pkt.ReadWoWString(decompCount);

            packet.AddValue("Account Data", data);
        }
        public static void HandleSpellNonMeleeDmgLog(Packet packet)
        {
            packet.ReadPackedGuid128("Me");
            packet.ReadPackedGuid128("CasterGUID");
            packet.ReadPackedGuid128("CastID");

            packet.ReadInt32<SpellId>("SpellID");
            packet.ReadInt32("Damage");
            packet.ReadInt32("OverKill");

            packet.ReadByte("SchoolMask");

            packet.ReadInt32("ShieldBlock");
            packet.ReadInt32("Resisted");
            packet.ReadInt32("Absorbed");

            packet.ResetBitReader();

            packet.ReadBit("Periodic");

            packet.ReadBitsE<AttackerStateFlags>("Flags", 7);

            var hasDebugData = packet.ReadBit("HasDebugData");
            var hasLogData = packet.ReadBit("HasLogData");
            var hasSandboxScaling = packet.ReadBit("HasSandboxScaling");

            if (hasDebugData)
            {
                packet.ReadSingle("CritRoll");
                packet.ReadSingle("CritNeeded");
                packet.ReadSingle("HitRoll");
                packet.ReadSingle("HitNeeded");
                packet.ReadSingle("MissChance");
                packet.ReadSingle("DodgeChance");
                packet.ReadSingle("ParryChance");
                packet.ReadSingle("BlockChance");
                packet.ReadSingle("GlanceChance");
                packet.ReadSingle("CrushChance");
            }

            if (hasLogData)
                SpellHandler.ReadSpellCastLogData(packet, "SpellCastLogData");

            if (hasSandboxScaling)
                ReadSandboxScalingData(packet, "SandboxScalingData");
        }
Exemplo n.º 8
0
        public static void HandleSpellNonMeleeDmgLog(Packet packet)
        {
            packet.ReadPackedGuid128("Me");
            packet.ReadPackedGuid128("CasterGUID");

            packet.ReadInt32<SpellId>("SpellID");
            packet.ReadInt32("Damage");
            packet.ReadInt32("OverKill");

            packet.ReadByte("SchoolMask");

            packet.ReadInt32("ShieldBlock");
            packet.ReadInt32("Resisted");
            packet.ReadInt32("Absorbed");

            packet.ResetBitReader();

            packet.ReadBit("Periodic");

            packet.ReadBitsE<AttackerStateFlags>("Flags", 9);

            var bit148 = packet.ReadBit();
            var bit76 = packet.ReadBit("HasLogData");

            if (bit148)
            {
                packet.ReadSingle("CritRoll");
                packet.ReadSingle("CritNeeded");
                packet.ReadSingle("HitRoll");
                packet.ReadSingle("HitNeeded");
                packet.ReadSingle("MissChance");
                packet.ReadSingle("DodgeChance");
                packet.ReadSingle("ParryChance");
                packet.ReadSingle("BlockChance");
                packet.ReadSingle("GlanceChance");
                packet.ReadSingle("CrushChance");
            }

            if (bit76)
                SpellParsers.ReadSpellCastLogData(packet);
        }
Exemplo n.º 9
0
 public static void HandlePetitionTurnInResults(Packet packet)
 {
     packet.ReadBitsE<PetitionResultType>("Result", 4);
 }
Exemplo n.º 10
0
        private static MovementInfo ReadMovementUpdateBlock(Packet packet, WowGuid guid, object index)
        {
            var moveInfo = new MovementInfo();

            var guid1 = new byte[8];
            var transportGuid = new byte[8];
            var goTransportGuid = new byte[8];
            var attackingTargetGuid = new byte[8];
            var guid5 = new byte[8];
            var guid6 = new byte[8];
            var guid7 = new byte[8];

            var hasAnimKit1 = false;
            var hasAnimKit2 = false;
            var hasAnimKit3 = false;
            var hasFullSpline = false;
            var hasSplineStartTime = false;
            var hasSplineVerticalAcceleration = false;
            var hasMovementFlags = false;
            var hasMoveFlagsExtra = false;
            var hasTimestamp = false;
            var hasOrientation = false;
            var hasTransportData = false;
            var hasTransportTime2 = false;
            var hasTransportTime3 = false;
            var hasGOTransportTime2 = false;
            var hasGOTransportTime3 = false;
            var hasPitch = false;
            var hasFallData = false;
            var hasFallDirection = false;
            var hasSplineElevation = false;

            var bit134 = false;
            var bitA8 = false;
            var bit23C = false;
            var bit298 = false;
            var bit230 = false;
            var bit284 = false;
            var bit228 = false;
            var bit258 = false;
            var bit218 = false;
            var bit220 = false;

            var bits168 = 0u;
            var splineCount = 0u;
            var bits138 = 0u;
            var bits98 = 0u;
            var bits25C = 0u;
            var bits26C = 0u;
            var bits288 = 0u;
            var bits418 = 0u;
            var bits2AA = 0u;
            var splineType = SplineType.Stop;

            var bit2A4 = packet.ReadBit(); // 676
            var hasVehicleData = packet.ReadBit("Has Vehicle Data", index); // 488
            var bit414 = packet.ReadBit(); // 1044
            var hasGameObjectRotation = packet.ReadBit("Has GameObject Rotation", index); // 512
            packet.ReadBit(); // fake 0
            var isLiving = packet.ReadBit("Is Living", index); // 368
            var hasSceneObjectData = packet.ReadBit("Has Scene Object Data", index); // 1032
            packet.ReadBit(); // fake 2
            var bit29C = packet.ReadBit(); // 668
            var bit2A8 = packet.ReadBit(); // 680
            var bit2A9 = packet.ReadBit(); // 681
            packet.ReadBit(); // fake 1
            var hasTransportPosition = packet.ReadBit("Has Transport Position", index); // 424
            var bit1DC = packet.ReadBit(); // 476
            var hasAnimKits = packet.ReadBit("Has Anim Kits", index); // 498
            var hasStationaryPosition = packet.ReadBit("Has Stationary Position", index); // 448
            var hasAttackingTarget = packet.ReadBit("Has Attacking Target", index); // 464
            packet.ReadBit(); // fake 3
            var transportFrames = packet.ReadBits("Transport Frames Count", 22, index); // 1068
            var bit32A = packet.ReadBit(); // 810
            var bit428 = packet.ReadBit(); // 1064

            if (bit428)
                bits418 = packet.ReadBits(22);

            if (hasTransportPosition)
            {
                packet.StartBitStream(goTransportGuid, 3, 5, 2, 1, 4);
                hasGOTransportTime3 = packet.ReadBit();
                hasGOTransportTime2 = packet.ReadBit();
                packet.StartBitStream(goTransportGuid, 0, 6, 7);
            }

            if (isLiving)
            {
                hasTransportData = packet.ReadBit("Has Transport Data", index);
                if (hasTransportData)
                {
                    transportGuid[4] = packet.ReadBit();
                    transportGuid[0] = packet.ReadBit();
                    transportGuid[5] = packet.ReadBit();
                    transportGuid[2] = packet.ReadBit();
                    transportGuid[3] = packet.ReadBit();
                    hasTransportTime2 = packet.ReadBit();
                    transportGuid[7] = packet.ReadBit();
                    transportGuid[6] = packet.ReadBit();
                    transportGuid[1] = packet.ReadBit();
                    hasTransportTime3 = packet.ReadBit();
                }

                hasPitch = !packet.ReadBit("Has Pitch", index);
                packet.ReadBit();
                bits168 = packet.ReadBits(19);
                guid1[1] = packet.ReadBit();
                hasMoveFlagsExtra = !packet.ReadBit();
                packet.ReadBit();
                hasSplineElevation = !packet.ReadBit("Has SplineElevation", index);

                if (hasMoveFlagsExtra)
                    moveInfo.FlagsExtra = packet.ReadBitsE<MovementFlagExtra>("Extra Movement Flags", 13, index);

                hasOrientation = !packet.ReadBit();
                hasTimestamp = !packet.ReadBit();
                hasMovementFlags = !packet.ReadBit();
                bitA8 = !packet.ReadBit("bitA8", index);
                guid1[2] = packet.ReadBit();
                guid1[6] = packet.ReadBit();
                hasFallData = packet.ReadBit();
                guid1[5] = packet.ReadBit();
                guid1[4] = packet.ReadBit();
                guid1[0] = packet.ReadBit();

                if (hasMovementFlags)
                    moveInfo.Flags = packet.ReadBitsE<MovementFlag>("Movement Flags", 30, index);
                packet.ReadBit();
                if (hasFallData)
                    hasFallDirection = packet.ReadBit();
                bits98 = packet.ReadBits("bits98", 22, index);

                guid1[7] = packet.ReadBit();
                moveInfo.HasSplineData = packet.ReadBit();
                guid1[3] = packet.ReadBit();

                if (moveInfo.HasSplineData)
                {
                    hasFullSpline = packet.ReadBit();
                    if (hasFullSpline)
                    {
                        hasSplineVerticalAcceleration = packet.ReadBit();
                        packet.ReadBitsE<SplineMode>("Spline Mode", 2, index);
                        splineCount = packet.ReadBits(20);
                        packet.ReadBitsE<SplineFlag434>("Spline flags", 25, index);

                        hasSplineStartTime = packet.ReadBit();
                        bit134 = packet.ReadBit();
                        if (bit134)
                        {
                            bits138 = packet.ReadBits(21);
                            packet.ReadBits(2);
                        }
                    }
                }
            }

            if (bit29C)
            {
                bit230 = packet.ReadBit();
                bit258 = packet.ReadBit();
                packet.ReadBit("bit20E", index);
                packet.ReadBit("bit20F", index);
                bit228 = packet.ReadBit();
                packet.ReadBit("bit20C", index);
                bit218 = packet.ReadBit();
                packet.ReadBit("bit20D", index);
                bit284 = packet.ReadBit();

                if (bit284)
                {
                    bits25C = packet.ReadBits(21);
                    bits26C = packet.ReadBits(21);
                }

                bit298 = packet.ReadBit();

                if (bit298)
                    bits288 = packet.ReadBits(20);

                bit23C = packet.ReadBit();
                packet.ReadBit("bit210", index);
                bit220 = packet.ReadBit();
            }

            if (hasAttackingTarget)
                attackingTargetGuid = packet.StartBitStream(4, 6, 3, 5, 0, 2, 7, 1);

            if (hasAnimKits)
            {
                hasAnimKit1 = !packet.ReadBit();
                hasAnimKit2 = !packet.ReadBit();
                hasAnimKit3 = !packet.ReadBit();
            }

            if (bit32A)
                bits2AA = packet.ReadBits(7);

            packet.ResetBitReader();

            for (var i = 0; i < transportFrames; ++i)
                packet.ReadInt32("Transport frame", index, i);

            if (bit29C)
            {
                if (bit23C)
                {
                    packet.ReadSingle("Float234", index);
                    packet.ReadSingle("Float238", index);
                }

                if (bit284)
                {
                    for (var i = 0; i < bits26C; ++i)
                    {
                        packet.ReadSingle("Float270+0", index, i);
                        packet.ReadSingle("Float270+1", index, i);
                    }

                    packet.ReadSingle("Float27C", index);

                    for (var i = 0; i < bits25C; ++i)
                    {
                        packet.ReadSingle("Float260+0", index, i);
                        packet.ReadSingle("Float260+1", index, i);
                    }

                    packet.ReadSingle("Float280", index);
                }

                if (bit258)
                {
                    packet.ReadSingle("Float244", index);
                    packet.ReadSingle("Float250", index);
                    packet.ReadSingle("Float254", index);
                    packet.ReadSingle("Float248", index);
                    packet.ReadSingle("Float240", index);
                    packet.ReadSingle("Float24C", index);
                }

                packet.ReadInt32("Int208", index);

                if (bit298)
                {
                    for (var i = 0; i < bits288; ++i)
                    {
                        packet.ReadSingle("Float28C+0", index, i);
                        packet.ReadSingle("Float28C+1", index, i);
                        packet.ReadSingle("Float28C+2", index, i);
                    }
                }

                if (bit220)
                    packet.ReadInt32("int21C", index);

                if (bit218)
                    packet.ReadInt32("int214", index);

                if (bit230)
                    packet.ReadInt32("int22C", index);

                if (bit228)
                    packet.ReadInt32("int224", index);
            }

            if (isLiving)
            {
                if (hasFallData)
                {
                    if (hasFallDirection)
                    {
                        packet.ReadSingle("Jump Sin Angle", index);
                        packet.ReadSingle("Jump Cos Angle", index);
                        packet.ReadSingle("Jump XY Speed", index);
                    }

                    packet.ReadSingle("Jump Z Speed", index);
                    packet.ReadUInt32("Jump Fall Time", index);
                }

                if (moveInfo.HasSplineData)
                {
                    if (hasFullSpline)
                    {
                        packet.ReadSingle("Duration Mod Next", index);
                        for (uint i = 0; i < splineCount; i++)
                        {
                            Vector3 v = new Vector3();
                            v.Z = packet.ReadSingle();
                            v.Y = packet.ReadSingle();
                            v.X = packet.ReadSingle();

                            packet.AddValue("Spline", v, index);
                        }

                        var type = packet.ReadByte();
                        switch (type)
                        {
                            case 1:
                                splineType = SplineType.Normal;
                                break;
                            case 2:
                                splineType = SplineType.FacingSpot;
                                break;
                            case 3:
                                splineType = SplineType.FacingTarget;
                                break;
                            case 4:
                                splineType = SplineType.FacingAngle;
                                break;
                        }

                        packet.ReadSingle("Duration Mod", index);

                        //    NYI block here

                        if (splineType == SplineType.FacingSpot)
                            packet.ReadVector3("Facing spot", index);

                        if (hasSplineVerticalAcceleration)
                            packet.ReadSingle("Spline Vertical Acceleration", index);

                        if (splineType == SplineType.FacingAngle)
                            packet.ReadSingle("Facing Angle", index);

                        packet.ReadUInt32("Spline FULL Time", index);
                        if (hasSplineStartTime)
                            packet.ReadUInt32("Spline Start time", index);

                        packet.ReadUInt32("Spline Time", index);
                    }

                    packet.ReadUInt32("Spline ID", index);
                    packet.ReadVector3("Spline Endpoint", index);
                }

                /*for (var i = 0; i < 10; ++i)
                    packet.ReadSingle("unk float");
                if (bits98 > 0)
                    packet.ReadBits((int)bits98);*/
                //for (var i = 0; i < bits98; ++i)
                //    packet.ReadInt32("Int9C", index, i);

                moveInfo.Position.Z = packet.ReadSingle();
                moveInfo.Position.Y = packet.ReadSingle();
                packet.ReadSingle("Fly Speed", index);
                packet.ReadXORByte(guid1, 6);
                packet.ReadSingle("Fly Back Speed", index);

                if (hasTransportData)
                {
                    packet.ReadXORByte(transportGuid, 7);
                    packet.ReadXORByte(transportGuid, 4);

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

                    packet.ReadUInt32("Transport Time", index);

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

                    moveInfo.TransportOffset.O = packet.ReadSingle();
                    moveInfo.TransportOffset.X = packet.ReadSingle();
                    packet.ReadXORByte(transportGuid, 6);
                    packet.ReadXORByte(transportGuid, 3);
                    packet.ReadXORByte(transportGuid, 2);
                    moveInfo.TransportOffset.Z = packet.ReadSingle();
                    moveInfo.TransportOffset.Y = packet.ReadSingle();
                    var seat = packet.ReadSByte("Transport Seat", index);
                    packet.ReadXORByte(transportGuid, 1);
                    packet.ReadXORByte(transportGuid, 0);
                    packet.ReadXORByte(transportGuid, 5);

                    moveInfo.TransportGuid = new WowGuid64(BitConverter.ToUInt64(transportGuid, 0));
                    packet.AddValue("Transport GUID", moveInfo.TransportGuid, index);
                    packet.AddValue("Transport Position", moveInfo.TransportOffset, index);

                    if (moveInfo.TransportGuid.HasEntry() && moveInfo.TransportGuid.GetHighType() == HighGuidType.Vehicle &&
                        guid.HasEntry() && guid.GetHighType() == HighGuidType.Creature)
                    {
                        var vehicleAccessory = new VehicleTemplateAccessory
                        {
                            AccessoryEntry = guid.GetEntry(),
                            SeatId = seat
                        };

                        Storage.VehicleTemplateAccessorys.Add(moveInfo.TransportGuid.GetEntry(), vehicleAccessory, packet.TimeSpan);
                    }
                }

                moveInfo.Position.X = packet.ReadSingle();
                packet.AddValue("Position", moveInfo.Position, index);
                packet.ReadXORByte(guid1, 2);

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

                packet.ReadSingle("Swim Speed", index);
                packet.ReadXORByte(guid1, 1);
                packet.ReadSingle("Run Back Speed", index);
                packet.ReadSingle("Swim Back Speed", index);
                packet.ReadXORByte(guid1, 5);

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

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

                packet.ReadSingle("Turn Speed", index);
                packet.ReadXORByte(guid1, 3);
                moveInfo.RunSpeed = packet.ReadSingle("Run Speed", index) / 7.0f;
                packet.ReadXORByte(guid1, 7);
                moveInfo.WalkSpeed = packet.ReadSingle("Walk Speed", index) / 2.5f;
                packet.ReadSingle("Pitch Speed", index);

                if (hasTimestamp)
                    packet.ReadUInt32("Time?", index);

                packet.ReadXORByte(guid1, 4);
                packet.ReadXORByte(guid1, 0);
                packet.WriteGuid("GUID2", guid1);

                if (hasOrientation)
                    moveInfo.Orientation = packet.ReadSingle("Orientation", index);
            }

            if (hasAttackingTarget)
            {
                packet.ParseBitStream(attackingTargetGuid, 5, 1, 2, 0, 3, 4, 6, 7);
                packet.WriteGuid("Attacking Target GUID", attackingTargetGuid, index);
            }

            if (hasStationaryPosition)
            {
                moveInfo.Orientation = packet.ReadSingle("Stationary Orientation", index);
                moveInfo.Position = packet.ReadVector3("Stationary Position", index);
            }

            if (hasTransportPosition)
            {
                packet.ReadSByte("Transport Seat", index);
                moveInfo.TransportOffset.X = packet.ReadSingle();
                packet.ReadXORBytes(goTransportGuid, 1, 0, 2, 6, 5, 4);

                if (hasGOTransportTime2)
                    packet.ReadUInt32("Transport Time 3", index);

                packet.ReadXORByte(goTransportGuid, 7);
                moveInfo.TransportOffset.O = packet.ReadSingle();
                moveInfo.TransportOffset.Z = packet.ReadSingle();
                moveInfo.TransportOffset.Y = packet.ReadSingle();

                if (hasGOTransportTime3)
                    packet.ReadUInt32("Transport Time 2", index);

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

                moveInfo.TransportGuid = new WowGuid64(BitConverter.ToUInt64(goTransportGuid, 0));
                packet.AddValue("Transport GUID", moveInfo.TransportGuid, index);
                packet.AddValue("Transport Position", moveInfo.TransportOffset, index);
            }

            if (bit1DC)
                packet.ReadInt32("int1D8", index);

            if (bit2A4)
                packet.ReadInt32("int2A0", index);

            if (bit32A)
                packet.ReadBytes("Bytes", (int)bits2AA);

            if (hasGameObjectRotation)
                packet.ReadPackedQuaternion("GameObject Rotation", index);

            if (hasVehicleData)
            {
                moveInfo.VehicleId = packet.ReadUInt32("Vehicle Id", index);
                packet.ReadSingle("Vehicle Orientation", index);
            }

            if (bit414)
                packet.ReadInt32("int410", index);

            if (hasAnimKits)
            {
                if (hasAnimKit1)
                    packet.ReadUInt16("Anim Kit 1", index);
                if (hasAnimKit2)
                    packet.ReadUInt16("Anim Kit 2", index);
                if (hasAnimKit3)
                    packet.ReadUInt16("Anim Kit 3", index);
            }

            if (bit428)
                for (var i = 0; i < bits418; ++i)
                    packet.ReadInt32("Int3F8", index, i);

            if (isLiving && moveInfo.HasSplineData && hasFullSpline && splineType == SplineType.FacingTarget)
            {

                var facingTargetGuid = new byte[8];
                packet.StartBitStream(facingTargetGuid, 6, 7, 3, 0, 5, 1, 4, 2);
                packet.ParseBitStream(facingTargetGuid, 4, 2, 5, 6, 0, 7, 1, 3);
                packet.WriteGuid("Facing Target GUID", facingTargetGuid, index);
            }

            return moveInfo;
        }
Exemplo n.º 11
0
        public static void HandleMoveStop422(Packet packet)
        {
            var info = new MovementInfo();
            var guidBytes = new byte[8];
            var transportGuidBytes = new byte[8];

            guidBytes[2] = packet.ReadBit();
            guidBytes[0] = packet.ReadBit();

            info.HasSplineData = packet.ReadBit("HasSplineData");

            info.Flags = packet.ReadBitsE<MovementFlag>("Movement Flags", 30);

            guidBytes[4] = packet.ReadBit();
            guidBytes[6] = packet.ReadBit();
            guidBytes[3] = packet.ReadBit();
            guidBytes[5] = packet.ReadBit();
            guidBytes[7] = packet.ReadBit();

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

            guidBytes[1] = packet.ReadBit();

            var havePitch = packet.ReadBit("HavePitch");

            var haveFallData = packet.ReadBit("HaveFallData");

            var haveFallDirection = false;
            if (haveFallData)
                haveFallDirection = packet.ReadBit("HaveFallDirection");

            var haveTransportData = packet.ReadBit("HaveTransportData");

            var haveTransportTime2 = false;
            var haveTransportTime3 = false;

            if (haveTransportData)
            {
                transportGuidBytes = packet.StartBitStream(0, 6, 2, 5, 4, 1, 3, 7);
                haveTransportTime2 = packet.ReadBit("HaveTransportTime2");
                haveTransportTime3 = packet.ReadBit("HaveTransportTime3");
            }

            var splineElevation = packet.ReadBit("HaveSplineElevation");

            info.Orientation = packet.ReadSingle("Orientation");

            packet.ReadUInt32("Timestamp");

            info.Position = packet.ReadVector3("Position");

            packet.ReadXORByte(guidBytes, 2);
            packet.ReadXORByte(guidBytes, 3);

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

            if (haveFallData)
            {
                packet.ReadUInt32("Fall Time");
                packet.ReadSingle("Fall Vertical Speed");
                packet.ReadSingle("Fall Horizontal Speed");

                if (haveFallDirection)
                {
                    packet.ReadSingle("Fall Cos Angle");
                    packet.ReadSingle("Fall Sin Angle");
                }
            }

            packet.ReadXORByte(guidBytes, 5);
            packet.ReadXORByte(guidBytes, 7);

            if (haveTransportData)
            {
                packet.ReadByte("Transport Seat");
                packet.ReadSingle("Transport Orientation");
                packet.ReadVector3("Transport Position");

                packet.ReadUInt32("Transport Time");

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

                packet.ParseBitStream(transportGuidBytes, 3, 6);

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

                packet.ParseBitStream(transportGuidBytes, 7, 5, 2, 1, 0, 4);
            }

            packet.ReadXORByte(guidBytes, 1);
            packet.ReadXORByte(guidBytes, 0);

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

            packet.ReadXORByte(guidBytes, 6);
            packet.ReadXORByte(guidBytes, 4);

            packet.WriteGuid("Guid", guidBytes);
            packet.WriteGuid("Transport Guid", transportGuidBytes);
        }
Exemplo n.º 12
0
        private static MovementInfo ReadMovementUpdateBlock510(Packet packet, WowGuid guid, object index)
        {
            var moveInfo = new MovementInfo();

            var bit654 = packet.ReadBit("Has bit654", index);
            packet.ReadBit();
            var hasGameObjectRotation = packet.ReadBit("Has GameObject Rotation", index);
            var hasAttackingTarget = packet.ReadBit("Has Attacking Target", index);
            /*var bit2 = */ packet.ReadBit();
            var bit520 = packet.ReadBit("Has bit520", index);
            var unkLoopCounter = packet.ReadBits(24);
            var transport = packet.ReadBit("Transport", index);
            var hasGameObjectPosition = packet.ReadBit("Has GameObject Position", index);
            /*var bit653 = */ packet.ReadBit();
            var bit784 = packet.ReadBit("Has bit784", index);
            /*var isSelf = */ packet.ReadBit("Self", index);
            /*var bit1 = */ packet.ReadBit();
            var living = packet.ReadBit("Living", index);
            /*var bit3 = */ packet.ReadBit();
            var bit644 = packet.ReadBit("Has bit644", index);
            var hasStationaryPosition = packet.ReadBit("Has Stationary Position", index);
            var hasVehicleData = packet.ReadBit("Has Vehicle Data", index);
            var bits360 = packet.ReadBits(21);
            var hasAnimKits = packet.ReadBit("Has AnimKits", index);
            for (var i = 0; i < bits360; ++i)
                packet.ReadBits(2);

            var guid2 = new byte[8];
            var facingTargetGuid = new byte[8];
            var unkSplineCounter = 0u;
            var attackingTargetGuid = new byte[8];
            var transportGuid = new byte[8];
            var goTransportGuid = new byte[8];
            var hasFallData = false;
            var hasFallDirection = false;
            var hasTimestamp = false;
            var hasOrientation = false;
            var hasPitch = false;
            var hasSplineElevation = false;
            var hasTransportData = false;
            var hasTransportTime2 = false;
            var hasTransportTime3 = false;
            var hasFullSpline = false;
            var hasSplineVerticalAcceleration = false;
            var hasUnkSplineCounter = false;
            var hasSplineStartTime = false;
            var hasGOTransportTime3 = false;
            var hasGOTransportTime2 = false;
            var hasAnimKit1 = false;
            var hasAnimKit2 = false;
            var hasAnimKit3 = false;
            var splineType = SplineType.Stop;
            var unkLoopCounter2 = 0u;
            var splineCount = 0u;

            var field8 = false;
            var bit540 = false;
            var bit552 = false;
            var bit580 = false;
            var bit624 = false;
            var bit147 = 0u;
            var bit151 = 0u;
            var bit158 = 0u;
            var bit198 = 0u;

            if (living)
            {
                guid2[3] = packet.ReadBit();
                hasFallData = packet.ReadBit("Has Fall Data", index);
                hasTimestamp = !packet.ReadBit("Lacks Timestamp", index);
                packet.ReadBit(); // bit172
                guid2[2] = packet.ReadBit();
                packet.ReadBit(); // bit149
                hasPitch = !packet.ReadBit("Lacks Pitch", index);
                var hasMoveFlagsExtra = !packet.ReadBit();
                guid2[4] = packet.ReadBit();
                guid2[5] = packet.ReadBit();
                unkLoopCounter2 = packet.ReadBits(24);
                hasSplineElevation = !packet.ReadBit();
                field8 = !packet.ReadBit();
                packet.ReadBit(); // bit148
                guid2[0] = packet.ReadBit();
                guid2[6] = packet.ReadBit();
                guid2[7] = packet.ReadBit();
                hasTransportData = packet.ReadBit("Has Transport Data", index);
                hasOrientation = !packet.ReadBit();

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

                if (hasMoveFlagsExtra)
                    moveInfo.FlagsExtra = packet.ReadBitsE<MovementFlagExtra>("Extra Movement Flags", 13, index);

                var hasMovementFlags = !packet.ReadBit();
                guid2[1] = packet.ReadBit();
                if (hasFallData)
                    hasFallDirection = packet.ReadBit("Has Fall Direction", index);

                moveInfo.HasSplineData = packet.ReadBit("Has Spline Data", index);
                if (hasMovementFlags)
                    moveInfo.Flags = packet.ReadBitsE<MovementFlag>("Movement Flags", 30, index);

                if (moveInfo.HasSplineData)
                {
                    hasFullSpline = packet.ReadBit("Has extended spline data", index);
                    if (hasFullSpline)
                    {
                        hasSplineStartTime = packet.ReadBit();
                        splineCount = packet.ReadBits("Spline Waypoints", 22, index);
                        /*var splineFlags = */ packet.ReadBitsE<SplineFlag434>("Spline flags", 25, index);
                        var bits57 = packet.ReadBits(2);
                        switch (bits57)
                        {
                            case 1:
                                splineType = SplineType.FacingTarget;
                                break;
                            case 0:
                                splineType = SplineType.FacingAngle;
                                break;
                            case 2:
                                splineType = SplineType.Normal;
                                break;
                            case 3:
                                splineType = SplineType.FacingSpot;
                                break;
                        }

                        if (splineType == SplineType.FacingTarget)
                            facingTargetGuid = packet.StartBitStream(0, 1, 6, 5, 2, 3, 4, 7);

                        hasUnkSplineCounter = packet.ReadBit();
                        if (hasUnkSplineCounter)
                        {
                            unkSplineCounter = packet.ReadBits(23);
                            packet.ReadBits(2);
                        }

                        /*var splineMode = */ packet.ReadBitsE<SplineMode>("Spline Mode", 2, index);
                        hasSplineVerticalAcceleration = packet.ReadBit();
                    }
                }
            }

            if (hasGameObjectPosition)
            {
                hasGOTransportTime3 = packet.ReadBit();
                goTransportGuid[3] = packet.ReadBit();
                goTransportGuid[1] = packet.ReadBit();
                goTransportGuid[4] = packet.ReadBit();
                goTransportGuid[7] = packet.ReadBit();
                goTransportGuid[2] = packet.ReadBit();
                goTransportGuid[5] = packet.ReadBit();
                goTransportGuid[0] = packet.ReadBit();
                goTransportGuid[6] = packet.ReadBit();
                hasGOTransportTime2 = packet.ReadBit();
            }

            if (bit654)
                packet.ReadBits(9);

            if (bit520)
            {
                bit540 = packet.ReadBit("bit540", index);
                packet.ReadBit("bit536", index);
                bit552 = packet.ReadBit("bit552", index);
                packet.ReadBit("bit539", index);
                bit624 = packet.ReadBit("bit624", index);
                bit580 = packet.ReadBit("bit580", index);
                packet.ReadBit("bit537", index);

                if (bit580)
                {
                    bit147 = packet.ReadBits(23);
                    bit151 = packet.ReadBits(23);
                }

                if (bit624)
                    bit158 = packet.ReadBits(22);

                packet.ReadBit("bit538", index);
            }

            if (hasAttackingTarget)
                attackingTargetGuid = packet.StartBitStream(2, 6, 7, 1, 0, 3, 4, 5);

            if (bit784)
                bit198 = packet.ReadBits(24);

            if (hasAnimKits)
            {
                hasAnimKit3 = !packet.ReadBit();
                hasAnimKit1 = !packet.ReadBit();
                hasAnimKit2 = !packet.ReadBit();
            }

            packet.ResetBitReader();

            // Reading data
            for (var i = 0; i < bits360; ++i)
            {
                packet.ReadSingle();
                packet.ReadUInt32();
                packet.ReadSingle();
                packet.ReadUInt32();
                packet.ReadSingle();
                packet.ReadSingle();
            }

            for (var i = 0u; i < unkLoopCounter; ++i)
                packet.ReadUInt32("Unk UInt32", index, (int)i);

            if (living)
            {
                packet.ReadSingle("FlyBack Speed", index);
                if (moveInfo.HasSplineData)
                {
                    if (hasFullSpline)
                    {
                        if (hasUnkSplineCounter)
                        {
                            for (var i = 0; i < unkSplineCounter; ++i)
                            {
                                packet.ReadSingle("Unk Spline Float1", index, i);
                                packet.ReadSingle("Unk Spline Float2", index, i);
                            }
                        }

                        if (splineType == SplineType.FacingTarget)
                        {
                            packet.ParseBitStream(facingTargetGuid, 3, 2, 0, 5, 6, 7, 4, 1);
                            packet.WriteGuid("Facing Target GUID", facingTargetGuid, index);
                        }

                        packet.ReadUInt32("Spline Time", index);
                        packet.ReadUInt32("Spline Full Time", index);

                        if (hasSplineVerticalAcceleration)
                            packet.ReadSingle("Spline Vertical Acceleration", index);

                        packet.ReadSingle("Spline Duration Multiplier Next", index);
                        packet.ReadSingle("Spline Duration Multiplier", index);

                        if (splineType == SplineType.FacingSpot)
                        {
                            var point = new Vector3
                            {
                                X = packet.ReadSingle(),
                                Z = packet.ReadSingle(),
                                Y = packet.ReadSingle()
                            };

                            packet.AddValue("Facing Spot", point, index);
                        }

                        if (hasSplineStartTime)
                            packet.ReadUInt32("Spline Start Time", index);

                        for (var i = 0u; i < splineCount; ++i)
                        {
                            var wp = new Vector3
                            {
                                Y = packet.ReadSingle(),
                                Z = packet.ReadSingle(),
                                X = packet.ReadSingle()
                            };

                            packet.AddValue("Spline Waypoint", wp, index, i);
                        }

                        if (splineType == SplineType.FacingAngle)
                            packet.ReadSingle("Facing Angle", index);
                    }

                    var endPoint = new Vector3
                    {
                        Y = packet.ReadSingle(),
                        X = packet.ReadSingle(),
                        Z = packet.ReadSingle()
                    };

                    packet.ReadUInt32("Spline Id", index);
                    packet.AddValue("Spline Endpoint", endPoint, index);
                }

                packet.ReadSingle("Swim Speed", index);

                if (hasFallData)
                {
                    if (hasFallDirection)
                    {
                        packet.ReadSingle("Jump Velocity", index);
                        packet.ReadSingle("Jump Cos", index);
                        packet.ReadSingle("Jump Sin", index);
                    }

                    packet.ReadSingle("Fall Start Velocity", index);
                    packet.ReadInt32("Time Fallen", index);
                }

                if (hasTransportData)
                {
                    moveInfo.TransportOffset.Z = packet.ReadSingle();
                    packet.ReadXORByte(transportGuid, 4);
                    moveInfo.TransportOffset.X = packet.ReadSingle();
                    if (hasTransportTime3)
                        packet.ReadUInt32("Transport Time 3", index);

                    packet.ReadXORByte(transportGuid, 6);
                    packet.ReadXORByte(transportGuid, 5);
                    packet.ReadXORByte(transportGuid, 1);
                    moveInfo.TransportOffset.O = packet.ReadSingle();
                    moveInfo.TransportOffset.Y = packet.ReadSingle();
                    var seat = packet.ReadSByte("Transport Seat", index);
                    packet.ReadXORByte(transportGuid, 7);
                    if (hasTransportTime2)
                        packet.ReadUInt32("Transport Time 2", index);

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

                    moveInfo.TransportGuid = packet.WriteGuid("Transport GUID", transportGuid, index);
                    packet.AddValue("Transport Position", moveInfo.TransportOffset, index);

                    if (moveInfo.TransportGuid.HasEntry() && moveInfo.TransportGuid.GetHighType() == HighGuidType.Vehicle &&
                        guid.HasEntry() && guid.GetHighType() == HighGuidType.Creature)
                    {
                        VehicleTemplateAccessory vehicleAccessory = new VehicleTemplateAccessory
                        {
                            Entry = moveInfo.TransportGuid.GetEntry(),
                            AccessoryEntry = guid.GetEntry(),
                            SeatId = seat
                        };

                        Storage.VehicleTemplateAccessories.Add(vehicleAccessory, packet.TimeSpan);
                    }
                }

                packet.ReadXORByte(guid2, 1);
                packet.ReadSingle("Turn Speed", index);
                moveInfo.Position.Y = packet.ReadSingle();
                packet.ReadXORByte(guid2, 3);
                moveInfo.Position.Z = packet.ReadSingle();
                if (hasOrientation)
                    moveInfo.Orientation = packet.ReadSingle();

                packet.ReadSingle("Run Back Speed", index);
                if (hasSplineElevation)
                    packet.ReadSingle("Spline Elevation", index);

                packet.ReadXORByte(guid2, 0);
                packet.ReadXORByte(guid2, 6);
                for (var i = 0u; i < unkLoopCounter2; ++i)
                    packet.ReadUInt32("Unk2 UInt32", index, (int)i);

                moveInfo.Position.X = packet.ReadSingle();
                if (hasTimestamp)
                    packet.ReadUInt32("Time", index);

                moveInfo.WalkSpeed = packet.ReadSingle("Walk Speed", index) / 2.5f;
                if (hasPitch)
                    packet.ReadSingle("Pitch", index);

                packet.ReadXORByte(guid2, 5);
                if (field8)
                    packet.ReadUInt32("Unk UInt32", index);

                packet.ReadSingle("Pitch Speed", index);
                packet.ReadXORByte(guid2, 2);
                moveInfo.RunSpeed = packet.ReadSingle("Run Speed", index) / 7.0f;
                packet.ReadXORByte(guid2, 7);
                packet.ReadSingle("SwimBack Speed", index);
                packet.ReadXORByte(guid2, 4);
                packet.ReadSingle("Fly Speed", index);

                packet.WriteGuid("GUID 2", guid2, index);
                packet.AddValue("Position", moveInfo.Position, index);
                packet.AddValue("Orientation", moveInfo.Orientation, index);
            }

            if (bit520)
            {
                if (bit580)
                {
                    packet.ReadSingle("field154", index);
                    packet.ReadSingle("field155", index);

                    for (var i = 0; i < bit147; ++i)
                    {
                        packet.ReadSingle();
                        packet.ReadSingle();
                    }

                    for (var i = 0; i < bit151; ++i)
                    {
                        packet.ReadSingle();
                        packet.ReadSingle();
                    }
                }

                if (bit540)
                {
                    packet.ReadSingle("field136", index);
                    packet.ReadSingle("field134", index);
                }

                if (bit552)
                {
                    packet.ReadSingle("field143", index);
                    packet.ReadSingle("field141", index);
                    packet.ReadSingle("field142", index);
                    packet.ReadSingle("field140", index);
                    packet.ReadSingle("field139", index);
                    packet.ReadSingle("field144", index);
                }

                packet.ReadSingle("field132", index);
                if (bit624)
                {
                    for (var i = 0; i < bit158; ++i)
                    {
                        packet.ReadSingle();
                        packet.ReadSingle();
                        packet.ReadSingle();
                    }
                }

                packet.ReadSingle("field133", index);
                packet.ReadSingle("field131", index);
            }

            if (hasAttackingTarget)
            {
                packet.ParseBitStream(attackingTargetGuid, 3, 4, 2, 5, 1, 6, 7, 0);
                packet.WriteGuid("Attacking Target GUID", attackingTargetGuid, index);
            }

            if (hasStationaryPosition)
            {
                moveInfo.Position.X = packet.ReadSingle();
                moveInfo.Orientation = packet.ReadSingle("Stationary Orientation", index);
                moveInfo.Position.Y = packet.ReadSingle();
                moveInfo.Position.Z = packet.ReadSingle();
                packet.AddValue("Stationary Position", moveInfo.Position,index );
            }

            if (hasGameObjectPosition)
            {
                packet.ReadXORByte(goTransportGuid, 3);
                packet.ReadXORByte(goTransportGuid, 1);
                packet.ReadSByte("GO Transport Seat", index);
                moveInfo.TransportOffset.Z = packet.ReadSingle();
                packet.ReadXORByte(goTransportGuid, 2);
                packet.ReadXORByte(goTransportGuid, 7);
                if (hasGOTransportTime3)
                    packet.ReadUInt32("GO Transport Time 3", index);

                packet.ReadXORByte(goTransportGuid, 6);
                if (hasGOTransportTime2)
                    packet.ReadUInt32("GO Transport Time 2", index);

                packet.ReadUInt32("GO Transport Time", index);
                moveInfo.TransportOffset.Y = packet.ReadSingle();
                moveInfo.TransportOffset.X = packet.ReadSingle();
                packet.ReadXORByte(goTransportGuid, 0);
                packet.ReadXORByte(goTransportGuid, 4);
                packet.ReadXORByte(goTransportGuid, 5);
                moveInfo.TransportOffset.O = packet.ReadSingle();

                moveInfo.TransportGuid = new WowGuid64(BitConverter.ToUInt64(goTransportGuid, 0));
                packet.AddValue("GO Transport GUID", moveInfo.TransportGuid, index);
                packet.AddValue("GO Transport Position", moveInfo.TransportOffset, index);
            }

            if (hasAnimKits)
            {
                if (hasAnimKit3)
                    packet.ReadUInt16("Anim Kit 3", index);
                if (hasAnimKit1)
                    packet.ReadUInt16("Anim Kit 1", index);
                if (hasAnimKit2)
                    packet.ReadUInt16("Anim Kit 2", index);
            }

            if (hasVehicleData)
            {
                packet.ReadSingle("Vehicle Orientation", index);
                moveInfo.VehicleId = packet.ReadUInt32("Vehicle Id", index);
            }

            if (transport)
                packet.ReadUInt32("Transport Path Timer", index);

            if (bit644)
                packet.ReadUInt32("field162", index);

            if (bit784)
            {
                for (var i = 0; i < bit198; ++i)
                    packet.ReadUInt32();
            }

            if (hasGameObjectRotation)
                moveInfo.Rotation = packet.ReadPackedQuaternion("GameObject Rotation", index);

            return moveInfo;
        }
Exemplo n.º 13
0
        public static void ReadSpellTargetData(Packet packet, params object[] idx)
        {
            packet.ResetBitReader();

            packet.ReadBitsE<TargetFlag>("Flags", ClientVersion.AddedInVersion(ClientVersionBuild.V6_1_0_19678) ? 23 : 21, idx);
            var hasSrcLoc = packet.ReadBit("HasSrcLocation", idx);
            var hasDstLoc = packet.ReadBit("HasDstLocation", idx);
            var hasOrient = packet.ReadBit("HasOrientation", idx);
            var nameLength = packet.ReadBits(7);

            packet.ReadPackedGuid128("Unit", idx);
            packet.ReadPackedGuid128("Item", idx);

            if (hasSrcLoc)
                ReadLocation(packet, "SrcLocation");

            if (hasDstLoc)
                ReadLocation(packet, "DstLocation");

            if (hasOrient)
                packet.ReadSingle("Orientation", idx);

            packet.ReadWoWString("Name", nameLength, idx);
        }
Exemplo n.º 14
0
 public static void HandleTransferAborted(Packet packet)
 {
     packet.ReadInt32<MapId>("MapID");
     packet.ReadByte("Arg");
     packet.ReadBitsE<TransferAbortReason>("TransfertAbort", 5);
 }
Exemplo n.º 15
0
 public static void HandleRequestAccountData(Packet packet)
 {
     packet.ReadBitsE<AccountDataType>("Data Type", 3);
 }
Exemplo n.º 16
0
        private static MovementInfo ReadMovementUpdateBlock(Packet packet, WowGuid guid, object index)
        {
            var moveInfo = new MovementInfo();

            var guid1 = new byte[8];
            var transportGuid = new byte[8];
            var goTransportGuid = new byte[8];
            var attackingTargetGuid = new byte[8];

            var hasAnimKit1 = false;
            var hasAnimKit2 = false;
            var hasAnimKit3 = false;
            var hasFullSpline = false;
            var hasSplineStartTime = false;
            var hasSplineVerticalAcceleration = false;
            var hasGOTransportTime2 = false;
            var hasGOTransportTime3 = false;
            var hasSplineElevation = false;
            var hasMovementFlags = false;
            var hasMoveFlagsExtra = false;
            var hasTimestamp = false;
            var hasOrientation = false;
            var hasTransportData = false;
            var hasTransportTime3 = false;
            var hasTransportTime2 = false;
            var hasPitch = false;
            var hasFallData = false;
            var hasFallDirection = false;

            var bit130 = false;
            var bitA0 = false;
            var bit23C = false;
            var bit298 = false;
            var bit230 = false;
            var bit284 = false;
            var bit228 = false;
            var bit258 = false;
            var bit218 = false;
            var bit220 = false;

            var bits160 = 0u;
            var splineCount = 0u;
            var bits11C = 0u;
            var bits90 = 0u;
            var bits25C = 0u;
            var bits26C = 0u;
            var bits288 = 0u;
            var bits418 = 0u;
            var bits2AA = 0u;
            SplineType splineType = SplineType.Stop;

            var bit2A9 = packet.ReadBit();
            var bit29C = packet.ReadBit();
            packet.ReadBit(); // fake 1
            var bit1DC = packet.ReadBit();
            var bit2A4 = packet.ReadBit();
            var bit2A8 = packet.ReadBit();
            packet.ReadBit(); // fake 0
            var hasAttackingTarget = packet.ReadBit("Has Attacking Target", index);
            var transportFrames = packet.ReadBits("Transport Frames Count", 22, index);
            var bit414 = packet.ReadBit();
            packet.ReadBit(); // fake 3
            var bit428 = packet.ReadBit();
            var bit32A = packet.ReadBit();
            var hasStationaryPosition = packet.ReadBit("Has Stationary Position", index);
            packet.ReadBit(); // fake 2
            var isLiving = packet.ReadBit("Is Living", index);
            var hasAnimKits = packet.ReadBit("Has Anim Kits", index);
            var hasVehicleData = packet.ReadBit("Has Vehicle Data", index);
            var hasGameObjectPosition = packet.ReadBit("Has GameObject Position", index);
            var hasSceneObjectData = packet.ReadBit("Has Scene Object Data", index);
            var hasGameObjectRotation = packet.ReadBit("Has GameObject Rotation", index);

            if (bit29C)
            {
                bit284 = packet.ReadBit();
                if (bit284)
                {
                    bits25C = packet.ReadBits(21);
                    bits26C = packet.ReadBits(21);
                }

                packet.ReadBit("bit20C", index);
                packet.ReadBit("bit210", index);
                bit23C = packet.ReadBit();
                bit298 = packet.ReadBit();
                packet.ReadBit("bit20F", index);
                packet.ReadBit("bit20E", index);
                bit218 = packet.ReadBit();
                bit220 = packet.ReadBit();
                if (bit298)
                    bits288 = packet.ReadBits(20);

                bit228 = packet.ReadBit();
                packet.ReadBit("bit20D", index);
                bit230 = packet.ReadBit();
                bit258 = packet.ReadBit();
            }

            if (bit428)
                bits418 = packet.ReadBits(22);

            if (isLiving)
            {
                guid1[4] = packet.ReadBit();
                guid1[1] = packet.ReadBit();
                bits160 = packet.ReadBits(19);
                for (var i = 0; i < bits160; ++i)
                    packet.ReadBits("bits164", 2, index, i);

                guid1[5] = packet.ReadBit();
                hasOrientation = !packet.ReadBit();
                guid1[7] = packet.ReadBit();
                bits90 = packet.ReadBits(22);
                moveInfo.HasSplineData = packet.ReadBit();
                hasSplineElevation = !packet.ReadBit();
                if (moveInfo.HasSplineData)
                {
                    hasFullSpline = packet.ReadBit();
                    if (hasFullSpline)
                    {
                        bit130 = packet.ReadBit();
                        hasSplineVerticalAcceleration = packet.ReadBit("has Spline Vertical Acceleration", index);
                        packet.ReadBitsE<SplineMode>("Spline Mode", 2, index);
                        if (bit130)
                        {
                            bits11C = packet.ReadBits(21);
                            packet.ReadBits("bits12C", 2, index);
                        }
                        packet.ReadBitsE<SplineFlag434>("Spline flags", 25, index);
                        hasSplineStartTime = packet.ReadBit("Has Spline Start Time", index);
                        splineCount = packet.ReadBits("SplineWaypointsCount", 20, index);
                    }
                }

                bitA0 = !packet.ReadBit();
                guid1[3] = packet.ReadBit();
                packet.ReadBit("bitA4", index);
                hasMovementFlags = !packet.ReadBit();
                if (hasMovementFlags)
                    moveInfo.Flags = packet.ReadBitsE<MovementFlag>("Movement Flags", 30, index);

                packet.ReadBit("bit8C", index);
                packet.ReadBit("bit8D", index);
                guid1[2] = packet.ReadBit();
                hasTimestamp = !packet.ReadBit();
                guid1[0] = packet.ReadBit();
                hasTransportData = packet.ReadBit();
                if (hasTransportData)
                {
                    packet.StartBitStream(transportGuid, 4, 7, 3, 1, 6);
                    hasTransportTime2 = packet.ReadBit();
                    packet.StartBitStream(transportGuid, 2, 0, 5);
                    hasTransportTime3 = packet.ReadBit();
                }

                guid1[6] = packet.ReadBit();
                hasFallData = packet.ReadBit();
                if (hasFallData)
                    hasFallDirection = packet.ReadBit();

                hasMoveFlagsExtra = !packet.ReadBit();
                hasPitch = !packet.ReadBit();
                if (hasMoveFlagsExtra)
                    moveInfo.FlagsExtra = packet.ReadBitsE<MovementFlagExtra>("Extra Movement Flags", 13, index);
            }

            if (hasGameObjectPosition)
            {
                packet.StartBitStream(goTransportGuid, 0, 7);
                hasGOTransportTime3 = packet.ReadBit();
                goTransportGuid[1] = packet.ReadBit();
                hasGOTransportTime2 = packet.ReadBit();
                packet.StartBitStream(goTransportGuid, 6, 5, 4, 3, 2);
            }

            if (bit32A)
                bits2AA = packet.ReadBits(7);

            if (hasAttackingTarget)
                packet.StartBitStream(attackingTargetGuid, 5, 4, 6, 0, 1, 7, 2, 3);

            // Sceneobject data
            var CreatorGUID = new byte[8];
            byte[][] guid358 = null;
            byte[][][] guid358_6 = null;
            uint[] bits358_10 = null;
            uint[][] bits358_6_84 = null;
            uint[][] bits358_6_94 = null;
            uint[][] bits358_6_31 = null;
            uint[][] bits358_6_74 = null;
            byte[][][] bit358_6_78_9 = null;
            byte[][][] bit358_6_88_10 = null;
            bool[][][] bit358_6_88_C = null;
            bool[][][] bit358_6_88_8 = null;
            bool[][] bit358_6_2E = null;
            bool[][] bit358_6_30 = null;
            bool[] bit358_20 = null;
            bool[] bit358_C = null;
            bool[] bit358_24 = null;

            var bit338 = false;
            var bit330 = false;
            var bit341 = false;
            var bit340 = false;
            var bit332 = false;
            var bit33C = false;

            uint[] bits388 = null;
            uint[] bits388_10 = null;
            byte[][] bit388_1_10 = null;
            bool[][] bit388_1_C = null;
            bool[][] bit388_1_8 = null;

            if (hasSceneObjectData)
            {
                guid358 = new byte[2][];
                guid358_6 = new byte[2][][];
                bits358_10 = new uint[2];
                bits358_6_84 = new uint[2][];
                bits358_6_94 = new uint[2][];
                bits358_6_31 = new uint[2][];
                bits358_6_74 = new uint[2][];
                bit358_6_78_9 = new byte[2][][];
                bit358_6_88_10 = new byte[2][][];
                bit358_6_88_C = new bool[2][][];
                bit358_6_88_8 = new bool[2][][];
                bit358_6_2E = new bool[2][];
                bit358_6_30 = new bool[2][];
                bit358_20 = new bool[2];
                bit358_C = new bool[2];
                bit358_24 = new bool[2];

                for (var i = 0; i < 2; ++i)
                {
                    guid358[i] = new byte[8];
                    packet.StartBitStream(guid358[i], 3, 4, 1, 0);
                    bits358_10[i] = packet.ReadBits(2);
                    bit358_20[i] = !packet.ReadBit();

                    guid358_6[i] = new byte[bits358_10[i]][];
                    bits358_6_84[i] = new uint[bits358_10[i]];
                    bits358_6_94[i] = new uint[bits358_10[i]];
                    bits358_6_31[i] = new uint[bits358_10[i]];
                    bits358_6_74[i] = new uint[bits358_10[i]];
                    bit358_6_78_9[i] = new byte[bits358_10[i]][];
                    bit358_6_88_10[i] = new byte[bits358_10[i]][];
                    bit358_6_88_C[i] = new bool[bits358_10[i]][];
                    bit358_6_88_8[i] = new bool[bits358_10[i]][];
                    bit358_6_2E[i] = new bool[bits358_10[i]];
                    bit358_6_30[i] = new bool[bits358_10[i]];

                    for (var j = 0; j < bits358_10[i]; ++j)
                    {
                        guid358_6[i][j] = new byte[8];
                        bits358_6_84[i][j] = packet.ReadBits(21);

                        bit358_6_88_8[i][j] = new bool[bits358_6_84[i][j]];
                        bit358_6_88_C[i][j] = new bool[bits358_6_84[i][j]];
                        bit358_6_88_10[i][j] = new byte[bits358_6_84[i][j]];
                        for (var k = 0; k < bits358_6_84[i][j]; ++k)
                        {
                            bit358_6_88_10[i][j][k] = (byte)(10 - packet.ReadBit());
                            bit358_6_88_C[i][j][k] = !packet.ReadBit();
                            bit358_6_88_8[i][j][k] = !packet.ReadBit();
                        }

                        packet.StartBitStream(guid358_6[i][j], 5, 3, 4, 1, 0, 6, 7);
                        bits358_6_31[i][j] = packet.ReadBits(7);
                        guid358_6[i][j][2] = packet.ReadBit();
                        bit358_6_2E[i][j] = !packet.ReadBit();
                        bits358_6_74[i][j] = packet.ReadBits(20);

                        bit358_6_78_9[i][j] = new byte[bits358_6_74[i][j]];
                        for (var k = 0; k < bits358_6_74[i][j]; ++k)
                            bit358_6_78_9[i][j][k] = (byte)(10 - packet.ReadBit());

                        bit358_6_30[i][j] = packet.ReadBit();
                        bits358_6_94[i][j] = packet.ReadBits(21);
                    }

                    guid358[i][6] = packet.ReadBit();
                    bit358_C[i] = !packet.ReadBit();
                    packet.StartBitStream(guid358[i], 2, 5);
                    bit358_24[i] = !packet.ReadBit();
                    guid358[i][7] = packet.ReadBit();
                }

                bit330 = !packet.ReadBit();
                bit340 = !packet.ReadBit();

                bits388 = new uint[3];
                bits388_10 = new uint[3];
                bit388_1_10 = new byte[3][];
                bit388_1_C = new bool[3][];
                bit388_1_8 = new bool[3][];

                for (var i = 0; i < 3; ++i)
                {
                    bits388_10[i] = packet.ReadBits(21);
                    bits388[i] = packet.ReadBits(21);
                    bit388_1_10[i] = new byte[bits388[i]];
                    bit388_1_C[i] = new bool[bits388[i]];
                    bit388_1_8[i] = new bool[bits388[i]];

                    for (var j = 0; j < bits388[i]; ++j)
                    {
                        bit388_1_8[i][j] = !packet.ReadBit();
                        bit388_1_10[i][j] = (byte)(10 - packet.ReadBit());
                        bit388_1_C[i][j] = !packet.ReadBit();
                    }
                }

                bit33C = !packet.ReadBit();
                bit341 = !packet.ReadBit();
                bit338 = !packet.ReadBit();
                bit332 = !packet.ReadBit();
                packet.ReadBit(); // fake bit
                packet.ReadBit("bit351", index);
                packet.ReadBit("bit350", index);
                packet.StartBitStream(CreatorGUID, 2, 7, 0, 5, 1, 3, 6, 4);
            }

            if (hasAnimKits)
            {
                hasAnimKit3 = !packet.ReadBit();
                hasAnimKit1 = !packet.ReadBit();
                hasAnimKit2 = !packet.ReadBit();
            }

            packet.ResetBitReader();

            for (var i = 0; i < transportFrames; ++i)
                packet.ReadInt32("Transport frame", index, i);

            if (hasSceneObjectData)
            {
                for (var i = 0; i < 2; ++i)
                {
                    for (var j = 0; j < bits358_10[i]; ++j)
                    {
                        for (var k = 0; k < bits358_6_74[i][j]; ++k)
                        {
                            packet.ReadInt32("int358+6+78+0", index, i, j, k);
                            packet.ReadInt16("short358+6+78+3", index, i, j, k);
                            packet.ReadByte("byte358+6+78+8", index, i, j, k);
                            packet.ReadInt16("short358+6+78+2", index, i, j, k);
                            if (bit358_6_78_9[i][j][k] != 9)
                                packet.ReadByte("byte358+6+78+9", index, i, j, k);
                        }

                        packet.ReadXORByte(guid358_6[i][j], 6);
                        for (var k = 0; k < bits358_6_84[i][j]; ++k)
                        {
                            packet.ReadInt32("int358+6+88+4", index, i, j, k);
                            packet.ReadInt32("int358+6+88+0", index, i, j, k);
                            if (bit358_6_88_8[i][j][k])
                                packet.ReadInt32("int358+6+88+8", index, i, j, k);

                            if (bit358_6_88_C[i][j][k])
                                packet.ReadInt32("int358+6+88+C", index, i, j, k);

                            if (bit358_6_88_10[i][j][k] != 9)
                                packet.ReadByte("byte358+6+88+10", index, i, j, k);
                        }

                        packet.ReadInt32("int358+6+28", index, i, j);
                        packet.ReadXORBytes(guid358_6[i][j], 5, 3);
                        packet.ReadInt32("int358+6+24", index, i, j);
                        packet.ReadXORByte(guid358_6[i][j], 1);
                        packet.ReadInt32("Int358+6+8", index, i, j);
                        packet.ReadInt16("short358+6+2C", index, i, j);
                        packet.ReadInt32("int358+6+C", index, i, j);
                        if (!bit358_6_30[i][j])
                            packet.ReadByte("byte358+6+30", index, i, j);

                        for (var k = 0; k < bits358_6_94[i][j]; ++k)
                        {
                            packet.ReadInt32("int358+6+98+4", index, i, j, k);
                            packet.ReadInt32("int358+6+98+0", index, i, j, k);
                        }

                        packet.ReadXORByte(guid358_6[i][j], 0);
                        packet.ReadWoWString("String358+6+31", (int)bits358_6_31[i][j], index, i, j);
                        packet.ReadInt32("int358+6+10", index, i, j);
                        packet.ReadInt16("short358+6+16", index, i, j);
                        packet.ReadInt16("short358+6+14", index, i, j);
                        packet.ReadXORByte(guid358_6[i][j], 2);
                        packet.ReadInt32("int358+6+18", index, i, j);
                        packet.ReadXORByte(guid358_6[i][j], 4);

                        if (bit358_6_2E[i][j])
                            packet.ReadInt16("short358+6+2E", index, i, j);

                        packet.ReadInt32("int358+6+1C", index, i, j);
                        packet.ReadInt32("int358+6+20", index, i, j);
                        packet.ReadXORByte(guid358_6[i][j], 7);

                        packet.WriteGuid("Guid 358_6", guid358_6[i][j], index, i, j);
                    }

                    packet.ReadXORBytes(guid358[i], 0, 7);
                    packet.ReadByte("byte358+25", index, i);
                    if (bit358_24[i])
                        packet.ReadInt32("int358+C", index, i);

                    packet.ReadXORBytes(guid358[i], 5, 4);
                    if (!bit358_20[i])
                        packet.ReadByte("byte358+24", index, i);

                    if (bit358_C[i])
                        packet.ReadInt16("Short358+10", index, i);

                    packet.ReadXORBytes(guid358[i], 1, 2, 3, 6);
                    packet.ReadInt32("int358+8", index, i);
                    packet.WriteGuid("Guid358", guid358[i], index, i);
                }

                for (var i = 0; i < 3; ++i)
                {
                    for (var j = 0; j < bits388_10[i]; ++j)
                    {
                        packet.ReadInt32("int388+6+4", index, i, j);
                        packet.ReadInt32("int388+6+0", index, i, j);
                    }

                    for (var j = 0; j < bits388[i]; ++j)
                    {
                        packet.ReadInt32("int388+1+0", index, i, j);
                        if (bit388_1_C[i][j])
                            packet.ReadInt32("int388+1+C", index, i, j);

                        if (bit388_1_8[i][j])
                            packet.ReadInt32("int388+1+8", index, i, j);

                        if (bit388_1_10[i][j] != 9)
                            packet.ReadByte("byte388+1+10", index, i, j);

                        packet.ReadInt32("int388+1+4", index, i, j);
                    }
                }

                if (bit338)
                    packet.ReadInt32("Int338", index);
                packet.ParseBitStream(CreatorGUID, 3, 5, 4, 2, 7, 6, 0, 1);

                if (bit33C)
                    packet.ReadInt32("Int33C", index);

                if (bit341)
                    packet.ReadByte("Byte341", index);

                if (bit340)
                    packet.ReadByte("Byte340", index);

                packet.ReadInt32("Int334", index);
                if (bit332)
                    packet.ReadInt16("Short332", index);

                if (bit330)
                    packet.ReadInt16("Short318", index);

                packet.WriteGuid("Creator GUID", CreatorGUID, index);
            }

            if (bit29C)
            {
                if (bit258)
                {
                    packet.ReadSingle("Float250", index);
                    packet.ReadSingle("Float254", index);
                    packet.ReadSingle("Float248", index);
                    packet.ReadSingle("Float24C", index);
                    packet.ReadSingle("Float240", index);
                    packet.ReadSingle("Float244", index);
                }

                if (bit284)
                {
                    packet.ReadSingle("Float280", index);
                    for (var i = 0; i < bits26C; ++i)
                    {
                        packet.ReadSingle("Float270+1", index, i);
                        packet.ReadSingle("Float270+0", index, i);
                    }

                    packet.ReadSingle("Float27C", index);
                    for (var i = 0; i < bits25C; ++i)
                    {
                        packet.ReadSingle("Float260+0", index, i);
                        packet.ReadSingle("Float260+1", index, i);
                    }
                }

                if (bit230)
                    packet.ReadInt32("int22C", index);

                if (bit220)
                    packet.ReadInt32("int21C", index);

                if (bit23C)
                {
                    packet.ReadSingle("Float238", index);
                    packet.ReadSingle("Float234", index);
                }

                if (bit298)
                {
                    for (var i = 0; i < bits288; ++i)
                    {
                        packet.ReadSingle("Float28C+0", index, i);
                        packet.ReadSingle("Float28C+2", index, i);
                        packet.ReadSingle("Float28C+1", index, i);
                    }
                }

                packet.ReadInt32("Int208", index);
                if (bit228)
                    packet.ReadInt32("int224", index);

                if (bit218)
                    packet.ReadInt32("int214", index);
            }

            if (isLiving)
            {
                moveInfo.Position.Y = packet.ReadSingle();
                if (moveInfo.HasSplineData)
                {
                    if (hasFullSpline)
                    {
                        for (var i = 0u; i < splineCount; ++i)
                        {
                            var wp = new Vector3
                            {
                                Z = packet.ReadSingle(),
                                X = packet.ReadSingle(),
                                Y = packet.ReadSingle()
                            };

                            packet.AddValue("Spline Waypoint", wp, index, i);
                        }

                        packet.ReadInt32("Spline Time", index); // if need swap with "Spline Full Time"
                        if (hasSplineVerticalAcceleration)
                            packet.ReadSingle("Spline Vertical Acceleration", index);

                        if (bit130)
                        {
                            for (var i = 0; i < bits11C; ++i)
                            {
                                packet.ReadSingle("Float13C+1", index, i);
                                packet.ReadSingle("Float13C+0", index, i);
                            }
                        }

                        packet.ReadInt32("Spline Full Time", index);

                        if (hasSplineStartTime)
                            packet.ReadInt32("Spline Start Time", index);

                        var type = packet.ReadByte();
                        switch (type)
                        {
                            case 1:
                                splineType = SplineType.Normal;
                                break;
                            case 2:
                                splineType = SplineType.FacingSpot;
                                break;
                            case 3:
                                splineType = SplineType.FacingTarget;
                                break;
                            case 4:
                                splineType = SplineType.FacingAngle;
                                break;
                        }

                        packet.ReadSingle("Spline Duration Multiplier", index); // if need swap with "Spline Duration Multiplier Next"
                        packet.ReadSingle("Spline Duration Multiplier Next", index);

                        if (splineType == SplineType.FacingSpot)
                        {
                            var point = new Vector3
                            {
                                Y = packet.ReadSingle(),
                                Z = packet.ReadSingle(),
                                X = packet.ReadSingle()
                            };

                            packet.AddValue("Facing Spot", point, index);
                        }

                        if (splineType == SplineType.FacingAngle)
                            packet.ReadSingle("Facing Angle", index);
                    }

                    moveInfo.Position.Y = packet.ReadSingle();
                    moveInfo.Position.Z = packet.ReadSingle();
                    moveInfo.Position.X = packet.ReadSingle();
                    packet.ReadInt32("Spline Id", index);
                }

                packet.ReadSingle("FloatBC", index);
                packet.ReadSingle("FloatAC", index);
                packet.ReadXORByte(guid1, 4);
                packet.ReadSingle("FloatA8", index);

                if (hasFallData)
                {
                    if (hasFallDirection)
                    {
                        packet.ReadSingle("Jump Velocity", index);
                        packet.ReadSingle("Jump Sin", index);
                        packet.ReadSingle("Jump Cos", index);
                    }

                    packet.ReadUInt32("Time Fallen", index);
                    packet.ReadSingle("Fall Start Velocity", index);
                }

                if (hasTransportData)
                {
                    packet.ReadXORByte(transportGuid, 5);
                    var seat = packet.ReadByte("Transport Seat", index);
                    packet.ReadXORByte(transportGuid, 2);
                    moveInfo.TransportOffset.O = packet.ReadSingle();
                    packet.ReadXORBytes(transportGuid, 4, 7);
                    if (hasTransportTime2)
                        packet.ReadUInt32("Transport Time 2", index);

                    packet.ReadUInt32("Transport Time", index);
                    moveInfo.TransportOffset.Y = packet.ReadSingle();
                    packet.ReadXORBytes(transportGuid, 3, 6);
                    moveInfo.TransportOffset.X = packet.ReadSingle();
                    packet.ReadXORByte(transportGuid, 0);
                    if (hasTransportTime3)
                        packet.ReadUInt32("Transport Time 3", index);
                    packet.ReadXORByte(transportGuid, 1);
                    moveInfo.TransportOffset.Z = packet.ReadSingle();

                    moveInfo.TransportGuid = new WowGuid64(BitConverter.ToUInt64(transportGuid, 0));
                    packet.AddValue("Transport GUID", moveInfo.TransportGuid, index);
                    packet.AddValue("Transport Position", moveInfo.TransportOffset, index);

                    if (moveInfo.TransportGuid.HasEntry() && moveInfo.TransportGuid.GetHighType() == HighGuidType.Vehicle &&
                        guid.HasEntry() && guid.GetHighType() == HighGuidType.Creature)
                    {
                        var vehicleAccessory = new VehicleTemplateAccessory();
                        vehicleAccessory.AccessoryEntry = guid.GetEntry();
                        vehicleAccessory.SeatId = seat;
                        Storage.VehicleTemplateAccessorys.Add(moveInfo.TransportGuid.GetEntry(), vehicleAccessory, packet.TimeSpan);
                    }
                }

                packet.ReadXORByte(guid1, 5);

                if (hasTimestamp)
                    packet.ReadUInt32("Time", index);

                for (var i = 0; i < bits90; ++i)
                    packet.ReadInt32("Int8C", index, i);

                if (bitA0)
                    packet.ReadInt32("Int98", index);

                packet.ReadXORByte(guid1, 1);
                packet.ReadSingle("FloatB0", index);
                packet.ReadSingle("FloatC0", index);
                packet.ReadXORByte(guid1, 6);
                packet.ReadSingle("FloatC4", index);

                for (var i = 0; i < bits160; ++i)
                {
                    packet.ReadSingle("Float16C+3", index, i);
                    packet.ReadSingle("Float16C+5", index, i);
                    packet.ReadSingle("Float16C+1", index, i);
                    packet.ReadInt32("Int16C+0", index, i);
                    packet.ReadInt32("Int16C+4", index, i);
                    packet.ReadSingle("Float16C+2", index, i);
                }

                moveInfo.Position.X = packet.ReadSingle();
                if (hasOrientation)
                    moveInfo.Orientation = packet.ReadSingle();

                packet.ReadSingle("FloatC8", index);
                packet.ReadSingle("FloatB4", index);
                if (hasSplineElevation)
                    packet.ReadSingle("Spline Elevation", index);

                packet.ReadXORByte(guid1, 3);
                if (hasPitch)
                    packet.ReadSingle("Pitch", index);

                packet.ReadSingle("FloatB8", index);
                packet.ReadXORBytes(guid1, 7, 2);
                moveInfo.Position.Z = packet.ReadSingle();
                packet.ReadXORByte(guid1, 0);

                packet.WriteGuid("GUID1", guid1, index);
                packet.AddValue("Position", moveInfo.Position, index);
                packet.AddValue("Orientation", moveInfo.Orientation, index);
            }

            if (hasStationaryPosition)
            {
                moveInfo.Position.X = packet.ReadSingle();
                moveInfo.Position.Z = packet.ReadSingle();
                moveInfo.Position.Y = packet.ReadSingle();
                moveInfo.Orientation = packet.ReadSingle("Stationary Orientation", index);

                packet.AddValue("Stationary Position", moveInfo.Position, index);
            }

            if (hasGameObjectPosition)
            {
                if (hasGOTransportTime2)
                    packet.ReadUInt32("GO Transport Time 2", index);

                packet.ReadXORBytes(goTransportGuid, 4, 2, 7, 3);
                packet.ReadUInt32("GO Transport Time", index);
                moveInfo.TransportOffset.Y = packet.ReadSingle();
                packet.ReadXORByte(goTransportGuid, 1);
                moveInfo.TransportOffset.Z = packet.ReadSingle();
                packet.ReadSByte("GO Transport Seat", index);
                if (hasGOTransportTime3)
                    packet.ReadUInt32("GO Transport Time 3", index);

                packet.ReadXORByte(goTransportGuid, 6);
                moveInfo.TransportOffset.O = packet.ReadSingle();
                packet.ReadXORBytes(goTransportGuid, 5, 0);
                moveInfo.TransportOffset.X = packet.ReadSingle();

                moveInfo.TransportGuid = new WowGuid64(BitConverter.ToUInt64(goTransportGuid, 0));
                packet.AddValue("GO Transport GUID", moveInfo.TransportGuid, index);
                packet.AddValue("GO Transport Position", moveInfo.TransportOffset, index);
            }

            if (hasGameObjectRotation)
                packet.ReadPackedQuaternion("GameObject Rotation", index);

            if (hasAttackingTarget)
            {
                packet.ParseBitStream(attackingTargetGuid, 4, 6, 3, 0, 7, 1, 2, 5);
                packet.WriteGuid("Attacking GUID", attackingTargetGuid, index);
            }

            if (hasAnimKits)
            {
                if (hasAnimKit3)
                    packet.ReadUInt16("Anim Kit 3", index);
                if (hasAnimKit1)
                    packet.ReadUInt16("Anim Kit 1", index);
                if (hasAnimKit2)
                    packet.ReadUInt16("Anim Kit 2", index);
            }

            if (bit1DC)
                packet.ReadInt32("int1D8", index);

            if (hasVehicleData)
            {
                moveInfo.VehicleId = packet.ReadUInt32("Vehicle Id", index);
                packet.ReadSingle("Vehicle Orientation", index);
            }

            if (bit2A4)
                packet.ReadInt32("int2A0", index);

            if (bit414)
                packet.ReadInt32("int410", index);

            if (bit32A)
                packet.ReadBytes("Bytes", (int)bits2AA);

            if (bit428)
                for (var i = 0; i < bits418; ++i)
                    packet.ReadInt32("Int3F8", index, i);

            if (isLiving && moveInfo.HasSplineData && hasFullSpline && splineType == SplineType.FacingTarget)
            {
                var facingTargetGuid = new byte[8];
                facingTargetGuid = packet.StartBitStream(5, 3, 6, 2, 7, 0, 1, 4);
                packet.ParseBitStream(facingTargetGuid, 7, 0, 1, 4, 2, 5, 3, 6);
                packet.WriteGuid("Facing Target GUID", facingTargetGuid, index);
            }

            return moveInfo;
        }
Exemplo n.º 17
0
        private static MovementInfo ReadMovementUpdateBlock434(Packet packet, WowGuid guid, object index)
        {
            var moveInfo = new MovementInfo();

            // bits
            /*var bit3 =*/
            packet.ReadBit();
            /*var bit4 =*/
            packet.ReadBit();
            var hasGameObjectRotation = packet.ReadBit("Has GameObject Rotation", index);
            var hasAnimKits = packet.ReadBit("Has AnimKits", index);
            var hasAttackingTarget = packet.ReadBit("Has Attacking Target", index);
            packet.ReadBit("Self", index);
            var hasVehicleData = packet.ReadBit("Has Vehicle Data", index);
            var living = packet.ReadBit("Living", index);
            var unkLoopCounter = packet.ReadBits("Unknown array size", 24, index);
            /*var bit1 =*/
            packet.ReadBit();
            var hasGameObjectPosition = packet.ReadBit("Has GameObject Position", index);
            var hasStationaryPosition = packet.ReadBit("Has Stationary Position", index);
            var bit456 = packet.ReadBit();
            /*var bit2 =*/
            packet.ReadBit();
            var transport = packet.ReadBit("Transport", index);
            var hasOrientation = false;
            var guid2 = new byte[8];
            var hasPitch = false;
            var hasFallData = false;
            var hasSplineElevation = false;
            var hasTransportData = false;
            var hasTimestamp = false;
            var transportGuid = new byte[8];
            var hasTransportTime2 = false;
            var hasTransportTime3 = false;
            var bit216 = false;
            var hasSplineStartTime = false;
            var splineCount = 0u;
            var splineType = SplineType.Stop;
            var facingTargetGuid = new byte[8];
            var hasSplineVerticalAcceleration = false;
            var hasFallDirection = false;
            var goTransportGuid = new byte[8];
            var hasGOTransportTime2 = false;
            var hasGOTransportTime3 = false;
            var attackingTargetGuid = new byte[8];
            var hasAnimKit1 = false;
            var hasAnimKit2 = false;
            var hasAnimKit3 = false;

            if (living)
            {
                var hasMovementFlags = !packet.ReadBit();
                hasOrientation = !packet.ReadBit("Lacks orientation", index);
                guid2[7] = packet.ReadBit();
                guid2[3] = packet.ReadBit();
                guid2[2] = packet.ReadBit();
                if (hasMovementFlags)
                    moveInfo.Flags = (MovementFlag)packet.ReadBitsE<Enums.MovementFlag>("Movement Flags", 30, index);

                packet.ReadBit("Has MovementInfo spline", index);
                hasPitch = !packet.ReadBit("Lacks pitch", index);
                moveInfo.HasSplineData = packet.ReadBit("Has Spline Data", index);
                hasFallData = packet.ReadBit("Has Fall Data", index);
                hasSplineElevation = !packet.ReadBit("Lacks spline elevation", index);
                guid2[5] = packet.ReadBit();
                hasTransportData = packet.ReadBit("Has Transport Data", index);
                hasTimestamp = !packet.ReadBit("Lacks timestamp", index);
                if (hasTransportData)
                {
                    transportGuid[1] = packet.ReadBit();
                    hasTransportTime2 = packet.ReadBit();
                    transportGuid[4] = packet.ReadBit();
                    transportGuid[0] = packet.ReadBit();
                    transportGuid[6] = packet.ReadBit();
                    hasTransportTime3 = packet.ReadBit();
                    transportGuid[7] = packet.ReadBit();
                    transportGuid[5] = packet.ReadBit();
                    transportGuid[3] = packet.ReadBit();
                    transportGuid[2] = packet.ReadBit();
                }

                guid2[4] = packet.ReadBit();
                if (moveInfo.HasSplineData)
                {
                    bit216 = packet.ReadBit("Has extended spline data", index);
                    if (bit216)
                    {
                        /*var splineMode =*/
                        packet.ReadBitsE<SplineMode>("Spline Mode", 2, index);
                        hasSplineStartTime = packet.ReadBit("Has spline start time", index);
                        splineCount = packet.ReadBits("Spline Waypoints", 22, index);
                        var bits57 = packet.ReadBits(2);
                        switch (bits57)
                        {
                            case 0:
                                splineType = SplineType.FacingAngle;
                                break;
                            case 1:
                                splineType = SplineType.FacingSpot;
                                break;
                            case 2:
                                splineType = SplineType.FacingTarget;
                                break;
                            case 3:
                                splineType = SplineType.Normal;
                                break;
                        }

                        if (splineType == SplineType.FacingTarget)
                            facingTargetGuid = packet.StartBitStream(4, 3, 7, 2, 6, 1, 0, 5);

                        hasSplineVerticalAcceleration = packet.ReadBit("Has spline vertical acceleration", index);
                        packet.AddValue("Spline type", splineType, index);
                        /*splineFlags =*/
                        packet.ReadBitsE<SplineFlag434>("Spline flags", 25, index);
                    }
                }

                guid2[6] = packet.ReadBit();
                if (hasFallData)
                    hasFallDirection = packet.ReadBit("Has Fall Direction", index);

                guid2[0] = packet.ReadBit();
                guid2[1] = packet.ReadBit();
                packet.ReadBit();
                if (!packet.ReadBit())
                    moveInfo.FlagsExtra = packet.ReadBitsE<MovementFlagExtra>("Extra Movement Flags", 12, index);
            }

            if (hasGameObjectPosition)
            {
                goTransportGuid[5] = packet.ReadBit();
                hasGOTransportTime3 = packet.ReadBit();
                goTransportGuid[0] = packet.ReadBit();
                goTransportGuid[3] = packet.ReadBit();
                goTransportGuid[6] = packet.ReadBit();
                goTransportGuid[1] = packet.ReadBit();
                goTransportGuid[4] = packet.ReadBit();
                goTransportGuid[2] = packet.ReadBit();
                hasGOTransportTime2 = packet.ReadBit();
                goTransportGuid[7] = packet.ReadBit();
            }

            if (hasAttackingTarget)
                attackingTargetGuid = packet.StartBitStream(2, 7, 0, 4, 5, 6, 1, 3);

            if (hasAnimKits)
            {
                hasAnimKit1 = !packet.ReadBit();
                hasAnimKit2 = !packet.ReadBit();
                hasAnimKit3 = !packet.ReadBit();
            }

            packet.ResetBitReader();

            // Reading data
            for (var i = 0u; i < unkLoopCounter; ++i)
                packet.ReadUInt32("Unk UInt32", index, (int)i);

            if (living)
            {
                packet.ReadXORByte(guid2, 4);

                packet.ReadSingle("RunBack Speed", index);
                if (hasFallData)
                {
                    if (hasFallDirection)
                    {
                        packet.ReadSingle("Jump XY Speed", index);
                        packet.ReadSingle("Jump Cos", index);
                        packet.ReadSingle("Jump Sin", index);
                    }

                    packet.ReadInt32("Time Fallen", index);
                    packet.ReadSingle("Fall Z Speed", index);
                }

                packet.ReadSingle("SwimBack Speed", index);
                if (hasSplineElevation)
                    packet.ReadSingle("Spline Elevation", index);

                if (moveInfo.HasSplineData)
                {
                    if (bit216)
                    {
                        if (hasSplineVerticalAcceleration)
                            packet.ReadSingle("Spline Vertical Acceleration", index);
                        packet.ReadUInt32("Spline Time", index);
                        if (splineType == SplineType.FacingAngle)
                            packet.ReadSingle("Facing Angle", index);
                        else if (splineType == SplineType.FacingTarget)
                        {
                            packet.ParseBitStream(facingTargetGuid, 5, 3, 7, 1, 6, 4, 2, 0);
                            packet.WriteGuid("Facing Target GUID", facingTargetGuid, index);
                        }

                        for (var i = 0u; i < splineCount; ++i)
                        {
                            var wp = new Vector3
                            {
                                Z = packet.ReadSingle(),
                                X = packet.ReadSingle(),
                                Y = packet.ReadSingle()
                            };

                            packet.AddValue("Spline Waypoint", wp, index, i);
                        }

                        if (splineType == SplineType.FacingSpot)
                        {
                            var point = new Vector3
                            {
                                X = packet.ReadSingle(),
                                Z = packet.ReadSingle(),
                                Y = packet.ReadSingle()
                            };

                            packet.AddValue("Facing Spot", point, index);
                        }

                        packet.ReadSingle("Spline Duration Multiplier Next", index);
                        packet.ReadUInt32("Spline Full Time", index);
                        if (hasSplineStartTime)
                            packet.ReadUInt32("Spline Start time", index);

                        packet.ReadSingle("Spline Duration Multiplier", index);
                    }

                    var endPoint = new Vector3
                    {
                        Z = packet.ReadSingle(),
                        X = packet.ReadSingle(),
                        Y = packet.ReadSingle()
                    };

                    packet.ReadUInt32("Spline Id", index);
                    packet.AddValue("Spline Endpoint:", endPoint, index);
                }

                moveInfo.Position.Z = packet.ReadSingle();
                packet.ReadXORByte(guid2, 5);

                if (hasTransportData)
                {
                    packet.ReadXORByte(transportGuid, 5);
                    packet.ReadXORByte(transportGuid, 7);

                    packet.ReadUInt32("Transport Time", index);
                    moveInfo.TransportOffset.O = packet.ReadSingle();
                    if (hasTransportTime2)
                        packet.ReadUInt32("Transport Time 2", index);

                    moveInfo.TransportOffset.Y = packet.ReadSingle();
                    moveInfo.TransportOffset.X = packet.ReadSingle();
                    packet.ReadXORByte(transportGuid, 3);

                    moveInfo.TransportOffset.Z = packet.ReadSingle();
                    packet.ReadXORByte(transportGuid, 0);

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

                    var seat = packet.ReadSByte("Transport Seat", index);
                    packet.ReadXORByte(transportGuid, 1);
                    packet.ReadXORByte(transportGuid, 6);
                    packet.ReadXORByte(transportGuid, 2);
                    packet.ReadXORByte(transportGuid, 4);
                    moveInfo.TransportGuid = new WowGuid64(BitConverter.ToUInt64(transportGuid, 0));
                    packet.AddValue("Transport GUID", moveInfo.TransportGuid, index);
                    packet.AddValue("Transport Position", moveInfo.TransportOffset, index);

                    if (moveInfo.TransportGuid.HasEntry() && moveInfo.TransportGuid.GetHighType() == HighGuidType.Vehicle &&
                        guid.HasEntry() && guid.GetHighType() == HighGuidType.Creature)
                    {
                        var vehicleAccessory = new VehicleTemplateAccessory();
                        vehicleAccessory.AccessoryEntry = guid.GetEntry();
                        vehicleAccessory.SeatId = seat;
                        Storage.VehicleTemplateAccessorys.Add(moveInfo.TransportGuid.GetEntry(), vehicleAccessory, packet.TimeSpan);
                    }
                }

                moveInfo.Position.X = packet.ReadSingle();
                packet.ReadSingle("Pitch Speed", index);
                packet.ReadXORByte(guid2, 3);
                packet.ReadXORByte(guid2, 0);

                packet.ReadSingle("Swim Speed", index);
                moveInfo.Position.Y = packet.ReadSingle();
                packet.ReadXORByte(guid2, 7);
                packet.ReadXORByte(guid2, 1);
                packet.ReadXORByte(guid2, 2);

                moveInfo.WalkSpeed = packet.ReadSingle("Walk Speed", index) / 2.5f;
                if (hasTimestamp)
                    packet.ReadUInt32("Time", index);

                packet.ReadSingle("FlyBack Speed", index);
                packet.ReadXORByte(guid2, 6);

                packet.ReadSingle("Turn Speed", index);
                if (hasOrientation)
                    moveInfo.Orientation = packet.ReadSingle();

                moveInfo.RunSpeed = packet.ReadSingle("Run Speed", index) / 7.0f;
                if (hasPitch)
                    packet.ReadSingle("Pitch", index);

                packet.ReadSingle("Fly Speed", index);

                packet.WriteGuid("GUID 2", guid2);
                packet.AddValue("Position", moveInfo.Position, index);
                packet.AddValue("Orientation", moveInfo.Orientation, index);
            }

            if (hasVehicleData)
            {
                packet.ReadSingle("Vehicle Orientation", index);
                moveInfo.VehicleId = packet.ReadUInt32("Vehicle Id", index);
            }

            if (hasGameObjectPosition)
            {
                packet.ReadXORByte(goTransportGuid, 0);
                packet.ReadXORByte(goTransportGuid, 5);
                if (hasGOTransportTime3)
                    packet.ReadUInt32("GO Transport Time 3", index);

                packet.ReadXORByte(goTransportGuid, 3);

                moveInfo.TransportOffset.X = packet.ReadSingle();
                packet.ReadXORByte(goTransportGuid, 4);
                packet.ReadXORByte(goTransportGuid, 6);
                packet.ReadXORByte(goTransportGuid, 1);

                packet.ReadSingle("GO Transport Time", index);
                moveInfo.TransportOffset.Y = packet.ReadSingle();
                packet.ReadXORByte(goTransportGuid, 2);
                packet.ReadXORByte(goTransportGuid, 7);

                moveInfo.TransportOffset.Z = packet.ReadSingle();
                packet.ReadByte("GO Transport Seat", index);
                moveInfo.TransportOffset.O = packet.ReadSingle();
                if (hasGOTransportTime2)
                    packet.ReadUInt32("GO Transport Time 2", index);

                moveInfo.TransportGuid = new WowGuid64(BitConverter.ToUInt64(goTransportGuid, 0));
                packet.AddValue("GO Transport GUID", moveInfo.TransportGuid, index);
                packet.AddValue("GO Transport Position", moveInfo.TransportOffset, index);
            }

            if (hasGameObjectRotation)
                packet.ReadPackedQuaternion("GameObject Rotation", index);

            if (bit456)
            {
                // float[] arr = new float[16];
                // ordering: 13, 4, 7, 15, BYTE, 10, 11, 3, 5, 14, 6, 1, 8, 12, 0, 2, 9
                packet.ReadBytes(4 * 16 + 1);
            }

            if (hasStationaryPosition)
            {
                moveInfo.Orientation = packet.ReadSingle("Stationary Orientation", index);
                moveInfo.Position = packet.ReadVector3("Stationary Position", index);
            }

            if (hasAttackingTarget)
            {
                packet.ParseBitStream(attackingTargetGuid, 4, 0, 3, 5, 7, 6, 2, 1);
                packet.WriteGuid("Attacking Target GUID", attackingTargetGuid, index);
            }

            if (hasAnimKits)
            {
                if (hasAnimKit1)
                    packet.ReadUInt16("AI Anim Kit Id", index);
                if (hasAnimKit2)
                    packet.ReadUInt16("Movement Anim Kit Id", index);
                if (hasAnimKit3)
                    packet.ReadUInt16("Melee Anim Kit Id", index);
            }

            if (transport)
                packet.ReadUInt32("Transport path timer", index);

            return moveInfo;
        }
Exemplo n.º 18
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);
            }
        }
Exemplo n.º 19
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);
            }
        }
Exemplo n.º 20
0
        private static MovementInfo ReadMovementUpdateBlock432(Packet packet, WowGuid guid, object index)
        {
            var moveInfo = new MovementInfo();

            /*bool bit2 = */packet.ReadBit();
            /*bool bit3 = */packet.ReadBit();
            /*bool bit4 = */packet.ReadBit();
            var hasStationaryPosition = packet.ReadBit("Has Stationary Position", index);
            var hasAnimKits = packet.ReadBit("Has AnimKits", index);
            var unkLoopCounter = packet.ReadBits(24);
            /*bool bit1 = */packet.ReadBit();
            bool hasTransportExtra = packet.ReadBit("Has Transport Extra", index);
            bool hasGORotation = packet.ReadBit("Has GameObject Rotation", index);
            bool living = packet.ReadBit("Living", index);
            bool hasGameObjectPosition = packet.ReadBit("Has GameObject Position", index);
            bool hasVehicleData = packet.ReadBit("Has Vehicle Data", index);
            bool hasAttackingTarget = packet.ReadBit("Has Attacking Target", index);
            /*bool bit0 =*/packet.ReadBit();
            bool unkFloats = packet.ReadBit();

            bool unkFloat1 = false;
            bool hasFallData = false;
            bool unkFloat2 = false;
            bool bit216 = false;
            bool bit256 = false;
            bool hasSplineDurationMult = false;
            SplineType splineType = SplineType.Normal;
            var facingTarget = new byte[8];
            uint splineCount = 0u;
            bool hasTransportData = false;
            var transportGuid = new byte[8];
            bool hasTransportTime2 = false;
            bool hasTransportTime3 = false;
            bool hasFallDirection = false;
            bool hasUnkUInt = false;
            bool hasOrientation = false;
            var attackingTarget = new byte[8];
            var goTransportGuid = new byte[8];
            bool hasGOTransportTime2 = false;
            bool hasGOTransportTime3 = false;
            bool hasAnimKit1 = false;
            bool hasAnimKit2 = false;
            bool hasAnimKit3 = false;
            var guid2 = new byte[8];

            if (living)
            {
                unkFloat1 = !packet.ReadBit();
                hasOrientation = !packet.ReadBit();
                bool hasExtraMovementFlags = !packet.ReadBit();
                hasFallData = packet.ReadBit("Has Fall Data", index);
                guid2[0] = packet.ReadBit();
                guid2[5] = packet.ReadBit();
                guid2[4] = packet.ReadBit();
                bool hasMovementFlags = !packet.ReadBit();
                moveInfo.HasSplineData = packet.ReadBit("Has Spline Data", index);
                /*bool bit148 = */packet.ReadBit();

                if (hasExtraMovementFlags)
                    moveInfo.FlagsExtra = packet.ReadBitsE<MovementFlagExtra>("Extra Movement Flags", 12, index);

                hasUnkUInt = !packet.ReadBit();
                guid2[3] = packet.ReadBit();
                /*bool bit149 = */packet.ReadBit();

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

                guid2[1] = packet.ReadBit();
                unkFloat2 = !packet.ReadBit();
                hasTransportData = packet.ReadBit("Has Transport Data", index);
                guid2[2] = packet.ReadBit();

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

                if (moveInfo.HasSplineData)
                {
                    bit216 = packet.ReadBit();
                    if (bit216)
                    {
                        uint bits57 = packet.ReadBits(2);
                        splineCount = packet.ReadBits(22);
                        switch (bits57)
                        {
                            case 0:
                                splineType = SplineType.FacingTarget;
                                break;
                            case 1:
                                splineType = SplineType.FacingSpot;
                                break;
                            case 2:
                                splineType = SplineType.Normal;
                                break;
                            case 3:
                                splineType = SplineType.FacingAngle;
                                break;
                        }

                        if (splineType == SplineType.FacingTarget)
                            facingTarget = packet.StartBitStream(4, 3, 2, 5, 7, 1, 0, 6);

                        packet.ReadBitsE<SplineFlag422>("Spline flags", 25, index);
                        /*splineMode =*/packet.ReadBits(2);
                        hasSplineDurationMult = packet.ReadBit("HasSplineDurationMult", index);
                        bit256 = packet.ReadBit();
                    }
                }

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

                guid2[6] = packet.ReadBit();
                guid2[7] = packet.ReadBit();
            }

            if (hasGameObjectPosition)
            {
                goTransportGuid[5] = packet.ReadBit();
                goTransportGuid[4] = packet.ReadBit();
                hasGOTransportTime3 = packet.ReadBit();
                goTransportGuid[7] = packet.ReadBit();
                goTransportGuid[6] = packet.ReadBit();
                goTransportGuid[1] = packet.ReadBit();
                goTransportGuid[2] = packet.ReadBit();
                hasGOTransportTime2 = packet.ReadBit();
                goTransportGuid[0] = packet.ReadBit();
                goTransportGuid[3] = packet.ReadBit();
            }

            if (hasAnimKits)
            {
                hasAnimKit1 = !packet.ReadBit();
                hasAnimKit3 = !packet.ReadBit();
                hasAnimKit2 = !packet.ReadBit();
            }

            if (hasAttackingTarget)
                attackingTarget = packet.StartBitStream(4, 3, 2, 5, 0, 6, 1, 7);

            for (var i = 0; i < unkLoopCounter; ++i)
            {
                packet.ReadInt32();
            }

            if (hasGameObjectPosition)
            {
                if (hasGOTransportTime3)
                    packet.ReadInt32("GO Transport Time 3", index);

                packet.ReadXORByte(goTransportGuid, 7);

                moveInfo.TransportOffset.Z = packet.ReadSingle();
                packet.ReadByte("GO Transport Seat", index);
                moveInfo.TransportOffset.X = packet.ReadSingle();
                moveInfo.TransportOffset.Y = packet.ReadSingle();

                packet.ReadXORByte(goTransportGuid, 4);
                packet.ReadXORByte(goTransportGuid, 5);
                packet.ReadXORByte(goTransportGuid, 6);

                moveInfo.TransportOffset.O = packet.ReadSingle();
                packet.ReadInt32("GO Transport Time", index);

                packet.ReadXORByte(goTransportGuid, 1);

                if (hasGOTransportTime2)
                    packet.ReadInt32("GO Transport Time 2", index);

                packet.ReadXORByte(goTransportGuid, 0);
                packet.ReadXORByte(goTransportGuid, 2);
                packet.ReadXORByte(goTransportGuid, 3);

                moveInfo.TransportGuid = packet.WriteGuid("GO Transport GUID", goTransportGuid, index);
                packet.AddValue("GO Transport Position", moveInfo.TransportOffset, index);
            }

            if (living)
            {
                if (moveInfo.HasSplineData)
                {
                    if (bit216)
                    {
                        packet.ReadSingle("Unknown Spline Float 2", index);
                        for (var i = 0u; i < splineCount; ++i)
                        {
                            var wp = new Vector3
                            {
                                Y = packet.ReadSingle(),
                                Z = packet.ReadSingle(),
                                X = packet.ReadSingle()
                            };

                            packet.AddValue("Spline Waypoint", wp, index, i);
                        }

                        if (splineType == SplineType.FacingTarget)
                        {
                            packet.ParseBitStream(facingTarget, 2, 1, 3, 7, 0, 5, 4, 6);
                            packet.WriteGuid("Facing Target GUID", facingTarget, index);
                        }
                        else if (splineType == SplineType.FacingSpot)
                        {
                            var point = new Vector3
                            {
                                Y = packet.ReadSingle(),
                                Z = packet.ReadSingle(),
                                X = packet.ReadSingle()
                            };

                            packet.AddValue("Facing Spot", point, index);
                        }

                        if (hasSplineDurationMult)
                            packet.ReadSingle("Spline Duration Modifier", index);

                        if (bit256)
                            packet.ReadUInt32("Unknown Spline Int32 1", index);

                        packet.ReadUInt32("Unknown Spline Int32 2", index);
                        packet.ReadSingle("Unknown Spline Float 1", index);
                        if (splineType == SplineType.FacingAngle)
                            packet.ReadSingle("Facing Angle", index);

                        packet.ReadUInt32("Unknown Spline Int32 3", index);
                    }

                    packet.ReadUInt32("Spline Full Time", index);
                    var endPoint = new Vector3
                    {
                        Z = packet.ReadSingle(),
                        Y = packet.ReadSingle(),
                        X = packet.ReadSingle()
                    };

                    packet.AddValue("Spline Endpoint", endPoint, index);
                }

                if (hasTransportData)
                {
                    packet.ReadXORByte(transportGuid, 6);
                    if (hasTransportTime2)
                        packet.ReadInt32("Transport Time 2", index);

                    var seat = packet.ReadByte("Transport Seat", index);
                    moveInfo.TransportOffset.O = packet.ReadSingle();
                    packet.ReadXORByte(transportGuid, 7);
                    moveInfo.TransportOffset.Y = packet.ReadSingle();
                    packet.ReadXORByte(transportGuid, 3);
                    if (hasTransportTime3)
                        packet.ReadInt32("Transport Time 3", index);

                    packet.ReadInt32("Transport Time", index);
                    packet.ReadXORByte(transportGuid, 0);
                    packet.ReadXORByte(transportGuid, 1);
                    moveInfo.TransportOffset.X = packet.ReadSingle();
                    packet.ReadXORByte(transportGuid, 4);
                    moveInfo.TransportOffset.Z = packet.ReadSingle();
                    packet.ReadXORByte(transportGuid, 5);
                    packet.ReadXORByte(transportGuid, 2);

                    moveInfo.TransportGuid = new WowGuid64(BitConverter.ToUInt64(transportGuid, 0));
                    packet.AddValue("Transport GUID", moveInfo.TransportGuid, index);
                    packet.AddValue("Transport Position", moveInfo.TransportOffset, index);

                    if (moveInfo.TransportGuid.HasEntry() && moveInfo.TransportGuid.GetHighType() == HighGuidType.Vehicle &&
                        guid.HasEntry() && guid.GetHighType() == HighGuidType.Creature)
                    {
                        VehicleTemplateAccessory vehicleAccessory = new VehicleTemplateAccessory
                        {
                            Entry = moveInfo.TransportGuid.GetEntry(),
                            AccessoryEntry = guid.GetEntry(),
                            SeatId = seat
                        };

                        Storage.VehicleTemplateAccessories.Add(vehicleAccessory, packet.TimeSpan);
                    }
                }

                moveInfo.Position = new Vector3 {Z = packet.ReadSingle()};
                packet.ReadSingle("FlyBack Speed", index);
                moveInfo.Position.Y = packet.ReadSingle();
                packet.ReadXORByte(guid2, 4);
                packet.ReadXORByte(guid2, 0);
                moveInfo.Position.X = packet.ReadSingle();
                if (hasFallData)
                {
                    packet.ReadInt32("Time Fallen", index);
                    if (hasFallDirection)
                    {
                        packet.ReadSingle("Jump Sin", index);
                        packet.ReadSingle("Jump Velocity", index);
                        packet.ReadSingle("Jump Cos", index);
                    }
                    packet.ReadSingle("Fall Start Velocity", index);
                }

                if (hasOrientation)
                    moveInfo.Orientation = packet.ReadSingle("Orientation");

                packet.AddValue("Position", moveInfo.Position, moveInfo.Orientation, index);
                packet.ReadSingle("Swim Speed", index);
                moveInfo.RunSpeed = packet.ReadSingle("Run Speed", index) / 7.0f;
                packet.ReadSingle("Fly Speed", index);
                packet.ReadXORByte(guid2, 2);
                if (unkFloat2)
                    packet.ReadSingle("Unk float +36", index);

                if (unkFloat1)
                    packet.ReadSingle("Unk float +28", index);

                packet.ReadXORByte(guid2, 3);
                packet.ReadSingle("RunBack Speed", index);
                packet.ReadXORByte(guid2, 6);
                packet.ReadSingle("Pitch Speed", index);
                packet.ReadXORByte(guid2, 7);
                packet.ReadXORByte(guid2, 5);
                packet.ReadSingle("Turn Speed", index);
                packet.ReadSingle("SwimBack Speed", index);
                packet.ReadXORByte(guid2, 1);
                packet.WriteGuid("GUID 2", guid2, index);
                if (hasUnkUInt)
                    packet.ReadInt32();

                moveInfo.WalkSpeed = packet.ReadSingle("Walk Speed", index) / 2.5f;
            }

            if (hasAttackingTarget)
            {
                packet.ParseBitStream(attackingTarget, 6, 5, 3, 2, 0, 1, 7, 4);
                packet.WriteGuid("Attacking Target GUID", attackingTarget, index);
            }

            if (unkFloats)
            {
                int i;
                for (i = 0; i < 13; ++i)
                    packet.ReadSingle("Unk float 456", index, i);

                packet.ReadByte("Unk byte 456", index);

                for (; i < 16; ++i)
                    packet.ReadSingle("Unk float 456", index, i);
            }

            if (hasVehicleData)
            {
                packet.ReadSingle("Vehicle Orientation", index);
                moveInfo.VehicleId = packet.ReadUInt32("Vehicle Id", index);
            }

            if (hasGORotation)
                moveInfo.Rotation = packet.ReadPackedQuaternion("GO Rotation", index);

            if (hasStationaryPosition)
            {
                moveInfo.Position = new Vector3
                {
                    X = packet.ReadSingle(),
                    Z = packet.ReadSingle(),
                    Y = packet.ReadSingle()
                };

                moveInfo.Orientation = packet.ReadSingle("O", index);
                packet.AddValue("Stationary Position", moveInfo.Position, index);
            }

            if (hasAnimKits)
            {
                if (hasAnimKit3)
                    packet.ReadUInt16("Anim Kit 3", index);
                if (hasAnimKit1)
                    packet.ReadUInt16("Anim Kit 1", index);
                if (hasAnimKit2)
                    packet.ReadUInt16("Anim Kit 2", index);
            }

            if (hasTransportExtra)
                packet.ReadInt32("Transport Time", index);

            packet.ResetBitReader();
            return moveInfo;
        }
Exemplo n.º 21
0
 public static void HandleActivateTaxiReply(Packet packet)
 {
     packet.ReadBitsE<TaxiError>("Result", 4);
 }
Exemplo n.º 22
0
        public static void HandleSpellGo(Packet packet)
        {
            var guid1 = new byte[8];
            var guid2 = new byte[8];
            var guid3 = new byte[8];
            var guid4 = new byte[8];
            var guid5 = new byte[8];
            byte[][] guid6;
            byte[][] guid7;
            var guid8 = new byte[8];
            var powerGUID = new byte[8];
            byte[][] guid10;
            var guid11 = new byte[8];

            var bitE8 = packet.ReadBit();
            packet.StartBitStream(guid1, 6, 7);

            packet.ReadBit(); // fake bit

            packet.StartBitStream(guid2, 2, 6, 0, 3, 4, 1, 7, 5);

            guid3[4] = packet.ReadBit();
            guid1[1] = packet.ReadBit();
            guid3[2] = packet.ReadBit();
            var counter1 = (int)packet.ReadBits(24);
            guid1[0] = packet.ReadBit();
            var counter2 = (int)packet.ReadBits(24);
            guid3[5] = packet.ReadBit();

            if (bitE8)
                packet.StartBitStream(guid4, 4, 7, 5, 3, 6, 2, 1, 0);

            packet.ReadBit(); // fake bit

            packet.StartBitStream(guid5, 5, 3, 4, 6, 7, 1, 2, 0);

            var bitF0 = !packet.ReadBit();
            var bit19C = !packet.ReadBit();
            var bit180 = !packet.ReadBit();
            var bit1D8 = !packet.ReadBit();

            guid3[7] = packet.ReadBit();

            guid6 = new byte[counter2][];
            for (var i = 0; i < counter2; ++i)
            {
                guid6[i] = new byte[8];
                packet.StartBitStream(guid6[i], 5, 3, 1, 4, 6, 0, 2, 7);
            }

            guid7 = new byte[counter1][];
            for (var i = 0; i < counter1; ++i)
            {
                guid7[i] = new byte[8];
                packet.StartBitStream(guid7[i], 0, 2, 7, 4, 6, 3, 5, 1);
            }

            var hasTargetMask = !packet.ReadBit();
            var bit1C8 = !packet.ReadBit();

            var counter3 = packet.ReadBits(21);

            var hasPowerData = packet.ReadBit();
            var bitC8 = packet.ReadBit();
            var bit1A0 = !packet.ReadBit();

            if (bitC8)
                packet.StartBitStream(guid8, 4, 7, 6, 3, 2, 0, 5, 1);

            var bit181 = !packet.ReadBit();
            var bit1DC = !packet.ReadBit();

            guid1[4] = packet.ReadBit();

            var powerCount = 0u;
            if (hasPowerData)
            {
                powerGUID[4] = packet.ReadBit();
                powerCount = packet.ReadBits(21);
                packet.StartBitStream(powerGUID, 2, 3, 7, 6, 5, 0, 1);
            }

            var bit198 = !packet.ReadBit();
            var bit194 = !packet.ReadBit();

            if (hasTargetMask)
                packet.ReadBitsE<TargetFlag>("Target Flags", 20);

            var bits5C = packet.ReadBits(13);
            guid1[3] = packet.ReadBit();
            var bits184 = packet.ReadBits(3);

            packet.ReadBit(); // fake bit

            guid1[2] = packet.ReadBit();
            var bit1B0 = !packet.ReadBit();
            guid3[3] = packet.ReadBit();
            var counter4 = (int)packet.ReadBits(20);

            guid10 = new byte[counter4][];
            for (var i = 0; i < counter4; ++i)
            {
                guid10[i] = new byte[8];
                packet.StartBitStream(guid10[i], 5, 1, 4, 7, 3, 6, 0, 2);
            }

            packet.StartBitStream(guid11, 4, 1, 5, 2, 7, 6, 0, 3);

            guid3[1] = packet.ReadBit();
            guid1[5] = packet.ReadBit();
            guid3[6] = packet.ReadBit();

            var counter5 = packet.ReadBits(25);

            guid3[0] = packet.ReadBit();

            var bitsF0 = 0u;
            if (bitF0)
                bitsF0 = packet.ReadBits(7);

            var bit1C4 = !packet.ReadBit();
            var bit1AC = packet.ReadBit();

            for (var i = 0; i < counter5; ++i)
            {
                var bits136 = packet.ReadBits(4);

                if (bits136 == 11)
                    packet.ReadBits("bits140", 4, i);
            }

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

            packet.ReadXORByte(guid1, 2);

            packet.ReadInt32("Int60");

            for (var i = 0; i < counter1; ++i)
            {
                packet.ParseBitStream(guid7[i], 3, 6, 7, 5, 0, 4, 2, 1);
                packet.WriteGuid("Guid7", guid7[i], i);
            }

            packet.ReadXORByte(guid1, 6);

            for (var i = 0; i < counter2; ++i)
            {
                packet.ParseBitStream(guid6[i], 6, 0, 3, 7, 2, 1, 5, 4);
                packet.WriteGuid("Guid7", guid7[i], i);
            }

            packet.ReadXORByte(guid3, 0);

            if (bitC8)
            {
                packet.ReadXORByte(guid8, 6);
                packet.ReadXORByte(guid8, 7);
                packet.ReadXORByte(guid8, 3);
                packet.ReadXORByte(guid8, 0);

                packet.ReadSingle("FloatBC");

                packet.ReadXORByte(guid8, 1);

                packet.ReadSingle("FloatC0");

                packet.ReadXORByte(guid8, 4);
                packet.ReadXORByte(guid8, 2);

                packet.ReadSingle("FloatB8");

                packet.ReadXORByte(guid8, 5);

                packet.WriteGuid("guidG", guid8);
            }

            if (bit19C)
                packet.ReadInt32("Int19C");

            if (bitE8)
            {
                var pos = new Vector3();

                packet.ReadXORByte(guid4, 5);
                packet.ReadXORByte(guid4, 1);
                packet.ReadXORByte(guid4, 6);
                packet.ReadXORByte(guid4, 0);
                packet.ReadXORByte(guid4, 3);
                packet.ReadXORByte(guid4, 4);

                pos.X = packet.ReadSingle("FloatD8");

                packet.ReadXORByte(guid4, 2);

                pos.Y = packet.ReadSingle("FloatDC");
                pos.Z = packet.ReadSingle("FloatE0");

                packet.ReadXORByte(guid4, 7);

                packet.WriteGuid("Guid4", guid4);
                packet.AddValue("Position", pos);
            }

            if (bit1B0)
                packet.ReadByte("Byte1B0");

            packet.ReadXORByte(guid1, 5);
            packet.ReadXORByte(guid1, 7);

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

            if (bit1AC)
            {
                packet.ReadInt32("Int1A8");
                packet.ReadInt32("Int1A4");
            }

            packet.ReadXORByte(guid1, 4);

            for (var i = 0; i < counter4; ++i)
            {
                packet.ReadXORByte(guid10[i], 4);
                packet.ReadXORByte(guid10[i], 5);

                packet.ReadSingle("Float1B8", i);

                packet.ReadXORByte(guid10[i], 0);
                packet.ReadXORByte(guid10[i], 1);
                packet.ReadXORByte(guid10[i], 2);
                packet.ReadXORByte(guid10[i], 3);

                packet.ReadSingle("Float1B8", i);
                packet.ReadSingle("Float1B8", i);

                packet.ReadXORByte(guid10[i], 6);
                packet.ReadXORByte(guid10[i], 7);

                packet.WriteGuid("Guid10", guid10[i], i);
            }

            if (hasPowerData)
            {
                packet.ReadInt32("Spell power");
                packet.ReadInt32("Attack power");

                for (var i = 0; i < powerCount; ++i)
                {
                    packet.ReadUInt32E<PowerType>("Power Type", i);
                    packet.ReadInt32("Power Value", i);
                }

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

                packet.ReadInt32("Current Health");
                packet.WriteGuid("Power GUID", powerGUID);
            }

            packet.ReadXORByte(guid3, 6);
            packet.ReadXORByte(guid1, 3);

            if (bit180)
                packet.ReadByte("Byte180");

            packet.ParseBitStream(guid2, 3, 2, 1, 4, 6, 0, 7, 5);
            packet.ReadXORByte(guid3, 3);

            for (var i = 0; i < bits184; ++i)
                packet.ReadByte("Byte188", i);

            packet.ReadWoWString("StringF0", bitsF0);
            packet.ReadByte("Cast Count");

            if (bit1C4)
                packet.ReadInt32("Int1C4");

            packet.ReadXORByte(guid3, 7);

            if (bit1D8)
                packet.ReadInt32("Int1D8");

            if (bit198)
                packet.ReadSingle("Float198");

            packet.ReadInt32E<CastFlag>("Cast Flags");

            packet.ReadXORByte(guid3, 4);
            packet.ReadXORByte(guid3, 1);

            packet.ReadInt32<SpellId>("Spell ID");

            if (bit1DC)
                packet.ReadByte("Byte1DC");

            for (var i = 0; i < counter3; ++i)
            {
                packet.ReadByte("ByteED", i);
                packet.ReadInt32("IntED", i);
            }

            packet.ReadXORByte(guid1, 0);

            if (bit1A0)
                packet.ReadByte("Byte1A0");

            if (bit181)
                packet.ReadByte("Byte181");

            if (bit194)
                packet.ReadInt32("Int194");

            packet.ReadXORByte(guid1, 1);

            if (bit1C8)
                packet.ReadInt32("Int1C8");

            packet.ReadXORByte(guid3, 5);
            packet.ReadXORByte(guid3, 2);

            packet.WriteGuid("Guid8", guid1);
            packet.WriteGuid("Guid9", guid3);
            packet.WriteGuid("Guid2", guid2);
            packet.WriteGuid("Guid11", guid11);
            packet.WriteGuid("Guid5", guid5);
        }
Exemplo n.º 23
0
 public static void HandleAttackSwingError(Packet packet)
 {
     packet.ReadBitsE<AttackSwingErr>("Reason", 2);
 }
Exemplo n.º 24
0
        public static void HandleSpellGo(Packet packet)
        {
            var guid1 = new byte[8];
            var guid2 = new byte[8];
            var guid3 = new byte[8];
            var guid4 = new byte[8];
            var guid5 = new byte[8];
            var guid6 = new byte[8];
            var guid7 = new byte[8];
            byte[][] guid8;
            byte[][] guid9;
            byte[][] hitGuid;

            var bits4C = (int)packet.ReadBits(13);
            var bit1A0 = !packet.ReadBit();
            var bits74 = (int)packet.ReadBits(25);
            var bit1B4 = !packet.ReadBit();
            guid1[1] = packet.ReadBit();
            var bits174 = (int)packet.ReadBits(3);
            var bits64 = (int)packet.ReadBits(24);

            guid8 = new byte[bits64][];
            for (var i = 0; i < bits64; ++i)
            {
                guid8[i] = new byte[8];
                packet.StartBitStream(guid8[i], 2, 6, 3, 4, 5, 1, 7, 0);
            }

            var bit1B8 = !packet.ReadBit();
            var bit171 = !packet.ReadBit();
            guid1[6] = packet.ReadBit();
            var bits1A4 = (int)packet.ReadBits(20);
            guid2[3] = packet.ReadBit();
            packet.ReadBit(); // fake bit
            var hasTargetFlags = !packet.ReadBit();
            guid7[2] = packet.ReadBit();
            guid7[5] = packet.ReadBit();
            guid7[1] = packet.ReadBit();
            guid7[6] = packet.ReadBit();
            guid7[4] = packet.ReadBit();
            guid7[3] = packet.ReadBit();
            guid7[7] = packet.ReadBit();
            guid7[0] = packet.ReadBit();
            var bit1CC = !packet.ReadBit();
            guid9 = new byte[bits1A4][];
            for (var i = 0; i < bits1A4; ++i)
            {
                guid9[i] = new byte[8];
                packet.StartBitStream(guid9[i], 0, 4, 1, 6, 5, 3, 2, 7);
            }

            packet.ReadBit(); // fake bit
            guid4[6] = packet.ReadBit();
            guid4[4] = packet.ReadBit();
            guid4[1] = packet.ReadBit();
            guid4[3] = packet.ReadBit();
            guid4[2] = packet.ReadBit();
            guid4[7] = packet.ReadBit();
            guid4[0] = packet.ReadBit();
            guid4[5] = packet.ReadBit();

            if (hasTargetFlags)
                packet.ReadBitsE<TargetFlag>("Target Flags", 20);

            var bit19C = packet.ReadBit();
            guid2[7] = packet.ReadBit();
            var bit184 = !packet.ReadBit();
            var hasSrcLocation = packet.ReadBit();
            packet.ReadBit(); // fake bit
            guid3[1] = packet.ReadBit();
            guid3[3] = packet.ReadBit();
            guid3[0] = packet.ReadBit();
            guid3[7] = packet.ReadBit();
            guid3[4] = packet.ReadBit();
            guid3[2] = packet.ReadBit();
            guid3[5] = packet.ReadBit();
            guid3[6] = packet.ReadBit();
            var bitE0 = !packet.ReadBit();
            guid1[7] = packet.ReadBit();
            var bit190 = !packet.ReadBit();
            guid2[6] = packet.ReadBit();
            var bit188 = !packet.ReadBit();
            var bit18C = !packet.ReadBit();
            guid2[2] = packet.ReadBit();
            guid1[4] = packet.ReadBit();
            guid1[2] = packet.ReadBit();
            if (hasSrcLocation)
            {
                guid5[7] = packet.ReadBit();
                guid5[2] = packet.ReadBit();
                guid5[5] = packet.ReadBit();
                guid5[0] = packet.ReadBit();
                guid5[4] = packet.ReadBit();
                guid5[6] = packet.ReadBit();
                guid5[1] = packet.ReadBit();
                guid5[3] = packet.ReadBit();
            }

            guid1[5] = packet.ReadBit();

            var bits0 = 0u;
            if (bitE0)
                bits0 = packet.ReadBits(7);

            var hitCount = (int)packet.ReadBits(24);
            var hasDestLocation = packet.ReadBit();

            hitGuid = new byte[hitCount][];
            for (var i = 0; i < hitCount; ++i)
            {
                hitGuid[i] = new byte[8];
                packet.StartBitStream(hitGuid[i], 4, 3, 5, 6, 7, 0, 2, 1);
            }

            if (hasDestLocation)
            {
                guid6[7] = packet.ReadBit();
                guid6[0] = packet.ReadBit();
                guid6[2] = packet.ReadBit();
                guid6[1] = packet.ReadBit();
                guid6[6] = packet.ReadBit();
                guid6[5] = packet.ReadBit();
                guid6[3] = packet.ReadBit();
                guid6[4] = packet.ReadBit();
            }

            guid2[0] = packet.ReadBit();
            var bits160 = (int)packet.ReadBits(21);
            guid2[1] = packet.ReadBit();
            guid2[4] = packet.ReadBit();
            guid1[0] = packet.ReadBit();
            var bit170 = !packet.ReadBit();
            var bit2C = packet.ReadBit();
            var bit1C8 = !packet.ReadBit();

            for (var i = 0; i < bits74; ++i)
            {
                if (packet.ReadBits("bits22[0]", 4, i) == 11)
                    packet.ReadBits("bits22[1]", 4, i);
            }

            guid2[5] = packet.ReadBit();
            guid1[3] = packet.ReadBit();
            if (bit2C)
            {
                var bits1C = (int)packet.ReadBits("bits1C", 21);
                if (bit2C)
                {
                    for (var i = 0; i < bits1C; ++i)
                    {
                        packet.ReadInt32("IntED", i);
                        packet.ReadInt32("IntED", i);
                    }

                    packet.ReadInt32("Int18");
                    packet.ReadInt32("Int14");
                    packet.ReadInt32("Int10");
                }
            }

            if (hasDestLocation)
            {
                Vector3 pos = new Vector3();
                packet.ReadXORByte(guid6, 0);
                pos.Z = packet.ReadSingle();
                packet.ReadXORByte(guid6, 1);
                pos.Y = packet.ReadSingle();
                pos.X = packet.ReadSingle();
                packet.ReadXORByte(guid6, 7);
                packet.ReadXORByte(guid6, 4);
                packet.ReadXORByte(guid6, 3);
                packet.ReadXORByte(guid6, 2);
                packet.ReadXORByte(guid6, 5);
                packet.ReadXORByte(guid6, 6);
                packet.WriteGuid("Destination Transport GUID", guid6);
                packet.AddValue("Destination Position", pos);
            }

            if (hasSrcLocation)
            {
                Vector3 pos = new Vector3();
                packet.ReadXORByte(guid5, 6);
                pos.Z = packet.ReadSingle();
                packet.ReadXORByte(guid5, 4);
                packet.ReadXORByte(guid5, 5);
                packet.ReadXORByte(guid5, 1);
                pos.X = packet.ReadSingle();
                pos.Y = packet.ReadSingle();
                packet.ReadXORByte(guid5, 7);
                packet.ReadXORByte(guid5, 2);
                packet.ReadXORByte(guid5, 0);
                packet.ReadXORByte(guid5, 3);
                packet.WriteGuid("Source Transport GUID", guid5);
                packet.AddValue("Source Position", pos);
            }

            for (var i = 0; i < bits64; ++i)
            {
                packet.ParseBitStream(guid8[i], 7, 4, 1, 3, 5, 6, 2, 0);
                packet.WriteGuid("Guid8", guid8[i], i);
            }

            if (bit184)
                packet.ReadInt32("Int184");

            for (var i = 0; i < hitCount; ++i)
            {
                packet.ParseBitStream(hitGuid[i], 7, 1, 6, 2, 4, 3, 5, 0);
                packet.WriteGuid("Hit GUID", hitGuid[i], i);
            }

            packet.ReadXORByte(guid2, 4);
            for (var i = 0; i < bits1A4; ++i)
            {
                packet.ReadXORByte(guid9[i], 7);
                packet.ReadSingle("Float1A8", i);
                packet.ReadSingle("Float1A8", i);
                packet.ReadXORByte(guid9[i], 2);
                packet.ReadXORByte(guid9[i], 0);
                packet.ReadXORByte(guid9[i], 6);
                packet.ReadSingle("Float1A8", i);
                packet.ReadXORByte(guid9[i], 1);
                packet.ReadXORByte(guid9[i], 3);
                packet.ReadXORByte(guid9[i], 4);
                packet.ReadXORByte(guid9[i], 5);

                packet.WriteGuid("Guid6", guid9[i], i);
            }

            packet.ReadXORByte(guid2, 2);
            packet.ReadXORByte(guid7, 5);
            packet.ReadXORByte(guid7, 2);
            packet.ReadXORByte(guid7, 7);
            packet.ReadXORByte(guid7, 4);
            packet.ReadXORByte(guid7, 1);
            packet.ReadXORByte(guid7, 6);
            packet.ReadXORByte(guid7, 3);
            packet.ReadXORByte(guid7, 0);
            packet.ReadXORByte(guid3, 0);
            packet.ReadXORByte(guid3, 4);
            packet.ReadXORByte(guid3, 5);
            packet.ReadXORByte(guid3, 7);
            packet.ReadXORByte(guid3, 6);
            packet.ReadXORByte(guid3, 3);
            packet.ReadXORByte(guid3, 2);
            packet.ReadXORByte(guid3, 1);

            if (bit190)
                packet.ReadByte("Byte190");

            packet.ReadXORByte(guid2, 0);
            packet.ReadXORByte(guid2, 3);
            for (var i = 0; i < bits160; ++i)
            {
                packet.ReadInt32("IntED", i);
                packet.ReadByte("ByteED", i);
            }

            packet.ReadXORByte(guid1, 4);
            packet.ReadXORByte(guid4, 6);
            packet.ReadXORByte(guid4, 5);
            packet.ReadXORByte(guid4, 7);
            packet.ReadXORByte(guid4, 3);
            packet.ReadXORByte(guid4, 1);
            packet.ReadXORByte(guid4, 0);
            packet.ReadXORByte(guid4, 4);
            packet.ReadXORByte(guid4, 2);
            if (bit19C)
            {
                packet.ReadInt32("Int198");
                packet.ReadInt32("Int194");
            }

            packet.ReadXORByte(guid2, 1);
            packet.ReadByte("Byte40");
            packet.ReadWoWString("StringE0", bits0);
            packet.ReadInt32("Time");
            packet.ReadXORByte(guid1, 2);
            packet.ReadXORByte(guid2, 7);
            packet.ReadXORByte(guid1, 6);
            if (bit1B4)
                packet.ReadInt32("Int1B4");
            if (bit1B8)
                packet.ReadInt32("Int1B8");
            if (bit1C8)
                packet.ReadInt32("Int1C8");
            if (bit171)
                packet.ReadByte("Byte171");
            if (bit1A0)
                packet.ReadByte("Byte1A0");
            if (bit1CC)
                packet.ReadByte("Byte1CC");
            packet.ReadXORByte(guid1, 5);
            for (var i = 0; i < bits174; ++i)
                packet.ReadByte("Byte178", i);

            if (bit188)
                packet.ReadSingle("Float188");

            packet.ReadInt32<SpellId>("Spell ID");
            packet.ReadInt32("Int48");

            if (bit18C)
                packet.ReadInt32("Int18C");

            packet.ReadXORByte(guid1, 3);

            if (bit170)
                packet.ReadByte("Byte170");

            packet.ReadXORByte(guid1, 0);
            packet.ReadXORByte(guid2, 6);
            packet.ReadXORByte(guid1, 1);
            packet.ReadXORByte(guid1, 7);
            packet.ReadXORByte(guid2, 5);

            packet.WriteGuid("Caster GUID", guid1);
            packet.WriteGuid("Caster Unit GUID", guid2);
            packet.WriteGuid("Target GUID", guid3);
            packet.WriteGuid("Guid4", guid4);
            packet.WriteGuid("Guid7", guid7);
        }
Exemplo n.º 25
0
        public static void ReadMovementStats(Packet packet, params object[] idx)
        {
            packet.ReadPackedGuid128("MoverGUID", idx);

            packet.ReadUInt32("MoveIndex", idx);
            packet.ReadVector4("Position", idx);

            packet.ReadSingle("Pitch", idx);
            packet.ReadSingle("StepUpStartElevation", idx);

            var int152 = packet.ReadInt32("RemoveForcesCount", idx);
            packet.ReadInt32("MoveTime", idx);

            for (var i = 0; i < int152; i++)
                packet.ReadPackedGuid128("RemoveForcesIDs", idx, i);

            packet.ResetBitReader();

            packet.ReadBitsE<MovementFlag>("Movement Flags", 30, idx);
            packet.ReadBitsE<MovementFlagExtra>("Extra Movement Flags", 15, idx);

            var hasTransport = packet.ReadBit("Has Transport Data", idx);
            var hasFall = packet.ReadBit("Has Fall Data", idx);
            packet.ReadBit("HasSpline", idx);
            packet.ReadBit("HeightChangeFailed", idx);
            packet.ReadBit("RemoteTimeValid", idx);

            if (hasTransport)
            {
                packet.ReadPackedGuid128("TransportGuid", idx);
                packet.ReadVector4("TransportPosition", idx);
                packet.ReadByte("TransportSeat", idx);
                packet.ReadInt32("TransportMoveTime", idx);

                packet.ResetBitReader();

                var hasPrevMoveTime = packet.ReadBit("HasPrevMoveTime", idx);
                var hasVehicleRecID = packet.ReadBit("HasVehicleRecID", idx);

                if (hasPrevMoveTime)
                    packet.ReadUInt32("PrevMoveTime", idx);

                if (hasVehicleRecID)
                    packet.ReadUInt32("VehicleRecID", idx);
            }

            if (hasFall)
            {
                packet.ReadUInt32("FallTime", idx);
                packet.ReadSingle("JumpVelocity", idx);

                packet.ResetBitReader();

                var bit20 = packet.ReadBit("HasFallDirection", idx);
                if (bit20)
                {
                    packet.ReadVector2("Direction", idx);
                    packet.ReadSingle("HorizontalSpeed", idx);
                }
            }
        }
Exemplo n.º 26
0
        public static void HandleMovementSetPitch422(Packet packet)
        {
            var guidBytes = new byte[8];
            guidBytes[1] = packet.ReadBit();
            guidBytes[6] = packet.ReadBit();
            guidBytes[7] = packet.ReadBit();
            guidBytes[3] = packet.ReadBit();

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

            guidBytes[5] = packet.ReadBit();
            guidBytes[2] = packet.ReadBit();
            guidBytes[0] = packet.ReadBit();

            packet.ReadBit("HasSplineData");

            guidBytes[4] = packet.ReadBit();

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

            var splineElevation = packet.ReadBit("SplineElevation"); // OR Swimming
            var onTransport = packet.ReadBit("OnTransport");

            var transportBytes = new byte[8];
            var hasInterpolatedMovement = false;
            var time3 = false;
            if (onTransport)
            {
                transportBytes = packet.StartBitStream(0, 6, 2, 5, 4, 1, 3, 7);
                hasInterpolatedMovement = packet.ReadBit("HasInterpolatedMovement");
                time3 = packet.ReadBit("HasTime3");
            }

            var swimming = packet.ReadBit("HasPitch");  // OR SplineElevation
            var interPolatedTurning = packet.ReadBit("HasFallData");
            var jumping = false;
            if (interPolatedTurning)
                jumping = packet.ReadBit("HasFallDirection");

            packet.ReadVector3("Position");
            packet.ReadInt32("Time");
            packet.ReadSingle("Orientation");

            packet.ReadXORByte(guidBytes, 1);
            packet.ReadXORByte(guidBytes, 4);

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

            if (onTransport)
            {
                packet.ReadByte("Transport Seat");
                packet.ReadSingle("Transport Orientation");
                packet.ReadVector3("Transport Position");
                packet.ReadInt32("Transport Time");
                if (hasInterpolatedMovement)
                    packet.ReadInt32("Transport Time 2");

                packet.ReadXORByte(transportBytes, 3);
                packet.ReadXORByte(transportBytes, 6);

                if (time3)
                    packet.ReadInt32("Transport Time 3");

                packet.ReadXORByte(transportBytes, 7);
                packet.ReadXORByte(transportBytes, 5);
                packet.ReadXORByte(transportBytes, 2);
                packet.ReadXORByte(transportBytes, 1);
                packet.ReadXORByte(transportBytes, 0);
                packet.ReadXORByte(transportBytes, 4);

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

            if (swimming)
                packet.ReadSingle("Swim Pitch");

            packet.ReadXORByte(guidBytes, 5);

            if (interPolatedTurning)
            {
                packet.ReadInt32("Time Fallen");
                packet.ReadSingle("Fall Start Velocity");
                if (jumping)
                {
                    packet.ReadSingle("Jump Velocity");
                    packet.ReadSingle("Jump Sin");
                    packet.ReadSingle("Jump Cos");

                }
            }

            packet.ReadXORByte(guidBytes, 0);
            packet.ReadXORByte(guidBytes, 3);
            packet.ReadXORByte(guidBytes, 6);
            packet.ReadXORByte(guidBytes, 7);
            packet.ReadXORByte(guidBytes, 2);

            packet.WriteGuid("Guid", guidBytes);
        }
Exemplo n.º 27
0
        public static void HandleCastSpell(Packet packet)
        {
            var guid1 = new byte[8];
            var guid2 = new byte[8];
            var guid3 = new byte[8];
            var guid4 = new byte[8];
            var guid5 = new byte[8];
            var guid6 = new byte[8];

            var bit158 = false;
            var bit154 = false;
            var bit14C = false;
            var bit120 = false;
            var bit17C = false;
            var bit178 = false;
            var bit180 = false;
            var bit110 = false;
            var bit198 = false;
            var bit160 = false;

            var hasTargetMask = !packet.ReadBit();
            var hasCastCount = !packet.ReadBit();
            var bit18 = !packet.ReadBit();
            var hasSpellId = !packet.ReadBit();

            var counter = packet.ReadBits(2);

            packet.ReadBit(); // fake bit

            var bitFC = !packet.ReadBit();

            packet.ReadBit(); // fake bit

            var bit70 = packet.ReadBit();
            var bitF8 = !packet.ReadBit();
            var bit78 = !packet.ReadBit();
            var bit50 = packet.ReadBit();
            var bit1A0 = packet.ReadBit();
            var bit1C = !packet.ReadBit();

            for (var i = 0; i < counter; ++i)
                packet.ReadBits("unk value0", 2, i);

            var bits188 = 0u;
            if (bit1A0)
            {
                bit198 = !packet.ReadBit();
                guid1[3] = packet.ReadBit();
                bit180 = !packet.ReadBit();
                bits188 = packet.ReadBits(22);
                bit17C = packet.ReadBit();
                var bit108 = !packet.ReadBit();

                packet.StartBitStream(guid1, 6, 0);

                if (bit108)
                    packet.ReadBits("bits108", 30);

                bit160 = !packet.ReadBit();
                var bit184 = packet.ReadBit();

                packet.StartBitStream(guid1, 2, 7, 1, 5);

                bit120 = !packet.ReadBit();

                if (bit17C)
                    bit178 = packet.ReadBit();

                var bit19C = packet.ReadBit();
                guid1[4] = packet.ReadBit();
                bit158 = packet.ReadBit();

                if (bit158)
                {
                    bit14C = packet.ReadBit("bit14C");
                    packet.StartBitStream(guid2, 6, 3, 1, 0, 4);
                    bit154 = packet.ReadBit();
                    packet.StartBitStream(guid2, 7, 2, 5);
                }

                var bit185 = packet.ReadBit();
                var bit10C = !packet.ReadBit();

                if (bit10C)
                    packet.ReadBits("bits10C", 13);

                bit110 = !packet.ReadBit();
            }

            if (hasTargetMask)
                packet.ReadBitsE<TargetFlag>("Target Flags", 20);

            packet.StartBitStream(guid3, 2, 1, 3, 6, 5, 4, 7, 0);

            if (bit70)
                packet.StartBitStream(guid4, 3, 6, 1, 0, 4, 5, 7, 2);

            if (bit50)
                packet.StartBitStream(guid5, 6, 3, 5, 2, 0, 4, 1, 7);

            packet.StartBitStream(guid6, 5, 0, 2, 3, 1, 4, 6, 7);

            var bits2F7 = 0u;
            if (bit78)
                bits2F7 = packet.ReadBits("bits2F7", 7);

            if (bit1C)
                packet.ReadBits("bits2F5", 5);

            for (var i = 0; i < counter; ++i)
            {
                packet.ReadInt32("Int1AC", i);
                packet.ReadInt32("Int1AC", i);
            }

            if (bit1A0)
            {
                if (bit158)
                {
                    packet.ReadXORByte(guid2, 5);

                    if (bit154)
                        packet.ReadInt32("Int150");

                    packet.ReadSingle("Float13C");
                    packet.ReadSingle("Float134");

                    if (bit14C)
                        packet.ReadInt32("Int148");

                    packet.ParseBitStream(guid2, 7, 2, 0);

                    packet.ReadInt32("Int144");

                    packet.ParseBitStream(guid2, 1, 6, 3);

                    packet.ReadSingle("Float130");

                    packet.ReadXORByte(guid2, 4);

                    packet.ReadByte("Byte140");
                    packet.ReadSingle("Float138");

                    packet.WriteGuid("Guid2", guid2);
                }

                if (bit120)
                    packet.ReadSingle("Float120");

                packet.ParseBitStream(guid1, 6, 4);

                if (bit17C)
                {
                    packet.ReadInt32("Int164");

                    if (bit178)
                    {
                        packet.ReadSingle("Float170");
                        packet.ReadSingle("Float16C");
                        packet.ReadSingle("Float174");
                    }

                    packet.ReadSingle("Float168");
                }

                packet.ParseBitStream(guid1, 3, 2);

                if (bit160)
                    packet.ReadSingle("Float160");

                if (bit198)
                    packet.ReadInt32("Int198");

                packet.ReadSingle("Float11C");

                if (bit110)
                    packet.ReadInt32("Int110");

                packet.ParseBitStream(guid1, 5, 0);

                packet.ReadSingle("Float114");
                packet.ReadSingle("Float118");

                for (var i = 0; i < bits188; ++i)
                    packet.ReadInt32("IntEB", i);

                if (bit180)
                    packet.ReadSingle("Float180");

                packet.ParseBitStream(guid1, 7, 1);

                packet.WriteGuid("Guid1", guid1);
            }

            if (hasSpellId)
                packet.ReadInt32<SpellId>("Spell ID");

            if (bit50)
            {
                packet.ReadXORByte(guid5, 7);
                packet.ReadSingle("Float40");
                packet.ParseBitStream(guid5, 6, 0);
                packet.ReadSingle("Float44");
                packet.ParseBitStream(guid5, 1, 4);
                packet.ReadSingle("Float48");
                packet.ParseBitStream(guid5, 3, 2, 5);
                packet.WriteGuid("Guid5", guid5);
            }

            if (bit70)
            {
                packet.ParseBitStream(guid4, 5, 4, 3, 1);
                packet.ReadSingle("Float68");
                packet.ReadSingle("Float64");
                packet.ParseBitStream(guid4, 2, 6, 7);
                packet.ReadSingle("Float60");
                packet.ReadXORByte(guid4, 0);

                packet.WriteGuid("Guid4", guid4);
            }

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

            if (hasCastCount)
                packet.ReadByte("Cast Count");

            if (bitF8)
                packet.ReadSingle("FloatF8");

            if (bit78)
                packet.ReadWoWString("string2F7", bits2F7);

            if (bit18)
                packet.ReadInt32("Int18");

            if (bitFC)
                packet.ReadSingle("FloatFC");

            packet.WriteGuid("Guid6", guid6);
            packet.WriteGuid("Guid3", guid3);
        }
Exemplo n.º 28
0
        public static void HandleSpellStart(Packet packet)
        {
            var guid1 = new byte[8];
            var guid2 = new byte[8];
            var guid3 = new byte[8];
            var guid4 = new byte[8];
            var guid6 = new byte[8];
            var guid7 = new byte[8];
            var guid8 = new byte[8];
            byte[][] guid9;
            byte[][] guid10;
            byte[][] guid11;

            packet.ReadInt32<SpellId>("Spell ID");
            packet.ReadByte("Byte20");
            packet.ReadInt32("Int30");
            packet.ReadInt32("Int28");

            guid1[2] = packet.ReadBit();

            var bitC0 = !packet.ReadBit();
            var bit164 = !packet.ReadBit();
            var bits44 = (int)packet.ReadBits(24);

            guid2[2] = packet.ReadBit();
            var bits184 = (int)packet.ReadBits(20);
            guid2[3] = packet.ReadBit();
            var bit17C = packet.ReadBit();
            guid2[4] = packet.ReadBit();
            guid1[0] = packet.ReadBit();

            guid9 = new byte[bits184][];
            for (var i = 0; i < bits184; ++i)
            {
                guid9[i] = new byte[8];
                packet.StartBitStream(guid9[i], 0, 3, 2, 4, 1, 5, 7, 6);
            }

            guid2[5] = packet.ReadBit();
            guid1[5] = packet.ReadBit();
            guid1[1] = packet.ReadBit();
            packet.ReadBit(); // fake bit
            var bits54 = (int)packet.ReadBits(25);
            var bit194 = !packet.ReadBit();
            var bit170 = !packet.ReadBit();
            var bit180 = !packet.ReadBit();
            var hasTargetFlags = !packet.ReadBit();
            guid4[3] = packet.ReadBit();
            guid4[1] = packet.ReadBit();
            guid4[6] = packet.ReadBit();
            guid4[2] = packet.ReadBit();
            guid4[7] = packet.ReadBit();
            guid4[5] = packet.ReadBit();
            guid4[0] = packet.ReadBit();
            guid4[4] = packet.ReadBit();
            var bit1A8 = !packet.ReadBit();
            var bits34 = (int)packet.ReadBits(24);

            guid10 = new byte[bits44][];
            for (var i = 0; i < bits44; ++i)
            {
                guid10[i] = new byte[8];
                packet.StartBitStream(guid10[i], 2, 1, 5, 6, 7, 0, 4, 3);
            }

            var bits140 = (int)packet.ReadBits(21);

            var bit98 = packet.ReadBit();
            if (bit98)
                packet.StartBitStream(guid6, 1, 2, 5, 3, 4, 6, 0, 7);

            guid11 = new byte[bits34][];
            for (var i = 0; i < bits34; ++i)
            {
                guid11[i] = new byte[8];
                packet.StartBitStream(guid11[i], 7, 3, 1, 4, 0, 5, 6, 2);
            }

            var bit198 = !packet.ReadBit();
            var bit1AC = !packet.ReadBit();
            guid2[7] = packet.ReadBit();
            var bits154 = (int)packet.ReadBits(3);
            guid2[6] = packet.ReadBit();
            packet.ReadBit(); // fake bit
            guid3[6] = packet.ReadBit();
            guid3[1] = packet.ReadBit();
            guid3[5] = packet.ReadBit();
            guid3[0] = packet.ReadBit();
            guid3[7] = packet.ReadBit();
            guid3[3] = packet.ReadBit();
            guid3[2] = packet.ReadBit();
            guid3[4] = packet.ReadBit();
            var bit168 = !packet.ReadBit();

            var bitB8 = packet.ReadBit();
            if (bitB8)
                packet.StartBitStream(guid7, 3, 1, 4, 5, 6, 0, 7, 2);

            guid1[3] = packet.ReadBit();
            guid2[1] = packet.ReadBit();

            if (hasTargetFlags)
                packet.ReadBitsE<TargetFlag>("Target Flags", 20);

            for (var i = 0; i < bits54; ++i)
            {
                var bits136 = packet.ReadBits(4);

                if (bits136 == 11)
                    packet.ReadBits("bits140", 4, i);
            }

            var bit151 = !packet.ReadBit();
            var bit16C = !packet.ReadBit();
            packet.ReadBits("bits2C", 13);
            guid2[0] = packet.ReadBit();
            packet.ReadBit(); // fake bit
            guid8[7] = packet.ReadBit();
            guid8[1] = packet.ReadBit();
            guid8[0] = packet.ReadBit();
            guid8[4] = packet.ReadBit();
            guid8[3] = packet.ReadBit();
            guid8[5] = packet.ReadBit();
            guid8[6] = packet.ReadBit();
            guid8[2] = packet.ReadBit();
            guid1[7] = packet.ReadBit();
            guid1[6] = packet.ReadBit();

            var bitsC0 = 0u;
            if (bitC0)
                bitsC0 = packet.ReadBits(7);

            var bit150 = !packet.ReadBit();

            guid1[4] = packet.ReadBit();

            for (var i = 0; i < bits44; ++i)
            {
                packet.ParseBitStream(guid10[i], 0, 1, 7, 4, 3, 6, 2, 5);
                packet.WriteGuid("Guid9", guid10[i], i);
            }

            if (bitB8)
            {
                packet.ReadSingle("FloatAC");
                packet.ReadSingle("FloatB0");
                packet.ReadXORByte(guid7, 0);
                packet.ReadXORByte(guid7, 1);
                packet.ReadXORByte(guid7, 2);
                packet.ReadXORByte(guid7, 7);
                packet.ReadXORByte(guid7, 5);
                packet.ReadXORByte(guid7, 3);
                packet.ReadXORByte(guid7, 4);
                packet.ReadXORByte(guid7, 6);
                packet.ReadSingle("FloatA8");
                packet.WriteGuid("Guid7", guid7);
            }

            for (var i = 0; i < bits184; ++i)
            {
                packet.ReadXORByte(guid9[i], 4);
                packet.ReadXORByte(guid9[i], 1);
                packet.ReadXORByte(guid9[i], 3);
                packet.ReadXORByte(guid9[i], 5);
                packet.ReadSingle("Float188");
                packet.ReadSingle("Float188");
                packet.ReadXORByte(guid9[i], 0);
                packet.ReadSingle("Float188");
                packet.ReadXORByte(guid9[i], 7);
                packet.ReadXORByte(guid9[i], 2);
                packet.ReadXORByte(guid9[i], 6);
                packet.WriteGuid("Guid9", guid9[i], i);
            }

            if (bit98)
            {
                packet.ReadXORByte(guid6, 1);
                packet.ReadSingle("Float88");
                packet.ReadXORByte(guid6, 7);
                packet.ReadXORByte(guid6, 0);
                packet.ReadSingle("Float8C");
                packet.ReadXORByte(guid6, 3);
                packet.ReadXORByte(guid6, 6);
                packet.ReadSingle("Float90");
                packet.ReadXORByte(guid6, 2);
                packet.ReadXORByte(guid6, 4);
                packet.ReadXORByte(guid6, 5);
                packet.WriteGuid("Guid6", guid6);
            }

            if (bit180)
                packet.ReadByte("Byte180");
            packet.ReadXORByte(guid2, 6);

            for (var i = 0; i < bits34; ++i)
            {
                packet.ParseBitStream(guid11[i], 0, 7, 2, 3, 5, 1, 4, 6);
                packet.WriteGuid("Guid11", guid11[i], i);
            }

            packet.ReadXORByte(guid8, 0);
            packet.ReadXORByte(guid8, 1);
            packet.ReadXORByte(guid8, 3);
            packet.ReadXORByte(guid8, 7);
            packet.ReadXORByte(guid8, 5);
            packet.ReadXORByte(guid8, 2);
            packet.ReadXORByte(guid8, 4);
            packet.ReadXORByte(guid8, 6);
            packet.ReadXORByte(guid1, 4);
            if (bit1A8)
                packet.ReadInt32("Int1A8");
            for (var i = 0; i < bits140; ++i)
            {
                packet.ReadInt32("IntED", i);
                packet.ReadByte("ByteED", i);
            }

            if (bit198)
                packet.ReadInt32("Int198");

            if (bit164)
                packet.ReadInt32("Int164");

            packet.ReadXORByte(guid4, 1);
            packet.ReadXORByte(guid4, 6);
            packet.ReadXORByte(guid4, 5);
            packet.ReadXORByte(guid4, 4);
            packet.ReadXORByte(guid4, 2);
            packet.ReadXORByte(guid4, 0);
            packet.ReadXORByte(guid4, 7);
            packet.ReadXORByte(guid4, 3);
            packet.ReadXORByte(guid3, 0);
            packet.ReadXORByte(guid3, 5);
            packet.ReadXORByte(guid3, 4);
            packet.ReadXORByte(guid3, 2);
            packet.ReadXORByte(guid3, 7);
            packet.ReadXORByte(guid3, 6);
            packet.ReadXORByte(guid3, 1);
            packet.ReadXORByte(guid3, 3);
            if (bit194)
                packet.ReadInt32("Int194");
            packet.ReadXORByte(guid2, 5);
            packet.ReadXORByte(guid2, 2);
            packet.ReadWoWString("StringC0", bitsC0);
            packet.ReadXORByte(guid2, 7);
            if (bit1AC)
                packet.ReadByte("Byte1AC");
            if (bit170)
                packet.ReadByte("Byte170");
            packet.ReadXORByte(guid1, 6);
            packet.ReadXORByte(guid2, 3);
            if (bit17C)
            {
                packet.ReadInt32("Int174");
                packet.ReadInt32("Int178");
            }

            if (bit151)
                packet.ReadByte("Byte151");
            for (var i = 0; i < bits154; ++i)
                packet.ReadByte("Byte158", i);

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

            if (bit16C)
                packet.ReadInt32("Int16C");

            packet.ReadXORByte(guid1, 0);

            if (bit168)
                packet.ReadSingle("Float168");

            packet.ReadXORByte(guid2, 1);
            packet.ReadXORByte(guid2, 4);
            packet.ReadXORByte(guid1, 3);

            if (bit150)
                packet.ReadByte("Byte150");

            packet.ReadXORByte(guid1, 2);
            packet.ReadXORByte(guid2, 0);
            packet.ReadXORByte(guid1, 7);

            packet.WriteGuid("Guid1", guid1);
            packet.WriteGuid("Guid2", guid2);
            packet.WriteGuid("Guid3", guid3);
            packet.WriteGuid("Guid4", guid4);
            packet.WriteGuid("Guid8", guid8);
        }
Exemplo n.º 29
0
        public static void HandleSpellStart(Packet packet)
        {
            var guid1 = new byte[8];
            var guid2 = new byte[8];
            var guid3 = new byte[8];
            var guid4 = new byte[8];
            var guid5 = new byte[8];
            byte[][] guid6;
            byte[][] guid7;
            var guid8 = new byte[8];
            var guid9 = new byte[8];
            var powerGUID = new byte[8];
            byte[][] guid11;

            packet.ReadBit(); // fake bit

            guid1[4] = packet.ReadBit();

            var bit198 = !packet.ReadBit();
            var bit170 = !packet.ReadBit();
            var bit168 = !packet.ReadBit();

            packet.ReadBit(); // fake bit

            guid2[7] = packet.ReadBit();

            packet.StartBitStream(guid3, 2, 5, 6, 1, 0, 3, 7, 4);

            guid1[1] = packet.ReadBit();

            var bit151 = !packet.ReadBit();

            packet.StartBitStream(guid4, 7, 0, 1, 3, 4, 2, 5, 6);

            guid2[2] = packet.ReadBit();

            var hasTargetFlags = !packet.ReadBit();
            var bit180 = !packet.ReadBit();

            guid1[5] = packet.ReadBit();

            var bit1AC = !packet.ReadBit();
            var bits140 = (int)packet.ReadBits(21);
            var bit16C = !packet.ReadBit();
            var bits2C = (int)packet.ReadBits("bits2C", 13);
            var bit17C = packet.ReadBit();
            var bit98 = packet.ReadBit();

            guid2[3] = packet.ReadBit();

            var counter2 = packet.ReadBits(20);

            guid2[1] = packet.ReadBit();
            guid1[0] = packet.ReadBit();

            packet.StartBitStream(guid2, 6, 5);

            var bit194 = !packet.ReadBit();
            var counter1 = packet.ReadBits(24);

            guid1[3] = packet.ReadBit();

            var bit1A8 = !packet.ReadBit();
            var bitC0 = !packet.ReadBit();

            if (hasTargetFlags)
                packet.ReadBitsE<TargetFlag>("Target Flags", 20);

            guid1[2] = packet.ReadBit();

            if (bit98)
                packet.StartBitStream(guid5, 2, 4, 6, 3, 7, 5, 1, 0);

            guid6 = new byte[counter1][];
            for (var i = 0; i < counter1; ++i)
            {
                guid6[i] = new byte[8];
                packet.StartBitStream(guid6[i], 6, 7, 0, 2, 5, 4, 1, 3);
            }

            var bitB8 = packet.ReadBit();

            packet.ReadBit(); // fake bit

            guid7 = new byte[counter2][];
            for (var i = 0; i < counter2; ++i)
            {
                guid7[i] = new byte[8];
                packet.StartBitStream(guid7[i], 0, 4, 3, 1, 6, 7, 2, 5);
            }

            packet.StartBitStream(guid8, 4, 6, 7, 0, 1, 2, 3, 5);

            var bit164 = !packet.ReadBit();
            if (bitB8)
                packet.StartBitStream(guid9, 4, 1, 7, 3, 0, 5, 6, 2);

            var hasPowerData = packet.ReadBit();
            var counter3 = packet.ReadBits(24);

            var PowerTypeCount = 0u;
            if (hasPowerData)
            {
                packet.StartBitStream(powerGUID, 7, 4, 0, 6);
                PowerTypeCount = packet.ReadBits(21);
                packet.StartBitStream(powerGUID, 5, 2, 3, 1);
            }

            guid11 = new byte[counter3][];
            for (var i = 0; i < counter3; ++i)
            {
                guid11[i] = new byte[8];
                packet.StartBitStream(guid11[i], 4, 0, 2, 7, 6, 1, 3, 5);
            }

            packet.StartBitStream(guid2, 0, 4);

            guid1[6] = packet.ReadBit();

            var bits154 = packet.ReadBits(3);
            var bit150 = !packet.ReadBit();
            guid1[7] = packet.ReadBit();
            var counter4 = packet.ReadBits(25);

            var bitsC0 = 0u;
            if (bitC0)
                bitsC0 = packet.ReadBits(7);

            for (var i = 0; i < counter4; ++i)
            {
                if (packet.ReadBits("bits22[0]", 4, i) == 11)
                    packet.ReadBits("bits22[1]", 4, i);
            }

            packet.ReadXORByte(guid1, 7);

            if (hasPowerData)
            {
                packet.ReadXORByte(powerGUID, 3);
                packet.ReadXORByte(powerGUID, 5);
                packet.ReadXORByte(powerGUID, 1);
                packet.ReadXORByte(powerGUID, 4);

                for (var i = 0; i < PowerTypeCount; ++i)
                {
                    packet.ReadUInt32E<PowerType>("Power Type", i);
                    packet.ReadInt32("Power Value", i);
                }

                packet.ReadXORByte(powerGUID, 6);
                packet.ReadXORByte(powerGUID, 2);
                packet.ReadInt32("Current Health");
                packet.ReadInt32("Attack power");
                packet.ReadInt32("Spell power");
                packet.ReadXORByte(powerGUID, 7);
                packet.ReadXORByte(powerGUID, 0);

                packet.WriteGuid("Power GUID", powerGUID);
            }

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

            for (var i = 0; i < counter1; ++i)
            {
                packet.ParseBitStream(guid6[i], 7, 1, 0, 4, 2, 5, 6, 3);
                packet.WriteGuid("Guid6", guid6[i], i);
            }

            if (bit98)
            {
                packet.ReadXORByte(guid5, 2);
                packet.ReadXORByte(guid5, 6);
                packet.ReadXORByte(guid5, 0);
                packet.ReadXORByte(guid5, 3);
                packet.ReadXORByte(guid5, 4);

                packet.ReadSingle("Float8C");
                packet.ReadSingle("Float88");
                packet.ReadSingle("Float90");

                packet.ReadXORByte(guid5, 7);
                packet.ReadXORByte(guid5, 5);
                packet.ReadXORByte(guid5, 1);

                packet.WriteGuid("Guid10", guid5);
            }

            packet.ParseBitStream(guid4, 0, 6, 5, 7, 3, 2, 4, 1);
            packet.ReadXORByte(guid2, 3);

            for (var i = 0; i < counter3; ++i)
            {
                packet.ParseBitStream(guid11[i], 6, 0, 7, 1, 2, 5, 3, 4);

                packet.WriteGuid("Guid12", guid11[i], i);
            }

            if (bit168)
                packet.ReadSingle("Float168");

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

            packet.ReadXORByte(guid1, 3);

            if (bit1AC)
                packet.ReadByte("Byte1AC");

            packet.ReadXORByte(guid2, 4);

            if (bit198)
                packet.ReadInt32("Int198");

            if (bit151)
                packet.ReadByte("Byte151");

            packet.ReadXORByte(guid2, 0);
            packet.ReadXORByte(guid1, 4);

            if (bitB8)
            {
                packet.ReadSingle("FloatB0");

                packet.ReadXORByte(guid9, 4);

                packet.ReadSingle("FloatAC");
                packet.ReadSingle("FloatA8");

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

                packet.WriteGuid("Guid9", guid9);
            }

            packet.ReadXORByte(guid2, 2);
            packet.ReadXORByte(guid1, 6);

            if (bit150)
                packet.ReadByte("Byte150");

            packet.ReadXORByte(guid1, 1);

            packet.ReadInt32("Int30");

            for (var i = 0; i < counter2; ++i)
            {
                packet.ReadXORByte(guid7[i], 2);

                packet.ReadSingle("Float188", i);

                packet.ReadXORByte(guid7[i], 6);

                packet.ReadSingle("Float188", i);
                packet.ReadSingle("Float188", i);

                packet.ReadXORByte(guid7[i], 4);
                packet.ReadXORByte(guid7[i], 1);
                packet.ReadXORByte(guid7[i], 3);
                packet.ReadXORByte(guid7[i], 0);
                packet.ReadXORByte(guid7[i], 7);
                packet.ReadXORByte(guid7[i], 5);

                packet.WriteGuid("Guid7", guid7[i], i);
            }

            if (bit17C)
            {
                packet.ReadInt32("Int178");
                packet.ReadInt32("Int174");
            }

            packet.ReadInt32<SpellId>("Spell ID");

            if (bit16C)
                packet.ReadInt32("Int16C");

            packet.ReadXORByte(guid2, 6);

            if (bit1A8)
                packet.ReadInt32("Int1A8");

            for (var i = 0; i < bits140; ++i)
            {
                packet.ReadByteE<PowerType>("Power type", i);
                packet.ReadInt32("Value", i);
            }

            for (var i = 0; i < bits154; ++i)
                packet.ReadByte("Byte158", i);

            packet.ReadWoWString("StringC0", bitsC0);

            packet.ReadXORByte(guid2, 1);

            if (bit170)
                packet.ReadByte("Byte170");

            if (bit164)
                packet.ReadInt32("Int164");

            if (bit180)
                packet.ReadByte("Byte180");

            packet.ReadInt32("Int28");
            packet.ReadXORByte(guid1, 5);

            if (bit194)
                packet.ReadInt32("Int194");

            packet.ReadXORByte(guid1, 0);
            packet.ReadXORByte(guid2, 7);
            packet.ReadXORByte(guid2, 5);
            packet.ReadXORByte(guid1, 2);

            packet.ReadByte("Byte20");

            packet.WriteGuid("Guid1", guid1);
            packet.WriteGuid("Guid3", guid3);
            packet.WriteGuid("Guid4", guid4);
            packet.WriteGuid("Guid5", guid2);
        }
Exemplo n.º 30
0
        private static MovementInfo ReadMovementInfo420(Packet packet, object index)
        {
            var info = new MovementInfo
            {
                Flags = packet.ReadBitsE<MovementFlag>("Movement Flags", 30, index)
            };

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

            var onTransport = packet.ReadBit("OnTransport", index);
            var hasInterpolatedMovement = false;
            var time3 = false;
            if (onTransport)
            {
                hasInterpolatedMovement = packet.ReadBit("HasInterpolatedMovement", index);
                time3 = packet.ReadBit("Time3", index);
            }

            var swimming = packet.ReadBit("Swimming", index);
            var interPolatedTurning = packet.ReadBit("InterPolatedTurning", index);

            var jumping = false;
            if (interPolatedTurning)
                jumping = packet.ReadBit("Jumping", index);

            var splineElevation = packet.ReadBit("SplineElevation", index);

            info.HasSplineData = packet.ReadBit("HasSplineData", index);

            packet.ResetBitReader(); // reset bitreader

            packet.ReadGuid("GUID 2", index);

            packet.ReadInt32("Time", index);

            info.Position = packet.ReadVector3("Position", index);
            info.Orientation = packet.ReadSingle("Orientation", index);

            if (onTransport)
            {
                info.TransportGuid = packet.ReadGuid("Transport GUID", index);
                info.TransportOffset = packet.ReadVector4("Transport Position", index);
                packet.ReadByte("Transport Seat", index);
                packet.ReadInt32("Transport Time", index);
                if (hasInterpolatedMovement)
                    packet.ReadInt32("Transport Time 2", index);
                if (time3)
                    packet.ReadInt32("Transport Time 3", index);
            }
            if (swimming)
                packet.ReadSingle("Swim Pitch", index);

            if (interPolatedTurning)
            {
                packet.ReadInt32("Time Fallen", index);
                packet.ReadSingle("Fall Start Velocity", index);
                if (jumping)
                {
                    packet.ReadSingle("Jump Sin", index);
                    packet.ReadSingle("Jump Cos", index);
                    packet.ReadSingle("Jump Velocity", index);

                }
            }
            if (splineElevation)
                packet.ReadSingle("Spline Elevation", index);

            return info;
        }