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


C# Mobile.CanBeginAction方法代码示例

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


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

示例1: Polymorph

		public void Polymorph( Mobile m )
		{
			if ( !m.CanBeginAction( typeof( PolymorphSpell ) ) || !m.CanBeginAction( typeof( IncognitoSpell ) ) || m.IsBodyMod )
				return;

			IMount mount = m.Mount;

			if ( mount != null )
				mount.Rider = null;

			if ( m.Mounted )
				return;

			if ( m.BeginAction( typeof( PolymorphSpell ) ) )
			{
				Item disarm = m.FindItemOnLayer( Layer.OneHanded );

				if ( disarm != null && disarm.Movable )
					m.AddToBackpack( disarm );

				disarm = m.FindItemOnLayer( Layer.TwoHanded );

				if ( disarm != null && disarm.Movable )
					m.AddToBackpack( disarm );

				m.BodyMod = 42;
				m.HueMod = 0;

				new ExpirePolymorphTimer( m ).Start();
			}
		}
开发者ID:greeduomacro,项目名称:last-wish,代码行数:31,代码来源:Barracoon.cs

示例2: ValidateUse

        public bool ValidateUse(Mobile from)
        {
            PlayerMobile pm = from as PlayerMobile;

            if (!this.IsChildOf(from.Backpack))
            {
                // That must be in your pack for you to use it.
                from.SendLocalizedMessage(1042001);
            }
            else if (pm == null || pm.NpcGuild != NpcGuild.ThievesGuild)
            {
                // Only Members of the thieves guild are trained to use this item.
                from.SendLocalizedMessage(501702);
            }
            else if (Stealing.SuspendOnMurder && pm.Kills > 0)
            {
                // You are currently suspended from the thieves guild.  They would frown upon your actions.
                from.SendLocalizedMessage(501703);
            }
            else if (!from.CanBeginAction(typeof(IncognitoSpell)))
            {
                // You cannot disguise yourself while incognitoed.
                from.SendLocalizedMessage(501704);
            }
            else if (Factions.Sigil.ExistsOn(from))
            {
                from.SendLocalizedMessage(1010465); // You cannot disguise yourself while holding a sigil
            }
            else if (TransformationSpellHelper.UnderTransformation(from))
            {
                // You cannot disguise yourself while in that form.
                from.SendLocalizedMessage(1061634);
            }
            else if (from.BodyMod == 183 || from.BodyMod == 184)
            {
                // You cannot disguise yourself while wearing body paint
                from.SendLocalizedMessage(1040002);
            }
            else if (!from.CanBeginAction(typeof(PolymorphSpell)) || from.IsBodyMod)
            {
                // You cannot disguise yourself while polymorphed.
                from.SendLocalizedMessage(501705);
            }
            else
            {
                return true;
            }

            return false;
        }
开发者ID:jasegiffin,项目名称:JustUO,代码行数:50,代码来源:DisguiseKit.cs

