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


C# Backpack.MoveToWorld方法代码示例

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


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

示例1: PackToBank

        /// <summary>
        /// Moves all of the given Mobile's items to their bank.
        /// </summary>
        public virtual void PackToBank( Mobile m )
        {
            if( m == null || !m.Player )
                return;

            BankBox bank = m.FindBankNoCreate();
            Backpack pack = new Backpack();
            pack.Hue = 1157;

            List<Item> items = new List<Item>();

            for( int i = 0; i < m.Items.Count; i++ )
            {
                if( m.Items[i] is BankBox || (m.Backpack != null && m.Items[i].Serial == m.Backpack.Serial) )
                    continue;

                items.Add(m.Items[i]);
            }

            if( m.Backpack != null )
            {
                for( int i = 0; i < m.Backpack.Items.Count; i++ )
                    items.Add(m.Backpack.Items[i]);
            }

            items.ForEach(
                delegate( Item i )
                {
                    pack.AddItem(i);
                });
            items.Clear();

            if( bank == null )
                pack.MoveToWorld(m.Location, m.Map);
            else
                bank.AddItem(pack);
        }
开发者ID:greeduomacro,项目名称:hubroot,代码行数:40,代码来源:BaseKillCommand.cs

示例2: Destroy

		public virtual void Destroy( bool toBackpack )
		{
			Return();

			if ( !BaseHouse.NewVendorSystem )
				FixDresswear();

			/* Possible cases regarding item return:
			 * 
			 * 1. No item must be returned
			 *       -> do nothing.
			 * 2. ( toBackpack is false OR the vendor is in the internal map ) AND the vendor is associated with a AOS house
			 *       -> put the items into the moving crate or a vendor inventory,
			 *          depending on whether the vendor owner is also the house owner.
			 * 3. ( toBackpack is true OR the vendor isn't associated with any AOS house ) AND the vendor isn't in the internal map
			 *       -> put the items into a backpack.
			 * 4. The vendor isn't associated with any house AND it's in the internal map
			 *       -> do nothing (we can't do anything).
			 */

			ArrayList list = GetItems();

			if ( list.Count > 0 || HoldGold > 0 ) // No case 1
			{
				if ( ( !toBackpack || this.Map == Map.Internal ) && House != null && House.IsAosRules ) // Case 2
				{
					if ( House.IsOwner( Owner ) ) // Move to moving crate
					{
						if ( House.MovingCrate == null )
							House.MovingCrate = new MovingCrate( House );

						if ( HoldGold > 0 )
							Banker.Deposit( House.MovingCrate, HoldGold );

						foreach ( Item item in list )
						{
							House.MovingCrate.DropItem( item );
						}
					}
					else // Move to vendor inventory
					{
						VendorInventory inventory = new VendorInventory( House, Owner, Name, ShopName );
						inventory.Gold = HoldGold;

						foreach ( Item item in list )
						{
							inventory.AddItem( item );
						}

						House.VendorInventories.Add( inventory );
					}
				}
				else if ( ( toBackpack || House == null || !House.IsAosRules ) && this.Map != Map.Internal ) // Case 3 - Move to backpack
				{
					Container backpack = new Backpack();

					if ( HoldGold > 0 )
						Banker.Deposit( backpack, HoldGold );

					foreach ( Item item in list )
					{
						backpack.DropItem( item );
					}

					backpack.MoveToWorld( this.Location, this.Map );
				}
			}

			Delete();
		}
开发者ID:greeduomacro,项目名称:unknown-shard-1,代码行数:70,代码来源:PlayerVendor.cs

