[CommandProperty(AccessLevel.GameMaster)]
public virtual bool InstancedCorpse
{
get
{
if (!Core.SE)
{
return false;
}
return (DateTime.UtcNow < (m_TimeOfDeath + InstancedCorpseTime));
}
}
/*
private Dictionary<Item, InstancedItemInfo> m_InstancedItems;
public bool HasAssignedInstancedLoot { get; private set; }
private class InstancedItemInfo
{
private readonly Mobile m_Mobile;
private readonly Item m_Item;
public bool Perpetual { get; set; }
public InstancedItemInfo(Item i, Mobile m)
{
m_Item = i;
m_Mobile = m;
}
public bool IsOwner(Mobile m)
{
if (m_Item.LootType == LootType.Cursed) //Cursed Items are part of everyone's instanced corpse... (?)
{
return true;
}
if (m == null)
{
return false; //sanity
}
if (m_Mobile == m)
{
return true;
}
Party myParty = Party.Get(m_Mobile);
return (myParty != null && myParty == Party.Get(m));
}
}
public override bool IsChildVisibleTo(Mobile m, Item child)
{
if (!m.Player || m.IsStaff()) //Staff and creatures not subject to instancing.
{
return true;
}
if (m_InstancedItems != null)
{
InstancedItemInfo info;
if (m_InstancedItems.TryGetValue(child, out info) && (InstancedCorpse || info.Perpetual))
{
return info.IsOwner(m); //IsOwner checks Party stuff.
}
}
return true;
}
public override void AddItem(Item item)
{
base.AddItem(item);
if (InstancedCorpse && HasAssignedInstancedLoot)
{
if (item.GetBounce() != null)
{
if (m_HasLooted == null)
m_HasLooted = new List<Item>();
m_HasLooted.Add(item);
}
AssignInstancedLoot(item);
}
}
private void AssignInstancedLoot()
{
AssignInstancedLoot(this.Items);
}
public void AssignInstancedLoot(Item item)
{
AssignInstancedLoot(new Item[] { item });
}
private void AssignInstancedLoot(IEnumerable<Item> items)
{
if (m_Aggressors.Count == 0 || Items.Count == 0)
{
return;
}
if (m_InstancedItems == null)
{
m_InstancedItems = new Dictionary<Item, InstancedItemInfo>();
}
var stackables = new List<Item>();
var unstackables = new List<Item>();
foreach (var item in items.Where(i => !m_InstancedItems.ContainsKey(i)))
{
if (item.LootType != LootType.Cursed) //Don't have curesd items take up someone's item spot.. (?)
{
if (item.Stackable)
{
stackables.Add(item);
}
else
{
unstackables.Add(item);
}
}
}
var attackers = new List<Mobile>(m_Aggressors);
for (int i = 1; i < attackers.Count - 1; i++) //randomize
{
int rand = Utility.Random(i + 1);
Mobile temp = attackers[rand];
attackers[rand] = attackers[i];
attackers[i] = temp;
}
//stackables first, for the remaining stackables, have those be randomly added after
for (int i = 0; i < stackables.Count; i++)
{
Item item = stackables[i];
if (item.Amount >= attackers.Count)
{
int amountPerAttacker = (item.Amount / attackers.Count);
int remainder = (item.Amount % attackers.Count);
for (int j = 0; j < ((remainder == 0) ? attackers.Count - 1 : attackers.Count); j++)
{
Item splitItem = Mobile.LiftItemDupe(item, item.Amount - amountPerAttacker);
//LiftItemDupe automagically adds it as a child item to the corpse
if (!m_InstancedItems.ContainsKey(splitItem))
{
m_InstancedItems.Add(splitItem, new InstancedItemInfo(splitItem, attackers[j]));
}
//What happens to the remaining portion? TEMP FOR NOW UNTIL OSI VERIFICATION: Treat as Single Item.
}
if (remainder == 0)
{
if (!m_InstancedItems.ContainsKey(item))
{
m_InstancedItems.Add(item, new InstancedItemInfo(item, attackers[attackers.Count - 1]));
}
//Add in the original item (which has an equal amount as the others) to the instance for the last attacker, cause it wasn't added above.
}
else
{
unstackables.Add(item);
}
}
else
{
//What happens in this case? TEMP FOR NOW UNTIL OSI VERIFICATION: Treat as Single Item.
unstackables.Add(item);
}
}
for (int i = 0; i < unstackables.Count; i++)
{
Mobile m = attackers[i % attackers.Count];
Item item = unstackables[i];
if (!m_InstancedItems.ContainsKey(item))
{
m_InstancedItems.Add(item, new InstancedItemInfo(item, m));
}
}
ColUtility.Free(stackables);
ColUtility.Free(unstackables);
}
*/
public void AddCarvedItem(Item carved, Mobile carver)
{
DropItem(carved);
/*if (InstancedCorpse)
{
if (m_InstancedItems == null)
{
m_InstancedItems = new Dictionary<Item, InstancedItemInfo>();
}
if (!m_InstancedItems.ContainsKey(carved))
{
m_InstancedItems.Add(carved, new InstancedItemInfo(carved, carver));
}
}*/
}
if (!owner.Player)
{
//c.AssignInstancedLoot();
//c.HasAssignedInstancedLoot = true;
}
We use essential cookies to make this site work, and optional cookies to enhance your experience.