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


C# Item.Consume方法代码示例

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


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

示例1: OnDragDrop

        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is Apple && from != null)
            {
                dropped.Consume();
                Emote("*dévore la pomme*");
                PlaySound(Utility.Random(0x3A, 3));

                if (dropped.Amount >= 2 || Utility.Random(5) > 0)
                {
                    Say("Voici coffre !");
                    from.BankBox.Open();
                }
                else
                    Say("Moi encore faim !");

                return true;
            }
            else 
                return base.OnDragDrop(from, dropped);
        }
开发者ID:greeduomacro,项目名称:vivre-uo,代码行数:21,代码来源:OrcBanker.cs

示例2: OnDragDrop

        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is RecallRune)
            {
                if (this.IsLockedDown && from.AccessLevel < AccessLevel.GameMaster)
                {
                    from.SendLocalizedMessage(502413, null, 0x35); // That cannot be done while the book is locked down.
                }
                else if (this.IsOpen(from))
                {
                    from.SendLocalizedMessage(1005571); // You cannot place objects in the book while viewing the contents.
                }
                else if (this.m_Entries.Count < 16)
                {
                    RecallRune rune = (RecallRune)dropped;

                    if (rune.Marked && rune.TargetMap != null)
                    {
                        this.m_Entries.Add(new RunebookEntry(rune.Target, rune.TargetMap, rune.Description, rune.House));

                        dropped.Delete();

                        from.Send(new PlaySound(0x42, this.GetWorldLocation()));

                        string desc = rune.Description;

                        if (desc == null || (desc = desc.Trim()).Length == 0)
                            desc = "(indescript)";

                        from.SendMessage(desc);

                        return true;
                    }
                    else
                    {
                        from.SendLocalizedMessage(502409); // This rune does not have a marked location.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502401); // This runebook is full.
                }
            }
            else if (dropped is RecallScroll)
            {
                if (this.m_CurCharges < this.m_MaxCharges)
                {
                    from.Send(new PlaySound(0x249, this.GetWorldLocation()));

                    int amount = dropped.Amount;

                    if (amount > (this.m_MaxCharges - this.m_CurCharges))
                    {
                        dropped.Consume(this.m_MaxCharges - this.m_CurCharges);
                        this.m_CurCharges = this.m_MaxCharges;
                    }
                    else
                    {
                        this.m_CurCharges += amount;
                        dropped.Delete();

                        return true;
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502410); // This book already has the maximum amount of charges.
                }
            }

            return false;
        }
开发者ID:aj9251,项目名称:ServUO,代码行数:72,代码来源:Runebook.cs

示例3: OnDragDrop

        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is BlankScroll && UzeraanTurmoilQuest.HasLostScrollOfPower(from))
            {
                this.FocusTo(from);

                Item scroll = new SchmendrickScrollOfPower();

                if (!from.PlaceInBackpack(scroll))
                {
                    scroll.Delete();
                    from.SendLocalizedMessage(1046260); // You need to clear some space in your inventory to continue with the quest.  Come back here when you have more space in your inventory.
                    return false;
                }
                else
                {
                    dropped.Consume();
                    from.SendLocalizedMessage(1049346); // Schmendrick scribbles on the scroll for a few moments and hands you the finished product.
                    return dropped.Deleted;
                }
            }

            return base.OnDragDrop(from, dropped);
        }
开发者ID:FreeReign,项目名称:forkuo,代码行数:24,代码来源:Schmendrick.cs

示例4: OnDragDrop

        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is EvolutionEgg && Controlled && from == ControlMaster)
            {
                Say("*Eats the dragon egg*");
                Effects.SendFlashEffect(this, (FlashType)2);
                Hue = dropped.Hue;
                dropped.Consume();
            }

            return base.OnDragDrop(from, dropped);
        }
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:12,代码来源:MetaDragon.cs

