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


C# Bag.Delete方法代码示例

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


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

示例1: ReadyPlayer


//.........这里部分代码省略.........
                                items.Add(armor);
                            else if (armor.ProtectionLevel != ArmorProtectionLevel.Regular)
                                items.Add(armor);
                        }
                    }
                }

                if (m.Backpack != null)
                {
                    foreach (Item item in m.Backpack.Items)
                    {
                        if (item != null)
                        {
                            if (item is BaseWeapon && !MagicWeapons)
                            {
                                BaseWeapon weapon = (BaseWeapon) item;

                                if (weapon.AccuracyLevel != WeaponAccuracyLevel.Regular)
                                    items.Add(weapon);
                                else if (weapon.DamageLevel != WeaponDamageLevel.Regular)
                                    items.Add(weapon);
                                else if (weapon.DurabilityLevel != WeaponDurabilityLevel.Regular)
                                    items.Add(weapon);
                            }
                            else if (item is BaseArmor && !MagicArmor)
                            {
                                BaseArmor armor = (BaseArmor) item;

                                if (armor.Durability != ArmorDurabilityLevel.Regular)
                                    items.Add(armor);
                                else if (armor.ProtectionLevel != ArmorProtectionLevel.Regular)
                                    items.Add(armor);
                            }
                            else if (item is BasePotion && !Potions)
                                items.Add(item);
                            else if (item is EtherealMount && !Mounts)
                                items.Add(item);
                            else if (item is Bandage && !Bandages)
                                items.Add(item);
                        }
                    }
                }

                if (!Mounts)
                {
                    if (m.Mount != null)
                    {
                        IMount mount = m.Mount;
                        mount.Rider = null;
                        if (mount is BaseMount)
                        {
                            if (mount is BaseCreature)
                            {
                                BaseCreature bc = (BaseCreature)mount;
                                bc.ControlTarget = null;
                                bc.ControlOrder = OrderType.Stay;
                                bc.Internalize();

                                bc.SetControlMaster(null);
                                bc.SummonMaster = null;

                                bc.IsStabled = true;
                                m.Stabled.Add(bc);
                                MountCollection.Add(m.Serial, bc);
                                m.SendMessage(38, "Your mount has been moved to the your stables");
                            }
                        }
                    }
                }

                if (items.Count > 0)
                    m.SendMessage(38, "You had items that did not meet the requirements for the deathmatch and were thus moved to your bank.");

                foreach (Item item in items)
                    bag.AddItem(item);

                if (bag.Items.Count > 0)
                    bank.DropItem(bag);
                else
                    bag.Delete();

                #endregion
            }
            
            if (m_EventSupplier != null)
                m_EventSupplier.OnMoveOver(m);

            Contestants.Add(m);

            SpawnMobile(m);

            if ( m_GiveHorses )
                DMHorse.TryGiveHorse(m);

            if (m.NetState != null)
            {
                m.SendMessage(38, "You have joined a deathmatch");
                m.SendMessage(38, "You can check the score with \".DMScore\"");
            }
        }
开发者ID:FreeReign,项目名称:imaginenation,代码行数:101,代码来源:DMStone.cs

示例2: 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:greeduomacro,项目名称:RuneUO,代码行数:60,代码来源:ElwoodMcCarrin.cs

