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


C# Commands.CommandEventArgs类代码示例

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


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

示例1: Msg

        private static void Msg(CommandEventArgs e)
        {
            Mobile from = e.Mobile;

            Guild theguild = from.Guild as Guild;
            if (theguild == null)
            {
                from.SendMessage("You are not in a guild!");
            }
            else
            {
                string AbbreviationOrName;
                foreach (NetState state in NetState.Instances)
                {
                    Mobile m = state.Mobile;
                    bool found = false;
                    int i = 0;
                    while ((!found) && (i <= (theguild.Members.Count - 1)))
                    {
                        if (m != null && (theguild.IsMember(m)))
                        {//an empty abbreviationname will allways be show as "none"at the server. no need for an if statement
                            AbbreviationOrName = (from.Guild as Guild).Abbreviation;
                            m.SendMessage(0x3C, String.Format("[Guild][{1}]: {2}", from.Name, e.ArgString));
                            found = true;
                        }
                        i++;
                    }
                }
            }
        }
开发者ID:greeduomacro,项目名称:last-wish,代码行数:30,代码来源:GuildChat.cs

示例2: 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

示例3: Execute

        public override void Execute(CommandEventArgs e, object obj)
        {
            Mobile mob = (Mobile) obj;

            if (mob.IsDeadBondedPet)
            {
                BaseCreature bc = mob as BaseCreature;

                if (bc != null)
                    bc.ResurrectPet();
            }
            else if (!mob.Alive && mob is PlayerMobile)
            {
                ((PlayerMobile) mob).ForceResurrect();
                CommandLogging.WriteLine(e.Mobile, "Refreshing and resurrecting " + mob.Name);
            }
            else if (!mob.Alive)
            {
                mob.Resurrect();
                CommandLogging.WriteLine(e.Mobile, "Refreshing and resurrecting " + mob.Name);
            }

            CommandLogging.WriteLine(e.Mobile, "Refreshing but not resurrecting) " + mob.Name);

            mob.PublicOverheadMessage(MessageType.Regular, mob.SpeechHue, true, "I've been refreshed.");

            mob.Hits = mob.HitsMax;
            mob.Stam = mob.StamMax;
            mob.Mana = mob.ManaMax;
            mob.CurePoison(mob);
        }
开发者ID:FreeReign,项目名称:imaginenation,代码行数:31,代码来源:Refresh.cs

示例4: Execute

        public override void Execute( CommandEventArgs args, object o )
        {
            if( o is Item && !(o is AddonComponent) && !(o is BaseAddon) )
            {
                Item i = (Item)o;
                SiegeMachineComponent newComponent = new SiegeMachineComponent(i.ItemID);

                newComponent.Hue = i.Hue;
                newComponent.Light = i.Light;
                newComponent.Movable = false;
                newComponent.Name = i.Name;
                newComponent.MoveToWorld(i.Location, i.Map);

                if( i.Parent == args.Mobile )
                    newComponent.Bounce(args.Mobile);

                if( i is Container )
                    ((Container)i).Destroy();
                else
                    i.Delete();

                AddResponse("The item has been converted to a siege machine component.");
            }
            else
            {
                LogFailure("This command only works with items (no addons).");
            }
        }
开发者ID:greeduomacro,项目名称:hubroot,代码行数:28,代码来源:ToSiegeMachineComponent.cs

示例5: TownFinance_Command

 public static void TownFinance_Command(CommandEventArgs e)
 {
     if (e.Arguments.Length == 0)
     {
         e.Mobile.SendMessage("You must provide a town name! e.g. [townfinance britain");
         return;
     }
     if (!(e.Mobile is PlayerMobile))
     {
         e.Mobile.SendMessage("You must be a playermobile to do this!");
     }
     string townName = e.Arguments[0].ToLower();
     foreach (Town town in Town.Towns)
     {
         if (town.Definition != null && town.Definition.TownName != null)
         {
             string testName = town.Definition.TownName.String.ToLower();
             if (townName == testName)
             {
                 if (town.Owner != null)
                 {
                     e.Mobile.SendGump(new FinanceGump((PlayerMobile) e.Mobile, town.Owner, town));
                     return;
                 }
                 else
                 {
                     e.Mobile.SendMessage("That town is not faction controlled.");
                     return;
                 }
             }
         }
     }
     e.Mobile.SendMessage(townName + " is not a valid town!");
 }
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:34,代码来源:FinanceGump.cs

