当前位置: 首页>>代码示例>>C#>>正文


C# CommandEventArgs.GetString方法代码示例

本文整理汇总了C#中Server.CommandEventArgs.GetString方法的典型用法代码示例。如果您正苦于以下问题:C# CommandEventArgs.GetString方法的具体用法?C# CommandEventArgs.GetString怎么用?C# CommandEventArgs.GetString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Server.CommandEventArgs的用法示例。


在下文中一共展示了CommandEventArgs.GetString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ValidateArgs

        public override bool ValidateArgs( BaseCommandImplementor impl, CommandEventArgs e )
        {
            if ( e.Length >= 1 )
            {
                Type t = ScriptCompiler.FindTypeByName( e.GetString( 0 ) );

                if ( t == null )
                {
                    e.Mobile.SendMessage( "No type with that name was found." );

                    string match = e.GetString( 0 ).Trim();

                    if ( match.Length < 3 )
                    {
                        e.Mobile.SendMessage( "Invalid search string." );
                        e.Mobile.SendGump( new AddGump( e.Mobile, match, 0, Type.EmptyTypes, false ) );
                    }
                    else
                    {
                        e.Mobile.SendGump( new AddGump( e.Mobile, match, 0, AddGump.Match( match ).ToArray(), true ) );
                    }
                }
                else
                {
                    return true;
                }
            }
            else
            {
                e.Mobile.SendGump( new CategorizedAddGump( e.Mobile ) );
            }

            return false;
        }
开发者ID:kamronbatman,项目名称:Defiance-AOS-Pre-2012,代码行数:34,代码来源:Commands.cs

示例2: ExecuteList

        public override void ExecuteList( CommandEventArgs e, ArrayList list )
        {
            if ( list.Count > 0 )
            {
                List<string> columns = new List<string>();

                columns.Add( "Object" );

                if ( e.Length > 0 )
                {
                    int offset = 0;

                    if ( Insensitive.Equals( e.GetString( 0 ), "view" ) )
                        ++offset;

                    while ( offset < e.Length )
                        columns.Add( e.GetString( offset++ ) );
                }

                e.Mobile.SendGump( new InterfaceGump( e.Mobile, columns.ToArray(), list, 0, null ) );
            }
            else
            {
                AddResponse( "No matching objects found." );
            }
        }
开发者ID:justdanofficial,项目名称:khaeros,代码行数:26,代码来源:Interface.cs

示例3: FindItemByType_OnCommand

		public static void FindItemByType_OnCommand(CommandEventArgs e)
		{
			try
			{
				if (e.Length == 1)
				{
					LogHelper Logger = new LogHelper("FindItemByType.log", e.Mobile, false);

					string name = e.GetString(0);

					foreach (Item item in World.Items.Values)
					{
						if (item != null && item.GetType().ToString().ToLower().IndexOf(name.ToLower()) >= 0)
						{
							Logger.Log(LogType.Item, item);
						}
					}
					Logger.Finish();
				}
				else
				{
					e.Mobile.SendMessage("Format: FindItemByType <type>");
				}
			}
			catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); }
		}
开发者ID:zerodowned,项目名称:angelisland,代码行数:26,代码来源:FindItemByType.cs

示例4: FindMultiByType_OnCommand

		public static void FindMultiByType_OnCommand(CommandEventArgs e)
		{
			try
			{
				if (e.Length == 1)
				{
					LogHelper Logger = new LogHelper("FindMultiByType.log", e.Mobile, false);

					string name = e.GetString(0);

					foreach (ArrayList list in Server.Multis.BaseHouse.Multis.Values)
					{
						for (int i = 0; i < list.Count; i++)
						{
							BaseHouse house = list[i] as BaseHouse;
							// like Server.Multis.Tower
							if (house.GetType().ToString().ToLower().IndexOf(name.ToLower()) >= 0)
							{
								Logger.Log(house);
							}
						}
					}
					Logger.Finish();
				}
				else
				{
					e.Mobile.SendMessage("Format: FindMultiByType <type>");
				}
			}
			catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); }
		}
