View Single Post
Old 06-16-2007, 08:35 PM   #7 (permalink)
Lokai
Forum Expert
 
Lokai's Avatar
 
Join Date: Aug 2003
Location: Bergen, NY (Rochester)
Age: 42
Posts: 1,493
Send a message via ICQ to Lokai Send a message via MSN to Lokai Send a message via Yahoo to Lokai
Default

I added this class:

Code:
    public sealed class LinkedBookHeader : Packet
    {
        public LinkedBookHeader(Mobile from, BaseBook book)
            : base(0xD4)
        {
            string title = book.Title == null ? "" : book.Title;
            string author = book.Author == null ? "" : book.Author;
            byte[] titleBuffer = Utility.UTF8.GetBytes(title);
            byte[] authorBuffer = Utility.UTF8.GetBytes(author);
            EnsureCapacity(15 + titleBuffer.Length + authorBuffer.Length);
            m_Stream.Write((int)book.Serial);
            m_Stream.Write((bool)true);
            m_Stream.Write((bool)book.Writable);
            m_Stream.Write((ushort)book.PagesCount);
            m_Stream.Write((ushort)(titleBuffer.Length + 1));
            m_Stream.Write(titleBuffer, 0, titleBuffer.Length);
            m_Stream.Write((byte)0); // terminate
            m_Stream.Write((ushort)(authorBuffer.Length + 1));
            m_Stream.Write(authorBuffer, 0, authorBuffer.Length);
            m_Stream.Write((byte)0); // terminate
        }
    }
And changed this part of the OnDoubleClick method:

Code:
            from.Send(new LinkedBookHeader(from, book)); //changed this line
            from.Send(new BookPageDetails(book));
            Toggle = !Toggle;
        }
Lokai is offline   Reply With Quote