本文整理汇总了C#中Server.Commands.Generic.BaseCommand类的典型用法代码示例。如果您正苦于以下问题:C# BaseCommand类的具体用法?C# BaseCommand怎么用?C# BaseCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BaseCommand类属于Server.Commands.Generic命名空间,在下文中一共展示了BaseCommand类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Compile
public override void Compile( Mobile from, BaseCommand command, ref string[] args, ref object obj )
{
if ( command.ObjectTypes == ObjectTypes.Items )
return; // sanity check
obj = from;
}
示例2: Register
public override void Register( BaseCommand command )
{
base.Register( command );
for ( int i = 0; i < command.Commands.Length; ++i )
CommandSystem.Register( command.Commands[i], command.AccessLevel, new CommandEventHandler( Redirect ) );
}
示例3: Process
public override void Process( Mobile from, BaseCommand command, string[] args )
{
RangeCommandImplementor impl = RangeCommandImplementor.Instance;
if ( impl == null )
return;
impl.Process( 18, from, command, args );
}
示例4: Register
public static void Register( BaseCommand command )
{
m_AllCommands.Add( command );
List<BaseCommandImplementor> impls = BaseCommandImplementor.Implementors;
for ( int i = 0; i < impls.Count; ++i )
{
BaseCommandImplementor impl = impls[i];
if ( (command.Supports & impl.SupportRequirement) != 0 )
impl.Register( command );
}
}
示例5: Process
public override void Process(Mobile from, BaseCommand command, string[] args)
{
AreaCommandImplementor impl = AreaCommandImplementor.Instance;
if (impl == null)
return;
Map map = from.Map;
if (map == null || map == Map.Internal)
return;
impl.OnTarget(from, map, Point3D.Zero, new Point3D(map.Width - 1, map.Height - 1, 0), new object[] { command, args });
}
示例6: Process
public void Process( int range, Mobile from, BaseCommand command, string[] args )
{
AreaCommandImplementor impl = AreaCommandImplementor.Instance;
if ( impl == null )
return;
Map map = from.Map;
if ( map == null || map == Map.Internal )
return;
Point3D start = new Point3D( from.X - range, from.Y - range, from.Z );
Point3D end = new Point3D( from.X + range, from.Y + range, from.Z );
impl.OnTarget( from, map, start, end, new object[] { command, args } );
}
示例7: Compile
public override void Compile(Mobile from, BaseCommand command, ref string[] args, ref object obj)
{
try
{
Extensions ext = Extensions.Parse(from, ref args);
bool items, mobiles;
if (!this.CheckObjectTypes(from, command, ext, out items, out mobiles))
return;
if (!mobiles) // sanity check
{
command.LogFailure("This command does not support items.");
return;
}
ArrayList list = new ArrayList();
List<NetState> states = NetState.Instances;
for (int i = 0; i < states.Count; ++i)
{
NetState ns = states[i];
Mobile mob = ns.Mobile;
if (mob == null)
continue;
if (!BaseCommand.IsAccessible(from, mob))
continue;
if (ext.IsValid(mob))
list.Add(mob);
}
ext.Filter(list);
obj = list;
}
catch (Exception ex)
{
from.SendMessage(ex.Message);
}
}
示例8: Compile
public override void Compile( Mobile from, BaseCommand command, ref string[] args, ref object obj )
{
try
{
if (LoggingCustom.CommandDebug)
LoggingCustom.LogCommandDebug("Global...compiling\t");
Extensions ext = Extensions.Parse( from, ref args );
bool items, mobiles;
if (LoggingCustom.CommandDebug) LoggingCustom.LogCommandDebug( "1\t");
if ( !CheckObjectTypes( from, command, ext, out items, out mobiles ) )
return;
ArrayList list = new ArrayList();
if ( items )
{
if (LoggingCustom.CommandDebug) LoggingCustom.LogCommandDebug( "2\t");
foreach ( Item item in World.Items.Values )
{
if ( ext.IsValid( item ) )
list.Add( item );
}
}
if ( mobiles )
{
if (LoggingCustom.CommandDebug) LoggingCustom.LogCommandDebug( "3\t");
foreach ( Mobile mob in World.Mobiles.Values )
{
if ( ext.IsValid( mob ) )
list.Add( mob );
}
}
if (LoggingCustom.CommandDebug) LoggingCustom.LogCommandDebug( "startfilter:list with " + list.Count+ " in it\t");
ext.Filter( list );
if (LoggingCustom.CommandDebug) LoggingCustom.LogCommandDebug( "4\t");
obj = list;
}
catch ( Exception ex )
{
from.SendMessage( ex.Message );
}
}
示例9: Compile
public override void Compile( Mobile from, BaseCommand command, ref string[] args, ref object obj )
{
try
{
Extensions ext = Extensions.Parse( from, ref args );
bool items, mobiles;
if ( !CheckObjectTypes( from, command, ext, out items, out mobiles ) )
return;
if ( !mobiles ) // sanity check
{
command.LogFailure( "This command does not support items." );
return;
}
ArrayList list = new ArrayList();
ArrayList addresses = new ArrayList();
System.Collections.Generic.List<NetState> states = NetState.Instances;
for ( int i = 0; i < states.Count; ++i )
{
NetState ns = (NetState)states[i];
Mobile mob = ns.Mobile;
if ( mob != null && !addresses.Contains( ns.Address ) && ext.IsValid( mob ) )
{
list.Add( mob );
addresses.Add( ns.Address );
}
}
ext.Filter( list );
obj = list;
}
catch ( Exception ex )
{
from.SendMessage( ex.Message );
}
}
示例10: Compile
public override void Compile( Mobile from, BaseCommand command, ref string[] args, ref object obj )
{
try
{
Extensions ext = Extensions.Parse( from, ref args );
bool items, mobiles;
if ( !CheckObjectTypes( from, command, ext, out items, out mobiles ) )
return;
Region reg = from.Region;
ArrayList list = new ArrayList();
if ( mobiles )
{
foreach ( Mobile mob in reg.GetMobiles() )
{
if( !BaseCommand.IsAccessible( from, mob ) )
continue;
if ( ext.IsValid( mob ) )
list.Add( mob );
}
}
else
{
command.LogFailure( "This command does not support items." );
return;
}
ext.Filter( list );
obj = list;
}
catch ( Exception ex )
{
from.SendMessage( ex.Message );
}
}
示例11: Compile
public override void Compile( Mobile from, BaseCommand command, ref string[] args, ref object obj )
{
try
{
Extensions ext = Extensions.Parse( from, ref args );
bool items, mobiles;
if ( !CheckObjectTypes( from, command, ext, out items, out mobiles ) )
return;
ArrayList list = new ArrayList();
if ( items )
{
foreach ( Item item in World.Items.Values )
{
if ( ext.IsValid( item ) )
list.Add( item );
}
}
if ( mobiles )
{
foreach ( Mobile mob in World.Mobiles.Values )
{
if ( ext.IsValid( mob ) )
list.Add( mob );
}
}
ext.Filter( list );
obj = list;
}
catch ( Exception ex )
{
from.SendMessage( ex.Message );
}
}
示例12: RunCommand
public void RunCommand( Mobile from, object obj, BaseCommand command, string[] args )
{
// try
// {
CommandEventArgs e = new CommandEventArgs( from, command.Commands[0], GenerateArgString( args ), args );
if ( !command.ValidateArgs( this, e ) )
return;
bool flushToLog = false;
if ( obj is ArrayList )
{
ArrayList list = (ArrayList)obj;
if ( list.Count > 20 )
CommandLogging.Enabled = false;
else if ( list.Count == 0 )
command.LogFailure( "Nothing was found to use this command on." );
command.ExecuteList( e, list );
if ( list.Count > 20 )
{
flushToLog = true;
CommandLogging.Enabled = true;
}
}
else if ( obj != null )
{
if ( command.ListOptimized )
{
ArrayList list = new ArrayList();
list.Add( obj );
command.ExecuteList( e, list );
}
else
{
command.Execute( e, obj );
}
}
command.Flush( from, flushToLog );
// }
// catch ( Exception ex )
// {
// from.SendMessage( ex.Message );
// }
}
示例13: Process
public override void Process( Mobile from, BaseCommand command, string[] args )
{
BoundingBoxPicker.Begin( from, new BoundingBoxCallback( OnTarget ), new object[]{ command, args } );
}
示例14: Process
public override void Process( Mobile from, BaseCommand command, string[] args )
{
if ( command.ValidateArgs( this, new CommandEventArgs( from, command.Commands[0], GenerateArgString( args ), args ) ) )
from.BeginTarget( -1, command.ObjectTypes == ObjectTypes.All, TargetFlags.None, new TargetStateCallback( OnTarget ), new object[]{ command, args } );
}
示例15: Register
public virtual void Register( BaseCommand command )
{
for ( int i = 0; i < command.Commands.Length; ++i )
m_Commands[command.Commands[i]] = command;
}