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


C# CommandEventArgs.GetString方法代码示例

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


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

示例1: SetSkill_OnCommand

		public static void SetSkill_OnCommand( CommandEventArgs arg )
		{
			if ( arg.Length != 2 )
			{
				arg.Mobile.SendMessage( "SetSkill <skill name> <value>" );
			}
			else
			{
				SkillName skill;
#if Framework_4_0
				if( Enum.TryParse( arg.GetString( 0 ), true, out skill ) )
				{
					arg.Mobile.Target = new SkillTarget( skill, arg.GetDouble( 1 ) );
				}
				else
				{
					arg.Mobile.SendLocalizedMessage( 1005631 ); // You have specified an invalid skill to set.
				}
#else
                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));
#endif
			}
		}
开发者ID:FreeReign,项目名称:imaginenation,代码行数:32,代码来源:Skills.cs

示例2: HearCommands_OnCommand

 private static void HearCommands_OnCommand(CommandEventArgs args)
 {
     if (m_HearCommands.ContainsKey(args.Mobile))
     {
         m_HearCommands.Remove(args.Mobile);
         args.Mobile.SendMessage("Hear Commands disabled.");
     }
     else
     {
         if (args.Length == 1)
         {
             if (args.GetString(0).ToLower() == "noplayers")
             {
                 m_HearCommands.Add(args.Mobile, false);
                 args.Mobile.SendMessage("Hear Commands enabled without player commands, type .hearcommands again to disable it.");
             }
             else
             {
                 args.Mobile.SendMessage("Format:");
                 args.Mobile.SendMessage("HearCommands OR HearCommands noplayers");
             }
         }
         else
         {
             m_HearCommands.Add(args.Mobile, true);
             args.Mobile.SendMessage("Hear Commands enabled with playercommands, type .hearcommands again to disable it.");
             args.Mobile.SendMessage("To enable Hear Commands without player commands, type '.hearcommands noplayers'");
         }
     }
 }
开发者ID:FreeReign,项目名称:imaginenation,代码行数:30,代码来源:HearCommands.cs

示例3: HelpInfo_OnCommand

		private static void HelpInfo_OnCommand( CommandEventArgs e )
		{
			if( e.Length > 0 )
			{
				string arg = e.GetString( 0 ).ToLower();
				CommandInfo c;

				if( m_HelpInfos.TryGetValue( arg, out c ) )
				{
					Mobile m = e.Mobile;

					if( m.AccessLevel >= c.AccessLevel )
						m.SendGump( new CommandInfoGump( c ) );
					else
						m.SendMessage( "You don't have access to that command." );

					return;
				}
				else
					e.Mobile.SendMessage( String.Format( "Command '{0}' not found!", arg ) );
			}

			e.Mobile.SendGump( new CommandListGump( 0, e.Mobile, null ) );

		}
开发者ID:FreeReign,项目名称:imaginenation,代码行数:25,代码来源:HelpInfo.cs

示例4: Say_OnCommand

 private static void Say_OnCommand(CommandEventArgs e)
 {
     string message = "";
     if (e.Length >= 1)
         message = e.GetString(0);
     e.Mobile.Target = new SayTarget(message);
     e.Mobile.SendAsciiMessage("What object do you want to make speak?");
 }
开发者ID:Godkong,项目名称:Origins,代码行数:8,代码来源:SayCommand.cs

示例5: OnCommand_Construct

        private static void OnCommand_Construct(CommandEventArgs e)
        {
            Mobile m = e.Mobile;

            if (e.Length == 1)
            {
                string name = e.GetString(0);
                m.BeginTarget(-1, true, TargetFlags.None, new TargetStateCallback(OnTarget_Construct), name);
                m.SendMessage("Please target the loaction where you wish to place the house.");
            }
        }
开发者ID:kamronbatman,项目名称:Defiance-AOS-Pre-2012,代码行数:11,代码来源:Commands.cs

示例6: ExecuteList

			public override void ExecuteList(CommandEventArgs e, ArrayList list)
			{
				string filename = e.GetString(0);

				var spawners = new List<Spawner>();

				spawners.AddRange(
					list.AsParallel()
						.OfType<Spawner>()
						.Where(spawner => spawner != null && !spawner.Deleted && spawner.Map != Map.Internal && spawner.Parent == null));

				AddResponse(String.Format("{0} spawners exported to Saves/Spawners/{1}.", spawners.Count.ToString("#,0"), filename));

				ExportSpawners(spawners, filename);
			}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:15,代码来源:SpawnerExporter.cs

