示例#1
0
 public WoWObject(ObjectTypes typeId, MovementInfo movement, IDictionary<int, uint> data)
     : base(data)
 {
     TypeId = typeId;
     Movement = movement;
 }
示例#2
0
        public static MovementInfo Read(BinaryReader gr)
        {
            var movement = new MovementInfo();

            movement.UpdateFlags = (UpdateFlags)gr.ReadUInt16();

            if (movement.UpdateFlags.HasFlag(UpdateFlags.UPDATEFLAG_LIVING))
            {
                movement.Flags = (MovementFlags)gr.ReadUInt32();
                movement.Flags2 = (MovementFlags2)gr.ReadUInt16();
                movement.TimeStamp = gr.ReadUInt32();

                movement.Position = gr.ReadCoords3();
                movement.Facing = gr.ReadSingle();

                if (movement.Flags.HasFlag(MovementFlags.ONTRANSPORT))
                {
                    movement.Transport = TransportInfo.Read(gr, movement.Flags2);
                }

                if (movement.Flags.HasFlag(MovementFlags.SWIMMING) || movement.Flags.HasFlag(MovementFlags.FLYING) ||
                    movement.Flags2.HasFlag(MovementFlags2.AlwaysAllowPitching))
                {
                    movement.Pitch = gr.ReadSingle();
                }

                movement.FallTime = gr.ReadUInt32();

                if (movement.Flags.HasFlag(MovementFlags.FALLING))
                {
                    movement.FallVelocity = gr.ReadSingle();
                    movement.FallCosAngle = gr.ReadSingle();
                    movement.FallSinAngle = gr.ReadSingle();
                    movement.FallSpeed = gr.ReadSingle();
                }

                if (movement.Flags.HasFlag(MovementFlags.SPLINEELEVATION))
                {
                    movement.SplineElevation = gr.ReadSingle();
                }

                for (byte i = 0; i < movement.speeds.Length; ++i)
                    movement.speeds[i] = gr.ReadSingle();

                if (movement.Flags.HasFlag(MovementFlags.SPLINEENABLED))
                {
                    movement.Spline = SplineInfo.Read(gr);
                }
            }
            else
            {
                if (movement.UpdateFlags.HasFlag(UpdateFlags.UPDATEFLAG_GO_POSITION))
                {
                    movement.Transport.Guid = gr.ReadPackedGuid();
                    movement.Position = gr.ReadCoords3();
                    movement.Transport.Position = gr.ReadCoords3();
                    movement.Facing = gr.ReadSingle();
                    movement.Transport.Facing = gr.ReadSingle();
                }
                else if (movement.UpdateFlags.HasFlag(UpdateFlags.UPDATEFLAG_HAS_POSITION))
                {
                    movement.Position = gr.ReadCoords3();
                    movement.Facing = gr.ReadSingle();
                }
            }

            if (movement.UpdateFlags.HasFlag(UpdateFlags.UPDATEFLAG_LOWGUID))
            {
                movement.LowGuid = gr.ReadUInt32();
            }

            if (movement.UpdateFlags.HasFlag(UpdateFlags.UPDATEFLAG_HIGHGUID))
            {
                movement.HighGuid = gr.ReadUInt32();
            }

            if (movement.UpdateFlags.HasFlag(UpdateFlags.UPDATEFLAG_TARGET_GUID))
            {
                movement.AttackingTarget = gr.ReadPackedGuid();
            }

            if (movement.UpdateFlags.HasFlag(UpdateFlags.UPDATEFLAG_TRANSPORT))
            {
                movement.TransportTime = gr.ReadUInt32();
            }

            // WotLK
            if (movement.UpdateFlags.HasFlag(UpdateFlags.UPDATEFLAG_VEHICLE))
            {
                movement.VehicleId = gr.ReadUInt32();
                movement.VehicleAimAdjustement = gr.ReadSingle();
            }

            // 3.1
            if (movement.UpdateFlags.HasFlag(UpdateFlags.UPDATEFLAG_GO_ROTATION))
            {
                movement.GoRotationULong = gr.ReadUInt64();
            }
            return movement;
        }
