当前位置: 首页>>代码示例>>C#>>正文


C# Packet.ReadPackedVector3方法代码示例

本文整理汇总了C#中WowPacketParser.Misc.Packet.ReadPackedVector3方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.ReadPackedVector3方法的具体用法?C# Packet.ReadPackedVector3怎么用?C# Packet.ReadPackedVector3使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WowPacketParser.Misc.Packet的用法示例。


在下文中一共展示了Packet.ReadPackedVector3方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReadSplineMovement422

        private static void ReadSplineMovement422(ref Packet packet, Vector3 pos)
        {
            var flags = packet.ReadEnum<SplineFlag422>("Spline Flags", TypeCode.Int32);

            if (flags.HasAnyFlag(SplineFlag422.AnimationTier))
            {
                packet.ReadEnum<MovementAnimationState>("Animation State", TypeCode.Byte);
                packet.ReadInt32("Asynctime in ms"); // Async-time in ms
            }

            packet.ReadInt32("Move Time");

            if (flags.HasAnyFlag(SplineFlag422.Trajectory))
            {
                packet.ReadSingle("Vertical Speed");
                packet.ReadInt32("Unk Int32 2");
            }

            var waypoints = packet.ReadInt32("Waypoints");

            if (flags.HasAnyFlag(SplineFlag422.UsePathSmoothing))
            {
                for (var i = 0; i < waypoints; i++)
                    packet.ReadVector3("Waypoint", i);
            }
            else
            {
                var newpos = packet.ReadVector3("Waypoint Endpoint");

                var mid = new Vector3();
                mid.X = (pos.X + newpos.X) * 0.5f;
                mid.Y = (pos.Y + newpos.Y) * 0.5f;
                mid.Z = (pos.Z + newpos.Z) * 0.5f;

                for (var i = 1; i < waypoints; i++)
                {
                    var vec = packet.ReadPackedVector3();
                    vec.X += mid.X;
                    vec.Y += mid.Y;
                    vec.Z += mid.Z;

                    packet.WriteLine("[" + i + "]" + " Waypoint: " + vec);
                }
            }
        }
开发者ID:eddyb,项目名称:WowPacketParser,代码行数:45,代码来源:MovementHandler.cs

示例2: ReadSplineMovement510

        private static void ReadSplineMovement510(Packet packet, Vector3 pos)
        {
            var flags = packet.ReadInt32E<SplineFlag434>("Spline Flags");

            if (flags.HasAnyFlag(SplineFlag434.Animation))
            {
                packet.ReadByteE<MovementAnimationState>("Animation State");
                packet.ReadInt32("Asynctime in ms"); // Async-time in ms
            }

            packet.ReadInt32("Move Time");

            if (flags.HasAnyFlag(SplineFlag434.Parabolic))
            {
                packet.ReadSingle("Vertical Speed");
                packet.ReadInt32("Async-time in ms");
            }

            var waypoints = packet.ReadInt32("Waypoints");

            if (flags.HasAnyFlag(SplineFlag434.UncompressedPath))
            {
                for (var i = 0; i < waypoints; i++)
                    packet.ReadVector3("Waypoint", i);
            }
            else
            {
                var newpos = packet.ReadVector3("Waypoint Endpoint");

                var mid = new Vector3
                {
                    X = (pos.X + newpos.X)*0.5f,
                    Y = (pos.Y + newpos.Y)*0.5f,
                    Z = (pos.Z + newpos.Z)*0.5f
                };

                if (waypoints != 1)
                {
                    var vec = packet.ReadPackedVector3();
                    vec.X += mid.X;
                    vec.Y += mid.Y;
                    vec.Z += mid.Z;
                    packet.AddValue("Waypoint: ", vec, 0);

                    if (waypoints > 2)
                    {
                        for (var i = 1; i < waypoints - 1; ++i)
                        {
                            vec = packet.ReadPackedVector3();
                            vec.X += mid.X;
                            vec.Y += mid.Y;
                            vec.Z += mid.Z;

                            packet.AddValue("Waypoint", vec, i);
                        }
                    }
                }
            }

            var unkLoopCounter = packet.ReadUInt16("Unk UInt16");
            if (unkLoopCounter > 1)
            {
                packet.ReadSingle("Unk Float 1");
                packet.ReadUInt16("Unk UInt16 1");
                packet.ReadUInt16("Unk UInt16 2");
                packet.ReadSingle("Unk Float 2");
                packet.ReadUInt16("Unk UInt16 3");

                for (var i = 0; i < unkLoopCounter; i++)
                {
                    packet.ReadUInt16("Unk UInt16 1", i);
                    packet.ReadUInt16("Unk UInt16 2", i);
                }
            }
        }
开发者ID:DrEhsan,项目名称:WowPacketParser,代码行数:75,代码来源:MovementHandler.cs

