I am not sure how well this will interface directly into servuo and I think I have included all pieces. I wrote this about 5 years ago and recently started thinking about uo emulation again. I added the following functions and function calls in basehouse.cs
Add this to the onSecureTrade function:
m_House.transferyard(to); // calls class to transfer the yard tool items to the new owner
public void transferyard(Mobile to)
{
ArrayList Yardcrap = new ArrayList();
foreach (Item item in this.GetItemsInRange(42)) // find all items with a 75 tile radius of the fallen house's position.
{
if (item is YardItem)
{
YardItem yi = item as YardItem;
if (!yi.Deleted)
{
if (yi.LinkedHouse != null && yi.LinkedHouse == this)
{
Yardcrap.Add(item);
}
}
}
if (item is YardIronGate)
{
YardIronGate yi = item as YardIronGate;
if (!yi.Deleted)
{
if (yi.LinkedHouse != null && yi.LinkedHouse == this)
{
Yardcrap.Add(item);
}
}
}
if (item is YardStair)
{
YardStair yi = item as YardStair;
if (!yi.Deleted)
{
if (yi.LinkedHouse != null && yi.LinkedHouse == this)
{
Yardcrap.Add(item);
}
}
}
}
for (int i = 0; i < Yardcrap.Count; ++i)
{
Item yard = (Item)Yardcrap[i];
if (yard is YardStair)
{
YardStair ys = yard as YardStair;
ys.Placer = to;
ys.Name = ys.Placer.Name + "'s Yard";
}
if (yard is YardItem)
{
YardItem ys = yard as YardItem;
ys.Placer = to;
ys.Name = ys.Placer.Name + "'s Yard";
}
if (yard is YardIronGate)
{
YardIronGate ys = yard as YardIronGate;
ys.Placer = to;
ys.Name = ys.Placer.Name + "'s Yard";
}
}
}
that will transfer the yard from one home owner to the next. This prevents the old owner from taking down all the deco after the house is sold.
Now to ensure the yard gets deleted when a house is collapsed so players do not take it upon themselves to deco your shard with 18 million items.
This needs to be added to the onDelete function:
Then add this function to actually delete the yard:
public void deleteyard()
{
ArrayList Yardcrap = new ArrayList();
foreach (Item item in this.GetItemsInRange(42)) // find all items with a 75 tile radius of the fallen house's position.
{
if (item is YardItem)
{
YardItem yi = item as YardItem;
if (!yi.Deleted)
{
if (yi.LinkedHouse != null && yi.LinkedHouse == this)
{
Yardcrap.Add(item);
}
}
}
if (item is YardIronGate)
{
YardIronGate yi = item as YardIronGate;
if (!yi.Deleted)
{
if (yi.LinkedHouse != null && yi.LinkedHouse == this)
{
Yardcrap.Add(item);
}
}
}
if (item is YardStair)
{
YardStair yi = item as YardStair;
if (!yi.Deleted)
{
if (yi.LinkedHouse != null && yi.LinkedHouse == this)
{
Yardcrap.Add(item);
}
}
}
}
for (int i = 0; i < Yardcrap.Count; ++i)
{
Item yard = (Item)Yardcrap[i];
yard.Delete();
}
}