示例#3
0
        public static MovementInfo Read(BinaryReader gr)
        {
            var movementInfo = new MovementInfo();

            movementInfo.Flags = (MovementFlags)gr.ReadUInt32();
            movementInfo.Flags2 = (MovementFlags2)gr.ReadUInt16();
            movementInfo.TimeStamp = gr.ReadUInt32();

            movementInfo.Position = gr.ReadCoords3();
            movementInfo.Facing = gr.ReadSingle();

            if (movementInfo.Flags.HasFlag(MovementFlags.ONTRANSPORT))
            {
                movementInfo.Transport = TransportInfo.Read(gr, movementInfo.Flags2);
            }

            if (movementInfo.Flags.HasFlag(MovementFlags.SWIMMING) || movementInfo.Flags.HasFlag(MovementFlags.FLYING) ||
                movementInfo.Flags2.HasFlag(MovementFlags2.AlwaysAllowPitching))
            {
                movementInfo.Pitch = gr.ReadSingle();
            }

            movementInfo.FallTime = gr.ReadUInt32();

            if (movementInfo.Flags.HasFlag(MovementFlags.FALLING))
            {
                movementInfo.FallVelocity = gr.ReadSingle();
                movementInfo.FallCosAngle = gr.ReadSingle();
                movementInfo.FallSinAngle = gr.ReadSingle();
                movementInfo.FallSpeed = gr.ReadSingle();
            }

            if (movementInfo.Flags.HasFlag(MovementFlags.SPLINEELEVATION))
            {
                movementInfo.SplineElevation = gr.ReadSingle();
            }

            return movementInfo;
        }
示例#4
0
        public static MovementBlock Read(BinaryReader gr)
        {
            var movement = new MovementBlock();

            movement.UpdateFlags = (UpdateFlags)gr.ReadUInt16();

            if (movement.UpdateFlags.HasFlag(UpdateFlags.UPDATEFLAG_LIVING))
            {
                movement.Movement = MovementInfo.Read(gr);

                for (byte i = 0; i < movement.speeds.Length; ++i)
                {
                    movement.speeds[i] = gr.ReadSingle();
                }

                if (movement.Movement.Flags.HasFlag(MovementFlags.SPLINEENABLED))
                {
                    movement.Spline = SplineInfo.Read(gr);
                }
            }
            else
            {
                if (movement.UpdateFlags.HasFlag(UpdateFlags.UPDATEFLAG_GO_POSITION))
                {
                    movement.Movement.Transport.Guid     = gr.ReadPackedGuid();
                    movement.Movement.Position           = gr.ReadCoords3();
                    movement.Movement.Transport.Position = gr.ReadCoords3();
                    movement.Movement.Facing             = gr.ReadSingle();
                    movement.Movement.Transport.Facing   = gr.ReadSingle();
                }
                else if (movement.UpdateFlags.HasFlag(UpdateFlags.UPDATEFLAG_HAS_POSITION))
                {
                    movement.Movement.Position = gr.ReadCoords3();
                    movement.Movement.Facing   = gr.ReadSingle();
                }
            }

            if (movement.UpdateFlags.HasFlag(UpdateFlags.UPDATEFLAG_LOWGUID))
            {
                movement.LowGuid = gr.ReadUInt32();
            }

            if (movement.UpdateFlags.HasFlag(UpdateFlags.UPDATEFLAG_HIGHGUID))
            {
                movement.HighGuid = gr.ReadUInt32();
            }

            if (movement.UpdateFlags.HasFlag(UpdateFlags.UPDATEFLAG_TARGET_GUID))
            {
                movement.AttackingTarget = gr.ReadPackedGuid();
            }

            if (movement.UpdateFlags.HasFlag(UpdateFlags.UPDATEFLAG_TRANSPORT))
            {
                movement.TransportTime = gr.ReadUInt32();
            }

            // WotLK
            if (movement.UpdateFlags.HasFlag(UpdateFlags.UPDATEFLAG_VEHICLE))
            {
                movement.VehicleId             = gr.ReadUInt32();
                movement.VehicleAimAdjustement = gr.ReadSingle();
            }

            // 3.1
            if (movement.UpdateFlags.HasFlag(UpdateFlags.UPDATEFLAG_GO_ROTATION))
            {
                movement.GoRotationULong = gr.ReadUInt64();
            }
            return(movement);
        }
示例#5
0
 public MovementBlock()
 {
     Movement = new MovementInfo();
     Spline   = new SplineInfo();
 }
示例#6
0
 public WoWObject(ObjectTypes typeId, MovementInfo movement, IDictionary <int, uint> data)
     : base(data)
 {
     TypeId   = typeId;
     Movement = movement;
 }
示例#7
0
 public MovementBlock()
 {
     Movement = new MovementInfo();
     Spline = new SplineInfo();
 }