Пример #1
0
        public void Read(PacketIn p)
        {
            GUID = p.ReadPackedGUID();

            Flags  = (MovementFlags)p.ReadUInt32();
            Flags2 = (MovementFlags2)p.ReadUInt16();
            Time   = p.ReadUInt32();

            PositionX = p.ReadSingle();
            PositionY = p.ReadSingle();
            PositionZ = p.ReadSingle();
            PositionO = p.ReadSingle();

            if (Flags.HasFlag(MovementFlags.MOVEMENTFLAG_ONTRANSPORT))
            {
                if (MovementDataTransport == null)
                {
                    MovementDataTransport = new MovementDataTransport();
                }

                MovementDataTransport.TransportGuid = p.ReadPackedGUID();
                MovementDataTransport.TransportX    = p.ReadSingle();
                MovementDataTransport.TransportY    = p.ReadSingle();
                MovementDataTransport.TransportZ    = p.ReadSingle();
                MovementDataTransport.TransportO    = p.ReadSingle();
                MovementDataTransport.TransportTime = p.ReadUInt32();
                MovementDataTransport.TransportSeat = p.ReadByte();

                if (Flags2.HasFlag(MovementFlags2.MOVEMENTFLAG2_INTERPOLATED_MOVEMENT))
                {
                    MovementDataTransport.TransportTime2 = p.ReadUInt32();
                }
            }

            if (Flags.HasFlag(MovementFlags.MOVEMENTFLAG_SWIMMING | MovementFlags.MOVEMENTFLAG_FLYING) ||
                Flags2.HasFlag(MovementFlags2.MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING))
            {
                Pitch = p.ReadSingle();
            }

            FallTime = p.ReadUInt32();

            if (Flags.HasFlag(MovementFlags.MOVEMENTFLAG_FALLING))
            {
                FallVerticalSpeed = p.ReadSingle();
                FallSine          = p.ReadSingle();
                FallCosine        = p.ReadSingle();
                FallLateralSpeed  = p.ReadSingle();
            }

            if (Flags.HasFlag(MovementFlags.MOVEMENTFLAG_SPLINE_ELEVATION))
            {
                SplineElevation = p.ReadSingle();
            }
        }
Пример #2
0
        public void Write(PacketOut p)
        {
            p.Write(GUID);
            p.Write((UInt32)Flags);
            p.Write((UInt16)Flags2);
            p.Write(Time);
            p.Write(PositionX);
            p.Write(PositionY);
            p.Write(PositionZ);
            p.Write(PositionO);

            if (Flags.HasFlag(MovementFlags.MOVEMENTFLAG_ONTRANSPORT))
            {
                if (MovementDataTransport == null)
                {
                    MovementDataTransport = new MovementDataTransport();
                }

                p.Write(MovementDataTransport.TransportGuid);
                p.Write(MovementDataTransport.TransportX);
                p.Write(MovementDataTransport.TransportY);
                p.Write(MovementDataTransport.TransportZ);
                p.Write(MovementDataTransport.TransportO);
                p.Write(MovementDataTransport.TransportTime);
                p.Write(MovementDataTransport.TransportSeat);

                if (Flags2.HasFlag(MovementFlags2.MOVEMENTFLAG2_INTERPOLATED_MOVEMENT))
                {
                    p.Write(MovementDataTransport.TransportTime2);
                }
            }

            if (Flags.HasFlag(MovementFlags.MOVEMENTFLAG_SWIMMING | MovementFlags.MOVEMENTFLAG_FLYING) ||
                Flags2.HasFlag(MovementFlags2.MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING))
            {
                p.Write(Pitch);
            }

            p.Write(FallTime);

            if (Flags.HasFlag(MovementFlags.MOVEMENTFLAG_FALLING))
            {
                p.Write(FallVerticalSpeed);
                p.Write(FallSine);
                p.Write(FallCosine);
                p.Write(FallLateralSpeed);
            }

            if (Flags.HasFlag(MovementFlags.MOVEMENTFLAG_SPLINE_ELEVATION))
            {
                p.Write(SplineElevation);
            }
        }
