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


C# Mobile.PlaceInBackpack方法代码示例

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


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

示例1: FinishEffect

		protected override void FinishEffect( Point3D p, Map map, Mobile from )
		{
			if ( from.Skills.Fishing.Value < 10 )
			{
				from.SendLocalizedMessage( 1074487 ); // The creatures are too quick for you!
			}
			else
			{
				BaseFish fish = GiveFish( from );
				FishBowl bowl = Aquarium.GetEmptyBowl( from );

				if ( bowl != null )
				{
					fish.StopTimer();
					bowl.AddItem( fish );
					from.SendLocalizedMessage( 1074489 ); // A live creature jumps into the fish bowl in your pack!
					Delete();
					return;
				}
				else
				{
					if ( from.PlaceInBackpack( fish ) )
					{
						from.PlaySound( 0x5A2 );
						from.SendLocalizedMessage( 1074490 ); // A live creature flops around in your pack before running out of air.

						fish.Kill();
						Delete();
						return;
					}
					else
					{
						fish.Delete();

						from.SendLocalizedMessage( 1074488 ); // You could not hold the creature.
					}
				}
			}

			InUse = false;
			Movable = true;

			if ( !from.PlaceInBackpack( this ) )
			{
				if ( from.Map == null || from.Map == Map.Internal )
					Delete();
				else
					MoveToWorld( from.Location, from.Map );
			}
		}
开发者ID:greeduomacro,项目名称:last-wish,代码行数:50,代码来源:AquariumFishingNet.cs

示例2: OnComponentUsed

        public override void OnComponentUsed(AddonComponent c, Mobile from)
        {
            if (from.InRange(c.Location, 2))
            {
                if (this.m_Fruits > 0)
                {
                    Item fruit = this.Fruit;

                    if (fruit == null)
                        return;

                    if (!from.PlaceInBackpack(fruit))
                    {
                        fruit.Delete();
                        from.SendLocalizedMessage(501015); // There is no room in your backpack for the fruit.					
                    }
                    else
                    {
                        if (--this.m_Fruits == 0)
                            Timer.DelayCall(TimeSpan.FromMinutes(30), new TimerCallback(Respawn));

                        from.SendLocalizedMessage(501016); // You pick some fruit and put it in your backpack.
                    }
                }
                else
                    from.SendLocalizedMessage(501017); // There is no more fruit on this tree
            }
            else
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
        }
开发者ID:Crome696,项目名称:ServUO,代码行数:30,代码来源:FruitTrees.cs

示例3: Gather

		private void Gather( Mobile from )
		{
			int amount = 0;
			Item reg;
			bool canHold = true;
			for ( int i = 0; i < m_ResourceAmounts.Length && i < m_ResourceTypes.Length; ++i )
			{
				if ( m_ResourceAmounts[i] > 0 && canHold )
				{
					reg = Activator.CreateInstance( m_ResourceTypes[i], new object[]{ m_ResourceAmounts[i] } ) as Item;

					if ( !from.PlaceInBackpack( reg ) )
					{
						canHold = false;
						reg.Delete();
					}
					else
						amount += m_ResourceAmounts[i];
				}
				m_ResourceAmounts[i] = 0;
			}

			if ( amount == 1 )
				from.SendMessage( "You take a reagent from the statue and clean it." );
			else if ( amount > 1 )
				from.SendMessage( "You gather {0} reagents from the statue and clean it.", amount );
			else
				from.SendMessage( "You remove the reagents from the statue." );

			NextFill = DateTime.Now + TimeSpan.FromDays( 1 );
			if ( ItemID == 0x1949 )
				ItemID = 0x1947;
			else
				ItemID = 0x1948;
		}
开发者ID:ITLongwell,项目名称:aedilis2server,代码行数:35,代码来源:BlessedStatue.cs

示例4: OnDoubleClick

        public override void OnDoubleClick(Mobile from)
        {
            if (!this.VerifyMove(from))
                return;

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

            Point3D fireLocation = this.GetFireLocation(from);

            if (fireLocation == Point3D.Zero)
            {
                from.SendLocalizedMessage(501695); // There is not a spot nearby to place your campfire.
            }
            else if (!from.CheckSkill(SkillName.Camping, 0.0, 100.0))
            {
                from.SendLocalizedMessage(501696); // You fail to ignite the campfire.
            }
            else
            {
                this.Consume();

                if (!this.Deleted && this.Parent == null)
                    from.PlaceInBackpack(this);

                new Campfire().MoveToWorld(fireLocation, from.Map);
            }
        }