示例7: SetSkill_OnCommand

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

示例8: Cast_OnCommand

        public static void Cast_OnCommand(CommandEventArgs e)
        {
            if (e.Length == 1)
            {
                if (!Multis.DesignContext.Check(e.Mobile))
                    return; // They are customizing

                Spell spell = SpellRegistry.NewSpell(e.GetString(0), e.Mobile, null);

                if (spell != null)
                    spell.Cast();
                else
                    e.Mobile.SendMessage("That spell was not found.");
            }
            else
            {
                e.Mobile.SendMessage("Format: Cast <name>");
            }
        }
开发者ID:FreeReign,项目名称:forkuo,代码行数:19,代码来源:Handlers.cs

示例9: GetSkill_OnCommand

		public static void GetSkill_OnCommand( CommandEventArgs arg )
		{
			if ( arg.Length != 1 )
			{
				arg.Mobile.SendMessage( "GetSkill <skill name>" );
			}
			else
			{
				SkillName skill;
				if( Enum.TryParse( arg.GetString( 0 ), true, out skill ) )
				{
					arg.Mobile.Target = new SkillTarget( skill );
				}
				else
				{
					arg.Mobile.SendMessage( "You have specified an invalid skill to get." );
				}
			}
		}
开发者ID:greeduomacro,项目名称:last-wish,代码行数:19,代码来源:Skills.cs

示例10: ExecuteList

			public override void ExecuteList( CommandEventArgs e, ArrayList list )
			{
				string filename = e.GetString( 0 );
			
				ArrayList spawners = new ArrayList();
			
				for ( int i = 0; i < list.Count; ++i )
				{
					if ( list[i] is Spawner  )
					{
						Spawner spawner = (Spawner)list[i];
						if ( spawner != null && !spawner.Deleted && spawner.Map != Map.Internal && spawner.Parent == null )
							spawners.Add( spawner );
					}
				}
				
				AddResponse( String.Format( "{0} spawners exported to Saves/Spawners/{1}.", spawners.Count, filename ) );
				
				ExportSpawners( spawners, filename );
			}
开发者ID:FreeReign,项目名称:imaginenation,代码行数:20,代码来源:SpawnerExporter.cs

示例11: MoveItems_OnCommand

        public static void MoveItems_OnCommand(CommandEventArgs e)
        {
            Mobile from = e.Mobile;

            // if we have a command after just the word "MoveItems"...
            if (e.Length != 0)
            {
                switch (e.GetString(0).ToLower())
                {
                    case "exact":
                        from.Target = new PackFromTarget(from, true);
                        break;
                    default:
                        from.LocalOverheadMessage(MessageType.Regular, 1150, true, "MoveItems will allow you to move items of a specific type from one container to another. For example, you want to move all spools of thread from your main pack to another backpack. Type [moveitems, target a spool of thread, then target the backpack you want the spools of thread to be moved to. The TO container normally is outside your main backpack. If you type ' exact' after the command [moveitems it will only move very specific types. For example, [moveitems and targeting a yumi bow will move ALL baseranged items. [moveitems exact and targetting a yumi will only move yumis.");
                        break;
                }
            }
            else
                from.Target = new PackFromTarget(from, false);
        }
开发者ID:greeduomacro,项目名称:last-wish,代码行数:20,代码来源:MoveItems.cs

示例12: 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:jasegiffin,项目名称:JustUO,代码行数:41,代码来源:SpawnerExporter.cs

示例13: FindChar_OnCommand

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

                foreach (Account pm in Accounts.GetAccounts())
                {
                    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 the account '{1}'.", m.Name, pm);

                        }
                        else
                            continue;

                        ++index;

                    }
                }
                e.Mobile.SendMessage("Done.");
            }
            else
            {
                e.Mobile.SendMessage("Usage: FindChar <name>");
            }
        }
开发者ID:greeduomacro,项目名称:last-wish,代码行数:37,代码来源:FindChar.cs