示例3: PackUpItems

        private void PackUpItems()
        {
            if (c_House == null)
            {
                return;
            }

            Container bag = new Bag();
            bag.Name = "Town House Belongings";

            foreach (Item item in new ArrayList(c_House.LockDowns))
            {
                item.IsLockedDown = false;
                item.Movable = true;
                c_House.LockDowns.Remove(item);
                bag.DropItem(item);
            }

            foreach (SecureInfo info in new ArrayList(c_House.Secures))
            {
                info.Item.IsLockedDown = false;
                info.Item.IsSecure = false;
                info.Item.Movable = true;
                info.Item.SetLastMoved();
                c_House.Secures.Remove(info);
                bag.DropItem(info.Item);
            }

            foreach (
                Item item in
                    c_Blocks.SelectMany(
                        rect =>
                            Map.GetItemsInBounds(rect)
                                .Where(
                                    item =>
                                        !(item is HouseSign) && !(item is BaseDoor) && !(item is BaseMulti) &&
                                        !(item is BaseAddon) && !(item is AddonComponent) && item.Visible &&
                                        !item.IsLockedDown && !item.IsSecure && item.Movable && item.Map == c_House.Map &&
                                        c_House.Region.Contains(item.Location))))
            {
                bag.DropItem(item);
            }

            if (bag.Items.Count == 0)
            {
                bag.Delete();
                return;
            }

            c_House.Owner.BankBox.DropItem(bag);
        }
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:51,代码来源:TownHouseSign.cs