开发者ID:zerodowned,项目名称:angelisland,代码行数:31,代码来源:FindMultiByType.cs

示例5: Execute

		public override void Execute( CommandEventArgs e, object obj )
		{
			if ( e.Length < 2 )
				LogFailure( "Format: SetPvP <propertyName> <value>" );
			else if ( obj is PlayerMobile )
			{
				PlayerMobile from = (PlayerMobile)obj;
				FSPvpPointSystem.FSPvpSystem.PvpStats ps = FSPvpSystem.GetPvpStats( from );

				for ( int i = 0; ( i+1 ) < e.Length; i += 2 )
				{
					string result = Properties.SetValue( e.Mobile, ps, e.GetString( i ), e.GetString( i+1 ) );

					if ( result == "Property has been set." )
						AddResponse( result );
					else
						LogFailure( result );
				}
			}
		}
开发者ID:kamronbatman,项目名称:DefianceUO-Pre1.10,代码行数:20,代码来源:PvpSystemCommands.cs

示例6: FindItemByID_OnCommand

		public static void FindItemByID_OnCommand(CommandEventArgs e)
		{
			try
			{
				if (e.Length == 1)
				{
					//erl: LogHelper class handles generic logging functionality
					LogHelper Logger = new LogHelper("FindItemByID.log", e.Mobile, false);

					int ItemId = 0;
					string sx = e.GetString(0).ToLower();

					try
					{
						if (sx.StartsWith("0x"))
						{   // assume hex
							sx = sx.Substring(2);
							ItemId = int.Parse(sx, System.Globalization.NumberStyles.AllowHexSpecifier);
						}
						else
						{   // assume decimal
							ItemId = int.Parse(sx);
						}
					}
					catch
					{
						e.Mobile.SendMessage("Format: FindItemByID <ItemID>");
						return;
					}

					foreach (Item ix in World.Items.Values)
					{
						if (ix is Item)
							if (ix.ItemID == ItemId)
							{
								Logger.Log(LogType.Item, ix);
							}
					}
					Logger.Finish();
				}
				else
					e.Mobile.SendMessage("Format: FindItemByID <ItemID>");
			}
			catch (Exception err)
			{

				e.Mobile.SendMessage("Exception: " + err.Message);
			}

			e.Mobile.SendMessage("Done.");
		}
开发者ID:zerodowned,项目名称:angelisland,代码行数:51,代码来源:FindItemByID.cs