示例14: Password_OnCommand

        public static void Password_OnCommand(CommandEventArgs e)
        {
            Mobile from = e.Mobile;
            Account acct = from.Account as Account;

            if (acct == null)
                return;

            IPAddress[] accessList = acct.LoginIPs;

            if (accessList.Length == 0)
                return;

            NetState ns = from.NetState;

            if (ns == null)
                return;

            if (e.Length == 0)
            {
                from.SendMessage("You must specify the new password.");
                return;
            }
            else if (e.Length == 1)
            {
                from.SendMessage("To prevent potential typing mistakes, you must type the password twice. Use the format:");
                from.SendMessage("Password \"(newPassword)\" \"(repeated)\"");
                return;
            }

            string pass = e.GetString(0);
            string pass2 = e.GetString(1);

            if (pass != pass2)
            {
                from.SendMessage("The passwords do not match.");
                return;
            }

            bool isSafe = true;

            for (int i = 0; isSafe && i < pass.Length; ++i)
                isSafe = (pass[i] >= 0x20 && pass[i] < 0x7F);

            if (!isSafe)
            {
                from.SendMessage("That is not a valid password.");
                return;
            }

            try
            {
                IPAddress ipAddress = ns.Address;

                if (Utility.IPMatchClassC(accessList[0], ipAddress))
                {
                    acct.SetPassword(pass);
                    from.SendMessage("The password to your account has changed.");
                }
                else
                {
                    PageEntry entry = PageQueue.GetEntry(from);

                    if (entry != null)
                    {
                        if (entry.Message.StartsWith("[Automated: Change Password]"))
                            from.SendMessage("You already have a password change request in the help system queue.");
                        else
                            from.SendMessage("Your IP address does not match that which created this account.");
                    }
                    else if (PageQueue.CheckAllowedToPage(from))
                    {
                        from.SendMessage("Your IP address does not match that which created this account.  A page has been entered into the help system on your behalf.");

                        from.SendLocalizedMessage(501234, "", 0x35); /* The next available Counselor/Game Master will respond as soon as possible.
                        * Please check your Journal for messages every few minutes.
                        */

                        PageQueue.Enqueue(new PageEntry(from, String.Format("[Automated: Change Password]<br>Desired password: {0}<br>Current IP address: {1}<br>Account IP address: {2}", pass, ipAddress, accessList[0]), PageType.Account));
                    }
                }
            }
            catch
            {
            }
        }
开发者ID:Crome696,项目名称:ServUO,代码行数:86,代码来源:AccountHandler.cs

示例15: CSSCast_OnCommand

        private static void CSSCast_OnCommand(CommandEventArgs e)
        {
            if (e.Length == 1)
            {
                if (!CentralMemory.Running || !CSS.Running)
                {
                    e.Mobile.SendMessage("The Central Memory is not running.  This command is disabled.");
                    return;
                }

                if (!Multis.DesignContext.Check(e.Mobile))
                {
                    e.Mobile.SendMessage("You cannot cast while customizing!");
                    return;
                }

                CastCommandsModule module = (CastCommandsModule)CentralMemory.GetModule(e.Mobile.Serial, typeof(CastCommandsModule));
                if (module == null)
                {
                    e.Mobile.SendMessage("You do not have any commands to cast stored.");
                    return;
                }

                CastInfo info = module.Get(e.GetString(0));
                if (info == null)
                {
                    e.Mobile.SendMessage("You have not assigned that command to any spells.");
                    return;
                }

                if (SpellRestrictions.UseRestrictions && !SpellRestrictions.CheckRestrictions(e.Mobile, info.SpellType))
                {
                    e.Mobile.SendMessage("You are not allowed to cast this spell.");
                    return;
                }

                if (!CSpellbook.MobileHasSpell(e.Mobile, info.School, info.SpellType))
                {
                    e.Mobile.SendMessage("You do not have this spell.");
                    return;
                }

                Spell spell = SpellInfoRegistry.NewSpell(info.SpellType, info.School, e.Mobile, null);
                if (spell != null)
                    spell.Cast();
                else
                    e.Mobile.SendMessage("This spell has been disabled.");
            }
            else
            {
                e.Mobile.SendMessage("Format: Cast <text>");
            }
        }
开发者ID:evildude807,项目名称:kaltar,代码行数:53,代码来源:CSS.cs


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