Go Back   RunUO - Ultima Online Emulation > RunUO > FAQ Forum

FAQ Forum A place to find answers to the most frequently asked questions, and a place to post said answers. Do NOT use this forum to ask questions.

Reply
 
Thread Tools Display Modes
Old 07-22-2008, 05:55 PM   #1 (permalink)
Forum Expert
 
Join Date: Sep 2007
Location: The Netherlands
Age: 19
Posts: 1,095
Send a message via AIM to Shino90
Default Fix Scrambled Inventory on Resurrect

The following script edits will make sure items in your inventory stay in their place when you die/resurrect. The script edits affect Scripts/Mobiles/PlayerMobile.cs. It only saves item locations of blessed and newbied items for regular players, and all for GMs.


Find:
Code:
		private int m_GuildMessageHue, m_AllianceMessageHue;
Add below:
Code:
		private Dictionary<Item, Point2D> m_ItemLocations;


Find:
Code:
			base.Resurrect();
Add above:
Code:
			if( this.m_ItemLocations == null ) {
				return;
			}
			
			foreach( Item item in this.m_ItemLocations.Keys ) {
				item.X = this.m_ItemLocations[item].X;
				item.Y = this.m_ItemLocations[item].Y;
			}


Find:
Code:
			if ( m_SentHonorContext != null )
				m_SentHonorContext.OnSourceKilled();
Add below:
Code:
			List<Item> items = new List<Item>( this.Backpack.Items );
			
			m_ItemLocations = new Dictionary<Item, Point2D>();
			
			for( int i = 0; i < items.Count; i++ ) {
				if(items[i].LootType == LootType.Blessed || items[i].LootType == LootType.Newbied || AccessLevel > AccessLevel.Player) {
					m_ItemLocations[items[i]] = new Point2D( items[i].X, items[i].Y );
				}
			}


Find:
Code:
			switch ( version )
			{
Add below:
Code:
				case 26:
				{
					int itemLocationsCount = reader.ReadInt();

					if( itemLocationsCount > 0 )
					{
						m_ItemLocations = new Dictionary<Item, Point2D>();

						for( int i = 0; i < itemLocationsCount; i++ )
						{
							m_ItemLocations.Add( reader.ReadItem(), new Point2D( reader.ReadInt(), reader.ReadInt() ) );
						}
					}
					goto case 25;
				}


Find:
Code:
			writer.Write( (int) 25 ); // version
Replace by:
Code:
			writer.Write( (int) 26 ); // version
Add below:
Code:
			if( m_ItemLocations == null )
			{
				writer.Write( (int)0 );
			}
			else
			{
				writer.Write( m_ItemLocations.Count );

				foreach( KeyValuePair<Item, Point2D> kvp in m_ItemLocations )
				{
					writer.Write( kvp.Key );
					writer.Write( kvp.Value.X );
					writer.Write( kvp.Value.Y );
				}
			}
__________________
Shino90 is offline   Reply With Quote
Reply

Bookmarks

Tags
fix, inventory, items, moving, resurrect


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5