Ejemplo n.º 1
0
        public static SplineInfo Read(BinaryReader gr)
        {
            var spline = new SplineInfo();

            spline.Flags = (SplineFlags)gr.ReadUInt32();

            if (spline.Flags.HasFlag(SplineFlags.FINALPOINT))
            {
                spline.Point = gr.ReadCoords3();
            }

            if (spline.Flags.HasFlag(SplineFlags.FINALTARGET))
            {
                spline.Guid = gr.ReadUInt64();
            }

            if (spline.Flags.HasFlag(SplineFlags.FINALORIENT))
            {
                spline.Rotation = gr.ReadSingle();
            }

            spline.CurrentTime = gr.ReadUInt32();
            spline.FullTime    = gr.ReadUInt32();
            spline.Unknown1    = gr.ReadUInt32();

            spline.DurationMultiplier = gr.ReadSingle();
            spline.UnknownFloat2      = gr.ReadSingle();
            spline.UnknownFloat3      = gr.ReadSingle();

            spline.Unknown2 = gr.ReadUInt32();

            spline.Count = gr.ReadUInt32();

            for (uint i = 0; i < spline.Count; ++i)
            {
                spline.splines.Add(gr.ReadCoords3());
            }

            spline.SplineMode = (SplineMode)gr.ReadByte();

            spline.EndPoint = gr.ReadCoords3();
            return(spline);
        }
Ejemplo n.º 2
0
        public static SplineInfo Read(BinaryReader gr)
        {
            var spline = new SplineInfo();
            spline.Flags = (SplineFlags)gr.ReadUInt32();

            if (spline.Flags.HasFlag(SplineFlags.FINALPOINT))
            {
                spline.Point = gr.ReadCoords3();
            }

            if (spline.Flags.HasFlag(SplineFlags.FINALTARGET))
            {
                spline.Guid = gr.ReadUInt64();
            }

            if (spline.Flags.HasFlag(SplineFlags.FINALORIENT))
            {
                spline.Rotation = gr.ReadSingle();
            }

            spline.CurrentTime = gr.ReadUInt32();
            spline.FullTime = gr.ReadUInt32();
            spline.Unknown1 = gr.ReadUInt32();

            spline.DurationMultiplier = gr.ReadSingle();
            spline.UnknownFloat2 = gr.ReadSingle();
            spline.UnknownFloat3 = gr.ReadSingle();

            spline.Unknown2 = gr.ReadUInt32();

            spline.Count = gr.ReadUInt32();

            for (uint i = 0; i < spline.Count; ++i)
            {
                spline.splines.Add(gr.ReadCoords3());
            }

            spline.SplineMode = (SplineMode)gr.ReadByte();

            spline.EndPoint = gr.ReadCoords3();
            return spline;
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
 public MovementInfo()
 {
     Transport = new TransportInfo();
     Spline    = new SplineInfo();
 }
Ejemplo n.º 5
0
 public MovementInfo()
 {
     Transport = new TransportInfo();
     Spline = new SplineInfo();
 }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
0
 public MovementBlock()
 {
     Movement = new MovementInfo();
     Spline   = new SplineInfo();
 }
Ejemplo n.º 8
0
 public MovementBlock()
 {
     Movement = new MovementInfo();
     Spline = new SplineInfo();
 }