public virtual void Open(Mobile from, bool checkSelfLoot)
{
if (from.AccessLevel > AccessLevel.Player || from.InRange(this.GetWorldLocation(), 2))
{
#region Self Looting
if (checkSelfLoot && from == m_Owner && !GetFlag(CorpseFlag.SelfLooted) && this.Items.Count != 0)
{
DeathRobe robe = from.FindItemOnLayer(Layer.OuterTorso) as DeathRobe;
if (robe != null)
{
Map map = from.Map;
if (map != null && map != Map.Internal)
{
robe.MoveToWorld(from.Location, map);
robe.BeginDecay();
}
}
Container pack = from.Backpack;
if (m_RestoreEquip != null && pack != null)
{
List <Item> packItems = new List <Item>(pack.Items); // Only items in the top-level pack are re-equipped
for (int i = 0; i < packItems.Count; i++)
{
Item packItem = packItems[i];
if (m_RestoreEquip.Contains(packItem) && packItem.Movable)
{
from.EquipItem(packItem);
}
}
}
List <Item> items = new List <Item>(this.Items);
bool didntFit = false;
for (int i = 0; !didntFit && i < items.Count; ++i)
{
Item item = items[i];
Point3D loc = item.Location;
if (item.Layer == Layer.Hair || item.Layer == Layer.FacialHair || !item.Movable || !GetRestoreInfo(item, ref loc))
{
continue;
}
if (pack != null && pack.CheckHold(from, item, false, true))
{
item.Location = loc;
pack.AddItem(item);
if (m_RestoreEquip != null && m_RestoreEquip.Contains(item))
{
from.EquipItem(item);
}
}
else
{
didntFit = true;
}
}
from.PlaySound(0x3E3);
if (this.Items.Count != 0)
{
from.SendLocalizedMessage(1062472); // You gather some of your belongings. The rest remain on the corpse.
}
else
{
SetFlag(CorpseFlag.Carved, true);
if (ItemID == 0x2006)
{
ProcessDelta();
SendRemovePacket();
ItemID = Utility.Random(0xECA, 9); // bone graphic
Hue = 0;
ProcessDelta();
}
from.SendLocalizedMessage(1062471); // You quickly gather all of your belongings.
}
SetFlag(CorpseFlag.SelfLooted, true);
}
#endregion
if (!CheckLoot(from, null))
{
return;
}
base.OnDoubleClick(from);
}
else
{
from.SendLocalizedMessage(500446); // That is too far away.
return;
}
}