示例5: OnDragDrop

		public override bool OnDragDrop( Mobile from, Item dropped )
		{
			if ( dropped is RecallRune )
			{
				if ( !CheckAccess( from ) )
				{
					from.SendLocalizedMessage( 502413 ); // That cannot be done while the book is locked down.
				}
				else if ( IsOpen( from ) )
				{
					from.SendLocalizedMessage( 1005571 ); // You cannot place objects in the book while viewing the contents.
				}
				else if ( m_Entries.Count < 16 )
				{
					RecallRune rune = (RecallRune)dropped;

					if ( rune.Marked && rune.TargetMap != null )
					{
                        if (rune.ChargesLeft > 0)
                        {
                            m_Entries.Add(new RunebookEntry(rune.Target, rune.TargetMap, rune.Description, rune.House, rune.ChargesLeft));

                            dropped.Delete();

                            from.Send(new PlaySound(0x42, GetWorldLocation()));

                            string desc = rune.Description;

                            if (desc == null || (desc = desc.Trim()).Length == 0)
                                desc = "(indescript)";

                            from.SendMessage("You add a rune to {0} in the runebook.", desc);

                            return true;
                        }
                        else
                        {
                            from.SendAsciiMessage("This rune has no charges left.");
                        }
					}
					else
					{
						from.SendLocalizedMessage( 502409 ); // This rune does not have a marked location.
					}
				}
				else
				{
					from.SendLocalizedMessage( 502401 ); // This runebook is full.
				}
			}
			else if ( dropped is RecallScroll )
			{
				if ( m_CurCharges < m_MaxCharges )
				{
					from.Send( new PlaySound( 0x249, GetWorldLocation() ) );

					int amount = dropped.Amount;

					if ( amount > (m_MaxCharges - m_CurCharges) )
					{
						dropped.Consume( m_MaxCharges - m_CurCharges );
						m_CurCharges = m_MaxCharges;
					}
					else
					{
						m_CurCharges += amount;
						dropped.Delete();

						return true;
					}
				}
				else
				{
					from.SendLocalizedMessage( 502410 ); // This book already has the maximum amount of charges.
				}
			}

			return false;
		}
开发者ID:FreeReign,项目名称:imaginenation,代码行数:79,代码来源:Runebook.cs

示例6: OnLoomLoop

        public static void OnLoomLoop(ILoom loom, Mobile from, int hue, Item thread)
        {
            if (loom.Phase > 4)
            {
                loom.Phase = 0;
                Item item = new BoltOfCloth();
                item.Hue = hue;
                from.AddToBackpack(item);
                from.SendLocalizedMessage(500368); // You create some cloth and put it in your backpack.
            }

            LoomQuotaAttachment att = (LoomQuotaAttachment)XmlAttach.FindAttachment(from, typeof(LoomQuotaAttachment));
            if (att == null)
            {
                att = new LoomQuotaAttachment();
                XmlAttach.AttachTo(from, att);
            }
            att.RemoveLooms((Item)loom);

            if (from.NetState == null) // player logged off
                return;
            if (thread.Deleted || thread.Amount < 1 || !(thread is BaseClothMaterial))
                from.SendMessage("You finished processing all the threads/yarns.");
            else if (!thread.IsChildOf(from.Backpack))
                from.SendMessage("You can not continue without the threads/yarns in your backpack.");
            else if (loom is Item)
            {
                Item loom1 = (Item)loom;

                if (loom1.Deleted)
                    from.SendMessage("Where did the loom go?");
                else if (!from.InRange(loom1.GetWorldLocation(), 3))
                    from.SendMessage("You are too far away from the loom to continue your work.");
                else if (loom.Looming)
                    from.SendMessage("That loom is being used.");
                else
                {
                    if (att.getNumLooms() < LoomQuotaAttachment.m_LoomQuotaCap)
                    {
                        att.AddLooms(loom1);
                        if (Utility.Random(20 * att.getNumLooms()) < 1)
                            from.PublicOverheadMessage(Server.Network.MessageType.Emote, 51, false, "*looming*");
                        thread.Consume();
                        loom.BeginLoom(new LoomCallback(BaseClothMaterial.OnLoomLoop), from, thread.Hue, thread);
                        return;
                    }
                    else
                        from.SendMessage("You are too occupied with the " + LoomQuotaAttachment.m_LoomQuotaCap.ToString() + " looms you are running.");
                }
            }
        }
开发者ID:greeduomacro,项目名称:dragonknights-uo,代码行数:51,代码来源:YarnsAndThreads.cs