示例3: OnDoubleClick

		public override void OnDoubleClick(Mobile from)
		{
			if (IsChildOf(from.Backpack))
			{
				if (Sigil.ExistsOn(from))
				{
					from.SendLocalizedMessage(1010465); // You cannot disguise yourself while holding a sigil.
				}
				else if (!from.CanBeginAction(typeof(IncognitoSpell)))
				{
					from.SendLocalizedMessage(501698); // You cannot disguise yourself while incognitoed.
				}
				else if (!from.CanBeginAction(typeof(PolymorphSpell)))
				{
					from.SendLocalizedMessage(501699); // You cannot disguise yourself while polymorphed.
				}
				else if (TransformationSpellHelper.UnderTransformation(from))
				{
					from.SendLocalizedMessage(501699); // You cannot disguise yourself while polymorphed.
				}
				else if (from.IsBodyMod || from.FindItemOnLayer(Layer.Helm) is OrcishKinMask)
				{
					from.SendLocalizedMessage(501605); // You are already disguised.
				}
				else
				{
					from.BodyMod = (from.Female ? 184 : 183);
					from.HueMod = Hue;

                    if (from is PlayerMobile && Hue == 1358)
				    {
				        ((PlayerMobile) from).HalloweenPaintExpirationOrange = TimeSpan.FromDays(7.0);
				    }
				    else
				    {
                        ((PlayerMobile)from).HalloweenPaintExpirationPurple = TimeSpan.FromDays(7.0);			        
				    }

					from.SendMessage("Well, aren't you spooky looking now?.");
						// You now bear the markings of the savage tribe.  Your body paint will last about a week or you can remove it with an oil cloth.

					Consume();
				}
			}
			else
			{
				from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
			}
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:49,代码来源:HalloweenSkinDye.cs

示例4: OnDoubleClick

		public override void OnDoubleClick(Mobile from)
		{
			if (IsChildOf(from.Backpack))
			{
				if (Sigil.ExistsOn(from))
				{
					from.SendLocalizedMessage(1010465); // You cannot disguise yourself while holding a sigil.
				}
				else if (!from.CanBeginAction(typeof(IncognitoSpell)))
				{
					from.SendLocalizedMessage(501698); // You cannot disguise yourself while incognitoed.
				}
				else if (!from.CanBeginAction(typeof(PolymorphSpell)))
				{
					from.SendLocalizedMessage(501699); // You cannot disguise yourself while polymorphed.
				}
				else if (TransformationSpellHelper.UnderTransformation(from))
				{
					from.SendLocalizedMessage(501699); // You cannot disguise yourself while polymorphed.
				}
				else if (from.IsBodyMod || from.FindItemOnLayer(Layer.Helm) is OrcishKinMask)
				{
					from.SendLocalizedMessage(501605); // You are already disguised.
				}
				else
				{
					from.BodyMod = (from.Female ? 184 : 183);
					from.HueMod = Hue;

				    if (from is PlayerMobile && Hue == 61)
				    {
				        ((PlayerMobile) from).ZombiePaintExperationBooger = TimeSpan.FromDays(7.0);
				    }
				    else
				    {
                        ((PlayerMobile)from).ZombiePaintExperationVesper = TimeSpan.FromDays(7.0);			        
				    }

					from.SendMessage("You have painted yourself with zombie juices.  Yuck.");

					Consume();
				}
			}
			else
			{
				from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
			}
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:48,代码来源:ZombieSkinDye.cs

示例5: VerifyCast

		public static bool VerifyCast( Mobile Caster, bool messages )
		{
			if( Caster == null ) // Sanity
				return false;

			BaseWeapon weap = Caster.FindItemOnLayer( Layer.OneHanded ) as BaseWeapon;

			if( weap == null )
				weap = Caster.FindItemOnLayer( Layer.TwoHanded ) as BaseWeapon;

			if ( weap != null ) {
				if ( Core.ML && Caster.Skills[weap.Skill].Base < 50 ) {
					if ( messages ) {
						Caster.SendLocalizedMessage( 1076206 ); // Your skill with your equipped weapon must be 50 or higher to use Evasion.
					}
					return false;
				}
			} else if ( !( Caster.FindItemOnLayer( Layer.TwoHanded ) is BaseShield ) ) {
				if ( messages ) {
					Caster.SendLocalizedMessage( 1062944 ); // You must have a weapon or a shield equipped to use this ability!
				}
				return false;
			}

			if ( !Caster.CanBeginAction( typeof( Evasion ) ) ) {
				if ( messages ) {
					Caster.SendLocalizedMessage( 501789 ); // You must wait before trying again.
				}
				return false;
			}

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

示例6: CheckUse

		private bool CheckUse( Mobile from )
		{
			if ( !IsAccessibleTo( from ) )
				return false;

			if ( from.Map != Map || !from.InRange( GetWorldLocation(), 2 ) || !from.InLOS(this) )
			{
				from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
				return false;
			}

			if ( !from.CanBeginAction( typeof( FireHorn ) ) )
			{
				from.SendLocalizedMessage( 1049615 ); // You must take a moment to catch your breath.
				return false;
			}

			int sulfAsh = Core.AOS ? 4 : 15;
			if ( from.Backpack == null || from.Backpack.GetAmount( typeof( SulfurousAsh ) ) < sulfAsh )
			{
				from.SendLocalizedMessage( 1049617 ); // You do not have enough sulfurous ash.
				return false;
			}

			return true;
		}
开发者ID:FreeReign,项目名称:imaginenation,代码行数:26,代码来源:FireHorn.cs

示例7: OnUse

        public static TimeSpan OnUse( Mobile m )
        {
            if ( !m.Hidden )
            {
                m.SendLocalizedMessage( 502725 ); // You must hide first
            }
            else if ( m.Skills[SkillName.Hiding].Base < ((Core.ML) ? 30.0 : (Core.SE) ? 50.0 : 80.0) )
            {
                m.SendLocalizedMessage( 502726 ); // You are not hidden well enough.  Become better at hiding.
                m.RevealingAction();
            }
            else if( !m.CanBeginAction( typeof( Stealth ) ) )
            {
                m.SendLocalizedMessage( 1063086 ); // You cannot use this skill right now.
                m.RevealingAction();
            }
            else
            {
                int armorRating = GetArmorRating( m );

                if( armorRating >= (Core.AOS ? 42 : 26) )	//I have a hunch '42' was chosen cause someone's a fan of DNA
                {
                    m.SendLocalizedMessage( 502727 ); // You could not hope to move quietly wearing this much armor.
                    m.RevealingAction();
                }
                else if( m.CheckSkill( SkillName.Stealth, -20.0 + (armorRating * 2), (Core.AOS ? 60.0 : 80.0) + (armorRating * 2) ) )
                {
                    int steps = (int)(m.Skills[SkillName.Stealth].Value / (Core.AOS ? 5.0 : 10.0));

                    if( steps < 1 )
                        steps = 1;

                    m.AllowedStealthSteps = steps;

            // ------ NERUN's DISTRO - Orc Scout bug fix -----
                    if ( m is PlayerMobile )
                    {
                        PlayerMobile pm = m as PlayerMobile; // IsStealthing should be moved to Server.Mobiles
                        pm.IsStealthing = true;
                    }
            /*
                    PlayerMobile pm = m as PlayerMobile; // IsStealthing should be moved to Server.Mobiles

                    if( pm != null )
                            pm.IsStealthing = true;
            */
            // ------ END
                    m.SendLocalizedMessage( 502730 ); // You begin to move quietly.

                    return TimeSpan.FromSeconds( 10.0 );
                }
                else
                {
                    m.SendLocalizedMessage( 502731 ); // You fail in your attempt to move unnoticed.
                    m.RevealingAction();
                }
            }

            return TimeSpan.FromSeconds( 10.0 );
        }
开发者ID:vexilar,项目名称:RunUO_Rebar,代码行数:60,代码来源:Stealth.cs

示例8: OnDoubleClick

		public override void OnDoubleClick( Mobile from )
		{
			if ( !IsChildOf( from.Backpack ) )
			{
				from.SendLocalizedMessage( 1040019 ); // The bola must be in your pack to use it.
			}
			else if ( !from.CanBeginAction( typeof( Bola ) ) )
			{
				from.SendLocalizedMessage( 1049624 ); // You have to wait a few moments before you can use another bola!
			}
			else if ( from.Target is BolaTarget )
			{
				from.SendLocalizedMessage( 1049631 ); // This bola is already being used.
			}
			else if ( !HasFreeHands( from ) )
			{
				from.SendLocalizedMessage( 1040015 ); // Your hands must be free to use this
			}
			else if ( from.Mounted )
			{
				from.SendLocalizedMessage( 1040016 ); // You cannot use this while riding a mount
			}
			else if ( Server.Spells.Ninjitsu.AnimalForm.UnderTransformation( from ) )
			{
				from.SendLocalizedMessage( 1070902 ); // You can't use this while in an animal form!
			}
			else
			{
				EtherealMount.StopMounting( from );

				from.Target = new BolaTarget( this );
				from.LocalOverheadMessage( MessageType.Emote, 0x3B2, 1049632 ); // * You begin to swing the bola...*
				from.NonlocalOverheadMessage( MessageType.Emote, 0x3B2, 1049633, from.Name ); // ~1_NAME~ begins to menacingly swing a bola...
			}
		}
开发者ID:greeduomacro,项目名称:last-wish,代码行数:35,代码来源:Bola.cs

示例9: OnMovement

        public override void OnMovement(Mobile m, Point3D oldLocation)
        {
            base.OnMovement(m, oldLocation);

            Tournament tourny = null;

            if (this.m_Tournament != null)
                tourny = this.m_Tournament.Tournament;

            if (this.InRange(m, 4) && !this.InRange(oldLocation, 4) && tourny != null && tourny.Stage == TournamentStage.Signup && m.CanBeginAction(this))
            {
                Ladder ladder = Ladder.Instance;

                if (ladder != null)
                {
                    LadderEntry entry = ladder.Find(m);

                    if (entry != null && Ladder.GetLevel(entry.Experience) < tourny.LevelRequirement)
                        return;
                }

                if (tourny.HasParticipant(m))
                    return;

                this.PrivateOverheadMessage(MessageType.Regular, 0x35, false, String.Format("Hello m'{0}. Dost thou wish to enter this tournament? You need only to write your name in this book.", m.Female ? "Lady" : "Lord"), m.NetState);
                m.BeginAction(this);
                Timer.DelayCall(TimeSpan.FromSeconds(10.0), new TimerStateCallback(ReleaseLock_Callback), m);
            }
        }
开发者ID:Crome696,项目名称:ServUO,代码行数:29,代码来源:Tournament.cs

示例10: OnDoubleClick

        }// savage kin paint
        public override void OnDoubleClick(Mobile from)
        {
            if (this.IsChildOf(from.Backpack))
            {
                if (Factions.Sigil.ExistsOn(from))
                {
                    from.SendLocalizedMessage(1010465); // You cannot disguise yourself while holding a sigil.
                }
                else if (!from.CanBeginAction(typeof(Spells.Fifth.IncognitoSpell)))
                {
                    from.SendLocalizedMessage(501698); // You cannot disguise yourself while incognitoed.
                }
                else if (!from.CanBeginAction(typeof(Spells.Seventh.PolymorphSpell)))
                {
                    from.SendLocalizedMessage(501699); // You cannot disguise yourself while polymorphed.
                }
                else if (TransformationSpellHelper.UnderTransformation(from))
                {
                    from.SendLocalizedMessage(501699); // You cannot disguise yourself while polymorphed.
                }
                else if (Spells.Ninjitsu.AnimalForm.UnderTransformation(from))
                {
                    from.SendLocalizedMessage(1061634); // You cannot disguise yourself while in that form.
                }
                else if (from.IsBodyMod || from.FindItemOnLayer(Layer.Helm) is OrcishKinMask)
                {
                    from.SendLocalizedMessage(501605); // You are already disguised.
                }
                else
                {
                    from.BodyMod = (from.Female ? 184 : 183);
                    from.HueMod = 0;

                    if (from is PlayerMobile)
                        ((PlayerMobile)from).SavagePaintExpiration = TimeSpan.FromDays(7.0);

                    from.SendLocalizedMessage(1042537); // You now bear the markings of the savage tribe.  Your body paint will last about a week or you can remove it with an oil cloth.

                    this.Consume();
                }
            }
            else
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
        }
开发者ID:Crome696,项目名称:ServUO,代码行数:47,代码来源:TribalPaint.cs

示例11: OnUse

        public static TimeSpan OnUse(Mobile m)
        {
            if (!m.Hidden)
            {
                m.SendLocalizedMessage(502725); // You must hide first
            }
            else if (m.Skills[SkillName.Hiding].Base < HidingRequirement)
            {
                m.SendLocalizedMessage(502726); // You are not hidden well enough.  Become better at hiding.
                m.RevealingAction();
                BuffInfo.RemoveBuff(m, BuffIcon.HidingAndOrStealth);
            }
            else if (!m.CanBeginAction(typeof(Stealth)))
            {
                m.SendLocalizedMessage(1063086); // You cannot use this skill right now.
                m.RevealingAction();
                BuffInfo.RemoveBuff(m, BuffIcon.HidingAndOrStealth);
            }
            else
            {
                int armorRating = GetArmorRating(m);

                if (armorRating >= (Core.AOS ? 42 : 26)) //I have a hunch '42' was chosen cause someone's a fan of DNA
                {
                    m.SendLocalizedMessage(502727); // You could not hope to move quietly wearing this much armor.
                    m.RevealingAction();
                    BuffInfo.RemoveBuff(m, BuffIcon.HidingAndOrStealth);
                }
                else if (m.CheckSkill(SkillName.Stealth, -20.0 + (armorRating * 2), (Core.AOS ? 60.0 : 80.0) + (armorRating * 2)))
                {
                    int steps = (int)(m.Skills[SkillName.Stealth].Value / (Core.AOS ? 5.0 : 10.0));

                    if (steps < 1)
                        steps = 1;

                    m.AllowedStealthSteps = steps;

                    PlayerMobile pm = m as PlayerMobile; // IsStealthing should be moved to Server.Mobiles

                    if (pm != null)
                        pm.IsStealthing = true;

                    m.SendLocalizedMessage(502730); // You begin to move quietly.

                    BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.HidingAndOrStealth, 1044107, 1075655));
                    return TimeSpan.FromSeconds(10.0);
                }
                else
                {
                    m.SendLocalizedMessage(502731); // You fail in your attempt to move unnoticed.
                    m.RevealingAction();
                    BuffInfo.RemoveBuff(m, BuffIcon.HidingAndOrStealth);
                }
            }

            return TimeSpan.FromSeconds(10.0);
        }