示例3: HandleMonsterMove

        public static void HandleMonsterMove(Packet packet)
        {
            var guid = packet.ReadPackedGuid("GUID");

            if (Storage.Objects != null && Storage.Objects.ContainsKey(guid))
            {
                var obj = Storage.Objects[guid].Item1;
                UpdateField uf;
                if (obj.UpdateFields != null && obj.UpdateFields.TryGetValue(UpdateFields.GetUpdateField(UnitField.UNIT_FIELD_FLAGS), out uf))
                    if ((uf.UInt32Value & (uint)UnitFlags.IsInCombat) == 0) // movement could be because of aggro so ignore that
                        obj.Movement.HasWpsOrRandMov = true;
            }

            if (packet.Opcode == Opcodes.GetOpcode(Opcode.SMSG_MONSTER_MOVE_TRANSPORT))
            {
                packet.ReadPackedGuid("Transport GUID");

                if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767)) // no idea when this was added exactly
                    packet.ReadByte("Transport Seat");
            }

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767)) // no idea when this was added exactly
                packet.ReadBoolean("Toggle AnimTierInTrans");

            var pos = packet.ReadVector3("Position");

            packet.ReadInt32("Move Ticks");

            var type = packet.ReadEnum<SplineType>("Spline Type", TypeCode.Byte);

            switch (type)
            {
                case SplineType.FacingSpot:
                {
                    packet.ReadVector3("Facing Spot");
                    break;
                }
                case SplineType.FacingTarget:
                {
                    packet.ReadGuid("Facing GUID");
                    break;
                }
                case SplineType.FacingAngle:
                {
                    packet.ReadSingle("Facing Angle");
                    break;
                }
                case SplineType.Stop:
                    return;
            }

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_3_4_15595))
            {
                // Not the best way
                ReadSplineMovement434(ref packet, pos);
                return;
            }

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_2_2_14545))
            {
                // Not the best way
                ReadSplineMovement422(ref packet, pos);
                return;
            }

            var flags = packet.ReadEnum<SplineFlag>("Spline Flags", TypeCode.Int32);

            if (flags.HasAnyFlag(SplineFlag.AnimationTier))
            {
                packet.ReadEnum<MovementAnimationState>("Animation State", TypeCode.Byte);
                packet.ReadInt32("Async-time in ms");
            }

            packet.ReadInt32("Move Time");

            if (flags.HasAnyFlag(SplineFlag.Trajectory))
            {
                packet.ReadSingle("Vertical Speed");
                packet.ReadInt32("Async-time in ms");
            }

            var waypoints = packet.ReadInt32("Waypoints");

            if (flags.HasAnyFlag(SplineFlag.Flying | SplineFlag.CatmullRom))
            {
                for (var i = 0; i < waypoints; i++)
                    packet.ReadVector3("Waypoint", i);
            }
            else
            {
                var newpos = packet.ReadVector3("Waypoint Endpoint");

                var mid = new Vector3();
                mid.X = (pos.X + newpos.X) * 0.5f;
                mid.Y = (pos.Y + newpos.Y) * 0.5f;
                mid.Z = (pos.Z + newpos.Z) * 0.5f;

                for (var i = 1; i < waypoints; i++)
                {
                    var vec = packet.ReadPackedVector3();
//.........这里部分代码省略.........
开发者ID:eddyb,项目名称:WowPacketParser,代码行数:101,代码来源:MovementHandler.cs

示例4: HandleMonsterMove


//.........这里部分代码省略.........
                WowGuid transportGuid = packet.ReadPackedGuid("Transport GUID");

                int seat = -1;
                if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767)) // no idea when this was added exactly
                    seat = packet.ReadByte("Transport Seat");

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

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767)) // no idea when this was added exactly
                packet.ReadBool("Toggle AnimTierInTrans");

            var pos = packet.ReadVector3("Position");

            packet.ReadInt32("Move Ticks");

            var type = packet.ReadByteE<SplineType>("Spline Type");

            switch (type)
            {
                case SplineType.FacingSpot:
                {
                    packet.ReadVector3("Facing Spot");
                    break;
                }
                case SplineType.FacingTarget:
                {
                    packet.ReadGuid("Facing GUID");
                    break;
                }
                case SplineType.FacingAngle:
                {
                    packet.ReadSingle("Facing Angle");
                    break;
                }
                case SplineType.Stop:
                    return;
            }

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V5_1_0_16309))
            {
                // Not the best way
                ReadSplineMovement510(packet, pos);
                return;
            }

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_2_2_14545))
            {
                // Not the best way
                ReadSplineMovement422(packet, pos);
                return;
            }

            var flags = packet.ReadInt32E<SplineFlag>("Spline Flags");

            if (flags.HasAnyFlag(SplineFlag.AnimationTier))
            {
                packet.ReadByteE<MovementAnimationState>("Animation State");
                packet.ReadInt32("Async-time in ms");
            }

            packet.ReadInt32("Move Time");

            if (flags.HasAnyFlag(SplineFlag.Trajectory))
            {
                packet.ReadSingle("Vertical Speed");
                packet.ReadInt32("Async-time in ms");
            }

            var waypoints = packet.ReadInt32("Waypoints");

            if (flags.HasAnyFlag(SplineFlag.Flying | SplineFlag.CatmullRom))
            {
                for (var i = 0; i < waypoints; i++)
                    packet.ReadVector3("Waypoint", i);
            }
            else
            {
                var newpos = packet.ReadVector3("Waypoint Endpoint");

                Vector3 mid = (pos + newpos) * 0.5f;

                for (var i = 1; i < waypoints; i++)
                {
                    var vec = packet.ReadPackedVector3();
                    vec = mid - vec;
                    packet.AddValue("Waypoint", vec, i);
                }
            }
        }
开发者ID:DrEhsan,项目名称:WowPacketParser,代码行数:101,代码来源:MovementHandler.cs

