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


C# Item.IsChildOf方法代码示例

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


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

示例1: Dye

        public override bool Dye( Mobile from, Item item )
        {
            bool okay = ( item.IsChildOf( from.Backpack ) );

            if ( !okay )
            {
                if ( item.RootParent == null )
                {
                    BaseHouse house = BaseHouse.FindHouseAt( item );

                    if ( house == null || ( !house.IsLockedDown( item ) && !house.IsSecure( item ) ) )
                        from.SendLocalizedMessage( 501022 ); // Furniture must be locked down to paint it.
                    else if ( !house.IsCoOwner( from ) )
                        from.SendLocalizedMessage( 501023 ); // You must be the owner to use this item.
                    else
                        okay = true;
                }
                else
                    from.SendLocalizedMessage( 1048135 ); // The furniture must be in your backpack to be painted.
            }

            if ( okay && item.Dye( from, this ) )
            {
                from.PlaySound( 0x23E );
                return true;
            }
            return false;
        }
开发者ID:kamronbatman,项目名称:Defiance-AOS-Pre-2012,代码行数:28,代码来源:FurnitureDyeTub.cs

示例2: OnItemLifted

		public override void OnItemLifted( Mobile from, Item item )
		{
			if( item.IsChildOf( from.Backpack) )
			{
				from.Str -= 5;
				isactive = false;
			}
			base.OnItemLifted(from,item);
		}
开发者ID:greeduomacro,项目名称:unknown-shard-1,代码行数:9,代码来源:Charm.cs

示例3: AddContextMenuEntries

        public static void AddContextMenuEntries(Mobile from, Item item, List<ContextMenuEntry> list)
        {
            if (!item.IsChildOf(from.Backpack) && item.Parent != from)
                return;

            PlayerMobile pm = from as PlayerMobile;

            if (pm == null)
                return;

            list.Add(new ToggleClippings(pm, true, false, false, 1112282)); //Set to clip plants
            list.Add(new ToggleClippings(pm, false, true, false, 1112283)); //Set to cut reeds
            list.Add(new ToggleClippings(pm, false, false, true, 1150660)); //Set to cut topiaries
        }
开发者ID:mcarriere,项目名称:ServUO,代码行数:14,代码来源:Clippers.cs

示例4: OnSpunLoop

        public static void OnSpunLoop(ISpinningWheel wheel, Mobile from, int hue, Item cotton)
        {
            Item item = new SpoolOfThread(3);
            item.Hue = hue;
            from.AddToBackpack(item);

            SpinningWheelQuotaAttachment att = (SpinningWheelQuotaAttachment)XmlAttach.FindAttachment(from, typeof(SpinningWheelQuotaAttachment));
            if (att == null)
            {
                att = new SpinningWheelQuotaAttachment();
                XmlAttach.AttachTo(from, att);
            }
            att.RemoveWheels((Item)wheel);

            if (from.NetState == null) // player logged off
                return;
            if (cotton.Deleted || cotton.Amount < 1 || !(cotton is Flax))
                from.SendMessage("You finished processing all the flax.");
            else if (!cotton.IsChildOf(from.Backpack))
                from.SendMessage("You can not continue without the flax in your backpack.");
            else if (wheel is Item)
            {
                Item wheel1 = (Item)wheel;

                if (wheel1.Deleted)
                    from.SendMessage("Where did the spinning wheel go?");
                else if (!from.InRange(wheel1.GetWorldLocation(), 3))
                    from.SendMessage("You are too far away from the spinning wheel to continue your work.");
                else if (wheel.Spinning)
                    from.SendLocalizedMessage(502656); // That spinning wheel is being used.
                else
                {
                    if (att.getNumWheels() < SpinningWheelQuotaAttachment.m_WheelQuotaCap)
                    {
                        att.AddWheels(wheel1);
                        if (Utility.Random(6 * att.getNumWheels()) < 1)
                            from.PublicOverheadMessage(Server.Network.MessageType.Emote, 51, false, "*spinning*");
                        cotton.Consume();
                        wheel.BeginSpin(new SpinCallback(Flax.OnSpunLoop), from, cotton.Hue, cotton);
                        return;
                    }
                    else
                        from.SendMessage("You are too occupied with the " + SpinningWheelQuotaAttachment.m_WheelQuotaCap.ToString() + " spinning wheels you are running.");
                }
            }
            from.SendLocalizedMessage(1010577); // You put the spools of thread in your backpack.
        }
