private static void AllNames_OnTarget(Mobile from, object obj)
{
if (obj is AddressBook)
{
int count = 0;
AddressBook book = (AddressBook)obj;
if (book.Entries != null)
{
book.Entries.Clear();
}
else
{
book.Entries = new ArrayList();
}
foreach (Mobile m in World.Mobiles.Values)
{
PlayerMobile mp = m as PlayerMobile;
if (mp != null)
{
count += 1;
book.AddEntry(mp);
}
}
from.SendMessage("The Address Book has been filled with " + count + " entries");
CommandLogging.WriteLine(from, "{0} {1} filling Address Book {2}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(book));
}
else
{
from.BeginTarget(-1, false, TargetFlags.None, new TargetCallback(AllNames_OnTarget));
from.SendMessage("That is not a Address Book. Try again.");
}
}