示例#1
0
        public void Write(WorldPacket data)
        {
            data.WriteUInt32(Flags);
            data.WriteUInt8(AnimTier);
            data.WriteUInt32(TierTransStartTime);
            data.WriteInt32(Elapsed);
            data.WriteUInt32(MoveTime);
            data.WriteFloat(JumpGravity);
            data.WriteUInt32(SpecialTime);
            data.WriteUInt8(Mode);
            data.WriteUInt8(VehicleExitVoluntary);
            data.WritePackedGuid(TransportGUID);
            data.WriteInt8(VehicleSeat);
            data.WriteBits((byte)Face, 2);
            data.WriteBits(Points.Count, 16);
            data.WriteBits(PackedDeltas.Count, 16);
            data.WriteBit(SplineFilter.HasValue);
            data.WriteBit(SpellEffectExtraData.HasValue);
            data.FlushBits();

            if (SplineFilter.HasValue)
            {
                SplineFilter.Value.Write(data);
            }

            switch (Face)
            {
            case MonsterMoveType.FacingSpot:
                data.WriteVector3(FaceSpot);
                break;

            case MonsterMoveType.FacingTarget:
                data.WriteFloat(FaceDirection);
                data.WritePackedGuid(FaceGUID);
                break;

            case MonsterMoveType.FacingAngle:
                data.WriteFloat(FaceDirection);
                break;
            }

            foreach (Vector3 pos in Points)
            {
                data.WriteVector3(pos);
            }

            foreach (Vector3 pos in PackedDeltas)
            {
                data.WritePackXYZ(pos);
            }

            if (SpellEffectExtraData.HasValue)
            {
                SpellEffectExtraData.Value.Write(data);
            }
        }