开发者ID:FreeReign,项目名称:forkuo,代码行数:31,代码来源:Kindling.cs

示例5: GiveReward

        public bool GiveReward(Mobile to)
        {
            Bag bag = new Bag();

            bag.DropItem(new Gold(Utility.RandomMinMax(500, 1000)));

            if (Utility.RandomBool())
            {
                BaseWeapon weapon = Loot.RandomWeapon();

                if (Core.AOS)
                {
                    BaseRunicTool.ApplyAttributesTo(weapon, 2, 20, 30);
                }
                else
                {
                    weapon.DamageLevel = (WeaponDamageLevel)BaseCreature.RandomMinMaxScaled(2, 3);
                    weapon.AccuracyLevel = (WeaponAccuracyLevel)BaseCreature.RandomMinMaxScaled(2, 3);
                    weapon.DurabilityLevel = (WeaponDurabilityLevel)BaseCreature.RandomMinMaxScaled(2, 3);
                }

                bag.DropItem(weapon);
            }
            else
            {
                Item item;

                if (Core.AOS)
                {
                    item = Loot.RandomArmorOrShieldOrJewelry();

                    if (item is BaseArmor)
                        BaseRunicTool.ApplyAttributesTo((BaseArmor)item, 2, 20, 30);
                    else if (item is BaseJewel)
                        BaseRunicTool.ApplyAttributesTo((BaseJewel)item, 2, 20, 30);
                }
                else
                {
                    BaseArmor armor = Loot.RandomArmorOrShield();
                    item = armor;

                    armor.ProtectionLevel = (ArmorProtectionLevel)BaseCreature.RandomMinMaxScaled(2, 3);
                    armor.Durability = (ArmorDurabilityLevel)BaseCreature.RandomMinMaxScaled(2, 3);
                }

                bag.DropItem(item);
            }

            bag.DropItem(new Obsidian());

            if (to.PlaceInBackpack(bag))
            {
                return true;
            }
            else
            {
                bag.Delete();
                return false;
            }
        }
开发者ID:FreeReign,项目名称:forkuo,代码行数:60,代码来源:ElwoodMcCarrin.cs

示例6: OnTarget

		protected override void OnTarget( Mobile from, object targeted )
		{
			if ( m_Item.Deleted )
				return;

			if ( targeted is ICarvable )
			{
				((ICarvable)targeted).Carve( from, m_Item );
			}
			else
			{
				HarvestSystem system = Lumberjacking.System;
				HarvestDefinition def = Lumberjacking.System.Definition;

				int tileID;
				Map map;
				Point3D loc;

				if ( !system.GetHarvestDetails( from, m_Item, targeted, out tileID, out map, out loc ) )
				{
					from.SendLocalizedMessage( 500494 ); // You can't use a bladed item on that!
				}
				else if ( !def.Validate( tileID ) )
				{
					from.SendLocalizedMessage( 500494 ); // You can't use a bladed item on that!
				}
				else
				{
					HarvestBank bank = def.GetBank( map, loc.X, loc.Y );

					if ( bank == null )
						return;

					if ( bank.Current < 5 )
					{
						from.SendLocalizedMessage( 500493 ); // There's not enough wood here to harvest.
					}
					else
					{
						bank.Consume( 5, from );

						Item item = new Kindling();

						if ( from.PlaceInBackpack( item ) )
						{
							from.SendLocalizedMessage( 500491 ); // You put some kindling into your backpack.
							from.SendLocalizedMessage( 500492 ); // An axe would probably get you more wood.
						}
						else
						{
							from.SendLocalizedMessage( 500490 ); // You can't place any kindling into your backpack!

							item.Delete();
						}
					}
				}
			}
		}
开发者ID:Grimoric,项目名称:RunUO.T2A,代码行数:58,代码来源:BladedItemTarget.cs

示例7: GiveGift

		public virtual GiftResult GiveGift( Mobile mob, Item item )
		{
			if ( mob.PlaceInBackpack( item ) )
			{
				if ( !WeightOverloading.IsOverloaded( mob ) )
					return GiftResult.Backpack;
			}

			mob.BankBox.DropItem( item );
			return GiftResult.BankBox;
		}
开发者ID:Grimoric,项目名称:RunUO.T2A,代码行数:11,代码来源:GiftGiving.cs