示例4: OnResponse

		public override void OnResponse( NetState state, RelayInfo info )
		{
			PlayerMobile pm = m_Mobile as PlayerMobile;

			if ( info.ButtonID == 1 && !m_House.Deleted && pm != null )
			{
				if ( m_House.IsOwner( m_Mobile ) )
				{
					if ( m_House.FindGuildstone() != null )
					{
						m_Mobile.SendLocalizedMessage( 501389 ); // You cannot redeed a house with a guildstone inside.
						return;
					}
					/*else if ( m_House.PlayerVendors.Count > 0 )
					{
						m_Mobile.SendLocalizedMessage( 503236 ); // You need to collect your vendor's belongings before moving.
						return;
					}*/
					else if ( m_House.HasRentedVendors && m_House.VendorInventories.Count > 0 )
					{
						m_Mobile.SendLocalizedMessage( 1062679 ); // You cannot do that while you still have contract vendors or unclaimed contract vendor inventory in your house.
						return;
					}
					else if ( m_House.HasRentedVendors )
					{
						m_Mobile.SendLocalizedMessage( 1062680 ); // You cannot do that that while you still have contract vendors in your house.
						return;
					}
					else if ( m_House.VendorInventories.Count > 0 )
					{
						m_Mobile.SendLocalizedMessage( 1062681 ); // You cannot do that that while you still have unclaimed contract vendor inventory in your house.
						return;
					}

					Item toGive = null;

					if ( m_House.IsAosRules )
					{
                        if (m_House.Price > 0)
                        {
                            Bag bag = new Bag();
                            bag.DropItem(new BankCheck(m_House.Price));
							Item deed = m_House.GetDeed();
							if (deed != null) // deed == null <=> No deed exists for the house type
							{
								bag.DropItem(deed);
								toGive = bag as Item;
							}
							else
								bag.Delete();
                        }
                        else
                            toGive = m_House.GetDeed();
					}
					else
					{
						toGive = m_House.GetDeed();

						if ( toGive == null && m_House.Price > 0 )
							toGive = new BankCheck( m_House.Price );
					}

					if ( toGive != null )
					{
						BankBox box = m_Mobile.BankBox;

						if ( box != null && box.TryDropItem( m_Mobile, toGive, false ) )
						{
                            if (toGive is BankCheck)
                                m_Mobile.SendLocalizedMessage(1060397, ((BankCheck)toGive).Worth.ToString()); // ~1_AMOUNT~ gold has been deposited into your bank box.
                            else if (toGive is HouseDeed)
                                m_Mobile.SendMessage("The house deed has been placed in your bank box.");
                            else if (toGive is Container)
                                m_Mobile.SendMessage("The house deed and a check containing the house value have been placed in your bank box.");

							if ( pm.HasDonated )
							{
								m_House.KillVendors( true );
								HouseDecayingCrate crate = m_House.MoveAllDecayingToCrate();
								if ( crate.Items.Count == 0 )
									crate.Delete();
								else
									m_Mobile.BankBox.DropItem( crate );
							}

							m_Mobile.CloseGump( typeof( ConfirmCommitGump ) );

							m_House.RemoveKeys( m_Mobile );
							m_House.Delete();
						}
						else
						{
							toGive.Delete();
							m_Mobile.SendLocalizedMessage( 500390 ); // Your bank box is full.
						}
					}
					else
						m_Mobile.SendMessage( "Unable to refund house. Please contact a Developer." );
				}
				else
//.........这里部分代码省略.........
开发者ID:kamronbatman,项目名称:DefianceUO-Pre1.10,代码行数:101,代码来源:HouseDemolishGump.cs

示例5: PackUpItems

		protected void PackUpItems()
		{
			if ( c_House == null )
				return;

			Container bag = new Bag();
			bag.Name = "Town House Belongings";

			foreach( Item item in new ArrayList( c_House.LockDowns ) )
			{
				item.IsLockedDown = false;
				item.Movable = true;
				c_House.LockDowns.Remove( item );
				bag.DropItem( item );
			}

			foreach( SecureInfo info in new ArrayList( c_House.Secures ) )
			{
				info.Item.IsLockedDown = false;
				info.Item.IsSecure = false;
				info.Item.Movable = true;
				info.Item.SetLastMoved();
				c_House.Secures.Remove( info );
				bag.DropItem( info.Item );
			}

			foreach( Item item in World.Items.Values )
			{
				if ( item is HouseSign
				|| item is BaseDoor
				|| item is BaseMulti
				|| item is BaseAddon
				|| item is AddonComponent
				|| !item.Visible
				|| item.IsLockedDown
				|| item.IsSecure
				|| !item.Movable
				|| item.Map != c_House.Map
				|| !c_House.Region.Contains( item.Location ) )
						continue;

				bag.DropItem( item );
			}

			if ( bag.Items.Count == 0 )
			{
				bag.Delete();
				return;
			}

			c_House.Owner.BankBox.DropItem( bag );
		}
开发者ID:greeduomacro,项目名称:annox,代码行数:52,代码来源:TownHouseSign.cs

示例6: AddReward

        private bool AddReward(PlayerMobile player)
        {
            Bag rewardBag = new Bag();

            rewardBag.Hue = Utility.RandomDyedHue();
            LootPackEntry.AddRandomLoot(rewardBag, 5, 50, 5, 5, 50, 100);
            rewardBag.DropItem(new Gold(2000, 4000));

            if (0.05 > Utility.RandomDouble())
                rewardBag.DropItem(new BloodPentagramPartDeed());

            if (player.PlaceInBackpack(rewardBag))
                return true;
            else
            {
                rewardBag.Delete();
                player.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;
            }
        }
开发者ID:kamronbatman,项目名称:Defiance-AOS-Pre-2012,代码行数:20,代码来源:EldaTheQuestionableAlchemist.cs

示例7: CreateItens


//.........这里部分代码省略.........
                    else if (item is BaseCreature)
                    {
                        if (sphereItem.Hue != 1)
                        {
                            ((BaseCreature)item).Hue = sphereItem.Hue;
                        }

                        ShrinkItem shrunkenPet = new ShrinkItem((BaseCreature)item);
                        bagMount.DropItem(shrunkenPet);
                    }
                    else
                    {
                        bagOther.DropItem((Item)item);
                    }

                    if (item is Server.Mobiles.Horse && sphereItem.Hue != 1)
                    {
                        ((Server.Mobiles.Horse)item).Hue = DimensionsNewAge.Scripts.HueItemConst.GetNewHueBySphereHue(sphereItem.Hue);
                        ((Server.Mobiles.Horse)item).Name = "Wild Horse";
                    }

                    if (item is Server.Items.MagicDyeTub && sphereItem.Hue != 1)
                        ((Server.Items.MagicDyeTub)item).DyedHue = DimensionsNewAge.Scripts.HueItemConst.GetNewHueBySphereHue(sphereItem.Hue);

                    if (item is Server.Items.BaseClothing && sphereItem.Hue != 1)
                        ((Server.Items.BaseClothing)item).Hue = DimensionsNewAge.Scripts.HueItemConst.GetNewHueBySphereHue(sphereItem.Hue);

                }
                catch (Exception ex)
                {
                    Logger.LogSphereImport(string.Format("CreateItens ERRO " + ex.Message), sphereCharName);
                }
            }

            if (bagOres.Items.Count == 0)
                bagOres.Delete();
            if (bagIngots.Items.Count == 0)
                bagIngots.Delete();
            if (bagArmor.Items.Count == 0)
                bagArmor.Delete();
            if (bagWeapon.Items.Count == 0)
                bagWeapon.Delete();
            if (bagMount.Items.Count == 0)
                bagMount.Delete();
            if (bagOther.Items.Count == 0)
                bagOther.Delete();
            if (bagGold.Items.Count == 0)
                bagGold.Delete();
            if (bagPotion.Items.Count == 0)
                bagPotion.Delete();
            if (bagRegs.Items.Count == 0)
                bagRegs.Delete();
            if (bagCloth.Items.Count == 0)
                bagCloth.Delete();
            if (bagContainer.Items.Count == 0)
                bagContainer.Delete();
            if (bagMaps.Items.Count == 0)
                bagMaps.Delete();

            if (bagPlateOutras.Items.Count == 0)
                bagPlateOutras.Delete();
            if (bagPlateRusty.Items.Count == 0)
                bagPlateRusty.Delete();
            if (bagPlateOldCopper.Items.Count == 0)
                bagPlateOldCopper.Delete();
            if (bagPlateDullCopper.Items.Count == 0)
                bagPlateDullCopper.Delete();
            if (bagPlateRuby.Items.Count == 0)
                bagPlateRuby.Delete();
            if (bagPlateCopper.Items.Count == 0)
                bagPlateCopper.Delete();
            if (bagPlateBronze.Items.Count == 0)
                bagPlateBronze.Delete();
            if (bagPlateShadowIron.Items.Count == 0)
                bagPlateShadowIron.Delete();
            if (bagPlateSilver.Items.Count == 0)
                bagPlateSilver.Delete();
            if (bagPlateMercury.Items.Count == 0)
                bagPlateMercury.Delete();
            if (bagPlateRose.Items.Count == 0)
                bagPlateRose.Delete();
            if (bagPlateGold.Items.Count == 0)
                bagPlateGold.Delete();
            if (bagPlateAgapite.Items.Count == 0)
                bagPlateAgapite.Delete();
            if (bagPlateVerite.Items.Count == 0)
                bagPlateVerite.Delete();
            if (bagPlatePlutonio.Items.Count == 0)
                bagPlatePlutonio.Delete();
            if (bagPlateBloodRock.Items.Count == 0)
                bagPlateBloodRock.Delete();
            if (bagPlateValorite.Items.Count == 0)
                bagPlateValorite.Delete();
            if (bagPlateBlackRock.Items.Count == 0)
                bagPlateBlackRock.Delete();
            if (bagPlateMytheril.Items.Count == 0)
                bagPlateMytheril.Delete();
            if (bagPlateAqua.Items.Count == 0)
                bagPlateAqua.Delete();
        }