开发者ID:Crome696,项目名称:ServUO,代码行数:57,代码来源:Stealth.cs

示例12: GetScalar

        public static double GetScalar( Mobile m )
        {
            double val = 1.0;

            if ( m.CanBeginAction( typeof( ClericDivineFocusSpell ) ) )
                val = 1.5;

            return val;
        }
开发者ID:evildude807,项目名称:kaltar,代码行数:9,代码来源:DivineFocusSpell.cs

示例13: ValidateUse

		public bool ValidateUse( Mobile from )
		{
			PlayerMobile pm = from as PlayerMobile;

            if (!from.InRange(this.GetWorldLocation(), 1))
            {
                from.SendMessage("You are too far away.");
            }

            else if ( from.Skills.Forensics.Value < 80) 
            {
                from.SendMessage("You are not skilled enough in forensics.");
            }

            else if (!from.CanBeginAction(typeof(IncognitoSpell)))
            {
                // You cannot disguise yourself while incognitoed.
                from.SendLocalizedMessage(501704);
            }
            else if (TransformationSpellHelper.UnderTransformation(from))
            {
                // You cannot disguise yourself while in that form.
                from.SendLocalizedMessage(1061634);
            }
            else if (from.BodyMod == 183 || from.BodyMod == 184)
            {
                // You cannot disguise yourself while wearing body paint
                from.SendLocalizedMessage(1040002);
            }
            else if (!from.CanBeginAction(typeof(PolymorphSpell)) || from.IsBodyMod)
            {
                // You cannot disguise yourself while polymorphed.
                from.SendLocalizedMessage(501705);
            }
            else
            {
                return true;
            }

			return false;
		}