Пример #3
0
        public void Write(PacketOut p)
        {
            p.Write(GUID);
            p.Write((UInt32)Flags);
            p.Write((UInt16)Flags2);
            p.Write(Time);
            p.Write(PositionX);
            p.Write(PositionY);
            p.Write(PositionZ);
            p.Write(PositionO);

            if (Flags.HasFlag(MovementFlags.MOVEMENTFLAG_ONTRANSPORT))
            {
                if (MovementDataTransport == null)
                    MovementDataTransport = new MovementDataTransport();

                p.Write(MovementDataTransport.TransportGuid);
                p.Write(MovementDataTransport.TransportX);
                p.Write(MovementDataTransport.TransportY);
                p.Write(MovementDataTransport.TransportZ);
                p.Write(MovementDataTransport.TransportO);
                p.Write(MovementDataTransport.TransportTime);
                p.Write(MovementDataTransport.TransportSeat);

                if (Flags2.HasFlag(MovementFlags2.MOVEMENTFLAG2_INTERPOLATED_MOVEMENT))
                    p.Write(MovementDataTransport.TransportTime2);
            }

            if (Flags.HasFlag(MovementFlags.MOVEMENTFLAG_SWIMMING | MovementFlags.MOVEMENTFLAG_FLYING) ||
    Flags2.HasFlag(MovementFlags2.MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING))
                p.Write(Pitch);

            p.Write(FallTime);

            if (Flags.HasFlag(MovementFlags.MOVEMENTFLAG_FALLING))
            {
                p.Write(FallVerticalSpeed);
                p.Write(FallSine);
                p.Write(FallCosine);
                p.Write(FallLateralSpeed);
            }

            if (Flags.HasFlag(MovementFlags.MOVEMENTFLAG_SPLINE_ELEVATION))
                p.Write(SplineElevation);

        }
Пример #4
0
        public void Read(PacketIn p)
        {
            GUID = p.ReadPackedGUID();

            Flags = (MovementFlags)p.ReadUInt32();
            Flags2 = (MovementFlags2)p.ReadUInt16();
            Time = p.ReadUInt32();

            PositionX = p.ReadSingle();
            PositionY = p.ReadSingle();
            PositionZ = p.ReadSingle();
            PositionO = p.ReadSingle();

            if (Flags.HasFlag(MovementFlags.MOVEMENTFLAG_ONTRANSPORT))
            {
                if (MovementDataTransport == null)
                    MovementDataTransport = new MovementDataTransport();

                MovementDataTransport.TransportGuid = p.ReadPackedGUID();
                MovementDataTransport.TransportX = p.ReadSingle();
                MovementDataTransport.TransportY = p.ReadSingle();
                MovementDataTransport.TransportZ = p.ReadSingle();
                MovementDataTransport.TransportO = p.ReadSingle();
                MovementDataTransport.TransportTime = p.ReadUInt32();
                MovementDataTransport.TransportSeat = p.ReadByte();

                if (Flags2.HasFlag(MovementFlags2.MOVEMENTFLAG2_INTERPOLATED_MOVEMENT))
                    MovementDataTransport.TransportTime2 = p.ReadUInt32();
            }

            if (Flags.HasFlag(MovementFlags.MOVEMENTFLAG_SWIMMING | MovementFlags.MOVEMENTFLAG_FLYING) ||
                Flags2.HasFlag(MovementFlags2.MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING))
                Pitch = p.ReadSingle();

            FallTime = p.ReadUInt32();

            if (Flags.HasFlag(MovementFlags.MOVEMENTFLAG_FALLING))
            {
                FallVerticalSpeed = p.ReadSingle();
                FallSine = p.ReadSingle();
                FallCosine = p.ReadSingle();
                FallLateralSpeed = p.ReadSingle();
            }

            if (Flags.HasFlag(MovementFlags.MOVEMENTFLAG_SPLINE_ELEVATION))
                SplineElevation = p.ReadSingle();
        }