Exemplo n.º 1
0
 public static TransportInfo Read(BinaryReader reader, MovementFlags2 flags2)
 {
     var tInfo = new TransportInfo();
     tInfo.Guid = reader.ReadPackedGuid();
     tInfo.Position = reader.ReadCoords3();
     tInfo.Facing = reader.ReadSingle();
     tInfo.Time = reader.ReadUInt32();
     tInfo.Seat = reader.ReadByte();
     if (flags2.HasFlag(MovementFlags2.InterpolatedPlayerMovement))
         tInfo.Time2 = reader.ReadUInt32();
     return tInfo;
 }
Exemplo n.º 2
0
        private void ParseValues(BinaryReader gr)
        {
            ulong guid = gr.ReadPackedGuid();

            var woWObjectUpdate = WoWObjectUpdate.Read(gr);

            var wowobj = GetWoWObject(guid);
            if (wowobj != null)
                wowobj.AddUpdate(woWObjectUpdate);
            else
                MessageBox.Show("Boom!");
        }
Exemplo n.º 3
0
        protected TargetFlags ReadTargets(BinaryReader br)
        {
            var tf = (TargetFlags) br.ReadUInt32();
            AppendFormatLine("TargetFlags: {0}", tf);

            if (tf.HasFlag(TargetFlags.TARGET_FLAG_UNIT) ||
                tf.HasFlag(TargetFlags.TARGET_FLAG_PVP_CORPSE) ||
                tf.HasFlag(TargetFlags.TARGET_FLAG_OBJECT) ||
                tf.HasFlag(TargetFlags.TARGET_FLAG_CORPSE) ||
                tf.HasFlag(TargetFlags.TARGET_FLAG_UNK2))
            {
                AppendFormatLine("ObjectTarget: 0x{0:X16}", br.ReadPackedGuid());
            }

            if (tf.HasFlag(TargetFlags.TARGET_FLAG_ITEM) ||
                tf.HasFlag(TargetFlags.TARGET_FLAG_TRADE_ITEM))
            {
                AppendFormatLine("ItemTarget: 0x{0:X16}", br.ReadPackedGuid());
            }

            if (tf.HasFlag(TargetFlags.TARGET_FLAG_SOURCE_LOCATION))
            {
                AppendFormatLine("SrcTarget: {0} {1} {2}", br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
            }

            if (tf.HasFlag(TargetFlags.TARGET_FLAG_DEST_LOCATION))
            {
                AppendFormatLine("DstTargetGuid: {0}", br.ReadPackedGuid().ToString("X16"));
                AppendFormatLine("DstTarget: {0} {1} {2}", br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
            }

            if (tf.HasFlag(TargetFlags.TARGET_FLAG_STRING))
            {
                AppendFormatLine("StringTarget: {0}", br.ReadCString());
            }

            return tf;
        }
Exemplo n.º 4
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;
        }
Exemplo n.º 5
0
        public void ReadMov(BinaryReader gr)
        {
            Object obj = this;

            Unit u = new Unit();
            if (obj)
            {
                if (obj.IsUnit() || obj.IsPlayer())
                {
                    u = (Unit)obj;

                }
                //else return null;
            }

            UpdateFlags = (UpdateFlags)gr.ReadUInt16();

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

                Position = gr.ReadCoords3();
                Facing = gr.ReadSingle()*Mathf.Rad2Deg;

                if (obj.IsUnit() || obj.IsPlayer() || obj)
                    ((WorldObject)obj).SetCoordinates(Position);

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

                if (Flags.HasFlag(MovementFlags.Swimming) || Flags.HasFlag(MovementFlags.Flying) ||
                    Flags2.HasFlag(MovementFlags2.AlwaysAllowPitching))
                {
                    Pitch = gr.ReadSingle();
                }

                FallTime = gr.ReadUInt32();

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

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

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

                speedWalk = gr.ReadSingle();
                speedRun = gr.ReadSingle();
                speedSwimBack = gr.ReadSingle();
                speedSwim = gr.ReadSingle();
                speedWalkBack = gr.ReadSingle();
                speedFly = gr.ReadSingle();
                speedFlyBack = gr.ReadSingle();
                speedTurn = gr.ReadSingle();
                speedPitchRate = gr.ReadSingle();

                u.SetCoordinates(Position);
                u.SetSpeed(UnitMoveType.MOVE_WALK, speedWalk);
                u.SetSpeed(UnitMoveType.MOVE_RUN, speedRun);
                u.SetSpeed(UnitMoveType.MOVE_SWIMBACK, speedSwimBack);
                u.SetSpeed(UnitMoveType.MOVE_SWIM, speedSwim);
                u.SetSpeed(UnitMoveType.MOVE_WALKBACK, speedWalkBack);
                u.SetSpeed(UnitMoveType.MOVE_TURN, speedTurn);
                u.SetSpeed(UnitMoveType.MOVE_FLY, speedFly);
                u.SetSpeed(UnitMoveType.MOVE_FLYBACK, speedFlyBack);
                u.SetSpeed(UnitMoveType.MOVE_PITCH_RATE, speedPitchRate);

                if (Flags.HasFlag(MovementFlags.SplineEnabled))
                {
                    Spline = SplineInfo.Read(gr);
                }
            }
            else
            {
                if (UpdateFlags.HasFlag(UpdateFlags.UPDATEFLAG_GO_POSITION))
                {
                    Transport = new TransportInfo();
                    Transport.Guid = gr.ReadPackedGuid();
                    Position = gr.ReadCoords3();
                    Transport.Position = gr.ReadCoords3();
                    Facing = gr.ReadSingle() * Mathf.Rad2Deg;
                    Transport.Facing = gr.ReadSingle() * Mathf.Rad2Deg;
                    if (obj && obj.IsGameObject())
                        ((GO)obj).SetCoordinates(Position);
                }
                else if (UpdateFlags.HasFlag(UpdateFlags.UPDATEFLAG_HAS_POSITION))
                {
                    Position = gr.ReadCoords3();
                    Facing = gr.ReadSingle() * Mathf.Rad2Deg;
                    if (obj && obj.IsWorldObject())
                        ((WorldObject)obj).SetCoordinates(Position);
                }
            }

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

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

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

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

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

            // 3.1
            if (UpdateFlags.HasFlag(UpdateFlags.UPDATEFLAG_GO_ROTATION))
            {
                GoRotationULong = gr.ReadUInt64(); // fixme
            }
        }
Exemplo n.º 6
0
        private void ParseCreateObjects(BinaryReader gr)
        {
            var guid = gr.ReadPackedGuid();

            var objectTypeId = (ObjectTypes)gr.ReadByte();

            var movement = MovementInfo.Read(gr);

            // values part
            var update = WoWObjectUpdate.Read(gr);

            var obj = GetWoWObject(guid);
            if (obj == null)
                objects.Add(guid, new WoWObject(objectTypeId, movement, update.Data));
            else
            {
                objects.Remove(guid);
                objects.Add(guid, new WoWObject(objectTypeId, movement, update.Data));
            }
        }
Exemplo n.º 7
0
 private static void ParseOutOfRangeObjects(BinaryReader gr)
 {
     var count = gr.ReadUInt32();
     var guids = new ulong[count];
     for (var i = 0; i < count; ++i)
         guids[i] = gr.ReadPackedGuid();
 }
Exemplo n.º 8
0
        private static void ParseMovement(BinaryReader gr)
        {
            var guid = gr.ReadPackedGuid();

            var mInfo = MovementInfo.Read(gr);

            // is it even used by blizzard?
        }
Exemplo n.º 9
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;
        }