TraceStabled command

This commit is contained in:
eos 2012-12-02 00:31:31 +00:00
parent cfb2d9421a
commit 93a24b8af9

View file

@ -59,6 +59,7 @@ namespace Server.Commands.Generic
Register( new Factions.FactionKickCommand( Factions.FactionKickType.Unban ) );
Register( new BringToPackCommand() );
Register( new TraceLockdownCommand() );
Register( new TraceStabledCommand() );
}
private static List<BaseCommand> m_AllCommands = new List<BaseCommand>();
@ -1118,4 +1119,46 @@ namespace Server.Commands.Generic
LogFailure( "No house was found." );
}
}
public class TraceStabledCommand : BaseCommand
{
public TraceStabledCommand()
{
AccessLevel = AccessLevel.Administrator;
Supports = CommandSupport.Simple;
Commands = new string[] { "TraceStabled" };
ObjectTypes = ObjectTypes.Mobiles;
Usage = "TraceStabled";
Description = "Shows all mobiles that have a targeted pet in their stable.";
}
public override void Execute( CommandEventArgs e, object obj )
{
BaseCreature bc = obj as BaseCreature;
if ( bc == null )
{
LogFailure( "That is not a pet." );
}
else if ( !bc.IsStabled )
{
LogFailure( "That pet is not stabled." );
}
else
{
ArrayList list = new ArrayList();
foreach ( Mobile m in World.Mobiles.Values )
{
if ( m.Stabled.Contains( bc ) )
list.Add( m );
}
if ( list.Count == 0 )
LogFailure( "No mobiles were found." );
else
e.Mobile.SendGump( new InterfaceGump( e.Mobile, new string[] { "Object" }, list, 0, null ) );
}
}
}
}