开发者ID:greeduomacro,项目名称:dragonknights-uo,代码行数:47,代码来源:Flax.cs

示例5: ConsumeRelic

 public void ConsumeRelic(Mobile m, Item item)
 {
     if (!item.IsChildOf(m.Backpack))
     {
         m.SendMessage(54, "The relic must be in your backpack for you to use it!");
         return;
     }
     if (item is BaseMetaRelic)
     {
         var relic = item as BaseMetaRelic;
         relic.GetMeta(m, Pet);
     }
     else
     {
         m.SendMessage(54, "You must use this on a relic!");
     }
 }
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:17,代码来源:MetaStone.cs

示例6: CheckNonlocalDrop

		public override bool CheckNonlocalDrop( Mobile from, Item item, Item target )
		{
			if ( !base.CheckNonlocalDrop( from, item, target ) )
				return false;

			if ( from.AccessLevel >= AccessLevel.GameMaster )
				return true;

			Container pack = this.Backpack;
			if ( from == this && this.HasTrade && ( target == pack || target.IsChildOf( pack ) ) )
			{
				BounceInfo bounce = item.GetBounce();

				if ( bounce != null && bounce.m_Parent is Item )
				{
					Item parent = (Item) bounce.m_Parent;

					if ( parent == pack || parent.IsChildOf( pack ) )
						return true;
				}

				SendLocalizedMessage( 1004041 ); // You can't do that while you have a trade pending.
				return false;
			}

			return true;
		}
开发者ID:nick12344356,项目名称:The-Basement,代码行数:27,代码来源:PlayerMobile.cs

示例7: OnSubItemAdded

		public override void OnSubItemAdded( Item item )
		{
			if ( AccessLevel < AccessLevel.GameMaster && item.IsChildOf( this.Backpack ) )
			{
				int maxWeight = WeightOverloading.GetMaxWeight( this );
				int curWeight = Mobile.BodyWeight + this.TotalWeight;

				if ( curWeight > maxWeight )
					this.SendLocalizedMessage( 1019035, true, String.Format( " : {0} / {1}", curWeight, maxWeight ) );
			}
		}
开发者ID:nick12344356,项目名称:The-Basement,代码行数:11,代码来源:PlayerMobile.cs

示例8: AddContextMenuEntries

        public static void AddContextMenuEntries(Mobile from, Item item, List<ContextMenuEntry> list)
        {
            if (!item.IsChildOf(from.Backpack) && item.Parent != from)
                return;

            PlayerMobile pm = from as PlayerMobile;

            if (pm == null)
                return;

            int typeentry = 0;
            if (pm.ToggleCutClippings)
                typeentry = 1112282;
            if (pm.ToggleCutReeds)
                typeentry = 1112283;

            ContextMenuEntry clippingEntry = new ContextMenuEntry(typeentry);
            clippingEntry.Color = 0x421F;
            //list.Add( clippingEntry );

            list.Add(new ToggleClippings(pm, true, false, 1112282)); //set to clip plants
            list.Add(new ToggleClippings(pm, false, true, 1112283)); //Set to cut reeds
        }
开发者ID:GaeaUO,项目名称:ForkUO,代码行数:23,代码来源:Clippers.cs