示例5: ReadSplineMovement422

        private static void ReadSplineMovement422(Packet packet, Vector3 pos)
        {
            var flags = packet.ReadInt32E<SplineFlag422>("Spline Flags");

            if (flags.HasAnyFlag(SplineFlag422.AnimationTier))
            {
                packet.ReadByteE<MovementAnimationState>("Animation State");
                packet.ReadInt32("Asynctime in ms"); // Async-time in ms
            }

            packet.ReadInt32("Move Time");

            if (flags.HasAnyFlag(SplineFlag422.Trajectory))
            {
                packet.ReadSingle("Vertical Speed");
                packet.ReadInt32("Unk Int32 2");
            }

            var waypoints = packet.ReadInt32("Waypoints");

            if (flags.HasAnyFlag(SplineFlag422.UsePathSmoothing))
            {
                for (var i = 0; i < waypoints; i++)
                    packet.ReadVector3("Waypoint", i);
            }
            else
            {
                var newpos = packet.ReadVector3("Waypoint Endpoint");

                var mid = new Vector3
                {
                    X = (pos.X + newpos.X)*0.5f,
                    Y = (pos.Y + newpos.Y)*0.5f,
                    Z = (pos.Z + newpos.Z)*0.5f
                };

                for (var i = 1; i < waypoints; i++)
                {
                    var vec = packet.ReadPackedVector3();
                    vec.X += mid.X;
                    vec.Y += mid.Y;
                    vec.Z += mid.Z;

                    packet.AddValue("Waypoint", vec);
                }
            }
        }
开发者ID:DrEhsan,项目名称:WowPacketParser,代码行数:47,代码来源:MovementHandler.cs

示例6: HandleMonsterMove

        public static void HandleMonsterMove(Packet packet)
        {
            Guid mover = packet.ReadPackedGuid("GUID");

            if (packet.Opcode == Opcodes.GetOpcode(Opcode.SMSG_MONSTER_MOVE_TRANSPORT))
            {
                packet.ReadPackedGuid("Transport GUID");

                if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767)) // no idea when this was added exactly
                    packet.ReadByte("Transport Seat");
            }

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767)) // no idea when this was added exactly
                packet.ReadBoolean("Toggle AlwaysAllowPitching");

            var pos = packet.ReadVector3("Position");

            packet.ReadInt32("Move Ticks");

            var type = packet.ReadEnum<SplineType>("Spline Type", TypeCode.Byte);

            switch (type)
            {
                case SplineType.FacingSpot:
                {
                    packet.ReadVector3("Facing Spot");
                    break;
                }
                case SplineType.FacingTarget:
                {
                    packet.ReadGuid("Facing GUID");
                    break;
                }
                case SplineType.FacingAngle:
                {
                    packet.ReadSingle("Facing Angle");
                    break;
                }
                case SplineType.Stop:
                    return;
            }

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_2_2_14545))
            {
                // Not the best way
                ReadSplineMovement422(ref packet, pos);
                return;
            }

            var flags = packet.ReadEnum<SplineFlag>("Spline Flags", TypeCode.Int32);

            if (flags.HasAnyFlag(SplineFlag.AnimationTier))
            {
                packet.ReadEnum<MovementAnimationState>("Animation State", TypeCode.Byte);
                packet.ReadInt32("Asynctime in ms"); // Async-time in ms
            }

            if (flags.HasAnyFlag(SplineFlag.Falling)) // Could be SplineFlag.UsePathSmoothing
            {
                packet.ReadInt32("Unknown");
                packet.ReadInt16("Unknown");
                packet.ReadInt16("Unknown");
            }

            packet.ReadInt32("Move Time");

            if (flags.HasAnyFlag(SplineFlag.Trajectory))
            {
                packet.ReadSingle("Vertical Speed");
                packet.ReadInt32("Unk Int32 2");
            }

            var waypoints = packet.ReadInt32("Waypoints");
            var waypointsList = new List<string>();
            if (flags.HasAnyFlag(SplineFlag.Flying | SplineFlag.CatmullRom))
            {
                for (var i = 0; i < waypoints; i++)
                    waypointsList.Add(packet.ReadVector3("[" + i + "] Waypoint - Flying Or CatmullRom", i).ToString());
            }
            else
            {
                var newpos = packet.ReadVector3("Waypoint Endpoint");

                waypointsList.Add("New position: " + newpos.ToString());

                var mid = new Vector3();
                mid.X = (pos.X + newpos.X) * 0.5f;
                mid.Y = (pos.Y + newpos.Y) * 0.5f;
                mid.Z = (pos.Z + newpos.Z) * 0.5f;

                for (var i = 1; i < waypoints; i++)
                {
                    var vec = packet.ReadPackedVector3();
                    vec.X += mid.X;
                    vec.Y += mid.Y;
                    vec.Z += mid.Z;

                    string output = "[" + i + "]" + " Waypoint: " + vec;
                    packet.Writer.WriteLine(output);
                    waypointsList.Add(output);
//.........这里部分代码省略.........
开发者ID:Asdcrew,项目名称:WowPacketParser,代码行数:101,代码来源:MovementHandler.cs

示例7: HandleMonsterMove

        public static void HandleMonsterMove(Packet packet)
        {
            packet.ReadPackedGuid("GUID");

            if (packet.Opcode == Opcodes.GetOpcode(Opcode.SMSG_MONSTER_MOVE_TRANSPORT))
            {
                packet.ReadPackedGuid("Transport GUID");

                if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767)) // no idea when this was added exactly
                    packet.ReadByte("Transport Seat");
            }

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767)) // no idea when this was added exactly
                packet.ReadBoolean("Unk Boolean"); // Something to do with IsVehicleExitVoluntary ?

            var pos = packet.ReadVector3("Position");

            packet.ReadInt32("Move Ticks");

            var type = packet.ReadEnum<SplineType>("Spline Type", TypeCode.Byte);

            switch (type)
            {
                case SplineType.FacingSpot:
                {
                    packet.ReadVector3("Facing Spot");
                    break;
                }
                case SplineType.FacingTarget:
                {
                    packet.ReadGuid("Facing GUID");
                    break;
                }
                case SplineType.FacingAngle:
                {
                    packet.ReadSingle("Facing Angle");
                    break;
                }
                case SplineType.Stop:
                    return;
            }

            var flags = packet.ReadEnum<SplineFlag>("Spline Flags", TypeCode.Int32);

            if (flags.HasAnyFlag(SplineFlag.AnimationTier))
            {
                packet.ReadEnum<MovementAnimationState>("Animation State", TypeCode.Byte);
                packet.ReadInt32("Asynctime in ms"); // Async-time in ms
            }

            // Cannot find anything similar to this in 4.2.2 client
            if (ClientVersion.RemovedInVersion(ClientVersionBuild.V4_2_2_14545))
            {
                if (flags.HasAnyFlag(SplineFlag.Falling)) // Could be SplineFlag.UsePathSmoothing
                {
                    packet.ReadInt32("Unknown");
                    packet.ReadInt16("Unknown");
                    packet.ReadInt16("Unknown");
                }
            }

            packet.ReadInt32("Move Time");

            if (flags.HasAnyFlag(SplineFlag.Trajectory))
            {
                packet.ReadSingle("Vertical Speed");
                packet.ReadInt32("Unk Int32 2");
            }

            var waypoints = packet.ReadInt32("Waypoints");

            if (flags.HasAnyFlag(SplineFlag.Flying | SplineFlag.CatmullRom))
            {
                packet.ReadVector3("Waypoint", 0);

                for (var i = 1; i < waypoints; i++)
                    packet.ReadVector3("Waypoint", i);
            }
            else
            {
                var newpos = packet.ReadVector3("Waypoint Endpoint");

                var mid = new Vector3();
                mid.X = (pos.X + newpos.X) * 0.5f;
                mid.Y = (pos.Y + newpos.Y) * 0.5f;
                mid.Z = (pos.Z + newpos.Z) * 0.5f;

                for (var i = 1; i < waypoints; i++)
                {
                    var vec = packet.ReadPackedVector3();
                    vec.X += mid.X;
                    vec.Y += mid.Y;
                    vec.Z += mid.Z;

                    packet.Writer.WriteLine("[" + i + "]" + " Waypoint: " + vec);
                }
            }
        }