示例7: OnDragDrop

		public override bool OnDragDrop( Mobile from, Item item )
		{
			if ( item is BasePotion )
			{
				BasePotion pot = (BasePotion)item;
                int toHold = Math.Min( 100 - m_Held, pot.Amount );

				if ( toHold <= 0 )
				{
					from.SendLocalizedMessage( 502233 ); // The keg will not hold any more!
					return false;
				}
				else if ( m_Held == 0 )
				{
					#region Mondain's Legacy
					if ( (int) pot.PotionEffect >= (int) PotionEffect.Invisibility )
					{
						from.SendLocalizedMessage( 502232 ); // The keg is not designed to hold that type of object.
						return false;
					}
					#endregion

					if ( GiveBottle( from, toHold ) )
					{
						m_Type = pot.PotionEffect;
						Held = toHold;

						from.PlaySound( 0x240 );

						from.SendLocalizedMessage( 502237 ); // You place the empty bottle in your backpack.

                        item.Consume( toHold );

						if( !item.Deleted )
							item.Bounce( from );

						return true;
					}
					else
					{
						from.SendLocalizedMessage( 502238 ); // You don't have room for the empty bottle in your backpack.
						return false;
					}
				}
				else if ( pot.PotionEffect != m_Type )
				{
					from.SendLocalizedMessage( 502236 ); // You decide that it would be a bad idea to mix different types of potions.
					return false;
				}
				else
				{
					if ( GiveBottle( from, toHold ) )
					{
						Held += toHold;

						from.PlaySound( 0x240 );

						from.SendLocalizedMessage( 502237 ); // You place the empty bottle in your backpack.

						item.Consume( toHold );

						if( !item.Deleted )
							item.Bounce( from );

						return true;
					}
					else
					{
						from.SendLocalizedMessage( 502238 ); // You don't have room for the empty bottle in your backpack.
						return false;
					}
				}
			}
			else
			{
				from.SendLocalizedMessage( 502232 ); // The keg is not designed to hold that type of object.
				return false;
			}
		}
开发者ID:Grimoric,项目名称:RunUO.T2A,代码行数:79,代码来源:PotionKeg.cs

示例8: CONSUME

			public static void CONSUME(TriggerObject trigObject, Item item, int amount)
			{
				if (item != null && amount > 0)
				{
					item.Consume(amount);
				}
			}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:7,代码来源:UberScriptFunctions.cs