示例6: OnCommand

		public static void OnCommand( CommandEventArgs e )
		{
			if( e.Length >= 1 )
			{
				switch( e.Arguments[0] )
				{
					case "octant":

						Octant( e );
						break;

					case "line":

						Line( e );
						break;

					case "circle":

						Circle( e );
						break;

					case "spiral":

						Spiral( e );
						break;
				}
			}
		}
开发者ID:greeduomacro,项目名称:hubroot,代码行数:28,代码来源:Commands.cs

示例7: Use_OnCommand

 private static void Use_OnCommand(CommandEventArgs e)
 {
     Mobile mob = e.Mobile; 
     if (e.Arguments.Length >= 1)
     {
         string key = e.Arguments[0];
         Type t;
         if (!m_SupportedTypes.TryGetValue(key.ToLower(), out t))
         {
             SendMessage(mob, MessageType.UnknownType, key);
             //SendMessage(mob, MessageType.Usage);
         }
         else 
         {
             Item item = mob.Backpack.FindItemByType(t);
             if(item != null)
             {
                 mob.Use(item);
             }
             else
             {
                 SendMessage(mob, MessageType.NotFound, key);
             }
         }
     }
     else
     {
         SendMessage(mob, MessageType.Usage);
     }
 }
开发者ID:FreeReign,项目名称:imaginenation,代码行数:30,代码来源:Use.cs

示例8: WhoIs_OnCommand

        private static void WhoIs_OnCommand( CommandEventArgs e )
        {
            if( e.Mobile == null || !( e.Mobile is PlayerMobile ) || e.Mobile.Deleted )
                return;

            PlayerMobile m = e.Mobile as PlayerMobile;
            List<string> list = new List<string>();

            foreach( NetState state in NetState.Instances )
            {
                PlayerMobile player = state.Mobile as PlayerMobile;

                if( state.Mobile != null && state.Mobile != m && state.Mobile is PlayerMobile && player.DisplayGuildTitle && player.Name != null && player.Name.Length > 0 )
                    list.Add( player.Name );
            }

            if( list.Count > 0 )
            {
                m.SendMessage( "List of online characters:" );

                foreach( string st in list )
                    m.SendMessage( st );

            }

            else
                m.SendMessage( "There are currently no players visibly online." );
        }
开发者ID:justdanofficial,项目名称:khaeros,代码行数:28,代码来源:Online.cs

示例9: GMTool_OnCommand

 private static void GMTool_OnCommand( CommandEventArgs e )
 {
     Mobile from = e.Mobile;
     from.CloseGump(typeof(IceGMTool));
     from.SendGump(new IceGMTool(from));
     Console.WriteLine("*****[{1}] {0}  Useing Ice's GM Tool.*****", from.Name, from.AccessLevel);
 }
开发者ID:greeduomacro,项目名称:hubroot,代码行数:7,代码来源:GMTool.cs

示例10: ChangeCharacter_OnCommand

        public static void ChangeCharacter_OnCommand(CommandEventArgs e)
        {
            Mobile from = e.Mobile;
            NetState ns = from.NetState;

            /*
            if (from.GetLogoutDelay() > TimeSpan.Zero)
            {
                from.SendMessage("You are unable to change characters at present. Make sure you are not in combat and that you are in a safe logout location.");
                return;
            }
            */

            if (Spells.SpellHelper.CheckCombat(from))
            {
                from.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle??
                return;
            }
            else if (from.Spell != null)
            {
                from.SendLocalizedMessage(1049616); // You are too busy to do that at the moment.
                return;
            }

            ns.Mobile.SendGump(new gumpChangeCharacter(ns, from));

            Console.WriteLine("Client: {0}: Returning to character select. [{1}]",
                ns.ToString(),
                ns.Account.Username);

            return;
        }