开发者ID:greeduomacro,项目名称:DimensionsNewAge,代码行数:101,代码来源:SphereImport.cs

示例8: DeliveryConversion

		private bool DeliveryConversion()
		{
			const int amountCap = 60000;

			double exchangeRate = AutoDonate.CMOptions.ExchangeRate;
			DonationProfile dp = AutoDonate.Find(DeliverTo.Account);
			Container bank = DeliverTo.BankBox;

			if (bank != null)
			{
				Bag bag = new Bag();

				if (IsGift)
				{
					bag.Name = "A Donation Gift Bag";
					bag.Hue = 1152;

					string text = dp.Gifts.ContainsKey(ID) ? dp.Gifts[ID] : null;

					if (String.IsNullOrWhiteSpace(text))
					{
						text = "Hi, " + DeliverTo.RawName + ", ";
						text += "Here is a gift, a token of my appreciation. ";
						text += "Don't spend it all in one place! ";
						text += "Regards, " + DeliverFrom.RawName;
					}

					bag.DropItem(new DonationGiftBook(DeliverFrom, text));
				}
				else
				{
					bag.Name = "A Donation Reward Bag";
					bag.Hue = 1152;
				}

				long exchanged = (long)(Credit * exchangeRate);

				while (exchanged >= amountCap)
				{
					Item cur = AutoDonate.CMOptions.CurrencyType.CreateInstance();
					cur.Amount = amountCap;

					bag.DropItem(cur);

					if (cur.IsChildOf(bag))
					{
						exchanged -= cur.Amount;
					}
				}

				if (exchanged > 0)
				{
					Item cur = AutoDonate.CMOptions.CurrencyType.CreateInstance();
					cur.Amount = (int)exchanged;

					bag.DropItem(cur);

					if (cur.IsChildOf(bag))
					{
						exchanged -= cur.Amount;
					}
				}

				if (exchanged > 0)
				{
					bag.Delete();
					return false;
				}

				bank.DropItem(bag);
				dp.Credits -= Credit;
			}

			return true;
		}