开发者ID:CarlosX,项目名称:WowPacketParser,代码行数:98,代码来源:MovementHandler.cs

示例8: HandleMonsterMove

        public static void HandleMonsterMove(Packet packet)
        {
            var ownerGUID = new byte[8];
            var guid2 = new byte[8];
            var factingTargetGUID = new byte[8];
            var pos = new Vector3();

            var bitB0 = packet.ReadBit();
            ownerGUID[5] = packet.ReadBit();
            var hasAnimationTime = !packet.ReadBit();
            var hasTime = !packet.ReadBit();
            packet.StartBitStream(ownerGUID, 4, 3);
            var bit4C = !packet.ReadBit();
            var bit78 = packet.ReadBit();
            ownerGUID[2] = packet.ReadBit();
            var hasFlags = !packet.ReadBit();
            ownerGUID[0] = packet.ReadBit();

            var bits8C = 0u;
            if (bitB0)
            {
                packet.ReadBits("bits9C", 2);
                bits8C = packet.ReadBits(22);
            }

            var waypointCount = packet.ReadBits(22);
            var bit6D = !packet.ReadBit();
            ownerGUID[7] = packet.ReadBit();
            packet.ReadBit(); // fake bit
            packet.StartBitStream(guid2, 5, 3, 4, 6, 2, 1, 7, 0);
            var hasAnimationState = !packet.ReadBit();
            var hasParabolicTime = !packet.ReadBit();
            var hasParabolicSpeed = !packet.ReadBit();
            ownerGUID[6] = packet.ReadBit();
            var splineCount = packet.ReadBits(20);
            ownerGUID[1] = packet.ReadBit();
            var bit6C = !packet.ReadBit();
            var splineType = packet.ReadBits(3);

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

            packet.ReadBit("bit38");
            packet.ResetBitReader();

            if (bitB0)
            {
                packet.ReadSingle("floatA8");
                packet.ReadSingle("floatA0");
                packet.ReadInt16("shortAC");
                for (var i = 0; i < bits8C; ++i)
                {
                    packet.ReadInt16("short94+2", i);
                    packet.ReadInt16("short94+0", i);
                }
                packet.ReadInt16("shortA4");
            }

            packet.ReadXORBytes(guid2, 0, 1, 2, 7, 3, 4, 6, 5);
            if (splineType == 3)
            {
                packet.ParseBitStream(factingTargetGUID, 2, 1, 7, 0, 5, 3, 4, 6);
                packet.WriteGuid("Facting Target GUID", factingTargetGUID);
            }

            pos.Y = packet.ReadSingle();
            packet.ReadXORByte(ownerGUID, 7);
            if (hasAnimationTime)
                packet.ReadInt32("Asynctime in ms"); // Async-time in ms

            var waypoints = new Vector3[waypointCount];
            for (var i = 0; i < waypointCount; ++i)
            {
                var vec = packet.ReadPackedVector3();
                waypoints[i].X = vec.X;
                waypoints[i].Y = vec.Y;
                waypoints[i].Z = vec.Z;
            }

            packet.ReadSingle("Float2C");
            pos.Z = packet.ReadSingle();
            packet.ReadSingle("Float30");

            if (splineType == 2)
            {
                var spot = new Vector3
                {
                    Y = packet.ReadSingle(),
                    Z = packet.ReadSingle(),
                    X = packet.ReadSingle(),
                };
                packet.AddValue("Facing Spot", spot);
            }

            Vector3 endpos = new Vector3();
            for (var i = 0; i < splineCount; ++i)
            {
                var spot = new Vector3
                {
                    Y = packet.ReadSingle(),
//.........这里部分代码省略.........
开发者ID:samaelsacred,项目名称:WowPacketParser,代码行数:101,代码来源:MovementHandler.cs

示例9: HandleMonsterMove

        public static void HandleMonsterMove(Packet packet)
        {
            var pos = new Vector3();

            var guid2 = new byte[8];
            var factingTargetGUID = new byte[8];
            var ownerGUID = new byte[8];

            pos.Z = packet.ReadSingle();        // +6
            pos.X = packet.ReadSingle();        // +4
            packet.ReadInt32("Move Ticks");     // +10
            pos.Y = packet.ReadSingle();        // +5
            packet.ReadSingle("Float12");       // +12
            packet.ReadSingle("Float13");       // +13
            packet.ReadSingle("Float11");       // +11

            var bit21 = !packet.ReadBit();      // +21
            ownerGUID[0] = packet.ReadBit();    // +32 - 0

            var splineType = (int)packet.ReadBits(3);   // +68
            if (splineType == 3)
                packet.StartBitStream(factingTargetGUID, 6, 4, 3, 0, 5, 7, 1, 2);

            var bit19 = !packet.ReadBit();       // +19
            var bit69 = !packet.ReadBit();       // +69
            var bit120 = !packet.ReadBit();      // +120

            var splineCount = (int)packet.ReadBits(20); // +92

            var bit16 = !packet.ReadBit();      // +16

            ownerGUID[3] = packet.ReadBit();    // +35 - 3
            var bit108 = !packet.ReadBit();     // +108
            var bit22 = !packet.ReadBit();      // +22
            var bit109 = !packet.ReadBit();     // +109
            var bit20 = !packet.ReadBit();      // +20
            ownerGUID[7] = packet.ReadBit();    // +39 - 7
            ownerGUID[4] = packet.ReadBit();    // +36 - 4
            var bit18 = !packet.ReadBit();      // +18
            ownerGUID[5] = packet.ReadBit();    // +37 - 5

            var bits124 = (int)packet.ReadBits(22); // +124

            ownerGUID[6] = packet.ReadBit();    // +38 - 6
            packet.ReadBit();                   // fake bit

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

            var bit176 = packet.ReadBit();      // +176
            var bits84 = 0u;
            if (bit176)
            {
                packet.ReadBits("bits74", 2);
                bits84 = packet.ReadBits(22);
            }

            packet.ReadBit("bit56");            // +56
            ownerGUID[2] = packet.ReadBit();    // +38 - 2
            ownerGUID[1] = packet.ReadBit();    // +33 - 1

            var waypoints = new Vector3[bits124];
            for (var i = 0; i < bits124; ++i)
            {
                var vec = packet.ReadPackedVector3();
                waypoints[i].X = vec.X;
                waypoints[i].Y = vec.Y;
                waypoints[i].Z = vec.Z;
            }

            packet.ReadXORByte(ownerGUID, 1);   // +33 - 1

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

            var endpos = new Vector3();
            for (var i = 0; i < splineCount; ++i)
            {
                var spot = new Vector3
                {
                    Y = packet.ReadSingle(),
                    X = packet.ReadSingle(),
                    Z = packet.ReadSingle()
                };
                // client always taking first point
                if (i == 0)
                {
                    endpos = spot;
                }

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

            if (bit18)
                packet.ReadInt32("Int18");   // +18

            if (splineType == 3)
            {
                packet.ParseBitStream(factingTargetGUID, 5, 7, 0, 4, 3, 2, 6, 1);
                packet.WriteGuid("Facting Target GUID", factingTargetGUID);
            }

//.........这里部分代码省略.........
开发者ID:Oboltys,项目名称:WowPacketParser,代码行数:101,代码来源:MovementHandler.cs

示例10: HandleMonsterMove

        public static void HandleMonsterMove(Packet packet)
        {
            packet.ReadPackedGuid("GUID");

            if (packet.Opcode == Opcodes.GetOpcode(Opcode.SMSG_MONSTER_MOVE_TRANSPORT))
            {
                packet.ReadPackedGuid("Transport GUID");

                if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767)) // no idea when this was added exactly
                    packet.ReadByte("Transport Seat");
            }

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767)) // no idea when this was added exactly
                packet.ReadBoolean("Toggle AnimTierInTrans");

            var pos = packet.ReadVector3("Position");

            packet.ReadInt32("Move Ticks");

            var type = packet.ReadEnum<SplineType>("Spline Type", TypeCode.Byte);

            switch (type)
            {
                case SplineType.FacingSpot:
                {
                    packet.ReadVector3("Facing Spot");
                    break;
                }
                case SplineType.FacingTarget:
                {
                    packet.ReadGuid("Facing GUID");
                    break;
                }
                case SplineType.FacingAngle:
                {
                    packet.ReadSingle("Facing Angle");
                    break;
                }
                case SplineType.Stop:
                    return;
            }

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_2_2_14545))
            {
                // Not the best way
                ReadSplineMovement422(ref packet, pos);
                return;
            }

            var flags = packet.ReadEnum<SplineFlag>("Spline Flags", TypeCode.Int32);

            if (flags.HasAnyFlag(SplineFlag.AnimationTier))
            {
                packet.ReadEnum<MovementAnimationState>("Animation State", TypeCode.Byte);
                packet.ReadInt32("Async-time in ms");
            }

            packet.ReadInt32("Move Time");

            if (flags.HasAnyFlag(SplineFlag.Trajectory))
            {
                packet.ReadSingle("Vertical Speed");
                packet.ReadInt32("Async-time in ms");
            }

            var waypoints = packet.ReadInt32("Waypoints");

            if (flags.HasAnyFlag(SplineFlag.Flying | SplineFlag.CatmullRom))
            {
                for (var i = 0; i < waypoints; i++)
                    packet.ReadVector3("Waypoint", i);
            }
            else
            {
                var newpos = packet.ReadVector3("Waypoint Endpoint");

                var mid = new Vector3();
                mid.X = (pos.X + newpos.X) * 0.5f;
                mid.Y = (pos.Y + newpos.Y) * 0.5f;
                mid.Z = (pos.Z + newpos.Z) * 0.5f;

                for (var i = 1; i < waypoints; i++)
                {
                    var vec = packet.ReadPackedVector3();
                    vec.X += mid.X;
                    vec.Y += mid.Y;
                    vec.Z += mid.Z;

                    packet.WriteLine("[" + i + "]" + " Waypoint: " + vec);
                }
            }
        }