开发者ID:greeduomacro,项目名称:last-wish,代码行数:32,代码来源:ChangeCharacter.cs

示例11: Door_OnCommand

        private static void Door_OnCommand(CommandEventArgs e)
        {
            if (!e.Mobile.Alive)
            {
                e.Mobile.SendMessage("You can't use this command while being dead!");
                return;
            }

            BaseDoor doorToOpen = null;

            IPooledEnumerable eable = e.Mobile.GetObjectsInRange(3);
            foreach (object o in eable)
                if (o is BaseDoor && ((BaseDoor)o).GuildID <= 0)
                {
                    //if (e.Mobile.InLOS(o))
                    //{
                        doorToOpen = (BaseDoor) o;
                        break;
                    //}
                }
            eable.Free();

            if (doorToOpen == null)
                return;

            doorToOpen.Use(e.Mobile);
        }
开发者ID:FreeReign,项目名称:imaginenation,代码行数:27,代码来源:OpenDoor.cs

示例12: _OnCommand

		public static void _OnCommand(CommandEventArgs e)
		{
			var caller = e.Mobile;

			if (caller.HasGump(typeof(CompendiumPageRenderer)))
			{
				caller.CloseGump(typeof(CompendiumPageRenderer));
			}

			if (e.Arguments.Length > 0)
			{
				if (e.Arguments[0].IndexOfAny(Path.GetInvalidFileNameChars()) >= 0)
				{
					caller.SendMessage("That page name has illegal characters in it.");
					return;
				}

				if (g_CompendiumRenderers.ContainsKey(e.Arguments[0]))
				{
					var gump = new CompendiumPageGump(caller, g_CompendiumRenderers[e.Arguments[0]]);
					gump.Send();
				}
				else
				{
					caller.SendMessage("That page does not exist.");
				}
			}
		}
开发者ID:rokann,项目名称:JustUO,代码行数:28,代码来源:Compendium.cs

示例13: OnUniqueIPCommand

		private static void OnUniqueIPCommand(CommandEventArgs e)
		{
			if (e.Mobile != null)
			{
				e.Mobile.SendMessage("There are {0:#,0} unique IP's currently connected.", GetUniqueStates().Count);
			}
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:7,代码来源:IPLimiter.cs

示例14: OnCommand

		private static void OnCommand(CommandEventArgs args)
		{
			if (args.Mobile is PlayerMobile)
			{
				SendMessage(args.Mobile);
			}
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:7,代码来源:MoTDGump.cs

示例15: SetManeuver_OnCommand

        private static void SetManeuver_OnCommand( CommandEventArgs e )
        {
            if( e.Mobile == null || !( e.Mobile is PlayerMobile ) || e.Mobile.Deleted )
                return;

            BaseCombatManeuver maneuver = null;
            PlayerMobile m = e.Mobile as PlayerMobile;
            string text = e.ArgString.ToLower().Replace( " ", "" );

            foreach( KeyValuePair<string, BaseCombatManeuver> kvp in ValidManeuvers )
            {
                if( kvp.Key.ToLower().Replace( " ", "" ) == text )
                    maneuver = kvp.Value;
            }

            if( maneuver != null)
            {
                if( text == "none" )
                    text = null;

                m.SendMessage( "Change the preferred maneuver of which of your followers?" );
                m.Target = new SetManeuverTarget( maneuver, text );
            }

            else
            {
                m.SendMessage( "Invalid option. The following uses of this command are valid:" );

                foreach( KeyValuePair<string, BaseCombatManeuver> kvp in ValidManeuvers )
                {
                    m.SendMessage( ".SetManeuver " + kvp.Key );
                }
            }
        }
开发者ID:justdanofficial,项目名称:khaeros,代码行数:34,代码来源:Commands.cs


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