示例8: OnDoubleClick

		public override void OnDoubleClick( Mobile from )
		{
            if (from.BeginAction(typeof(IAction)))
            {
                bool releaseLock = true;

                if (from.InRange(GetWorldLocation(), 2) && from.InLOS(this))
                {
			        if ( !VerifyMove( from ) )
				        return;

			        Point3D fireLocation = GetFireLocation( from );

			        if ( fireLocation == Point3D.Zero )
			        {
				        from.SendLocalizedMessage( 501695 ); // There is not a spot nearby to place your campfire.
                        return;
			        }

                    else
                    {
                        new InternalTimer(from).Start();
                        releaseLock = false;

                        if (!from.CheckSkill(SkillName.Camping, 0.0, 100.0))
                        {
                            from.SendLocalizedMessage(501696); // You fail to ignite the campfire.
                        }
                        else
                        {
                            Consume();

                            if (!Deleted && Parent == null)
                                from.PlaceInBackpack(this);

                            new Campfire().MoveToWorld(fireLocation, from.Map);
                        }
                    }
                }
                else
				    from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.

                if (releaseLock && from is PlayerMobile)
                {
                    ((PlayerMobile)from).EndPlayerAction();
                }
            }
            else
                from.SendAsciiMessage("You must wait to perform another action.");
		}
开发者ID:FreeReign,项目名称:imaginenation,代码行数:50,代码来源:Kindling.cs

示例9: OnDoubleClick

        } // prismatic crystal

        public override void OnDoubleClick(Mobile from)
        {
            if (from.Backpack == null)
                return;

            if (from.InRange(Location, 2))
            {
                if (from.Backpack.FindItemByType(typeof (PrismaticAmber), true) == null)
                {
                    if (from.PlaceInBackpack(new PrismaticAmber()))
                        Delete();
                    else
                        from.SendLocalizedMessage(1077971); // Make room in your backpack first!
                }
                else
                    from.SendLocalizedMessage(1075464); // You already have as many of those as you need.
            }
            else
                from.SendLocalizedMessage(1076766); // That is too far away.
        }
开发者ID:rokann,项目名称:JustUO,代码行数:22,代码来源:PrismaticCrystal.cs

示例10: OnDoubleClick

        public override void OnDoubleClick(Mobile from)
        {
            if (!this.IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
                return;
            }

            Item replacement = this.CreateReplacement();

            if (!from.PlaceInBackpack(replacement))
            {
                replacement.Delete();
                from.SendLocalizedMessage(500720); // You don't have enough room in your backpack!
            }
            else
            {
                this.Delete();
                from.Use(replacement);
            }
        }
开发者ID:FreeReign,项目名称:forkuo,代码行数:21,代码来源:AquariumFishingNet.cs

示例11: GiveReward

        public virtual void GiveReward(Mobile to)
        {
            if (!this.m_RewardAvailable)
                return;

            int max = (int)(((double)this.m_LiveCreatures / 30) * m_Decorations.Length);

            int random = (max <= 0) ? 0 : Utility.Random(max);

            if (random >= m_Decorations.Length)
                random = m_Decorations.Length - 1;

            Item item;

            try
            {
                item = Activator.CreateInstance(m_Decorations[random]) as Item;
            }
            catch
            {
                return;
            }

            if (item == null)
                return;

            if (!to.PlaceInBackpack(item))
            {
                item.Delete();
                to.SendLocalizedMessage(1074361); // The reward could not be given.  Make sure you have room in your pack.
                return;
            }

            to.SendLocalizedMessage(1074360, String.Format("#{0}", item.LabelNumber)); // You receive a reward: ~1_REWARD~
            to.PlaySound(0x5A3);

            this.m_RewardAvailable = false;

            this.InvalidateProperties();
        }
开发者ID:m309,项目名称:ForkUO,代码行数:40,代码来源:Aquarium.cs

