Shino90
Sorceror
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:
Add below:
Find:
Add above:
Find:
Add below:
Find:
Add below:
Find:
Replace by:
Add below:
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;
Code:
private Dictionary<Item, Point2D> m_ItemLocations;
Find:
Code:
base.Resurrect();
Code:
if( this.m_ItemLocations != null ) {
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();
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 )
{
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
Code:
writer.Write( (int) 26 ); // version
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 );
}
}