开发者ID:jasegiffin,项目名称:JustUO,代码行数:75,代码来源:Transaction.cs

示例9: AddLootPouch

        public virtual void AddLootPouch(LootPack pack)
        {
            if (Summoned)
                return;

            Container backpack = Backpack;

            if (backpack == null)
            {
                backpack = new Backpack();

                backpack.Movable = false;

                AddItem(backpack);
            }
            //find top most container
            while (backpack.FindItemByType(typeof(Backpack)) != null)
                backpack = (Container)backpack.FindItemByType(typeof(Backpack));

            Container LootBag = new Bag();
            backpack.DropItem(LootBag);

            pack.Generate(this, LootBag, m_Spawning, m_KillersLuck);

            if (LootBag.Items.Count <= 0)
                LootBag.Delete();
        }
开发者ID:Godkong,项目名称:Origins,代码行数:27,代码来源:BaseCreature.cs

示例10: makeready

        public void makeready(Mobile who)
        {
            PlayerMobile c = (PlayerMobile)who;
            if (!who.Alive)
                who.Resurrect();

            Container bp = c.Backpack;
            Container bankbag = new Bag();
            bankbag.Hue = 63;
            BankBox bank = c.BankBox;
            Item oncurs = c.Holding;

            if (oncurs != null)
                bp.DropItem(oncurs);

            c.SendMessage("You have 10 seconds until the duel begins");
            c.SendMessage(63, "After one of you dies, both of you will be teleported out");

            c.Criminal = true;
            c.CurePoison(c);

            c.Blessed = true;
            c.Frozen = true;

            c.Hits = c.HitsMax;
            c.Mana = c.ManaMax;
            c.Stam = c.StamMax;

            c.StatMods.Clear();

            if (bp != null)
            {
                Item toDisarm = c.FindItemOnLayer(Layer.OneHanded);

                if (toDisarm == null || !toDisarm.Movable)
                    toDisarm = c.FindItemOnLayer(Layer.TwoHanded);

                if (toDisarm != null)
                    bp.DropItem(toDisarm);

                if (c.Mount != null)
                {
                    IMount mount = c.Mount;
                    mount.Rider = null;
                    if (mount is BaseMount)
                    {
                        BaseMount oldMount = (BaseMount)mount;
                        oldMount.Map = Map.Internal;
                        c.TempMount = oldMount;
                    }
                }

                while ((BasePotion)bp.FindItemByType(typeof(BasePotion)) != null)
                {
                    BasePotion potion = (BasePotion)bp.FindItemByType(typeof(BasePotion));
                    bankbag.DropItem(potion);
                }
                while ((EtherealMount)bp.FindItemByType(typeof(EtherealMount)) != null)
                {
                    EtherealMount mount = (EtherealMount)bp.FindItemByType(typeof(EtherealMount));
                    bankbag.DropItem(mount);
                }
                /*Item[] weps = bp.FindItemsByType( typeof( BaseWeapon ) ); 
                for ( int i = 0; i < weps.Length; ++i ) 
                { 
                    Item item = (Item)weps[i];
                    BaseWeapon weapon = item as BaseWeapon;
                    if( weapon.DamageLevel > WeaponDamageLevel.Regular ) 
                                bankbag.DropItem( item );
                }*/
                if (bankbag.Items.Count > 0)
                    bank.DropItem(bankbag);
                else
                    bankbag.Delete();
            }
        }
