本文整理汇总了C#中Server.Commands.Generic.BaseCommand.LogFailure方法的典型用法代码示例。如果您正苦于以下问题:C# BaseCommand.LogFailure方法的具体用法?C# BaseCommand.LogFailure怎么用?C# BaseCommand.LogFailure使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Commands.Generic.BaseCommand
的用法示例。
在下文中一共展示了BaseCommand.LogFailure方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
示例2: 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 );
}
}
示例3: 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 );
}
}
示例4: CheckObjectTypes
public bool CheckObjectTypes( BaseCommand command, Extensions ext, out bool items, out bool mobiles )
{
items = mobiles = false;
ObjectConditional cond = ObjectConditional.Empty;
foreach (BaseExtension check in ext)
{
if (check is WhereExtension)
{
cond = (check as WhereExtension).Conditional;
break;
}
}
bool condIsItem = cond.IsItem;
bool condIsMobile = cond.IsMobile;
switch ( command.ObjectTypes )
{
case ObjectTypes.All:
case ObjectTypes.Both:
{
if ( condIsItem )
items = true;
if ( condIsMobile )
mobiles = true;
break;
}
case ObjectTypes.Items:
{
if ( condIsItem )
{
items = true;
}
else if ( condIsMobile )
{
command.LogFailure( "You may not use a mobile type condition for this command." );
return false;
}
break;
}
case ObjectTypes.Mobiles:
{
if ( condIsMobile )
{
mobiles = true;
}
else if ( condIsItem )
{
command.LogFailure( "You may not use an item type condition for this command." );
return false;
}
break;
}
}
return true;
}
示例5: 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 );
// }
}
示例6: RunCommand
public void RunCommand( Mobile from, object obj, BaseCommand command, string[] args )
{
try
{
if (command is GetCommand && obj is ArrayList && ((ArrayList)obj).Count > 20000)
{
throw new Exception("Get command has too many potential target: " + ((ArrayList)obj).Count);
}
if (LoggingCustom.CommandDebug) LoggingCustom.LogCommandDebug( "RunCommand\t" + command.Commands[0] + "\t");
CommandEventArgs e = new CommandEventArgs( from, command.Commands[0], GenerateArgString( args ), args );
if ( !command.ValidateArgs( this, e ) )
return;
bool flushToLog = false;
if ( obj is ArrayList )
{
if (LoggingCustom.CommandDebug) LoggingCustom.LogCommandDebug( "objArrayList\t");
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 (LoggingCustom.CommandDebug) LoggingCustom.LogCommandDebug( "obj\t");
if ( command.ListOptimized )
{
ArrayList list = new ArrayList();
list.Add( obj );
command.ExecuteList( e, list );
}
else
{
command.Execute( e, obj );
}
}
if (LoggingCustom.CommandDebug) LoggingCustom.LogCommandDebug( "flush\t");
command.Flush( from, flushToLog );
}
catch ( Exception ex )
{
if (from != null) from.SendMessage( ex.Message );
}
}