示例3: Destroy

		public virtual void Destroy( bool toBackpack )
		{
			FixDresswear();

			List<Item> list = GetItems();

			if ( list.Count > 0 || HoldGold > 0 ) // No case 1
			{
				if ( ( toBackpack || House == null ) && this.Map != Map.Internal ) // Case 3 - Move to backpack
				{
					Container backpack = new Backpack();

					if ( HoldGold > 0 )
						Banker.Deposit( backpack, HoldGold );

					foreach ( Item item in list )
					{
						backpack.DropItem( item );
					}

					backpack.MoveToWorld( this.Location, this.Map );
				}
			}

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

示例4: OnDoubleClick

        public override void OnDoubleClick(Mobile from)
        {
            if (from.AccessLevel < AccessLevel.GameMaster)
            {
                from.SendMessage("You have initiated server shutdown.");
                from.SendMessage("The server is going down shortly.");
                this.Delete();
                return;
            }
            
            if (eventMobiles.Count != 0)
            {
                foreach (Item i in eventItems)
                {
                    i.Delete();
                }

                eventItems.Clear();

                foreach (Mobile m in eventMobiles)
                {
                    m.Delete();
                }

                eventMobiles.Clear();

                foreach (NetState state in NetState.Instances)
                    if (state.Mobile != null && state.Mobile.AccessLevel > AccessLevel.Player)
                        state.Mobile.SendMessage(66, "All NPCs and Items from Lord British's Books event have been removed.");
            }
            else
            {
                Map map = Map.Felucca;

                /////////////
                // MOBILES //
                /////////////

                LBBbaker baker = new LBBbaker();
                baker.Home = new Point3D(1451, 1614, 20);
                baker.MoveToWorld(baker.Home, map);
                eventMobiles.Add(baker);

                LBBbaldur baldur = new LBBbaldur();
                baldur.Home = new Point3D(5220, 730, -20);
                baldur.MoveToWorld(baldur.Home, map);
                eventMobiles.Add(baldur);

                LBBblacksmith blacksmith = new LBBblacksmith();
                blacksmith.Home = new Point3D(1420, 1547, 30);
                blacksmith.MoveToWorld(blacksmith.Home, map);
                eventMobiles.Add(blacksmith);

                LBBcarpenter carpenter = new LBBcarpenter();
                carpenter.Home = new Point3D(1432, 1595, 20);
                carpenter.MoveToWorld(carpenter.Home, map);
                eventMobiles.Add(carpenter);

                LBBcook cook = new LBBcook();
                cook.Home = new Point3D(1318, 1604, 50);
                cook.MoveToWorld(cook.Home, map);
                eventMobiles.Add(cook);

                LBBdrunkJeffrey drunkJeffrey = new LBBdrunkJeffrey();
                drunkJeffrey.Home = new Point3D(1412, 1655, 10);
                drunkJeffrey.MoveToWorld(drunkJeffrey.Home, map);
                eventMobiles.Add(drunkJeffrey);

                LBBeasternMageryShopVendor easternMageryShopVendor = new LBBeasternMageryShopVendor();
                easternMageryShopVendor.Home = new Point3D(1595, 1654, 10);
                easternMageryShopVendor.MoveToWorld(easternMageryShopVendor.Home, map);
                eventMobiles.Add(easternMageryShopVendor);

                LBBfisherman fisherman = new LBBfisherman();
                fisherman.Home = new Point3D(1489, 1749, -2);
                fisherman.MoveToWorld(fisherman.Home, map);
                eventMobiles.Add(fisherman);

                LBBleonard leonard = new LBBleonard();
                leonard.Home = new Point3D(1675, 1593, 7);
                leonard.MoveToWorld(leonard.Home, map);
                eventMobiles.Add(leonard);

                LBBlibrarian librarian = new LBBlibrarian();
                librarian.Home = new Point3D(1410, 1604, 30);
                librarian.MoveToWorld(librarian.Home, map);
                eventMobiles.Add(librarian);

                LBBlordBritish lordBritish = new LBBlordBritish();
                lordBritish.Home = new Point3D(1323, 1624, 55);
                lordBritish.MoveToWorld(lordBritish.Home, map);
                eventMobiles.Add(lordBritish);

                LBBmaid1 maid1 = new LBBmaid1();
                maid1.Home = new Point3D(1352, 1660, 72);
                maid1.MoveToWorld(maid1.Home, map);
                eventMobiles.Add(maid1);

                LBBmaid2 maid2 = new LBBmaid2();
                maid2.Home = new Point3D(1351, 1604, 72);
//.........这里部分代码省略.........
开发者ID:greeduomacro,项目名称:last-wish,代码行数:101,代码来源:LBBcontroller.cs

示例5: OnDeath

        public override void OnDeath( Container c )
        {
            if ( !Summoned && !m_NoKillAwards )
            {
                // note creatures with neg karma GIVE us karma, so these numbers are negated
                ArrayList list = GetLootingRights( this.DamageEntries );
                for ( int i = 0; i < list.Count; ++i )
                {
                    DamageStore ds = (DamageStore)list[i];
                    if ( !ds.m_HasRight )
                        continue;
                    Mobile mob = ds.m_Mobile;

                    if ( mob is BaseCreature )
                    {
                        BaseCreature bc = (BaseCreature)mob;
                        if ( bc.Controled && bc.ControlMaster != null )
                            mob = bc.ControlMaster;
                        else if ( bc.Summoned && bc.SummonMaster != null )
                            mob = bc.SummonMaster;
                    }

                    int noto = Notoriety.Compute( mob, this );
                    if ( noto == Notoriety.Innocent )
                        Titles.AlterNotoriety( mob, -8 );
                    else if ( noto == Notoriety.Murderer )
                        Titles.AlterNotoriety( mob, 1 );
                    // cap the gain/loss at the npc's karma?? (so killing a 0 karma npc only takes you to 0)
                }
            }

            base.OnDeath( c );
            if ( DeleteCorpseOnDeath )
            {
                c.Delete();
            }
            else if ( this is WaterElemental || this is FireElemental || this is AirElemental || this is PoisonElemental || this is BloodElemental )
            {
                Backpack pack = new Backpack();
                this.Corpse = pack;
                pack.MoveToWorld( c.Location, c.Map );
                while ( c.Items.Count > 0 )
                    pack.DropItem( (Item)c.Items[0] );
                c.Delete();
            }
        }
开发者ID:FreeReign,项目名称:Rebirth-Repack,代码行数:46,代码来源:BaseCreature.cs

示例6: Destroy

		public virtual void Destroy(bool toBackpack)
		{
			Item shoes = this.FindItemOnLayer(Layer.Shoes);

			if (shoes is Sandals)
				shoes.Hue = 0;

			ArrayList list = GetItems();

            // don't drop stuff owned by an administrator
            if (StaffOwned == false)
			    if (list.Count > 0 || HoldGold > 0) // if you have items of gold
			    {

				    if ((toBackpack || House == null) && this.Map != Map.Internal) // Move to backpack
				    {
					    Container backpack = new Backpack();

					    foreach (Item item in list)
					    {
						    if (item.Movable != false) // only drop items which are moveable
							    backpack.DropItem(item);
					    }

					    backpack.MoveToWorld(this.Location, this.Map);
				    }
			    }

			Delete();
		}
开发者ID:zerodowned,项目名称:angelisland,代码行数:30,代码来源:PlayerVendor.cs

示例7: LBBstart_OnCommand

        public static void LBBstart_OnCommand(CommandEventArgs e)
        {
            Map map = Map.Felucca;

            /////////////
            // MOBILES //
            /////////////
            
            LBBbaker baker = new LBBbaker();
            baker.Home = new Point3D(1451, 1614, 20);
            baker.MoveToWorld(baker.Home, map);

            LBBbaldur baldur = new LBBbaldur();
            baldur.Home = new Point3D(5220, 730, -20);
            baldur.MoveToWorld(baldur.Home, map);

            LBBblacksmith blacksmith = new LBBblacksmith();
            blacksmith.Home = new Point3D(1420, 1547, 30);
            blacksmith.MoveToWorld(blacksmith.Home, map);

            LBBcarpenter carpenter = new LBBcarpenter();
            carpenter.Home = new Point3D(1432, 1595, 20);
            carpenter.MoveToWorld(carpenter.Home, map);

            LBBcook cook = new LBBcook();
            cook.Home = new Point3D(1318, 1604, 50);
            cook.MoveToWorld(cook.Home, map);

            LBBdrunkJeffrey drunkJeffrey = new LBBdrunkJeffrey();
            drunkJeffrey.Home = new Point3D(1412, 1655, 10);
            drunkJeffrey.MoveToWorld(drunkJeffrey.Home, map);

            LBBeasternMageryShopVendor easternMageryShopVendor = new LBBeasternMageryShopVendor();
            easternMageryShopVendor.Home = new Point3D(1595, 1654, 10);
            easternMageryShopVendor.MoveToWorld(easternMageryShopVendor.Home, map);

            LBBfisherman fisherman = new LBBfisherman();
            fisherman.Home = new Point3D(1489, 1749, -2);
            fisherman.MoveToWorld(fisherman.Home, map);

            LBBleonard leonard = new LBBleonard();
            leonard.Home = new Point3D(1675, 1593, 7);
            leonard.MoveToWorld(leonard.Home, map);

            LBBlibrarian librarian = new LBBlibrarian();
            librarian.Home = new Point3D(1410, 1604, 30);
            librarian.MoveToWorld(librarian.Home, map);

            LBBlordBritish lordBritish = new LBBlordBritish();
            lordBritish.Home = new Point3D(1323, 1624, 55);
            lordBritish.MoveToWorld(lordBritish.Home, map);

            LBBmaid1 maid1 = new LBBmaid1();
            maid1.Home = new Point3D(1352, 1660, 72);
            maid1.MoveToWorld(maid1.Home, map);

            LBBmaid2 maid2 = new LBBmaid2();
            maid2.Home = new Point3D(1351, 1604, 72);
            maid2.MoveToWorld(maid2.Home, map);

            LBBmaid3 maid3 = new LBBmaid3();
            maid3.Home = new Point3D(1329, 1660, 72);
            maid3.MoveToWorld(maid3.Home, map);

            LBBmaid4 maid4 = new LBBmaid4();
            maid4.Home = new Point3D(1345, 1643, 50);
            maid4.MoveToWorld(maid4.Home, map);

            LBBmaid5 maid5 = new LBBmaid5();
            maid5.Home = new Point3D(1353, 1588, 50);
            maid5.MoveToWorld(maid5.Home, map);

            LBBnorthernMageryShopVendor northernMageryShopVendor = new LBBnorthernMageryShopVendor();
            northernMageryShopVendor.Home = new Point3D(1492, 1547, 35);
            northernMageryShopVendor.MoveToWorld(northernMageryShopVendor.Home, map);

            LBBoriandur oriandur = new LBBoriandur();
            oriandur.Home = new Point3D(5323, 749, -20);
            oriandur.MoveToWorld(oriandur.Home, map);

            LBBpriest priest = new LBBpriest();
            priest.Home = new Point3D(1452, 1589, 20);
            priest.MoveToWorld(priest.Home, map);

            LBBguard guard1 = new LBBguard();
            guard1.Home = new Point3D(1323, 1626, 55);
            guard1.MoveToWorld(guard1.Home, map);
            guard1.Direction = guard1.GetDirectionTo(new Point3D(1330, 1624, 50));

            LBBguard guard2 = new LBBguard();
            guard2.Home = new Point3D(1323, 1622, 55);
            guard2.MoveToWorld(guard2.Home, map);
            guard2.Direction = guard2.GetDirectionTo(new Point3D(1330, 1624, 50));

            LBBguard guard3 = new LBBguard();
            guard3.Home = new Point3D(1328, 1627, 50);
            guard3.MoveToWorld(guard3.Home, map);
            guard3.Direction = guard3.GetDirectionTo(new Point3D(1330, 1624, 50));

            LBBguard guard4 = new LBBguard();
//.........这里部分代码省略.........
开发者ID:greeduomacro,项目名称:last-wish,代码行数:101,代码来源:LBBcommands.cs


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