开发者ID:greeduomacro,项目名称:vivre-uo,代码行数:76,代码来源:ChallengeStone.cs

示例11: OnTalk

        public override void OnTalk(PlayerMobile player, bool contextMenu)
        {
            Direction = GetDirectionTo(player);
            QuestSystem qs = player.Quest;

            // Doing this quest
            if (qs is CursedCaveQuest)
            {
                if (qs.IsObjectiveInProgress(typeof(CursedCaveBeginObjective)))
                {
                    qs.AddConversation(new DuringKillTaskConversation());
                }
                else
                {
                    QuestObjective obj = qs.FindObjective(typeof(ReportBackObjective));

                    if (obj != null && !obj.Completed)
                    {
                        Bag rewardBag = new Bag();
                        rewardBag.Hue = Utility.RandomDyedHue();
                        LootPackEntry.AddRandomLoot(rewardBag, 5, 600,  5, 5, 50, 100);
                        rewardBag.DropItem(new Bandage(Utility.RandomMinMax(200, 300)));
                        rewardBag.DropItem(new Gold(2000, 4000));
                        if (0.08 > Utility.RandomDouble())
                            rewardBag.DropItem(new TreasureMap(6, Map.Felucca));
                        else
                            rewardBag.DropItem(new TreasureMap(Utility.RandomMinMax(3, 5), Map.Felucca));

                        // Add Artifact ***
                        if (0.05 > Utility.RandomDouble())
                        {
                            if (GetBestFightingSkill(player) == SkillName.Archery)
                                rewardBag.DropItem(new BowOfHephaestus());
                            else
                                rewardBag.DropItem(new LongswordOfJustice());
                        }
                        else if (0.2 > Utility.RandomDouble())
                        {
                            int rnd = Utility.Random(5);
                            switch (rnd)
                            {
                                case 0: rewardBag.DropItem(CreatePaladinArmor(typeof(PlateChest), "Platemail Tunic", Utility.Random(5))); break; //Up to 4 props + Chivalry
                                case 1: rewardBag.DropItem(CreatePaladinArmor(typeof(PlateArms), "Platemail Arms", Utility.Random(5))); break;
                                case 2: rewardBag.DropItem(CreatePaladinArmor(typeof(PlateGloves), "Platemail Gloves", Utility.Random(5))); break;
                                case 3: rewardBag.DropItem(CreatePaladinArmor(typeof(PlateLegs), "Platemail Legs", Utility.Random(5))); break;
                                case 4: rewardBag.DropItem(CreatePaladinArmor(typeof(PlateGorget), "Platemail Gorget", Utility.Random(5))); break;
                            }
                        }

                        if (player.PlaceInBackpack(rewardBag))
                        {
                            obj.Complete();
                            if (!player.KarmaLocked)
                                player.Karma = Math.Min(15000, player.Karma + 1500);
                        }
                        else
                        {
                            rewardBag.Delete();
                            player.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.
                        }
                    }
                }
            }
            else
            {
                // Busy with another quest
                if (qs != null)
                {
                    qs.AddConversation(new DontOfferConversation());
                }
                // Offer Quest
                else if (qs == null && QuestSystem.CanOfferQuest(player, typeof(CursedCaveQuest)))
                {
                    Direction = GetDirectionTo(player);
                    new CursedCaveQuest(player).SendOffer();
                }
            }
        }
