當前位置: 首頁>>代碼示例>>C#>>正文


C# Mobile.FindItemOnLayer方法代碼示例

本文整理匯總了C#中Server.Mobile.FindItemOnLayer方法的典型用法代碼示例。如果您正苦於以下問題:C# Mobile.FindItemOnLayer方法的具體用法?C# Mobile.FindItemOnLayer怎麽用?C# Mobile.FindItemOnLayer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Server.Mobile的用法示例。


在下文中一共展示了Mobile.FindItemOnLayer方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: 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 ( from.FindItemOnLayer( Layer.OneHanded ) != null || from.FindItemOnLayer( Layer.TwoHanded ) != null )
     {
         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
     {
         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:FreeReign,項目名稱:Rebirth-Repack,代碼行數:29,代碼來源:Bola.cs

示例2: OnDoubleClick

		public override void OnDoubleClick( Mobile from )
		{
			if( from.Mounted )
			{
				from.SendMessage( "You cannot harvest crops while mounted." );
			}
			else
			{
				Item oneHanded = from.FindItemOnLayer( Layer.OneHanded );
				Item twoHanded = from.FindItemOnLayer( Layer.TwoHanded );

				if( oneHanded != null && oneHanded is Server.Items.BaseAxe )
				{
					Chop( from );
				}
				else if( twoHanded != null && twoHanded is Server.Items.BaseAxe )
				{
					Chop( from );
				}
				else
				{
					from.SendMessage( "You need an axe to cut down this sapling!" );
				}
			}
		}
開發者ID:greeduomacro,項目名稱:hubroot,代碼行數:25,代碼來源:BaseTreeSapling.cs

示例3: OnDoubleClick

		public override void OnDoubleClick( Mobile from )
		{
			if ( !from.InRange( this.GetWorldLocation(), 1 ) )
			{
				from.SendLocalizedMessage( 502138 ); // That is too far away for you to use
				return;
			}
			else if ( from != m_Caster )
			{
				// from.SendLocalizedMessage( ); // 
				return;
			}

			BaseWeapon weapon = from.FindItemOnLayer( Layer.OneHanded ) as BaseWeapon;

			if ( weapon == null )
				weapon = from.FindItemOnLayer( Layer.TwoHanded ) as BaseWeapon;

			if ( weapon != null )
			{
				from.SendLocalizedMessage( 1080116 ); // You must have a free hand to use a Healing Stone.
			}
			else if ( from.BeginAction( typeof( BaseHealPotion ) ) )
			{
				from.Heal( Utility.RandomMinMax( BasePotion.Scale( from, 13 ) , BasePotion.Scale( from, 16 ) ) );
				this.Consume();
				Timer.DelayCall( TimeSpan.FromSeconds( 8.0 ), new TimerStateCallback( ReleaseHealLock ), from );
			}
			else
				from.SendLocalizedMessage( 1095172 ); // You must wait a few seconds before using another Healing Stone.
		}
開發者ID:PepeBiondi,項目名稱:runsa,代碼行數:31,代碼來源:HealingStone.cs

示例4: OnDamage

		public override void OnDamage( int amount, Mobile from, bool willKill )
		{
			base.OnDamage( amount, from, willKill );

			if( from == null || !from.Alive || from.Map != this.Map )
				return;

			Item i = from.FindItemOnLayer( Layer.FirstValid );
			Item ii = from.FindItemOnLayer( Layer.TwoHanded );

			if( i != null && i is BaseWeapon )
			{
				if( i is BaseRanged )
				{
					if( 0.40 > Utility.RandomDouble() )
						FireBullets( from );
				}
			}
			else if( ii != null && ii is BaseWeapon )
			{
				if( ii is BaseRanged )
				{
					if( 0.45 > Utility.RandomDouble() )
						FireBullets( from );
				}
			}
		}
開發者ID:greeduomacro,項目名稱:hubroot,代碼行數:27,代碼來源:PlantDemon.cs

示例5: DisRobe

 private static void DisRobe( Mobile m_from, Layer layer )
 {
    if ( m_from.FindItemOnLayer( layer ) != null )
    {
       Item item = m_from.FindItemOnLayer( layer );
       m_from.PlaceInBackpack( item ); // Place in a bag first?
    }
 }
開發者ID:kamronbatman,項目名稱:DefianceUO-Pre1.10,代碼行數:8,代碼來源:saythis.cs

示例6: DisRobe

			private static void DisRobe( Mobile m_from, Container cont, Layer layer ) 
			{ 
				if ( m_from.FindItemOnLayer( layer ) != null )
				{
					Item item = m_from.FindItemOnLayer( layer );
					cont.AddItem( item );
				}
			}
開發者ID:PepeBiondi,項目名稱:runsa,代碼行數:8,代碼來源:GMbody.cs

示例7: IsEmptyHanded

        public static bool IsEmptyHanded( Mobile from )
        {
            if ( from.FindItemOnLayer( Layer.OneHanded ) != null )
                return false;

            if ( from.FindItemOnLayer( Layer.TwoHanded ) != null )
                return false;

            return true;
        }
開發者ID:justdanofficial,項目名稱:khaeros,代碼行數:10,代碼來源:Stealing.cs

示例8: HasFreeHand

		public static bool HasFreeHand( Mobile m )
		{
			Item handOne = m.FindItemOnLayer( Layer.OneHanded );
			Item handTwo = m.FindItemOnLayer( Layer.TwoHanded );

			if ( handTwo is BaseWeapon )
				handOne = handTwo;

			return ( handOne == null || handTwo == null );
		}
開發者ID:kamronbatman,項目名稱:DefianceUO-Pre1.10,代碼行數:10,代碼來源:BasePotion.cs

示例9: UnMorph

		public bool UnMorph(Mobile from)
		{

		if (from.FindItemOnLayer(Layer.OuterTorso) == null || from.FindItemOnLayer(Layer.OuterTorso).Name != "a Shroud of Phasing")
			{
			this.Hue = 1153;
			}
			else
			{
			}
		return true;
		}
開發者ID:kamronbatman,項目名稱:DefianceUO-Pre1.10,代碼行數:12,代碼來源:Chest.cs

示例10: CheckTool

        public static bool CheckTool( Item tool, Mobile m )
        {
            Item check = m.FindItemOnLayer( Layer.OneHanded );

            if ( check is BaseTool && check != tool && !(check is AncientSmithyHammer) )
                return false;

            check = m.FindItemOnLayer( Layer.TwoHanded );

            if ( check is BaseTool && check != tool && !(check is AncientSmithyHammer) )
                return false;

            return true;
        }
開發者ID:cynricthehun,項目名稱:UOLegends,代碼行數:14,代碼來源:BaseTool.cs

示例11: ApplyEffect

        public override void ApplyEffect( Mobile to, Mobile source, int intensity, Item itemSource )
        {
            if ( source != to )
                source.DoHarmful( to );
            int chance = Utility.RandomMinMax( 1, 8 );
            string sundname = "";

            BaseArmor sundered = null;
            Layer layer = Layer.FirstValid;

            switch( chance )
            {
                case 1: layer = Layer.InnerTorso; sundname = "armour"; break;
                case 2: layer = Layer.InnerLegs; sundname = "leggings"; break;
                case 3: layer = Layer.TwoHanded; sundname = "shield"; break;
                case 4: layer = Layer.Neck; sundname = "gorget"; break;
                case 5: layer = Layer.Gloves; sundname = "gauntlets"; break;
                case 6: layer = Layer.Helm; sundname = "helm"; break;
                case 7: layer = Layer.Arms; sundname = "arm pads"; break;
                case 8: layer = Layer.OneHanded; sundname = "weapon"; break;
            }

            if( to.FindItemOnLayer( layer ) != null && to.FindItemOnLayer( layer ) is BaseArmor )
                sundered = to.FindItemOnLayer( layer ) as BaseArmor;

            if( sundered != null )
            {
                int amt = (int)(intensity * Divisor);
                if ( amt <= 0 )
                    amt = 0;

                sundered.HitPoints -= Utility.Random( amt ) + 1;

                if( sundered.HitPoints < 0 )
                {
                    sundered.MaxHitPoints += sundered.HitPoints;
                    sundered.HitPoints = 0;

                    if( sundered.MaxHitPoints < 0 )
                    {
                        sundered.Delete();
                        to.Emote( "*got {0} {1} destroyed by {2}*", to.Female == true ? "her" : "his", sundname, source.Name );
                    }
                }

                to.Emote( "*got {0} {1} damaged by {2}*", to.Female == true ? "her" : "his", sundname, source.Name );
            }
        }
開發者ID:justdanofficial,項目名稱:khaeros,代碼行數:48,代碼來源:RustEffect.cs

示例12: OnDoubleClick

        public override void OnDoubleClick( Mobile from )
        {
            if ( IsChildOf( from.Backpack ) )
            {
                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 ( 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.

                    Consume();
                }
            }
            else
            {
                from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
            }
        }
開發者ID:FreeReign,項目名稱:Rebirth-Repack,代碼行數:34,代碼來源:TribalPaint.cs

示例13: OnDoubleClick

        public override void OnDoubleClick( Mobile from )
        {
            if ( IsChildOf( from.Backpack ) )
            {
                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 ( Spells.Necromancy.TransformationSpell.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
                {
                    /* TODO: Desde el Publish 37 OSI no modifica el body del personaje al
                     * usar la TribalPaint, para que los elfos se sigan viendo con body
                     * de elfo. No obstante, no podemos eliminar esto ya que RunUO basa
                     * todo el código del efecto en si el personaje tiene este body o no.
                     */
                    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.

                    Consume();
                }
            }
            else
            {
                from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
            }
        }
開發者ID:Ravenwolfe,項目名稱:xrunuo,代碼行數:35,代碼來源:TribalPaint.cs

示例14: OnDoubleClick

        public override void OnDoubleClick(Mobile from)
        {
            // Scriptiz : gestion du double clic pour équipper un objet
            if (from.FindItemOnLayer(this.Layer) != this)
            {
                base.OnDoubleClick(from);
                return;
            }

            if (HarvestSystem == null || Deleted)
                return;

            Point3D loc = GetWorldLocation();

            if (!from.InLOS(loc) || !from.InRange(loc, 2))
            {
                from.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3E9, 1019045); // I can't reach that
                return;
            }
            else if (!this.IsAccessibleTo(from))
            {
                this.PublicOverheadMessage(MessageType.Regular, 0x3E9, 1061637); // You are not allowed to access this.
                return;
            }

            if (!(this.HarvestSystem is Mining))
                from.SendLocalizedMessage(1010018); // What do you want to use this item on?

            HarvestSystem.BeginHarvesting(from, this);
        }
開發者ID:greeduomacro,項目名稱:vivre-uo,代碼行數:30,代碼來源:BaseAxe.cs

示例15: IsMonk

		public static bool IsMonk( Mobile m )
		{
			if ( m is BaseCreature )
				return true;
			else
				return (m.FindItemOnLayer( Layer.Gloves ) is MonkFists);
		}
開發者ID:greeduomacro,項目名稱:cov-shard-svn-1,代碼行數:7,代碼來源:MonkSystem.cs


注:本文中的Server.Mobile.FindItemOnLayer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。