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


C# Mobile.PlaceInBackpack方法代码示例

本文整理汇总了C#中Server.Mobile.PlaceInBackpack方法的典型用法代码示例。如果您正苦于以下问题:C# Mobile.PlaceInBackpack方法的具体用法?C# Mobile.PlaceInBackpack怎么用?C# Mobile.PlaceInBackpack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Server.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:jackuoll,项目名称:Pre-AOS-RunUO,代码行数:50,代码来源:AquariumFishingNet.cs

示例2: OnComponentUsed

		public override void OnComponentUsed( AddonComponent c, Mobile from )
		{
			if ( from.InRange( c.Location, 2 ) )
			{
				if ( m_Fruits > 0 )
				{
					Item fruit = 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 ( --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:greeduomacro,项目名称:UO-Forever,代码行数:30,代码来源:FruitTrees.cs

示例3: 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();

                BaseRunicTool.ApplyAttributesTo( weapon, 2, 20, 30 );

                bag.DropItem( weapon );
            }
            else
            {
                Item 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 );

                bag.DropItem( item );
            }

            bag.DropItem( new Obsidian() );

            return to.PlaceInBackpack( bag );
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:30,代码来源:ElwoodMcCarrin.cs

示例4: OnAccepted

        public static void OnAccepted( Mobile from )
        {
            if ( from.Backpack == null )
                return;

            PlainGreyCloak cloak = from.FindItemOnLayer( Layer.Cloak ) as PlainGreyCloak;

            if ( cloak == null )
            {
                from.DropHolding();
                cloak = from.Backpack.FindItemByType<PlainGreyCloak>();
            }

            if ( cloak == null )
                return;

            cloak.Delete();
            from.PlaceInBackpack( new ShieldOfRecognition() );

            /* *smiles* Surely thy deeds will be recognized by those who see thee
             * wearing this shield! It shall serve as a reminder of the exalted
             * path that thou hast journeyed upon, and I wish to thank thee on
             * behalf of all whom thine efforts shall benefit. Ah, let us not
             * forget that old cloak I gavest thee - I shall take it back now and
             * give thee thine reward. */
            from.SendGump( new GenericQuestGump( 1075783 ) );

            if ( from is PlayerMobile )
                ( (PlayerMobile) from ).HumilityQuestStatus = HumilityQuestStatus.RewardAccepted;
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:30,代码来源:HumilityProofGump.cs

示例5: OnDoubleClick

        public override void OnDoubleClick( Mobile from )
        {
            if ( !from.InRange( Location, 2 ) )
            {
                // I can't reach that.
                from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 );
            }
            else if ( from is PlayerMobile && ( (PlayerMobile) from ).SacredQuest )
            {
                // You cannot think of any reason to want to do this.
                from.SendLocalizedMessage( 1080538 );
            }
            else if ( from.Backpack != null )
            {
                from.DropHolding();

                Item key = from.Backpack.FindItemByType( KeyType );

                if ( key != null )
                {
                    // You are already carrying a copy of this key fragment.
                    from.SendLocalizedMessage( 1111653 );
                }
                else
                {
                    from.PlaceInBackpack( (Item) Activator.CreateInstance( KeyType ) );

                    // You reach for the key and receive a glowing copy that you place in your bag.
                    from.SendLocalizedMessage( 1111652 );
                }
            }
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:32,代码来源:KeyFragmentSpawner.cs

示例6: OnDoubleClick

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

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

            Point3D fireLocation = GetFireLocation( from );

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

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

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

示例7: GiveReward

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

            bag.DropItem( new Gold( Utility.RandomMinMax( 1500, 2000 ) ) ); //Edit by Blady. Default was (500, 1000)

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

                if ( Core.AOS )
                {
                    BaseRunicTool.ApplyAttributesTo( weapon, (Utility.RandomMinMax(2,5)), 20, 80 ); //By Blady. Default: (3, 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, (Utility.RandomMinMax(2,5)), 20, 80 ); //By Blady. Default: (3, 20, 30)
                    else if ( item is BaseJewel )
                        BaseRunicTool.ApplyAttributesTo( (BaseJewel)item, (Utility.RandomMinMax(2,5)), 20, 80 ); //By Blady. Default: (3, 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:kamronbatman,项目名称:Defiance-AOS-Pre-2012,代码行数:60,代码来源:ElwoodMcCarrin.cs

示例8: 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

示例9: 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.GetCurrentFor( from ) < 5 )
                    {
                        from.SendLocalizedMessage( 500493 ); // There's not enough wood here to harvest.
                    }
                    else
                    {
                        bank.Consume( def, 5 );

                        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:FreeReign,项目名称:Rebirth-Repack,代码行数:58,代码来源:BladedItemTarget.cs

示例10: PackItem

        public static void PackItem( Mobile m, Item item )
        {
            if ( item is BaseArmor )
                ((BaseArmor)item).Quality = ArmorQuality.Exceptional;
            else if ( item is BaseWeapon )
                ((BaseWeapon)item).Quality = WeaponQuality.Exceptional;

            if ( !m.PlaceInBackpack( item ) )
                item.Delete();
        }
开发者ID:cynricthehun,项目名称:UOLegends,代码行数:10,代码来源:AutoSupply.cs

示例11: RaiseLevel

		public void RaiseLevel(Mobile from)
		{
			if (from == null || from.Backpack == null)
				return;

			if (++m_Level == 5)
				from.PlaceInBackpack(new MysticKeys());

			PartSetup(m_Level);
		}
开发者ID:kamronbatman,项目名称:DefianceUO-Pre1.10,代码行数:10,代码来源:MysticKeyParts.cs

示例12: 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:ITLongwell,项目名称:aedilis2server,代码行数:11,代码来源:GiftGiving.cs

示例13: GiveItem

        public static void GiveItem( Mobile m, Item item )
        {
            if ( item is BaseArmor )
                ((BaseArmor)item).Quality = ArmorQuality.Exceptional;
            else if ( item is BaseWeapon )
                ((BaseWeapon)item).Quality = WeaponQuality.Exceptional;

            Item move = m.FindItemOnLayer( item.Layer );
            if ( move != null )
            {
                if ( !m.PlaceInBackpack( move ) )
                {
                    item.Delete();
                    return;
                }
            }

            if ( !m.EquipItem( item ) && !m.PlaceInBackpack( item ) )
                item.Delete();
        }
开发者ID:cynricthehun,项目名称:UOLegends,代码行数:20,代码来源:AutoSupply.cs

示例14: OnDoubleClick

		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:romeov007,项目名称:imagine-uo,代码行数:20,代码来源:PrismaticCrystal.cs

示例15: OnComponentUsed

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

			if ( house != null && house.HasSecureAccess( from, SecureLevel.Friends ) )
			{
				if ( 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, 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
					{
						m_Logs -= amount;
						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:PepeBiondi,项目名称:runsa,代码行数:41,代码来源:TreeStump.cs


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