Beispiel #1
0
        protected override void WriteMovementUpdate(PrimitiveWriter packet, UpdateFieldFlags relation)
        {
            WriteMovementPacketInfo(packet);

            #region Speed Block

            packet.Write(WalkSpeed);
            packet.Write(RunSpeed);
            packet.Write(RunBackSpeed);
            packet.Write(SwimSpeed);
            packet.Write(SwimBackSpeed);
            packet.Write(FlightSpeed);
            packet.Write(FlightBackSpeed);
            packet.Write(TurnSpeed);
            packet.Write(PitchRate);

            #endregion Speed Block

            #region Spline Info

            if (MovementFlags.HasFlag(MovementFlags.SplineEnabled))
            {
                // TODO: Write spline flags
                //var splineFlags = SplineFlags.None;
            }

            #endregion Spline Info
        }
Beispiel #2
0
 protected override void WriteMovementUpdate(PrimitiveWriter writer, UpdateFieldFlags relation)
 {
     // UpdateFlag.HasPosition
 	writer.Write(Position.X);
 	writer.Write(Position.Y);
 	writer.Write(Position.Z);
     writer.WriteFloat(Orientation);
 }
Beispiel #3
0
		/// <summary>
		/// Writes the server's challenge.
		/// </summary>
		/// <param name="packet">the packet to write to</param>
		public void WriteServerChallenge(PrimitiveWriter packet)
		{
			packet.WriteBigInt(m_srp.PublicEphemeralValueB, 32);
			packet.WriteBigIntLength(m_srp.Generator, 1);

			// We will pad this out to 32 bytes.
			packet.WriteBigIntLength(m_srp.Modulus, 32);
			packet.WriteBigInt(m_srp.Salt);
		}
Beispiel #4
0
 protected virtual void WriteUpdateFlag_0x8(PrimitiveWriter writer, UpdateFieldFlags relation)
 {
     writer.Write(EntityId.LowRaw);
 }
Beispiel #5
0
        /// <summary>
        /// Writes all the blocks to the packet
        /// </summary>
        /// <param name="packet">The packet to write to</param>
        public void WriteFull(PrimitiveWriter packet)
        {
            packet.Write((byte)m_maxBlockCount);

            for (int i = 0; i < m_maxBlockCount; i++)
            {
                packet.Write(m_blocks[i]);
            }
        }
Beispiel #6
0
        /// <summary>
        /// Writes the bit mask of all required fields
        /// </summary>
        /// <param name="packet">The packet to write to</param>
        public void WriteTo(PrimitiveWriter packet)
        {
            //var valueCount = (m_highestIndex + 31) >> 5;
            var valueCount = (m_highestIndex >> 5) + 1;

            packet.Write((byte)valueCount);
            for (var i = 0; i < valueCount; i++)
            {
                packet.Write(m_blocks[i]);
            }
        }
Beispiel #7
0
 protected override void WriteUpdateFlag_0x10(PrimitiveWriter writer, UpdateFieldFlags relation)
 {
     writer.Write(150754760); // ?
 }
Beispiel #8
0
		protected override void WriteTypeSpecificMovementUpdate(PrimitiveWriter writer, UpdateFieldFlags relation, UpdateFlags updateFlags)
		{
			// Will only be GameObjects
			if (updateFlags.HasAnyFlag(UpdateFlags.Transport))
			{
				writer.Write(Utility.GetSystemTime());
			}
			if (updateFlags.HasAnyFlag(UpdateFlags.HasRotation))
			{
				writer.Write(Rotation);
			}
		}
Beispiel #9
0
 /// <summary>
 /// Writes the major portion of the create block.
 /// This handles flags 0x20, 0x40, and 0x100, they are exclusive to each other
 /// The content depends on the object's type
 /// </summary>
 /// <param name="writer"></param>
 /// <param name="relation"></param>
 protected virtual void WriteMovementUpdate(PrimitiveWriter writer, UpdateFieldFlags relation)
 {
 }
Beispiel #10
0
        /// <summary>
        /// Writes the data shared in movement packets and the create block of the update packet
        /// This is used in
        /// <list type="String">
        /// SMSG_UPDATE_OBJECT
        /// MSG_MOVE_*
        /// MSG_MOVE_SET_*_SPEED
        /// </list>
        /// </summary>
        /// <param name="packet"></param>
        public void WriteMovementPacketInfo(PrimitiveWriter packet, ref Vector3 pos, float orientation)
        {
            var moveFlags = MovementFlags;
            var moveFlags2 = MovementFlags2;

            if (moveFlags.HasAnyFlag(MovementFlags.OnTransport) && TransportInfo == null)
            {
                // should never happen
                moveFlags ^= MovementFlags.OnTransport;
            }

            packet.Write((uint)moveFlags);
            packet.Write((ushort)moveFlags2);
            packet.Write(Utility.GetSystemTime());
            packet.Write(pos.X);
            packet.Write(pos.Y);
            packet.Write(pos.Z);
            packet.Write(orientation);

            if (moveFlags.HasAnyFlag(MovementFlags.OnTransport))
            {
                // ReSharper disable PossibleNullReferenceException
                TransportInfo.EntityId.WritePacked(packet);
                // ReSharper restore PossibleNullReferenceException
                packet.Write(TransportPosition.X);
                packet.Write(TransportPosition.Y);
                packet.Write(TransportPosition.Z);
                packet.Write(TransportOrientation);
                packet.Write(TransportTime);
                packet.Write(TransportSeat);
            }

            if (moveFlags.HasAnyFlag(MovementFlags.Swimming | MovementFlags.Flying) ||
                moveFlags2.HasFlag(MovementFlags2.AlwaysAllowPitching))
            {
                packet.Write(PitchRate);
            }

            packet.Write(0); // air time

            if (moveFlags.HasAnyFlag(MovementFlags.Falling))
            {
                // yet somewhat unknown values (Client sends them)
                packet.Write(0f);
                packet.Write(8f);
                packet.Write(0.2f);
                packet.Write(1f);
            }

            if (moveFlags.HasAnyFlag(MovementFlags.SplineElevation))
            {
                packet.Write(0.0f);
            }
        }
