Beispiel #1
0
 protected override void WriteMovementUpdate(PrimitiveWriter writer, UpdateFieldFlags relation)
 {
     writer.Write(this.Position.X);
     writer.Write(this.Position.Y);
     writer.Write(this.Position.Z);
     writer.WriteFloat(this.Orientation);
 }
Beispiel #2
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

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

            #endregion
        }
Beispiel #3
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 #4
0
 protected override UpdateType GetCreationUpdateType(UpdateFieldFlags relation)
 {
     if (relation.HasAnyFlag(UpdateFieldFlags.Private | UpdateFieldFlags.OwnerOnly))
     {
         return(UpdateType.CreateSelf);
     }
     return(UpdateType.Create);
 }
Beispiel #5
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 #6
0
 protected override UpdateType GetCreationUpdateType(UpdateFieldFlags relation)
 {
     if (m_entry is GODuelFlagEntry)
     {
         return(UpdateType.CreateSelf);
     }
     return(UpdateType.Create);
 }
Beispiel #7
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);
 }
        private void FlagFinder(UpdateFieldFlags toSearch)
        {
            var query = from field in m_updateFieldList
                        where (field.Flags & toSearch) == toSearch
                        select field;

            Console.WriteLine("Flag: {0}", toSearch);
            foreach (var field in query)
            {
                Console.WriteLine("{0}: {1} - {2}", field.Size, field.Name, field.Flags);
            }
        }
Beispiel #9
0
 protected override void WriteMovementUpdate(PrimitiveWriter packet, UpdateFieldFlags relation)
 {
     if (UpdateFlags.HasAnyFlag(UpdateFlags.StationaryObjectOnTransport))
     {
         EntityId.Zero.WritePacked(packet);
         packet.Write(Position);
         packet.Write(Position);
         packet.Write(Orientation);
         packet.Write(0.0f);
     }
     else
     {
         if (!UpdateFlags.HasAnyFlag(UpdateFlags.StationaryObject))
         {
             return;
         }
         packet.Write(Position);
         packet.WriteFloat(Orientation);
     }
 }