示例9: 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 Cotton))
                from.SendMessage("You finished processing all the cotton.");
            else if (!cotton.IsChildOf(from.Backpack))
                from.SendMessage("You can not continue without the cotton 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(Cotton.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,代码来源:Cotton.cs

示例10: DetermineTarget

        public void DetermineTarget(Mobile pm, Item target)
        {
            if (Contains.Exists(x => x == target.GetType()))
            {
                pm.SendMessage(61, "The mortar already contains this ingredient.");
                return;
            }
            if (target is VileTentacles)
            {
                var tentacles = target as VileTentacles;
                if (tentacles.ChoppedUp)
                {
                    ContainsTentacles = true;
                    pm.SendMessage(54, "You place the chopped tentacles into the mortar and grind them up.");
                }
                else
                {
                    WrongStep = true;
                    pm.SendMessage(54, "You place the tentacles into the mortar and grind them up.");
                }
                Contains.Add(typeof(VileTentacles));
                target.Consume();
                pm.PlaySound(0x242);
            }

            else if (target is UndyingFlesh)
            {
                var flesh = target as UndyingFlesh;
                if (flesh.ChoppedUp)
                {
                    ContainsFlesh = true;
                    pm.SendMessage(54, "You place the diced flesh into the mortar and grind it up.");
                }
                else
                {
                    WrongStep = true;
                    pm.SendMessage(54, "You place the undying flesh into the mortar and grind it up.");
                }
                Contains.Add(typeof(UndyingFlesh));
                target.Consume();
                pm.PlaySound(0x242);
            }

            else if (target is FeyWings)
            {
                pm.SendMessage(54,
                    "You place fey wings into the mortar and grind them up into a fine powder.");
                target.Consume();
                ContainsWings = true;
                Contains.Add(typeof(FeyWings));
                pm.PlaySound(0x242);
            }

            else if (target is VialofVitriol)
            {
                pm.SendMessage(54,
                    "You dump the vial of vitriol into the mortar.");
                target.Consume();
                ContainsVitriol = true;
                Contains.Add(typeof(VialofVitriol));
                pm.PlaySound(0x242);
            }
            else if (target is DaemonClaw)
            {
                pm.SendMessage(54,
                    "You rip off one of the daemon claws fingers and place it into the mortar.");
                target.Consume();
                WrongStep = true;
                Contains.Add(typeof(DaemonClaw));
                pm.PlaySound(0x242);
            }
            else if (target is SeedofRenewal)
            {
                pm.SendMessage(54,
                    "You place the seed of renewal into the mortar and grind it up.");
                target.Consume();
                WrongStep = true;
                Contains.Add(typeof(SeedofRenewal));
                pm.PlaySound(0x242);
            }
            else if (target is SpiderCarapace)
            {
                pm.SendMessage(54,
                    "You rip off of the spider carapace and place it into the mortar.");
                target.Consume();
                WrongStep = true;
                Contains.Add(typeof(SpiderCarapace));
                pm.PlaySound(0x242);
            }
            else if (CookableFood.IsHeatSource(target))
            {
                if (ContainsFlesh && ContainsTentacles && ContainsVitriol && ContainsWings)
                {
                    pm.SendMessage(61,
                        "You place the mortar over the heat source and the ingredients inside begin to bubble and fizzle gently.");
                    Hue = 61;
                    Completed = true;
                }
                else if (Contains != null && Contains.Count > 0)
                {
//.........这里部分代码省略.........
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:101,代码来源:MortarPestle.cs

示例11: DetermineTarget

        public void DetermineTarget(Mobile pm, Item target)
        {
            if (Contains.Exists(x => x == target.GetType()))
            {
                pm.SendMessage(61, "The pewter bowl already contains this ingredient.");
                return;
            }

            if (target is VileTentacles)
            {
                pm.SendMessage(54, "You place the tentacles into the pewter bowl.");
                WrongStep = true;
                target.Consume();
                Contains.Add(typeof(VileTentacles));
            }

            else if (target is UndyingFlesh)
            {
                WrongStep = true;
                pm.SendMessage(54, "You place the undying flesh into the pewter bowl.");
                target.Consume();
                Contains.Add(typeof(UndyingFlesh));
            }

            else if (target is FeyWings)
            {
                WrongStep = true;
                pm.SendMessage(54, "You place the fey wings into the pewter bowl.");
                target.Consume();
                Contains.Add(typeof(FeyWings));
            }

            else if (target is VialofVitriol)
            {
                WrongStep = true;
                pm.SendMessage(54, "You dump the vial of vitriol in the pewter bowl.");
                target.Consume();
                Contains.Add(typeof(VialofVitriol));
            }
            else if (target is SpiderCarapace)
            {
                if (!ContainsCarapace)
                {
                    ContainsCarapace = true;
                    pm.SendMessage(54, "You rip of a piece of the spider carapace off and place it in the pewter bowl.");
                    target.Consume();
                    Contains.Add(typeof(SpiderCarapace));
                }
            }
            else if (target is SeedofRenewal)
            {
                if (!ContainsSeed)
                {
                    ContainsSeed = true;
                    pm.SendMessage(54, "You gently place the seed of renewal in the pewter bowl.");
                    target.Consume();
                    Contains.Add(typeof(SeedofRenewal));
                }
            }
            else if (target is DaemonClaw)
            {
                if (!ContainersClaw)
                {
                    ContainersClaw = true;
                    pm.SendMessage(54, "You place the daemon claw in the pewter bowl.");
                    target.Consume();
                    Contains.Add(typeof(DaemonClaw));
                }
            }
            else if (target is CrystalFlask)
            {
                if (Contains != null && Contains.Count > 0)
                {
                    var vial = target as CrystalFlask;
                    pm.SendMessage(61, "You pour the contents of the pewter bowl into the crystal flask.");
                    target.Name = "the cure";
                    if (Completed)
                    {
                        vial.Hue = 61;
                    }
                    else
                    {
                        vial.Bad = true;
                        vial.Hue = 1157;
                    }
                    vial.Filled = true;
                    Consume();
                }
                else
                {
                    pm.SendMessage(61, "There is nothing in the pewter bowl.");
                }
            }
            else
            {
                pm.SendMessage(61, "That doesn't look like it should go in the pewter bowl.");
            }

            if (Contains != null && Contains.Count > 0)
            {
//.........这里部分代码省略.........
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:101,代码来源:PewterBowl.cs

示例12: ConsumeNeeded

        private void ConsumeNeeded( ref int need, Item item, OnItemConsumed callback )
        {
            int theirAmount = item.Amount;

            if ( theirAmount < need )
            {
                if ( callback != null )
                    callback( item, theirAmount );

                item.Delete();
                need -= theirAmount;
            }
            else
            {
                if ( callback != null )
                    callback( item, need );

                item.Consume( need );
                need = 0;
            }
        }
开发者ID:kamronbatman,项目名称:Defiance-AOS-Pre-2012,代码行数:21,代码来源:Container.cs


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