コード例 #1
0
 public override void Process(Mobile from, BaseCommand command, string[] args)
 {
     if (command.ValidateArgs(this, new CommandEventArgs(from, command.Commands[0], this.GenerateArgString(args), args)))
     {
         from.BeginTarget(-1, command.ObjectTypes == ObjectTypes.All, TargetFlags.None, new TargetStateCallback(OnTarget), new object[] { command, args });
     }
 }
コード例 #2
0
 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,
                          (m, targeted) => OnTarget(m, targeted, command, args));
     }
 }
コード例 #3
0
        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
                    {
                        obj
                    };
                    command.ExecuteList(e, list);
                }
                else
                {
                    command.Execute(e, obj);
                }
            }

            command.Flush(from, flushToLog);
            //	}
            //	catch ( Exception ex )
            //	{
            //		from.SendMessage( ex.Message );
            //	}
        }
コード例 #4
0
        public void Redirect(CommandEventArgs e)
        {
            BaseCommand command = (BaseCommand)Commands[e.Command];

            if (command == null)
            {
                e.Mobile.SendMessage("That is either an invalid command name or one that does not support this modifier.");
            }
            else if (e.Mobile.AccessLevel < command.AccessLevel)
            {
                e.Mobile.SendMessage("You do not have access to that command.");
            }
            else if (command.ValidateArgs(this, e))
            {
                Process(e.Mobile, command, e.Arguments);
            }
        }
コード例 #5
0
		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
0
		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 } );
		}
コード例 #7
0
        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);
                }
            }
        }
コード例 #8
0
		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 );
			}
		}