开发者ID:greeduomacro,项目名称:hubroot,代码行数:41,代码来源:DisguiseKit.cs

示例14: OnDoubleClick

		public override void OnDoubleClick( Mobile from )
		{
			if ( !IsChildOf( from.Backpack ) )
				from.SendLocalizedMessage( 1042010 ); // You must have the object in your backpack to use it.
			else if ( from.CanBeginAction( typeof( SnowPile ) ) )
			{
				from.SendLocalizedMessage( 1005575 ); // You carefully pack the snow into a ball...
				from.Target = new SnowTarget( from, this );
			}
			else
				from.SendLocalizedMessage( 1005574 ); // The snow is not ready to be packed yet.  Keep trying.
		}
开发者ID:kamronbatman,项目名称:DefianceUO-Pre1.10,代码行数:12,代码来源:SnowEventPile.cs

示例15: OnUse

		public static TimeSpan OnUse( Mobile m )
		{
			if ( !m.Hidden )
			{
				m.SendLocalizedMessage( 502725 ); // You must hide first
			}
			else if ( m.Skills[SkillName.Hiding].Base < HidingRequirement )
			{
				m.SendLocalizedMessage( 502726 ); // You are not hidden well enough.  Become better at hiding.
				m.RevealingAction();
			}
			else if( !m.CanBeginAction( typeof( Stealth ) ) )
			{
				m.SendLocalizedMessage( 1063086 ); // You cannot use this skill right now.
				m.RevealingAction();
			}
			else
			{
				int armorRating = GetArmorRating( m );

				if( armorRating >= 26 )
				{
					m.SendLocalizedMessage( 502727 ); // You could not hope to move quietly wearing this much armor.
					m.RevealingAction();
				}
				else if( m.CheckSkill( SkillName.Stealth, -20.0 + (armorRating * 2), 80.0 + (armorRating * 2) ) )
				{
					int steps = (int)(m.Skills[SkillName.Stealth].Value / 10.0);

					if( steps < 1 )
						steps = 1;

					m.AllowedStealthSteps = steps;

					PlayerMobile pm = m as PlayerMobile; // IsStealthing should be moved to Server.Mobiles

					if( pm != null )
						pm.IsStealthing = true;

					m.SendLocalizedMessage( 502730 ); // You begin to move quietly.

					return TimeSpan.FromSeconds( 10.0 );
				}
				else
				{
					m.SendLocalizedMessage( 502731 ); // You fail in your attempt to move unnoticed.
					m.RevealingAction();
				}
			}

			return TimeSpan.FromSeconds( 10.0 );
		}
开发者ID:Grimoric,项目名称:RunUO.T2A,代码行数:52,代码来源:Stealth.cs


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