示例12: OnComponentUsed

        public override void OnComponentUsed(AddonComponent c, Mobile from)
        {
            BaseHouse house = BaseHouse.FindHouseAt(this);

            /*
            * Unique problems have unique solutions.  OSI does not have a problem with 1000s of mining carts
            * due to the fact that they have only a miniscule fraction of the number of 10 year vets that a
            * typical RunUO shard will have (RunUO's scaled down account aging system makes this a unique problem),
            * and the "freeness" of free accounts. We also dont have mitigating factors like inactive (unpaid)
            * accounts not gaining veteran time.
            *
            * The lack of high end vets and vet rewards on OSI has made testing the *exact* ranging/stacking
            * behavior of these things all but impossible, so either way its just an estimation.
            *
            * If youd like your shard's carts/stumps to work the way they did before, simply replace the check
            * below with this line of code:
            *
            * if (!from.InRange(GetWorldLocation(), 2)
            *
            * However, I am sure these checks are more accurate to OSI than the former version was.
            *
            */

            if (!from.InRange(this.GetWorldLocation(), 2) || !from.InLOS(this) || !((from.Z - this.Z) > -3 && (from.Z - this.Z) < 3))
            {
                from.LocalOverheadMessage(Network.MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
            }
            else if (house != null && house.HasSecureAccess(from, SecureLevel.Friends))
            {
                if (this.m_Logs > 0)
                {
                    Item logs = null;

                    switch ( Utility.Random(7) )
                    {
                        case 0:
                            logs = new Log();
                            break;
                        case 1:
                            logs = new AshLog();
                            break;
                        case 2:
                            logs = new OakLog();
                            break;
                        case 3:
                            logs = new YewLog();
                            break;
                        case 4:
                            logs = new HeartwoodLog();
                            break;
                        case 5:
                            logs = new BloodwoodLog();
                            break;
                        case 6:
                            logs = new FrostwoodLog();
                            break;
                    }

                    int amount = Math.Min(10, this.m_Logs);
                    logs.Amount = amount;

                    if (!from.PlaceInBackpack(logs))
                    {
                        logs.Delete();
                        from.SendLocalizedMessage(1078837); // Your backpack is full! Please make room and try again.
                    }
                    else
                    {
                        this.m_Logs -= amount;
                        this.PublicOverheadMessage(MessageType.Regular, 0, 1094719, m_Logs.ToString()); // Logs: ~1_COUNT~
                    }
                }
                else
                    from.SendLocalizedMessage(1094720); // There are no more logs available.
            }
            else
                from.SendLocalizedMessage(1061637); // You are not allowed to access this.
        }
开发者ID:FreeReign,项目名称:forkuo,代码行数:78,代码来源:TreeStump.cs

示例13: MessageLocalized

        /*public override void OnSingleClick( Mobile from )
        {
            int number = (Amount == 1) ? 1049124 : 1049123;

            from.Send( new MessageLocalized( Serial, ItemID, MessageType.Regular, 0x3B2, 3, number, "", Amount.ToString() ) );
        }*/
        public bool Scissor( Mobile from, Scissors scissors )
        {
            if ( Deleted || !from.CanSee( this ) ) return false;

            Consume();
            Item bandage = new Bandage();
            bandage.Hue = Hue;
            if (!from.PlaceInBackpack(bandage))
                bandage.MoveToWorld(from.Location, from.Map);

            //base.ScissorHelper( from, new Bandage(), 1 );

            return true;
        }
开发者ID:Godkong,项目名称:RunUO,代码行数:20,代码来源:Cloth.cs

示例14: CompleteCraft


//.........这里部分代码省略.........
						from.SendGump(new CraftGump(from, craftSystem, tool, message));
					}
					else if (message is int && (int)message > 0)
					{
						from.SendLocalizedMessage((int)message);
					}
					else if (message is string)
					{
						from.SendMessage((string)message);
					}

                    AutoCraftTimer.EndTimer(from);

					return;
				}

				tool.UsesRemaining--;

				if (craftSystem is DefBlacksmithy)
				{
					AncientSmithyHammer hammer = from.FindItemOnLayer(Layer.OneHanded) as AncientSmithyHammer;
					if (hammer != null && hammer != tool)
					{
						#region Mondain's Legacy
						if (hammer is HammerOfHephaestus)
						{
							if (hammer.UsesRemaining > 0)
							{
								hammer.UsesRemaining--;
							}

							if (hammer.UsesRemaining < 1)
							{
								from.PlaceInBackpack(hammer);
							}
						}
						else
						{
							hammer.UsesRemaining--;

							if (hammer.UsesRemaining < 1)
							{
								hammer.Delete();
							}
						}
						#endregion
					}
				}

				#region Mondain's Legacy
				if (tool is HammerOfHephaestus)
				{
					if (tool.UsesRemaining < 1)
					{
						tool.UsesRemaining = 0;
					}
				}
				else
				{
					if (tool.UsesRemaining < 1)
					{
						toolBroken = true;
					}

					if (toolBroken)
					{
开发者ID:Serado,项目名称:ServUO,代码行数:67,代码来源:CraftItem.cs

示例15: UndressItem

        public void UndressItem( Mobile m, Layer layer )
        {
            Item item = m.FindItemOnLayer( layer );

            if ( item != null && item.Movable )
                m.PlaceInBackpack( item );
        }
开发者ID:Leodinas,项目名称:uolite,代码行数:7,代码来源:Satyr.cs


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