UO-Orion

Member
UO-Orion submitted a new resource:

Unsecured Housing Item Alert - Overhead alert when exiting a house if there are unsecured items/containers inside

This is a basic addition to the HouseRegion.cs file to enable an alert for users as they exit a house where they are a Friend or higher IF any items are found that are not locked down or secured! It will give the count as Containers and Items (see screenshot) because Containers are treated as 1 item, and the Item count does NOT include the contents of those containers. I wanted to keep it as simple as possible since those are the number of things they'd need to secure to be "safe" if it was...

Read more about this resource...
 
Thank you so much for sharing the code!
Excellent script! My server is .NET2.0 and RUNUO 2.0, and I modified the script to suit my server:
1、Add two lines to the top quote:

using System.Collections;
using System.Collections.Generic;

2、Find this line:
public override bool OnDecay( Item item ),and add the following code above it:

//===start===
public override void OnExit(Mobile m)
{
base.OnExit(m);

if (m != null && m_House != null && m.AccessLevel == AccessLevel.Player && m_House.IsFriend(m))
{
List<Item> items = m_House.GetItems();
List<Item> unsecuredStuff = new List<Item>();

for (int i = 0; i < items.Count; i++)
{
Item item = items;

if (!item.Deleted && item.Map != Map.Internal && !(m_House.IsLockedDown(item) || m_House.IsSecure(item)))
{
unsecuredStuff.Add(item);
}
}

if (unsecuredStuff.Count > 0)
{
int unsecuredContainers = 0;
int unsecuredItems = 0;

for (int i = 0; i < unsecuredStuff.Count; i++)
{
Item item = unsecuredStuff;

if (item is BaseContainer)
unsecuredContainers++;
else
unsecuredItems++;
}

m.SendMessage("!!!WARNING!!!"); //It needs to be modified in the overhead section.
m.SendMessage("Containers: " + unsecuredContainers);
m.SendMessage("Items: " + unsecuredItems);
m.SendMessage("UNSECURED");
}
}
}
//===end===
 

Donations

Total amount
$30.00
Goal
$500.00

Shards

Back