RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Corpse Hair/Facial bug with client 6.0.1.7 [SVN-313]

Kamron

Knight
Corpse Hair/Facial bug with client 6.0.1.7 [SVN-313]

I apologize for such a long delay. There is STILL a bug with Hair/Facial hair in RunUO SVN 313 with clients above 6.0.1.7. This is an updated version of my previous thread. You can only fix this by doing the core modification.

Go to Server\Items\Container.cs - Look for this code

Code:
			if ( state != null && state.IsPost6017 )
				state.Send( new ContainerContent6017( state.Mobile, this ) );
			else
				state.Send( new ContainerContent( state.Mobile, this ) );

Change it to

Code:
			SendContentTo( to.NetState );

Now underneath that function where you made the replacement, add this new function:
Code:
		public virtual void SendContentTo( NetState state )
		{
			if ( state != null && state.IsPost6017 )
				state.Send( new ContainerContent6017( state.Mobile, this ) );
			else
				state.Send( new ContainerContent( state.Mobile, this ) );
		}

Now go to Scripts\Items\Misc\Corpses\Packets.cs and add this to the bottom:
Code:
	public sealed class CorpseContent6017 : Packet
	{
		public CorpseContent6017( Mobile beholder, Corpse beheld )
			: base( 0x3C )
		{
			List<Item> items = beheld.Items;
			int count = items.Count;

			if( beheld.Hair != null && beheld.Hair.ItemID > 0 )
				count++;
			if( beheld.FacialHair != null && beheld.FacialHair.ItemID > 0 )
				count++;

			EnsureCapacity( 5 + (count * 20) );

			long pos = m_Stream.Position;

			int written = 0;

			m_Stream.Write( (ushort)0 );

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

				if( !child.Deleted && child.Parent == beheld && beholder.CanSee( child ) )
				{
					m_Stream.Write( (int)child.Serial );
					m_Stream.Write( (ushort)child.ItemID );
					m_Stream.Write( (byte)0 ); // signed, itemID offset
					m_Stream.Write( (ushort)child.Amount );
					m_Stream.Write( (short)child.X );
					m_Stream.Write( (short)child.Y );
					m_Stream.Write( (byte)0 ); // Grid Location?
					m_Stream.Write( (int)beheld.Serial );
					m_Stream.Write( (ushort)child.Hue );

					++written;
				}
			}

			if( beheld.Hair != null && beheld.Hair.ItemID > 0 )
			{
				m_Stream.Write( (int)HairInfo.FakeSerial( beheld.Owner ) - 2 );
				m_Stream.Write( (ushort)beheld.Hair.ItemID );
				m_Stream.Write( (byte)0 ); // signed, itemID offset
				m_Stream.Write( (ushort)1 );
				m_Stream.Write( (short)0 );
				m_Stream.Write( (short)0 );
				m_Stream.Write( (byte)0 ); // Grid Location?
				m_Stream.Write( (int)beheld.Serial );
				m_Stream.Write( (ushort)beheld.Hair.Hue );

				++written;
			}

			if( beheld.FacialHair != null && beheld.FacialHair.ItemID > 0 )
			{
				m_Stream.Write( (int)FacialHairInfo.FakeSerial( beheld.Owner ) - 2 );
				m_Stream.Write( (ushort)beheld.FacialHair.ItemID );
				m_Stream.Write( (byte)0 ); // signed, itemID offset
				m_Stream.Write( (ushort)1 );
				m_Stream.Write( (short)0 );
				m_Stream.Write( (short)0 );
				m_Stream.Write( (byte)0 ); // Grid Location?
				m_Stream.Write( (int)beheld.Serial );
				m_Stream.Write( (ushort)beheld.FacialHair.Hue );

				++written;
			}

			m_Stream.Seek( pos, SeekOrigin.Begin );
			m_Stream.Write( (ushort)written );
		}
	}

While in that same file, modify this part:
Code:
	public sealed class CorpseContent : Packet
	{
		public CorpseContent( Mobile beholder, Corpse beheld )
			: base( 0x3C )
		{
			List<Item> items = beheld.[COLOR=RED]EquipItems[/COLOR];
			int count = items.Count;

To look like this:
Code:
	public sealed class CorpseContent : Packet
	{
		public CorpseContent( Mobile beholder, Corpse beheld )
			: base( 0x3C )
		{
			List<Item> items = beheld.[COLOR=BLUE]Items[/COLOR];
			int count = items.Count;

Now go to Scripts\Items\Misc\Corpses\Corpse.cs and find this code:
Code:
		public override void SendInfoTo( NetState state, bool sendOplPacket )
		{
			base.SendInfoTo( state, sendOplPacket );

			if ( ItemID == 0x2006 )
			{
				state.Send( new CorpseContent( state.Mobile, this ) );
				state.Send( new CorpseEquip( state.Mobile, this ) );
			}
		}

Replace that whole function with this:
Code:
		public override void SendContentTo( NetState state )
		{
			if ( ItemID == 0x2006 )
			{
				if ( state != null && state.IsPost6017 )
					state.Send( new CorpseContent6017( state.Mobile, this ) );
				else
					state.Send( new CorpseContent( state.Mobile, this ) );
				state.Send( new CorpseEquip( state.Mobile, this ) );
			}
			else
				base.SendContentTo( state );	
		}

		public override void SendInfoTo( NetState state, bool sendOplPacket )
		{
			base.SendInfoTo( state, sendOplPacket );

			if ( ItemID == 0x2006 )
			{
				if ( state != null && state.IsPost6017 )
					state.Send( new CorpseContent6017( state.Mobile, this ) );
				else
					state.Send( new CorpseContent( state.Mobile, this ) );
				state.Send( new CorpseEquip( state.Mobile, this ) );
			}
		}

You're done!
 
Top