示例9: ToggleItemInsurance_Callback

        private void ToggleItemInsurance_Callback(Mobile from, Item item, bool target)
        {
            if (item == null || !item.IsChildOf(this))
            {
                if (target)
                    BeginTarget(-1, false, TargetFlags.None, new TargetCallback(ToggleItemInsurance_Callback));

                SendLocalizedMessage(1060871, "", 0x23); // You can only insure items that you have equipped or that are in your backpack
            }
            else if (item.Insured)
            {
                item.Insured = false;

                SendLocalizedMessage(1060874, "", 0x35); // You cancel the insurance on the item

                if (target)
                {
                    BeginTarget(-1, false, TargetFlags.None, new TargetCallback(ToggleItemInsurance_Callback));
                    SendLocalizedMessage(1060868, "", 0x23); // Target the item you wish to toggle insurance status on <ESC> to cancel
                }
            }
            else if (!CanInsure(item))
            {
                if (target)
                    BeginTarget(-1, false, TargetFlags.None, new TargetCallback(ToggleItemInsurance_Callback));

                SendLocalizedMessage(1060869, "", 0x23); // You cannot insure that
            }
            else
            {
                if (!item.PayedInsurance)
                {
                    int cost = GetInsuranceCost(item);

                    if (Banker.Withdraw(from, cost))
                    {
                        SendLocalizedMessage(1060398, cost.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                        item.PayedInsurance = true;
                    }
                    else
                    {
                        SendLocalizedMessage(1061079, "", 0x23); // You lack the funds to purchase the insurance
                        return;
                    }
                }

                item.Insured = true;

                SendLocalizedMessage(1060873, "", 0x23); // You have insured the item

                if (target)
                {
                    BeginTarget(-1, false, TargetFlags.None, new TargetCallback(ToggleItemInsurance_Callback));
                    SendLocalizedMessage(1060868, "", 0x23); // Target the item you wish to toggle insurance status on <ESC> to cancel
                }
            }
        }
开发者ID:felladrin,项目名称:last-wish,代码行数:57,代码来源:PlayerMobile.cs

示例10: CheckNonlocalLift

		public override bool CheckNonlocalLift( Mobile from, Item item )
		{
			if ( item.IsChildOf( this.Backpack ) )
			{
				if ( IsOwner( from ) )
				{
					return true;
				}
				else
				{
					SayTo( from, 503223 ); // If you'd like to purchase an item, just ask.
					return false;
				}
			}

			return base.CheckNonlocalLift( from, item );
		}
开发者ID:Grimoric,项目名称:RunUO.T2A,代码行数:17,代码来源:PlayerVendor.cs

示例11: CheckNonlocalLift

        public override bool CheckNonlocalLift(Mobile from, Item item)
        {
            if (item.IsChildOf(Backpack))
            {
                if (IsOwner(from))
                {
                    return true;
                }

                SayTo(from, 503223); // If you'd like to purchase an item, just ask.
                return false;
            }

            if (BaseHouse.NewVendorSystem && IsOwner(from))
            {
                return true;
            }

            return base.CheckNonlocalLift(from, item);
        }
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:20,代码来源:PlayerVendor.cs

示例12: CheckAccessible

 public static bool CheckAccessible(Item tool, Mobile m)
 {
     return (tool.IsChildOf(m) || tool.Parent == m);
 }
开发者ID:Crome696,项目名称:ServUO,代码行数:4,代码来源:BaseTool.cs

示例13: AddContextMenuEntries

		public static void AddContextMenuEntries( Mobile from, Item item, List<ContextMenuEntry> list, HarvestSystem system )
		{
			if ( system != Mining.System )
				return;

			if ( !item.IsChildOf( from.Backpack ) && item.Parent != from )
				return;

			PlayerMobile pm = from as PlayerMobile;

			if ( pm == null )
				return;

			ContextMenuEntry miningEntry = new ContextMenuEntry( pm.ToggleMiningStone ? 6179 : 6178 );
			miningEntry.Color = 0x421F;
			list.Add( miningEntry );

			list.Add( new ToggleMiningStoneEntry( pm, false, 6176 ) );
			list.Add( new ToggleMiningStoneEntry( pm, true, 6177 ) );
		}
开发者ID:nick12344356,项目名称:The-Basement,代码行数:20,代码来源:BaseHarvestTool.cs

示例14: OnSubItemAdded

		public override void OnSubItemAdded(Item item)
		{
			if (AccessLevel >= AccessLevel.GameMaster || !item.IsChildOf(Backpack))
			{
				return;
			}

			int maxWeight = WeightOverloading.GetMaxWeight(this);
			int curWeight = BodyWeight + TotalWeight;

			if (curWeight > maxWeight)
			{
				SendLocalizedMessage(1019035, true, String.Format(" : {0} / {1}", curWeight, maxWeight));
			}
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:15,代码来源:PlayerMobile.cs

示例15: OnDroppedOnto

        public override bool OnDroppedOnto( Mobile from, Item target )
        {
            if( target != null && !target.Deleted && target is CustomSpellBook && target.IsChildOf(from) )
            {
                CustomSpellBook book = target as CustomSpellBook;

                if( Spell.CustomName == null || Spell.CustomName.Length < 1 )
                    from.SendMessage( "A spell scroll can only be copied onto a spell book after the spell has been properly named." );

                else if( book.ContainsSpell(Spell.CustomName) )
                    from.SendMessage( "That spell book already contains a spell with the same name as the one on the scroll." );

                else
                {
                    book.Spells.Add( DupeCustomMageSpell(Spell) );
                    from.SendMessage( "You successfully copy the spell onto the book." );
                }
            }

            return base.OnDroppedOnto( from, target );
        }
开发者ID:justdanofficial,项目名称:khaeros,代码行数:21,代码来源:CustomSpellScroll.cs


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