Server.Network.MobileIncoming.MobileIncoming C# (CSharp) Méthode

MobileIncoming() public méthode

public MobileIncoming ( Mobile beholder, Mobile beheld ) : System
beholder Mobile
beheld Mobile
Résultat System
        public MobileIncoming( Mobile beholder, Mobile beheld )
            : base(0x78)
        {
            m_Beheld = beheld;
            ++m_Version;

            List<Item> eq = beheld.Items;
            int count = eq.Count;

            if( beheld.HairItemID > 0 )
                count++;
            if( beheld.FacialHairItemID > 0 )
                count++;

            this.EnsureCapacity( 23 + (count * 9) );

            int hue = beheld.Hue;

            if ( beheld.SolidHueOverride >= 0 )
                hue = beheld.SolidHueOverride;

            m_Stream.Write( (int) beheld.Serial );
            m_Stream.Write( (short) beheld.Body );
            m_Stream.Write( (short) beheld.X );
            m_Stream.Write( (short) beheld.Y );
            m_Stream.Write( (sbyte) beheld.Z );
            m_Stream.Write( (byte) beheld.Direction );
            m_Stream.Write( (short) hue );
            m_Stream.Write( (byte) beheld.GetPacketFlags() );
            m_Stream.Write( (byte) Notoriety.Compute( beholder, beheld ) );

            for ( int i = 0; i < eq.Count; ++i )
            {
                Item item = eq[i];

                byte layer = (byte) item.Layer;

                if ( !item.Deleted && beholder.CanSee( item ) && m_DupedLayers[layer] != m_Version )
                {
                    m_DupedLayers[layer] = m_Version;

                    hue = item.Hue;

                    if ( beheld.SolidHueOverride >= 0 )
                        hue = beheld.SolidHueOverride;

                    int itemID = item.ItemID & 0x7FFF;
                    bool writeHue = ( hue != 0 );

                    if ( writeHue )
                        itemID |= 0x8000;

                    m_Stream.Write( (int) item.Serial );
                    m_Stream.Write( (ushort) itemID );
                    m_Stream.Write( (byte) layer );

                    if ( writeHue )
                        m_Stream.Write( (short) hue );
                }
            }

            if( beheld.HairItemID > 0 )
            {
                if( m_DupedLayers[(int)Layer.Hair] != m_Version )
                {
                    m_DupedLayers[(int)Layer.Hair] = m_Version;
                    hue = beheld.HairHue;

                    if( beheld.SolidHueOverride >= 0 )
                        hue = beheld.SolidHueOverride;

                    int itemID = beheld.HairItemID & 0x7FFF;

                    bool writeHue = (hue != 0);

                    if( writeHue )
                        itemID |= 0x8000;

                    m_Stream.Write( (int)HairInfo.FakeSerial( beheld ) );
                    m_Stream.Write( (ushort)itemID );
                    m_Stream.Write( (byte)Layer.Hair );

                    if( writeHue )
                        m_Stream.Write( (short)hue );
                }
            }

            if( beheld.FacialHairItemID > 0 )
            {
                if( m_DupedLayers[(int)Layer.FacialHair] != m_Version )
                {
                    m_DupedLayers[(int)Layer.FacialHair] = m_Version;
                    hue = beheld.FacialHairHue;

                    if( beheld.SolidHueOverride >= 0 )
                        hue = beheld.SolidHueOverride;

                    int itemID = beheld.FacialHairItemID & 0x7FFF;

                    bool writeHue = (hue != 0);

                    if( writeHue )
                        itemID |= 0x8000;

                    m_Stream.Write( (int)FacialHairInfo.FakeSerial( beheld ) );
                    m_Stream.Write( (ushort)itemID );
                    m_Stream.Write( (byte)Layer.FacialHair );

                    if( writeHue )
                        m_Stream.Write( (short)hue );
                }
            }

            m_Stream.Write( (int) 0 ); // terminate
        }
MobileIncoming