开发者ID:kamronbatman,项目名称:Defiance-AOS-Pre-2012,代码行数:78,代码来源:WarrenTheGuard.cs

示例12: OnTarget

            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is BaseHouseDoor)
                {
                    from.SendMessage("Ce n'est pas conseillé de faire ceci sur une porte de maison...");
                    return;
                }

                BaseDoor door = targeted as BaseDoor;

                if (door == null)
                {
                    from.SendMessage("Vous devez cibler une porte et non un " + targeted.GetType().Name);
                    return;
                }

                if (door.KeyValue != 0)
                {
                    from.SendMessage("La porte possède déjà un KeyValue !");
                    return;
                }

                door.KeyValue = (uint)door.Serial.Value;

                Bag keysBag = new Bag();
                keysBag.Hue = Utility.RandomDyedHue();
                for (int i = 1; i <= m_Quantity; i++)
                {
                    Key k = new Key(door.KeyValue);
                    keysBag.DropItem(k);
                }

                if (keysBag.Items.Count > 0)
                    from.Backpack.AddItem(keysBag);
                else
                    keysBag.Delete();
            }
开发者ID:greeduomacro,项目名称:vivre-uo,代码行数:37,代码来源:KeysCommands.cs

示例13: OnResponse

            public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
            {
                Mobile from = sender.Mobile;

                switch (info.ButtonID)
                {
                    case (int)Buttons.B_OK:
                        int counter = 0;
                        foreach (Item item in m_foundItems)
                            if (item.IsChildOf(from.Backpack))
                                counter++;

                        if (counter >= m_npc.ArtifactAmount)
                        {
                            Bag rewardBag = new Bag();
                            rewardBag.Hue = Utility.RandomDyedHue();
                            LootPackEntry.AddRandomLoot(rewardBag, 5, 600,  5, 5, 50, 100);
                            rewardBag.DropItem(new Bandage(Utility.RandomMinMax(200, 300)));
                            rewardBag.DropItem(new Gold(2000, 4000));
                            rewardBag.DropItem(new TreasureMap(Utility.RandomMinMax(2, 6), Map.Felucca));

                            // Add Artifact ***
                            if (0.40 > Utility.RandomDouble())
                                rewardBag.DropItem(new HarvesterOfTheGhost());

                            if (from.PlaceInBackpack(rewardBag))
                            {
                                foreach (Item item in m_foundItems)
                                    item.Delete();
                                m_npc.Say(1070984, "Reward Bag"); // You have earned the gratitude of the Empire. I have placed the ~1_OBJTYPE~ in your backpack.
                            }
                            else
                            {
                                rewardBag.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.
                            }
                        }
                        break;
                }
            }
开发者ID:kamronbatman,项目名称:Defiance-AOS-Pre-2012,代码行数:40,代码来源:CursedCaveUtility.cs

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

                int damageLevel = BaseCreature.RandomMinMaxScaled(2, 3);
                if (PseudoSeerStone.Instance != null && PseudoSeerStone.Instance._HighestDamageLevelSpawn < damageLevel)
                {
                    if (damageLevel == 5 && PseudoSeerStone.ReplaceVanqWithSkillScrolls) { bag.DropItem(PuzzleChest.CreateRandomSkillScroll()); }
                    int platAmount = PseudoSeerStone.PlatinumPerMissedDamageLevel * (damageLevel - PseudoSeerStone.Instance._HighestDamageLevelSpawn);
                    if (platAmount > 0) bag.DropItem(new Platinum(platAmount));
                    damageLevel = PseudoSeerStone.Instance._HighestDamageLevelSpawn;
                }
                weapon.DamageLevel = (WeaponDamageLevel)damageLevel;
				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();
				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 ObsidianStatue() );

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


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