/// <summary> /// /// </summary> /// <param name="packet"></param> /// <param name="updatingSelf"></param> private void WriteObjectValueUpdate( Packet packet, bool updatingSelf ) { packet.WriterStream.Write( (byte)UpdateTypes.Values ); EntityId entityId = new EntityId( this.Serial ); entityId.WritePacked( packet ); WriteUpdateMaskForValueUpdate( packet ); }
/// <summary> /// /// </summary> /// <param name="field"></param> /// <param name="value"></param> /// <returns></returns> protected Packet GetFieldUpdatePacket( UpdateFieldId updateFieldId, uint value ) { UpdatePacket packet = new UpdatePacket(); packet.WriterStream.Write( (byte)UpdateTypes.Values ); EntityId entityId = new EntityId( this.Serial ); entityId.WritePacked( packet ); int iBlocks = ( updateFieldId.RawId >> 5 ) + 1; packet.WriterStream.Write( (int)iBlocks ); packet.WriterStream.Fill( 0x00, ( iBlocks - 1 ) * 4 ); packet.WriterStream.Write( (uint)( 1 << ( updateFieldId.RawId & 31 ) ) ); packet.WriterStream.Write( (uint)value ); packet.EndWrite( 1 ); // Update Count return packet; }
/// <summary> /// /// </summary> /// <param name="field"></param> /// <param name="value"></param> /// <returns></returns> protected Packet GetFieldUpdatePacket( UpdateFieldId updateFieldId, EntityId value ) { UpdatePacket packet = new UpdatePacket(); packet.WriterStream.Write( (byte)UpdateTypes.Values ); EntityId entityId = new EntityId( this.Serial ); entityId.WritePacked( packet ); int iBlocks = ( ( updateFieldId.RawId + 1 ) >> 5 ) + 1; packet.WriterStream.Write( (int)iBlocks ); int iBlocksCheck = ( updateFieldId.RawId >> 5 ) + 1; if ( iBlocks > 1 && iBlocksCheck != iBlocks ) { packet.WriterStream.Fill( 0x00, ( iBlocks - 2 ) * 4 ); packet.WriterStream.Write( (uint)0x80000000 ); packet.WriterStream.Write( (uint)0x00000001 ); } else { packet.WriterStream.Fill( 0x00, ( iBlocks - 1 ) * 4 ); uint uiValue = (uint)( 1 << ( updateFieldId.RawId & 31 ) ); uiValue |= (uint)( uiValue << 1 ); packet.WriterStream.Write( (uint)uiValue ); } packet.WriterStream.Write( value ); packet.EndWrite( 1 ); // Update Count return packet; }
/// <summary> /// /// </summary> /// <returns></returns> public Packet GetDestroyPacket() { EntityId entityId = new EntityId(); return new DestroyPacket( entityId ); }
/// <summary> /// /// </summary> /// <param name="writer"></param> /// <param name="updatingSelf"></param> public void ObjectCreationUpdate( Packet writer, bool updatingSelf ) { writer.WriterStream.Write( (byte)this.PlayerField.GetCreationUpdateType( updatingSelf ) ); EntityId entityId = new EntityId(); entityId.WritePacked( writer ); writer.WriterStream.Write( (byte)this.PlayerField.ObjectTypeId ); WriteMovementUpdate( writer, updatingSelf ); WriteUpdateMaskForCreation( writer ); }
protected void SetEntityId( int iField, EntityId entityId ) { SetUInt32( iField, entityId.Low ); SetUInt32( iField + 1, entityId.High ); }
/// <summary> /// /// </summary> public DestroyPacket( EntityId entityId ) : base( (long)WordOpCode.SMSG_DESTROY_OBJECT, 0 ) { WriterStream.Write( (ushort)ByteOrder.NetToHost( 10 ) /* 2 + 8 */ ); // Size WriterStream.Write( (ushort)WordOpCode.SMSG_UPDATE_OBJECT ); // ID ////////////////////////////////////////////////////////////////////////// WriterStream.Write( (uint)entityId.High ); WriterStream.Write( (uint)entityId.Low ); }
protected Packet GetFieldUpdatePacket( UpdateFieldId field, EntityId value ) { return null; }