Example #1
0
 protected override UpdateType GetCreationUpdateType(UpdateFieldFlags relation)
 {
     if (relation.HasAnyFlag(UpdateFieldFlags.Private | UpdateFieldFlags.OwnerOnly))
     {
         return(UpdateType.CreateSelf);
     }
     return(UpdateType.Create);
 }
Example #2
0
 protected override UpdateType GetCreationUpdateType(UpdateFieldFlags relation)
 {
     if (relation.HasAnyFlag(UpdateFieldFlags.Private | UpdateFieldFlags.OwnerOnly))
     {
         return UpdateType.CreateSelf;
     }
     return UpdateType.Create;
 }
Example #3
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);
		        }
		    }
		}
Example #4
0
		protected override UpdateType GetCreationUpdateType(UpdateFieldFlags flags)
		{
			return flags.HasAnyFlag(UpdateFieldFlags.Private) ? UpdateType.CreateSelf : UpdateType.Create;
		}
Example #5
0
 protected override UpdateType GetCreationUpdateType(UpdateFieldFlags flags)
 {
     return(flags.HasAnyFlag(UpdateFieldFlags.Private) ? UpdateType.CreateSelf : UpdateType.Create);
 }
Example #6
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);
                }
            }
        }