From d5ebe946e90c397f8433a689f29427d96f93a845 Mon Sep 17 00:00:00 2001 From: mark Date: Wed, 8 Aug 2007 23:25:31 +0000 Subject: [PATCH] --- .../Items/Skill Items/Magical/Spellbook.cs | 21 ++++++++--- Server/Network/Packets.cs | 35 +++++++++++++++++++ 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/Scripts/Items/Skill Items/Magical/Spellbook.cs b/Scripts/Items/Skill Items/Magical/Spellbook.cs index 6e4d77504..891d856bf 100644 --- a/Scripts/Items/Skill Items/Magical/Spellbook.cs +++ b/Scripts/Items/Skill Items/Magical/Spellbook.cs @@ -497,10 +497,23 @@ namespace Server.Items to.Send( new DisplaySpellbook( this ) ); - if ( Core.AOS && to.NetState != null && to.NetState.Version != null && to.NetState.Version >= Version_400a ) - to.Send( new NewSpellbookContent( this, ItemID, BookOffset + 1, m_Content ) ); - else - to.Send( new SpellbookContent( m_Count, BookOffset + 1, m_Content, this ) ); + if ( to.NetState == null ) + return; + + if ( Core.AOS ) { + if ( to.NetState.Version != null && to.NetState.Version >= Version_400a ) { + to.Send( new NewSpellbookContent( this, ItemID, BookOffset + 1, m_Content ) ); + } else { + to.Send( new SpellbookContent( m_Count, BookOffset + 1, m_Content, this ) ); + } + } + else { + if ( to.NetState.IsPost6017 ) { + to.Send( new SpellbookContent6017( m_Count, BookOffset + 1, m_Content, this ) ); + } else { + to.Send( new SpellbookContent( m_Count, BookOffset + 1, m_Content, this ) ); + } + } } private Mobile m_Crafter; diff --git a/Server/Network/Packets.cs b/Server/Network/Packets.cs index 00c251182..ccf49341e 100644 --- a/Server/Network/Packets.cs +++ b/Server/Network/Packets.cs @@ -1531,6 +1531,41 @@ namespace Server.Network } } + public sealed class SpellbookContent6017 : Packet + { + public SpellbookContent6017( int count, int offset, ulong content, Item item ) : base( 0x3C ) + { + this.EnsureCapacity( 5 + (count * 20) ); + + int written = 0; + + m_Stream.Write( (ushort) 0 ); + + ulong mask = 1; + + for ( int i = 0; i < 64; ++i, mask <<= 1 ) + { + if ( (content & mask) != 0 ) + { + m_Stream.Write( (int) (0x7FFFFFFF - i) ); + m_Stream.Write( (ushort) 0 ); + m_Stream.Write( (byte) 0 ); + m_Stream.Write( (ushort) (i + offset) ); + m_Stream.Write( (short) 0 ); + m_Stream.Write( (short) 0 ); + m_Stream.Write( (byte) 0 ); // Grid Location? + m_Stream.Write( (int) item.Serial ); + m_Stream.Write( (short) 0 ); + + ++written; + } + } + + m_Stream.Seek( 3, SeekOrigin.Begin ); + m_Stream.Write( (ushort) written ); + } + } + public sealed class ContainerDisplay : Packet { public ContainerDisplay( Container c ) : base( 0x24, 7 )