示例7: Execute

		public override void Execute( CommandEventArgs e )
		{
			if ( e.Length >= 2 )
			{
				Serial serial = e.GetInt32( 0 );

				object obj = null;

				if ( serial.IsItem )
					obj = World.FindItem( serial );
				else if ( serial.IsMobile )
					obj = World.FindMobile( serial );

				if ( obj == null )
				{
					e.Mobile.SendMessage( "That is not a valid serial." );
				}
				else
				{
					BaseCommand command = null;
					Commands.TryGetValue( e.GetString( 1 ), out 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
					{
						string[] oldArgs = e.Arguments;
						string[] args = new string[oldArgs.Length - 2];

						for ( int i = 0; i < args.Length; ++i )
							args[i] = oldArgs[i + 2];

						RunCommand( e.Mobile, obj, command, args );
					}
				}
			}
			else
			{
				e.Mobile.SendMessage( "You must supply an object serial and a command name." );
			}
		}
开发者ID:Godkong,项目名称:RunUO,代码行数:47,代码来源:SerialCommandImplementor.cs

示例8: FindSkill_OnCommand

		private static void FindSkill_OnCommand(CommandEventArgs arg)
		{
			Mobile from = arg.Mobile;
			SkillName skill;

			// Init elapsed with 2nd of arguments passed to command
			int elapsed = arg.GetInt32(1);

			// Test the skill argument input to make sure it's valid

			try
			{
				// Try to set var holding skill arg to enum equivalent
				skill = (SkillName)Enum.Parse(typeof(SkillName), arg.GetString(0), true);
			}
			catch
			{
				// Skill not valid, return without performing mob search
				from.SendMessage("You have specified an invalid skill.");
				return;
			}

			ArrayList MobsMatched = FindSkillMobs(skill, elapsed);

			if (MobsMatched.Count > 0)
			{

				// Found some, so loop and display

				foreach (PlayerMobile pm in MobsMatched)
				{
					if (!pm.Hidden || from.AccessLevel > pm.AccessLevel || pm == from)
						from.SendMessage("{0}, x:{1}, y:{2}, z:{3}", pm.Name, pm.Location.X, pm.Location.Y, pm.Location.Z);
				}

			}
			else
			{

				// Found none, so inform.
				from.SendMessage("Nobody online has used that skill recently.");
			}

		}
开发者ID:zerodowned,项目名称:angelisland,代码行数:44,代码来源:FindSkill.cs

示例9: FindItemByName_OnCommand

		public static void FindItemByName_OnCommand(CommandEventArgs e)
		{
			if (e.Length == 1)
			{
				LogHelper Logger = new LogHelper("FindItemByName.log", e.Mobile, false);

				string name = e.GetString(0).ToLower();

				foreach (Item item in World.Items.Values)
					if (item.Name != null && item.Name.ToLower().IndexOf(name) >= 0)
						Logger.Log(LogType.Item, item);

				Logger.Finish();


			}
			else
			{
				e.Mobile.SendMessage("Format: FindItemByName <name>");
			}
		}
开发者ID:zerodowned,项目名称:angelisland,代码行数:21,代码来源:FindItemByName.cs

示例10: SetSkill_OnCommand

 public static void SetSkill_OnCommand( CommandEventArgs arg )
 {
     if ( arg.Length != 2 )
     {
         arg.Mobile.SendMessage( "SetSkill <skill name> <value>" );
     }
     else
     {
         SkillName skill;
         try
         {
             skill = (SkillName)Enum.Parse( typeof( SkillName ), arg.GetString( 0 ), true );
         }
         catch
         {
             arg.Mobile.SendLocalizedMessage( 1005631 ); // You have specified an invalid skill to set.
             return;
         }
         arg.Mobile.Target = new SkillTarget( skill, arg.GetDouble( 1 ) );
     }
 }
开发者ID:BackupTheBerlios,项目名称:sunuo-svn,代码行数:21,代码来源:Skills.cs

示例11: Execute

		public override void Execute( CommandEventArgs e )
		{
			if ( e.Length >= 2 )
			{
				int range = e.GetInt32( 0 );

				if ( range < 0 )
				{
					e.Mobile.SendMessage( "The range must not be negative." );
				}
				else
				{
					BaseCommand command = null;
					Commands.TryGetValue( e.GetString( 1 ), out 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
					{
						string[] oldArgs = e.Arguments;
						string[] args = new string[oldArgs.Length - 2];

						for ( int i = 0; i < args.Length; ++i )
							args[i] = oldArgs[i + 2];

						Process( range, e.Mobile, command, args );
					}
				}
			}
			else
			{
				e.Mobile.SendMessage( "You must supply a range and a command name." );
			}
		}
开发者ID:jackuoll,项目名称:Pre-AOS-RunUO,代码行数:40,代码来源:RangeCommandImplementor.cs

示例12: GetSkill_OnCommand

        public static void GetSkill_OnCommand( CommandEventArgs arg )
        {
            if ( arg.Length != 1 )
            {
                arg.Mobile.SendMessage( "GetSkill <skill name>" );
            }
            else
            {
                SkillName skill;
                try
                {
                    skill = (SkillName)Enum.Parse( typeof( SkillName ), arg.GetString( 0 ), true );
                }
                catch
                {
                    arg.Mobile.SendAsciiMessage( "You have specified an invalid skill to set." ); //
                    return;
                }

                arg.Mobile.Target = new SkillTarget( skill );
            }
        }
开发者ID:cynricthehun,项目名称:UOLegends,代码行数:22,代码来源:Skills.cs

示例13: ImportSpawners_OnCommand

        public static void ImportSpawners_OnCommand( CommandEventArgs e )
        {
            if ( e.Arguments.Length >= 1 )
            {
                string filename = e.GetString( 0 );
                string filePath = Path.Combine( "Saves/Spawners", filename );

                if ( File.Exists( filePath ) )
                {
                    XmlDocument doc = new XmlDocument();
                    doc.Load( filePath );

                    XmlElement root = doc["spawners"];

                    int successes = 0, failures = 0;

                    foreach ( XmlElement spawner in root.GetElementsByTagName( "spawner" ) )
                    {
                        try
                        {
                            ImportSpawner( spawner );
                            successes++;
                        }
                        catch { failures++; }
                    }

                    e.Mobile.SendMessage( "{0} spawners loaded successfully from {1}, {2} failures.", successes, filePath, failures );
                }
                else
                {
                    e.Mobile.SendMessage( "File {0} does not exist.", filePath );
                }
            }
            else
            {
                e.Mobile.SendMessage( "Usage: [ImportSpawners <filename>" );
            }
        }
开发者ID:cynricthehun,项目名称:UOLegends,代码行数:38,代码来源:SpawnerExporter.cs

示例14: FindGuild_OnCommand

		public static void FindGuild_OnCommand(CommandEventArgs e)
		{
			Guild temp = null;
			PlayerMobile ptemp = null;

			if (e.Length == 1)
			{
				string name = e.GetString(0).ToLower();

				foreach (Item n in World.Items.Values)
				{
					if (n is Guildstone && n != null)
					{
						if (((Guildstone)n).Guild != null)
							temp = ((Guildstone)n).Guild;

						if (temp.Abbreviation.ToLower() == name)
						{
							if (n.Parent != null && n.Parent is PlayerMobile)
							{
								ptemp = (PlayerMobile)n.Parent;
								e.Mobile.SendMessage("Guild Stone Found on Mobile {2}:{0}, {1}", ptemp.Name, ptemp.Location, ptemp.Account);
							}
							else
							{
								e.Mobile.SendMessage("Guild Stone Found {0}", n.Location);
							}
							return;
						}
					}
				}
				e.Mobile.SendMessage("Guild Stone not found in world");
			}
			else
			{
				e.Mobile.SendMessage("Format: FindGuild <abbreviation>");
			}
		}
开发者ID:zerodowned,项目名称:angelisland,代码行数:38,代码来源:FindGuild.cs

示例15: FindChar_OnCommand

		public static void FindChar_OnCommand( CommandEventArgs e )
		{
			if ( e.Length == 1 )
			{
				string name = e.GetString( 0 ).ToLower();

				foreach ( Account pm in Accounts.Table.Values )
				{
				  if ( pm == null )
						return;

				int index = 0;

					for ( int i = 0; i < pm.Length; ++i )
					{
						Mobile m = pm[i];
                        if ( m == null )
							continue;
						if (m.Name.ToLower().IndexOf( name ) >= 0)
						 {
						e.Mobile.SendMessage( "Character: {0}, Belongs to Account: {1}", m.Name, pm );

						 }
						else
						 continue;

						 ++index;

				    }
				}
			e.Mobile.SendMessage( "Done.");
			}
			else
			{
				e.Mobile.SendMessage( "Format: FindChar <name>" );
			}
		}
开发者ID:kamronbatman,项目名称:DefianceUO-Pre1.10,代码行数:37,代码来源:FindChar.cs


注:本文中的Server.CommandEventArgs.GetString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。