Beispiel #11
0
 /// <summary>
 /// Writes the data shared in movement packets and the create block of the update packet
 /// This is used in
 /// <list type="String">
 /// SMSG_UPDATE_OBJECT
 /// MSG_MOVE_*
 /// MSG_MOVE_SET_*_SPEED
 /// </list>
 /// </summary>
 /// <param name="packet"></param>
 public void WriteMovementPacketInfo(PrimitiveWriter packet)
 {
     WriteMovementPacketInfo(packet, ref m_position, m_orientation);
 }
Beispiel #12
0
 protected override void WriteUpdateFlag_0x10(PrimitiveWriter writer, UpdateFieldFlags relation)
 {
     writer.Write(150754760); // TODO - wtf?
     //base.WriteUpdateFlag_0x10(writer, relation);
 }
Beispiel #13
0
		protected override void WriteMovementUpdate(PrimitiveWriter writer, UpdateFieldFlags relation)
		{
			// UpdateFlag.StationaryObject
			writer.Write(Position);
			writer.WriteFloat(Orientation);
		}
Beispiel #14
0
		protected override void WriteMovementUpdate(PrimitiveWriter packet, UpdateFieldFlags relation)
		{
            if (UpdateFlags.Has(UpdateFlags.StationaryObjectOnTransport))
            {
                // corpses had this, but seemed to just send their own info for both
                EntityId.Zero.WritePacked(packet);
                packet.Write(Position);
                packet.Write(Position); // transport position, but server seemed to send normal position except orientation
                packet.Write(Orientation);
                packet.Write(Orientation);
            }
            else if (UpdateFlags.Has(UpdateFlags.StationaryObject))
            {
                #region UpdateFlag.Flag_0x40 (StationaryObject)

                packet.Write(Position);
                packet.WriteFloat(Orientation);

                #endregion
            }
		}
Beispiel #15
0
 protected virtual void WriteUpdateFlag_0x10(PrimitiveWriter writer, UpdateFieldFlags relation)
 {
     writer.Write(1);
 }
Beispiel #16
0
 protected virtual void WriteTypeSpecificMovementUpdate(PrimitiveWriter writer, UpdateFieldFlags relation, UpdateFlags updateFlags)
 {
 }
Beispiel #17
0
 protected override void WriteTypeSpecificMovementUpdate(PrimitiveWriter writer, UpdateFieldFlags relation, UpdateFlags updateFlags)
 {
     // Probably specific to Unit
     if (updateFlags.HasFlag(UpdateFlags.AttackingTarget))
     {
         writer.Write((byte)0); // pguid
     }
 }
Beispiel #18
0
		protected override void WriteMovementUpdate(PrimitiveWriter packet, UpdateFieldFlags relation)
		{
			// StationaryObjectOnTransport
			if (UpdateFlags.HasAnyFlag(UpdateFlags.StationaryObjectOnTransport))
			{
				EntityId.Zero.WritePacked(packet);
				packet.Write(Position);
				packet.Write(Position); // transport position, but server seemed to send normal position except orientation
				packet.Write(Orientation);
				packet.Write(0.0f);
			}
			else if (UpdateFlags.HasAnyFlag(UpdateFlags.StationaryObject))
			{
				#region UpdateFlag.Flag_0x40 (StationaryObject)

				packet.Write(Position);
				packet.WriteFloat(Orientation);

				#endregion
			}
		}
Beispiel #19
0
	    /// <summary>
		/// Writes the server's proof. 
		/// </summary>
		/// <param name="packet">the packet to write to</param>
		public void WriteServerProof(PrimitiveWriter packet)
		{
			packet.WriteBigInt(m_srp.ServerSessionKeyProof, 20);
		}
Beispiel #20
0
		protected override void WriteTypeSpecificMovementUpdate(PrimitiveWriter writer, UpdateFieldFlags relation, UpdateFlags updateFlags)
		{
			base.WriteTypeSpecificMovementUpdate(writer, relation, updateFlags);
			writer.Write(m_entry.VehicleId);
			writer.Write(m_entry.VehicleAimAdjustment);
		}
Beispiel #21
0
        public void WriteReconnectChallenge(PrimitiveWriter packet)
        {
            ReconnectProof = new byte[16];
            new System.Random(System.Environment.TickCount).NextBytes(ReconnectProof);

            packet.Write(ReconnectProof);
            // 16 bytes of 0's
            packet.Write(0L);
            packet.Write(0L);
        }