Exemplo n.º 1
0
        public OPLInfoPacket( ObjectPropertyList list )
            : base(0xBF)
        {
            EnsureCapacity( 13 );

            Write( (short) 0x10 );
            Write( (int) list.Serial );
            Write( (int) list.GetHash() );
        }
Exemplo n.º 2
0
        public OPLPacket( ObjectPropertyList list )
            : base(0xD6)
        {
            EnsureCapacity( 128 );

            Write( (short) 1 );
            Write( (int) list.Serial );
            Write( (short) 0 );
            Write( (int) list.GetHash() );

            ArrayList props = list.GetProps();
            for(int i=0;i<props.Count;i++)
            {
                ObjectProperty prop = (ObjectProperty)props[i];
                Write( (int) prop.Number );

                if ( prop.Args.Length > 0 )
                {
                    byte[] buff = Encoding.Unicode.GetBytes( prop.Args );
                    Write( (short) buff.Length );
                    Write( buff, 0, buff.Length );
                }
                else
                {
                    Write( (short) 0 );
                }
            }

            Write( (int) 0 );
        }
Exemplo n.º 3
0
        public static void Read( PacketReader p )
        {
            Serial ser = p.ReadUInt32();
            ushort zero = p.ReadUInt16();
            int hash = p.ReadInt32();

            object old = m_Entries[ser];
            if ( old is ObjectPropertyList )
            {
                if ( ((ObjectPropertyList)old).ServerHash+0x40000000 == hash )
                    return;
            }

            ArrayList props = new ArrayList();
            while ( true )
            {
                int num = p.ReadInt32();
                if ( num == 0 || num == -1 )
                    break;

                short argLen = p.ReadInt16();
                string args = String.Empty;

                if ( argLen > 0 )
                    args = p.ReadUnicodeString( argLen >> 1 );

                props.Add( new ObjectProperty( num, args ) );
            }

            ObjectPropertyList list;
            m_Entries[ser] = list = new ObjectPropertyList( ser, hash, props );
            if ( old is ObjectPropertyList )
                list.Add( ((ObjectPropertyList)old).MyProps );
        }