开发者ID:skypeak,项目名称:WowPacketParser_SkyFire,代码行数:92,代码来源:MovementHandler.cs

示例11: HandleMonsterMove


//.........这里部分代码省略.........
                packet.ReadInt32("Int40");

            if (bit2D)
                packet.ReadByte("Byte2D");

            Vector3 endpos = new Vector3();
            for (var i = 0; i < splineCount; ++i)
            {
                var spot = new Vector3
                {
                    Y = packet.ReadSingle(),
                    X = packet.ReadSingle(),
                    Z = packet.ReadSingle(),
                };
                // client always taking first point
                if (i == 0)
                {
                    endpos = spot;
                }

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

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

            if (bit55)
                packet.ReadByte("Byte55");

            packet.ReadInt32("Move Ticks");

            packet.ReadXORByte(ownerGUID, 0);

            if (splineType == 4)
                packet.ReadSingle("Facing Angle");

            pos.Y = packet.ReadSingle();

            if (bit0)
                packet.ReadSingle("Float3C");

            packet.ReadXORByte(ownerGUID, 7);
            packet.ReadXORByte(ownerGUID, 1);

            var waypoints = new Vector3[bits64];
            for (var i = 0; i < bits64; ++i)
            {
                var vec = packet.ReadPackedVector3();
                waypoints[i].X = vec.X;
                waypoints[i].Y = vec.Y;
                waypoints[i].Z = vec.Z;
            }

            if (splineType == 2)
            {
                packet.ReadSingle("FloatA8");
                packet.ReadSingle("FloatAC");
                packet.ReadSingle("FloatB0");
            }

            if (hasTime)
                packet.ReadInt32("Move Time in ms");

            if (bit30)
                packet.ReadInt32("Int30");

            packet.ReadXORByte(ownerGUID, 6);
            packet.ReadSingle("Float1C");
            packet.ReadXORByte(ownerGUID, 3);
            pos.X = packet.ReadSingle();
            packet.ReadXORByte(ownerGUID, 2);

            if (bit34)
                packet.ReadInt32("Int34");

            if (bit60)
                packet.ReadByte("Byte60");

            packet.ReadSingle("Float18");
            pos.Z = packet.ReadSingle();

            // Calculate mid pos
            var mid = new Vector3();
            mid.X = (pos.X + endpos.X) * 0.5f;
            mid.Y = (pos.Y + endpos.Y) * 0.5f;
            mid.Z = (pos.Z + endpos.Z) * 0.5f;
            for (var i = 0; i < bits64; ++i)
            {
                var vec = new Vector3
                {
                    X = mid.X - waypoints[i].X,
                    Y = mid.Y - waypoints[i].Y,
                    Z = mid.Z - waypoints[i].Z,
                };
                packet.AddValue("Waypoint", vec, i);
            }

            packet.WriteGuid("Owner GUID", ownerGUID);
            packet.WriteGuid("GUID2", guid2);
            packet.AddValue("Position", pos);
        }