Beispiel #10
0
        protected override void WriteMovementUpdate(PrimitiveWriter packet, UpdateFieldFlags relation)
        {
            if (UpdateFlags.HasAnyFlag(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.HasAnyFlag(UpdateFlags.StationaryObject))
            {
                #region UpdateFlag.Flag_0x40 (StationaryObject)

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

                #endregion
            }
        }
Beispiel #11
0
 protected override UpdateType GetCreationUpdateType(UpdateFieldFlags relation)
 {
     return(UpdateType.Create);
 }
Beispiel #12
0
		public static bool HasAnyFlag(this UpdateFieldFlags flags, UpdateFieldFlags otherFlags)
		{
			return (flags & otherFlags) != 0;
		}
Beispiel #13
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 #14
0
 public static bool HasAnyFlag(this UpdateFieldFlags flags, UpdateFieldFlags otherFlags)
 {
     return((flags & otherFlags) != UpdateFieldFlags.None);
 }
Beispiel #15
0
 protected override void WriteUpdateFlag_0x10(PrimitiveWriter writer, UpdateFieldFlags relation)
 {
     writer.Write(150754760); // ?
 }
Beispiel #16
0
		protected override UpdateType GetCreationUpdateType(UpdateFieldFlags flags)
		{
			return (flags & UpdateFieldFlags.Private) != 0 ? UpdateType.CreateSelf : UpdateType.Create;
		}
Beispiel #17
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 #18
0
		protected override UpdateType GetCreationUpdateType(UpdateFieldFlags relation)
		{
			return UpdateType.Create;
		}
Beispiel #19
0
 protected override void WriteMovementUpdate(PrimitiveWriter writer, UpdateFieldFlags relation)
 {
     // UpdateFlag.StationaryObject
     writer.Write(Position);
     writer.WriteFloat(Orientation);
 }
Beispiel #20
0
 protected virtual void WriteUpdateFlag_0x10(PrimitiveWriter writer, UpdateFieldFlags relation)
 {
     writer.Write(1);
 }
Beispiel #21
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 #22
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 #23
0
 protected override void WriteUpdateFlag_0x10(PrimitiveWriter writer, UpdateFieldFlags relation)
 {
     writer.Write(150754760); // TODO - wtf?
     //base.WriteUpdateFlag_0x10(writer, relation);
 }
Beispiel #24
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 #25
0
		protected abstract UpdateType GetCreationUpdateType(UpdateFieldFlags relation);
Beispiel #26
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 #27
0
		protected override UpdateType GetCreationUpdateType(UpdateFieldFlags flags)
		{
			return flags.HasAnyFlag(UpdateFieldFlags.Private) ? UpdateType.CreateSelf : UpdateType.Create;
		}
Beispiel #28
0
 protected override void WriteUpdateFlag_0x10(Core.Network.PrimitiveWriter writer, UpdateFieldFlags relation)
 {
     //base.WriteUpdateFlag_0x10(writer, relation);
     writer.Write(2f);
 }
Beispiel #29
0
 protected override UpdateType GetCreationUpdateType(UpdateFieldFlags relation)
 {
     return(this.m_entry is GODuelFlagEntry ? UpdateType.CreateSelf : UpdateType.Create);
 }
Beispiel #30
0
		protected override UpdateType GetCreationUpdateType(UpdateFieldFlags relation)
		{
			if (m_entry is GODuelFlagEntry)
			{
				return UpdateType.CreateSelf;
			}
			return UpdateType.Create;
		}
Beispiel #31
0
        protected void WriteUpdateValues(bool forCreation, Character receiver, UpdateFieldFlags relation)
        {
            UpdateMask mask;

            if (forCreation)
            {
                // completely new
                var pos = receiver.m_updatePacket.Position;
                mask = new UpdateMask(m_highestUsedUpdateIndex);
                receiver.m_updatePacket.Position = pos + 1 + (4 * mask.MaxBlockCount);                  // skip over the index block
                for (var i = 0; i <= m_highestUsedUpdateIndex; i++)
                {
                    var flags = _UpdateFieldInfos.FieldFlags[i];
                    if (flags.HasAnyFlag(relation) && m_updateValues[i].UInt32 != 0)
                    {
                        mask.SetBit(i);
                        WriteUpdateValue(receiver.m_updatePacket, receiver, i);
                    }
                }
                var newPos = receiver.m_updatePacket.Position;
                receiver.m_updatePacket.Position = pos;
                mask.WriteFull(receiver.m_updatePacket);                                                                                // write the full index block
                receiver.m_updatePacket.Position = newPos;
                return;
                //WriteUpdateValues(receiver, relation, 0, _UpdateFieldInfos.Fields.Length, true);
            }

            if (relation.HasAnyFlag(UpdateFieldFlags.Private))
            {
                // Private
                mask = m_privateUpdateMask;
            }
            else if (relation.HasAnyFlag(UpdateFieldFlags.OwnerOnly | UpdateFieldFlags.GroupOnly))
            {
                // Group or Owner
                var pos = receiver.m_updatePacket.Position;
                mask = new UpdateMask(m_privateUpdateMask.m_highestIndex);
                receiver.m_updatePacket.Position = pos + 1 + (4 * mask.MaxBlockCount);          // skip over the index block
                for (var i = m_privateUpdateMask.m_lowestIndex; i <= m_privateUpdateMask.m_highestIndex; i++)
                {
                    var flags = _UpdateFieldInfos.FieldFlags[i];
                    if (flags.HasAnyFlag(relation) &&
                        (!flags.HasAnyFlag(UpdateFieldFlags.Public) || m_publicUpdateMask.GetBit(i)))
                    {
                        mask.SetBit(i);
                        WriteUpdateValue(receiver.m_updatePacket, receiver, i);
                    }
                }
                var newPos = receiver.m_updatePacket.Position;
                receiver.m_updatePacket.Position = pos;
                mask.WriteFull(receiver.m_updatePacket);                                                                        // write the full index block
                receiver.m_updatePacket.Position = newPos;
                //WriteUpdateValues(receiver, relation, m_privateUpdateMask.m_lowestIndex, m_privateUpdateMask.m_highestIndex, false);
                return;
            }
            else
            {
                // Public
                mask = m_publicUpdateMask;
            }

            mask.WriteTo(receiver.m_updatePacket);

            for (var i = mask.m_lowestIndex; i <= mask.m_highestIndex; i++)
            {
                if (mask.GetBit(i))
                {
                    WriteUpdateValue(receiver.m_updatePacket, receiver, i);
                }
            }
        }
Beispiel #32
0
 protected virtual void WriteUpdateFlag_0x8(PrimitiveWriter writer, UpdateFieldFlags relation)
 {
     writer.Write(EntityId.LowRaw);
 }
Beispiel #33
0
		protected override void WriteMovementUpdate(PrimitiveWriter writer, UpdateFieldFlags relation)
		{
			// UpdateFlag.StationaryObject
			writer.Write(Position);
			writer.WriteFloat(Orientation);
		}
Beispiel #34
0
 protected virtual void WriteTypeSpecificMovementUpdate(PrimitiveWriter writer, UpdateFieldFlags relation, UpdateFlags updateFlags)
 {
 }
Beispiel #35
0
 protected override UpdateType GetCreationUpdateType(UpdateFieldFlags flags)
 {
     return(flags.HasAnyFlag(UpdateFieldFlags.Private) ? UpdateType.CreateSelf : UpdateType.Create);
 }
Beispiel #36
0
		protected void WriteUpdateValues(bool forCreation, Character receiver, UpdateFieldFlags relation)
		{
			UpdateMask mask;
			if (forCreation)
			{
				// completely new
				var pos = receiver.m_updatePacket.Position;
				mask = new UpdateMask(m_highestUsedUpdateIndex);
				receiver.m_updatePacket.Position = pos + 1 + (4 * mask.MaxBlockCount);	// skip over the index block
				for (var i = 0; i <= m_highestUsedUpdateIndex; i++)
				{
					var flags = _UpdateFieldInfos.FieldFlags[i];
					if (flags.HasAnyFlag(relation) && m_updateValues[i].UInt32 != 0)
					{
						mask.SetBit(i);
						WriteUpdateValue(receiver.m_updatePacket, receiver, i);
					}
				}
				var newPos = receiver.m_updatePacket.Position;
				receiver.m_updatePacket.Position = pos;
				mask.WriteFull(receiver.m_updatePacket);								// write the full index block
				receiver.m_updatePacket.Position = newPos;
				return;
				//WriteUpdateValues(receiver, relation, 0, _UpdateFieldInfos.Fields.Length, true);
			}

			if (relation.HasAnyFlag(UpdateFieldFlags.Private))
		    {
		        // Private
		        mask = m_privateUpdateMask;
		    }
		    else if (relation.HasAnyFlag(UpdateFieldFlags.OwnerOnly | UpdateFieldFlags.GroupOnly))
		    {
		        // Group or Owner
		        var pos = receiver.m_updatePacket.Position;
		        mask = new UpdateMask(m_privateUpdateMask.m_highestIndex);
		        receiver.m_updatePacket.Position = pos + 1 + (4 * mask.MaxBlockCount);	// skip over the index block
		        for (var i = m_privateUpdateMask.m_lowestIndex; i <= m_privateUpdateMask.m_highestIndex; i++)
		        {
		            var flags = _UpdateFieldInfos.FieldFlags[i];
					if (flags.HasAnyFlag(relation) &&
						(!flags.HasAnyFlag(UpdateFieldFlags.Public) || m_publicUpdateMask.GetBit(i)))
                    {
                        mask.SetBit(i);
                        WriteUpdateValue(receiver.m_updatePacket, receiver, i);
                    }
		        }
		        var newPos = receiver.m_updatePacket.Position;
		        receiver.m_updatePacket.Position = pos;
		        mask.WriteFull(receiver.m_updatePacket);								// write the full index block
		        receiver.m_updatePacket.Position = newPos;
		        //WriteUpdateValues(receiver, relation, m_privateUpdateMask.m_lowestIndex, m_privateUpdateMask.m_highestIndex, false);
		        return;
		    }
		    else
		    {
		        // Public
		        mask = m_publicUpdateMask;
		    }

		    mask.WriteTo(receiver.m_updatePacket);

		    for (var i = mask.m_lowestIndex; i <= mask.m_highestIndex; i++)
		    {
		        if (mask.GetBit(i))
		        {
		            WriteUpdateValue(receiver.m_updatePacket, receiver, i);
		        }
		    }
		}
Beispiel #37
0
 protected abstract UpdateType GetCreationUpdateType(UpdateFieldFlags relation);
Beispiel #38
0
 protected override UpdateType GetCreationUpdateType(UpdateFieldFlags relation)
 {
     if (relation.HasAnyFlag(UpdateFieldFlags.Private | UpdateFieldFlags.OwnerOnly))
     {
         return UpdateType.CreateSelf;
     }
     return UpdateType.Create;
 }
Beispiel #39
0
 protected virtual void WriteUpdateFlag_0x8(PrimitiveWriter writer, UpdateFieldFlags relation)
 {
     writer.Write(this.EntityId.LowRaw);
 }
Beispiel #40
0
 protected override void WriteTypeSpecificMovementUpdate(PrimitiveWriter writer, UpdateFieldFlags relation,
                                                         UpdateFlags updateFlags)
 {
     if (updateFlags.HasAnyFlag(UpdateFlags.Transport))
     {
         writer.Write(Utility.GetSystemTime());
     }
     if (!updateFlags.HasAnyFlag(UpdateFlags.HasRotation))
     {
         return;
     }
     writer.Write(Rotation);
 }
Beispiel #41
0
 protected virtual void WriteUpdateFlag_0x10(PrimitiveWriter writer, UpdateFieldFlags relation)
 {
     writer.Write(1);
 }
Beispiel #42
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 #43
0
 protected virtual void WriteTypeSpecificMovementUpdate(PrimitiveWriter writer, UpdateFieldFlags relation,
                                                        UpdateFlags updateFlags)
 {
 }
Beispiel #44
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 #45
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 #46
0
 protected override void WriteUpdateFlag_0x10(PrimitiveWriter writer, UpdateFieldFlags relation)
 {
     writer.Write(150754760);
 }
Beispiel #47
0
 protected override void WriteUpdateFlag_0x10(PrimitiveWriter writer, UpdateFieldFlags relation)
 {
     writer.Write(150754760); // TODO - wtf?
     //base.WriteUpdateFlag_0x10(writer, relation);
 }
Beispiel #48
0
 protected override void WriteUpdateFlag_0x10(Core.Network.PrimitiveWriter writer, UpdateFieldFlags relation)
 {
     //base.WriteUpdateFlag_0x10(writer, relation);
     writer.Write(2f);
 }
		private void FlagFinder(UpdateFieldFlags toSearch)
		{
			var query = from field in m_updateFieldList
			            where (field.Flags & toSearch) == toSearch
			            select field;

			Console.WriteLine("Flag: {0}", toSearch);
			foreach (var field in query)
			{
				Console.WriteLine("{0}: {1} - {2}", field.Size, field.Name, field.Flags);
			}
		}