开发者ID:samaelsacred,项目名称:WowPacketParser,代码行数:101,代码来源:MovementHandler.cs

示例12: HandleMonsterMove

        public static void HandleMonsterMove(Packet packet)
        {
            var guid = packet.ReadPackedGuid("GUID");

            if (Storage.Objects != null && Storage.Objects.ContainsKey(guid))
            {
                var obj = Storage.Objects[guid].Item1;
                UpdateField uf;
                if (obj.UpdateFields != null && obj.UpdateFields.TryGetValue(UpdateFields.GetUpdateField(UnitField.UNIT_FIELD_FLAGS), out uf))
                    if ((uf.UInt32Value & (uint)UnitFlags.IsInCombat) == 0) // movement could be because of aggro so ignore that
                        obj.Movement.HasWpsOrRandMov = true;
            }

            if (packet.Opcode == Opcodes.GetOpcode(Opcode.SMSG_MONSTER_MOVE_TRANSPORT, Direction.ServerToClient))
            {
                packet.ReadPackedGuid("Transport GUID");

                if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767)) // no idea when this was added exactly
                    packet.ReadByte("Transport Seat");
            }

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767)) // no idea when this was added exactly
                packet.ReadBool("Toggle AnimTierInTrans");

            var pos = packet.ReadVector3("Position");

            packet.ReadInt32("Move Ticks");

            var type = packet.ReadByteE<SplineType>("Spline Type");

            switch (type)
            {
                case SplineType.FacingSpot:
                {
                    packet.ReadVector3("Facing Spot");
                    break;
                }
                case SplineType.FacingTarget:
                {
                    packet.ReadGuid("Facing GUID");
                    break;
                }
                case SplineType.FacingAngle:
                {
                    packet.ReadSingle("Facing Angle");
                    break;
                }
                case SplineType.Stop:
                    return;
            }

            var flags = packet.ReadInt32E<SplineFlag>("Spline Flags");

            if (flags.HasAnyFlag(SplineFlag.Animation))
            {
                packet.ReadByteE<MovementAnimationState>("Animation State");
                packet.ReadInt32("Asynctime in ms"); // Async-time in ms
            }

            packet.ReadInt32("Move Time");

            if (flags.HasAnyFlag(SplineFlag.Parabolic))
            {
                packet.ReadSingle("Vertical Speed");
                packet.ReadInt32("Async-time in ms");
            }

            var waypoints = packet.ReadInt32("Waypoints");

            if (flags.HasAnyFlag(SplineFlag.UncompressedPath))
            {
                for (var i = 0; i < waypoints; i++)
                    packet.ReadVector3("Waypoint", i);
            }
            else
            {
                var newpos = packet.ReadVector3("Waypoint Endpoint");

                var mid = new Vector3
                {
                    X = (pos.X + newpos.X)*0.5f,
                    Y = (pos.Y + newpos.Y)*0.5f,
                    Z = (pos.Z + newpos.Z)*0.5f
                };

                if (waypoints != 1)
                {
                    var vec = packet.ReadPackedVector3();
                    vec.X += mid.X;
                    vec.Y += mid.Y;
                    vec.Z += mid.Z;
                    packet.AddValue("Waypoint", vec, 0);

                    if (waypoints > 2)
                    {
                        for (var i = 1; i < waypoints - 1; ++i)
                        {
                            vec = packet.ReadPackedVector3();
                            vec.X += mid.X;
                            vec.Y += mid.Y;
//.........这里部分代码省略.........
开发者ID:horn,项目名称:WowPacketParser,代码行数:101,代码来源:MovementHandler.cs

示例13: HandleMonsterMove


//.........这里部分代码省略.........
                packet.ReadSingle("FloatA0");

                for (var i = 0; i < bits8C; ++i)
                {
                    packet.ReadInt16("short74+2", i);
                    packet.ReadInt16("short74+0", i);
                }

                packet.ReadSingle("FloatA8");
                packet.ReadInt16("IntA4");
                packet.ReadInt16("IntAC");
            }

            if (bit6D)
                packet.ReadByte("Byte6D");

            if (splineType == 4)
                packet.ReadSingle("Facing Angle");

            if (bit40)
                packet.ReadInt32("Int40");

            packet.ReadXORByte(ownerGUID, 7);
            if (bit78)
                packet.ReadByte("Byte78");
            if (bit4C)
                packet.ReadInt32("Int4C");
            if (bit45)
                packet.ReadByte("Byte45");

            var waypoints = new Vector3[waypointCount];
            for (var i = 0; i < waypointCount; ++i)
            {
                var vec = packet.ReadPackedVector3();
                waypoints[i].X = vec.X;
                waypoints[i].Y = vec.Y;
                waypoints[i].Z = vec.Z;
            }

            packet.ReadXORByte(ownerGUID, 5);
            packet.ReadXORByte(ownerGUID, 1);
            packet.ReadXORByte(ownerGUID, 2);

            if (bit48)
                packet.ReadInt32("Int48");

            Vector3 endpos = new Vector3();
            for (var i = 0; i < splineCount; ++i)
            {
                var spot = new Vector3
                {
                    X = packet.ReadSingle(),
                    Y = packet.ReadSingle(),
                    Z = packet.ReadSingle()
                };
                // client always taking first point
                if (i == 0)
                {
                    endpos = spot;
                }

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

            packet.ReadXORByte(ownerGUID, 6);
开发者ID:Oboltys,项目名称:WowPacketParser,代码行数:66,代码来源:MovementHandler.cs

示例14: HandleOnMonsterMove

        public static void HandleOnMonsterMove(Packet packet)
        {
            var guid3 = new byte[8];
            var target = new byte[8];
            var pos = new Vector3();

            pos.Z = packet.ReadSingle(); // 24
            pos.X = packet.ReadSingle(); // 16
            packet.ReadInt32("Spline ID");
            pos.Y = packet.ReadSingle(); //20
            packet.WriteLine("Pos: {0}", pos);
            var transportPos = new Vector3
            {
                Y = packet.ReadSingle(), // 48
                Z = packet.ReadSingle(), // 52
                X = packet.ReadSingle(), // 44
            };
            packet.WriteLine("transportPos: {0}", transportPos);
            var hasAngle = !packet.ReadBit("!hasAngle");
            guid3[0] = packet.ReadBit();
            var splineType = packet.ReadBitsE<SplineType>("Spline Type", 3);
            if (splineType == SplineType.FacingTarget)
            {
                target = packet.StartBitStream(6, 4, 3, 0, 5, 7, 1, 2); // 184
            }
            var unk76 = !packet.ReadBit("!unk76");
            var unk69 = !packet.ReadBit("!unk69");
            var unk120 = -packet.ReadBit("unk120");

            var uncompressedSplineCount = packet.ReadBits("uncompressedSplineCount", 20);
            var hasSplineFlags = !packet.ReadBit("!hasSplineFlags");
            guid3[3] = packet.ReadBit();
            var unk108 = !packet.ReadBit("!unk108");
            var unk88 = !packet.ReadBit("!unk88");
            var unk109 = !packet.ReadBit("!unk109");
            var hasDutation = !packet.ReadBit("!hasduration");
            guid3[7] = packet.ReadBit();
            guid3[4] = packet.ReadBit();
            var unk72 = !packet.ReadBit("!unk72");
            guid3[5] = packet.ReadBit();
            var compressedSplineCount = packet.ReadBits("compressedSplineCount", 22);
            guid3[6] = packet.ReadBit();
            var unk112 = packet.ReadBit("!unk112") ? 0u : 1u;
            var guid2 = packet.StartBitStream(7, 1, 3, 0, 6, 4, 5, 2); // 112
            var unk176 = packet.ReadBit("unk176");
            var unk78 = 0u;
            var count140 = 0u;
            if (unk176)
            {
                unk78 = packet.ReadBits("unk78*2", 2);
                count140 = packet.ReadBits("count140", 22);
            }
            var unk56 = packet.ReadBit("unk56");
            guid3[2] = packet.ReadBit();
            guid3[1] = packet.ReadBit();
            for (var i = 0; i < compressedSplineCount; i++)
            {
                var vec = packet.ReadPackedVector3();
                vec.X += pos.X;
                vec.Y += pos.Y;
                vec.Z += pos.Z;
                packet.WriteLine("[{0}] Waypoint: {1}", i, vec); // not completed
            }
            packet.ParseBitStream(guid3, 1);
            packet.ParseBitStream(guid2, 6, 4, 1, 7, 0, 3, 5, 2);
            packet.WriteGuid("Guid2", guid2);

            for (var i = 0; i < uncompressedSplineCount; i++)
            {
                var point = new Vector3
                {
                    Y = packet.ReadSingle(), // 100
                    X = packet.ReadSingle(), // 96
                    Z = packet.ReadSingle(), // 104
                };
                packet.WriteLine("[{0}] Point: {1}", i, point);
            }

            if (unk72)
                packet.ReadInt32("unk72");

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

            packet.ParseBitStream(guid3, 5);

            if (hasAngle)
                packet.ReadSingle("Angle");

            if (unk176)
            {
                for (var i = 0; i < count140; i++)
                {
                    packet.ReadInt16("unk146", i);
                    packet.ReadInt16("unk144", i);
                }
                packet.ReadSingle("unka8h*4");
//.........这里部分代码省略.........
开发者ID:ChipLeo,项目名称:WowPacketParser,代码行数:101,代码来源:MovementHandler.cs

示例15: ReadSplineMovement434

        private static void ReadSplineMovement434(ref Packet packet, Vector3 pos)
        {
            var flags = packet.ReadEnum<SplineFlag434>("Spline Flags", TypeCode.Int32);

            if (flags.HasAnyFlag(SplineFlag434.Animation))
            {
                packet.ReadEnum<MovementAnimationState>("Animation State", TypeCode.Byte);
                packet.ReadInt32("Asynctime in ms"); // Async-time in ms
            }

            packet.ReadInt32("Move Time");

            if (flags.HasAnyFlag(SplineFlag434.Parabolic))
            {
                packet.ReadSingle("Vertical Speed");
                packet.ReadInt32("Async-time in ms");
            }

            var waypoints = packet.ReadInt32("Waypoints");

            if (flags.HasAnyFlag(SplineFlag434.UncompressedPath))
            {
                for (var i = 0; i < waypoints; i++)
                    packet.ReadVector3("Waypoint", i);
            }
            else
            {
                var newpos = packet.ReadVector3("Waypoint Endpoint");

                var mid = new Vector3();
                mid.X = (pos.X + newpos.X) * 0.5f;
                mid.Y = (pos.Y + newpos.Y) * 0.5f;
                mid.Z = (pos.Z + newpos.Z) * 0.5f;

                if (waypoints != 1)
                {
                    var vec = packet.ReadPackedVector3();
                    vec.X += mid.X;
                    vec.Y += mid.Y;
                    vec.Z += mid.Z;
                    packet.WriteLine("[0] Waypoint: " + vec);

                    if (waypoints > 2)
                    {
                        for (var i = 1; i < waypoints - 1; ++i)
                        {
                            vec = packet.ReadPackedVector3();
                            vec.X += mid.X;
                            vec.Y += mid.Y;
                            vec.Z += mid.Z;

                            packet.WriteLine("[" + i + "]" + " Waypoint: " + vec);
                        }
                    }
                }
            }
        }
开发者ID:eddyb,项目名称:WowPacketParser,代码行数:57,代码来源:MovementHandler.cs


注:本文中的WowPacketParser.Misc.Packet.ReadPackedVector3方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。