Inheritance: Server.Items.Container
		public override void AddContents( BaseContainer cont, Mobile creature, out int contentValue )
		{
			contentValue = 0;

			int count = Utility.RandomMinMax( m_MinCount, m_MaxCount );

			for ( int i = 0; i < count; i++ )
			{
				Type type = null;

				if ( m_Random )
					type = m_CommodityTypes[Utility.Random(m_CommodityTypes.Length)];
				else
					type = m_CommodityTypes[i % m_CommodityTypes.Length];

				Item com = Activator.CreateInstance( m_CommodityTypes[i] ) as Item;

				if ( com == null )
					throw new NullReferenceException( String.Format( "Type {0} is not an Item or could not be instantiated.", type.ToString() ) );
				else
				{
					if ( com.Stackable )
						com.Amount = Utility.RandomMinMax( m_MinAmount, m_MaxAmount );

					cont.DropItem( com );
				}
			}
		}
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is BaseContainer)
                {
                    m_engtarg = (BaseContainer)targeted;

                    if (!from.InRange(m_Engraver.GetWorldLocation(), 2) || !from.InRange(m_engtarg.GetWorldLocation(), 2))
                    {
                        from.SendLocalizedMessage(500446);                                   // That is too far away.
                    }
                    else if (m_engtarg.Parent == null)
                    {
                        BaseHouse house = BaseHouse.FindHouseAt(m_engtarg);

                        if (house == null || !house.IsLockedDown(m_engtarg))
                        {
                            from.SendMessage("Containers must be locked down to engrave them.");
                        }

                        else if (!house.IsCoOwner(from))
                        {
                            from.SendLocalizedMessage(501023);                                                       // You must be the owner to use this item.
                        }
                        else
                        {
                            from.Prompt = new RenameContPrompt(m_engtarg);
                            from.SendMessage("What would you like to engrave on the container ?");
                        }
                    }
                }
                else
                {
                    from.SendMessage("You cannot engrave that.");
                }
            }
Exemple #3
0
        public override void OnDoubleClick(Mobile from)
        {
            if (Movable)
            {
                from.SendMessage("This must be secured down in a home to use.");
            }
            else if (!from.InRange(GetWorldLocation(), 2))
            {
                from.SendMessage("You will have to get closer to use that.");
            }
            else if (!CheckAccess(from))
            {
                from.SendMessage("You cannot use this safe.");
            }
            else
            {
                BankBox box = from.BankBox;
                if (box != null)
                {
                    box.GumpID = BaseContainer.BankGump(from, box);
                    box.Open();
                }
            }

            return;
        }
		public override void AddContents( BaseContainer cont, Mobile creature, out int contentValue )
		{
			base.AddContents( cont, creature, out contentValue );

			if ( m_HealChance > Utility.RandomDouble() )
				cont.DropItem( new Bandage( Utility.RandomMinMax( MinAmount / 2, MaxAmount ) ) );

			int potioncount = Utility.RandomMinMax( MinAmount / 25, MaxAmount / 10 );

			for ( int i = 0; i < potioncount; i++ )
				if ( (m_HealChance / 2.0) > Utility.RandomDouble() )
					cont.DropItem( Utility.RandomBool() ? (Item)new LesserHealPotion() : (Item)new HealPotion() );

			int scrollcount = Utility.RandomMinMax( MinAmount / 12, MaxAmount / 5 );

			for ( int i = 0; i < scrollcount; i++ )
			{
				if ( (m_HealChance / 3.0) > Utility.RandomDouble() )
				{
					Item item = null;
					switch ( Utility.Random( 4 ) )
					{
						default:
						case 0: item = new HealScroll(); break;
						case 1: item = new GreaterHealScroll(); break;
						case 2: item = new CureScroll(); break;
						case 3: item = new ArchCureScroll(); break;
					}

					cont.DropItem( item );
				}
			}
		}
Exemple #5
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker))
            {
                return;
            }

            ClearCurrentAbility(attacker);
            Item toDisrobe = defender.FindItemOnLayer(Layer.InnerTorso);

            if (toDisrobe == null || !toDisrobe.Movable)
            {
                toDisrobe = defender.FindItemOnLayer(Layer.OuterTorso);
            }

            Container pack = defender.Backpack;

            if (pack == null || toDisrobe == null || !toDisrobe.Movable)
            {
                attacker.SendLocalizedMessage(1004001);                 // You cannot disarm your opponent.
            }
            else if (CheckMana(attacker, true))
            {
                //attacker.SendLocalizedMessage( 1060092 ); // You disarm their weapon!
                defender.SendLocalizedMessage(1062002);                 // You can no longer wear your ~1_ARMOR~

                defender.PlaySound(0x3B9);
                //defender.FixedParticles( 0x37BE, 232, 25, 9948, EffectLayer.InnerTorso );

                pack.DropItem(toDisrobe); BaseContainer.DropItemFix(toDisrobe, defender, pack.ItemID, pack.GumpID);

                BaseWeapon.BlockEquip(defender, BlockEquipDuration);
            }
        }
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            m_container = reader.ReadItem() as BaseContainer;
            m_expires   = reader.ReadDateTime();
            m_PrizeID   = reader.ReadInt();

            // okay, add deeds read from disk to our quest manager
            if (m_container != null && Expired == false)
            {
                // when we deserialize we don't know the ordr in which the deeds will be read,
                //	so insure they are stored sorted.
                PlayerQuestManager.AddSorted(this);
            }
            else
            {
                LogHelper Logger = new LogHelper("PlayerQuest.log", false);
                string    temp;
                if (m_container == null)
                {
                    temp = String.Format("Orphaned Quest Deed({0}) loaded for nonexistent Chest(0x{1:X}).", this.Serial, m_PrizeID);
                }
                else                 // Expired == true
                {
                    temp = String.Format("Expired Quest Deed({0}) loaded for (non)existent Chest(0x{1:X}).", this.Serial, m_PrizeID);
                }
                Logger.Log(LogType.Text, temp);
                Logger.Finish();
            }
        }
		public override void AddContents( BaseContainer cont, Mobile creature, out int contentValue )
		{
			base.AddContents( cont, creature, out contentValue );

			if ( m_RuneChance > Utility.RandomDouble() )
				cont.DropItem( new RecallRune() );

			int scrollcount = Utility.RandomMinMax( MinAmount / 25, MaxAmount / 8 );

			for ( int i = 0; i < scrollcount; i++ )
			{
				if ( (m_RuneChance / 3.0) > Utility.RandomDouble() )
				{
					Item item = null;
					switch ( Utility.Random( 5 ) )
					{
						default:
						case 0: case 1: case 2: item = new RecallScroll(); break;
						case 3: item = new MarkScroll(); break;
						case 4: item = new GateTravelScroll(); break;
					}

					cont.DropItem( item );
				}
			}
		}
Exemple #8
0
        public BuriedBody(int level, string who, Mobile digger) : base(0xe40)
        {
            string sCorpse = ContainerFunctions.GetOwner("Body");

            if (who != "" && who != null)
            {
                sCorpse = "bones";
                switch (Utility.RandomMinMax(0, 3))
                {
                case 0: sCorpse = "bones"; break;

                case 1: sCorpse = "body"; break;

                case 2: sCorpse = "skeletal remains"; break;

                case 3: sCorpse = "skeletal bones"; break;
                }
                sCorpse = "The " + sCorpse + " of " + who;
            }

            Name    = sCorpse;
            Movable = true;
            Weight  = 5;
            GumpID  = 9;
            ItemID  = 3786 + Utility.Random(8);

            ContainerFunctions.FillTheContainer(level, this, digger);

            if (level > 4)
            {
                ContainerFunctions.FillTheContainer(level, this, digger);
            }
            if (level > 8)
            {
                ContainerFunctions.FillTheContainer(level, this, digger);
            }
            if (GetPlayerInfo.LuckyPlayer(digger.Luck))
            {
                ContainerFunctions.FillTheContainer(level, this, digger);
            }

            int xTraCash = Utility.RandomMinMax((level * 300), (level * 500));

            ContainerFunctions.AddGoldToContainer(xTraCash, this, 0, digger);

            if (Utility.RandomMinMax(0, 500) < (level))
            {
                Item arty = ArtifactBuilder.CreateArtifact("random");
                DropItem(arty);
                BaseContainer.DropItemFix(arty, digger, ItemID, GumpID);
            }

            TrapType      = TrapType.None;
            TrapPower     = 0;
            TrapLevel     = 0;
            Locked        = false;
            LockLevel     = 0;
            MaxLockLevel  = 0;
            RequiredSkill = 0;
        }
Exemple #9
0
        public override void Open(Mobile from)
        {
            int amount = 50;

            if (this.Weight > 2.0)
            {
                Item i = null;
                i = new BlackPearl(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);
                i = new Bloodmoss(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);
                i = new Garlic(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);
                i = new Ginseng(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);
                i = new MandrakeRoot(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);
                i = new Nightshade(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);
                i = new SulfurousAsh(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);
                i = new SpidersSilk(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);
                i = new Brimstone(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);
                i = new ButterflyWings(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);
                i = new EyeOfToad(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);
                i = new FairyEgg(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);
                i = new GargoyleEar(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);
                i = new BeetleShell(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);
                i = new MoonCrystal(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);
                i = new PixieSkull(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);
                i = new RedLotus(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);
                i = new SeaSalt(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);
                i = new SilverWidow(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);
                i = new SwampBerries(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);

                this.Weight = 2.0;
            }

            base.Open(from);
        }
        public static void From(Mobile m)
        {
            CharacterDatabase DB = Server.Items.CharacterDatabase.GetDB(m);

            if (m.Backpack == null)
            {
                return;
            }

            int key = m.Serial.Value;

            if (Config.AllowPlayerToggle && DB.CharacterSheath != 1)
            {
                return;
            }

            Item weapon = m.FindItemOnLayer(Layer.OneHanded);

            if (weapon == null || !weapon.Movable)
            {
                weapon = m.FindItemOnLayer(Layer.TwoHanded);
            }

            Item lastWeapon = null;

            if (PlayerWeapons.ContainsKey(key))
            {
                lastWeapon = PlayerWeapons[key];
            }

            if (m.Warmode)
            {
                if ((weapon == null || AllowedToKeep(weapon)) && lastWeapon != null && lastWeapon.IsChildOf(m.Backpack) && lastWeapon.Movable && lastWeapon.Visible && !lastWeapon.Deleted)
                {
                    m.EquipItem(lastWeapon);

                    if (Config.SendOverheadMessage)
                    {
                        m.LocalOverheadMessage(Network.MessageType.Emote, m.EmoteHue, false, "*Unsheathes Weapon*");
                    }
                }
            }
            else
            {
                if (weapon != null && !AllowedToKeep(weapon))
                {
                    m.Backpack.DropItem(weapon); BaseContainer.DropItemFix(weapon, m, m.Backpack.ItemID, m.Backpack.GumpID);
                    PlayerWeapons[key] = weapon;

                    if (Config.SendOverheadMessage)
                    {
                        m.LocalOverheadMessage(Network.MessageType.Emote, m.EmoteHue, false, "*Sheathes Weapon*");
                    }
                }
            }
        }
 public override void OnDoubleClick(Mobile from)
 {
     if (Charges > 0)
     {
         ConsumeCharge(from);
         BankBox box = from.BankBox;
         if (box != null)
         {
             box.GumpID = BaseContainer.BankGump(from, box);
             box.Open();
         }
     }
 }
		public PlayerQuestDeed(BaseContainer c) : base( 0x14F0 )
		{
			base.Weight = 1.0;
			base.Name = "a quest ticket";
			m_container = c;										// the prize
			m_expires = DateTime.Now + TimeSpan.FromHours(24.0);	// Heartbeat has it's own hadrcoded notion of 24 hours not tied to this value
			m_PrizeID = (int)m_container.Serial;					// identifies the prize
			PlayerQuestManager.Deeds.Add(this);						// add to our managers list
			PlayerQuestManager.Announce();							// force an announcement now
			LogHelper Logger = new LogHelper("PlayerQuest.log", false);
			string temp = String.Format("A Player Quest Deed({0}) has been created.", this.Serial);
			Logger.Log(LogType.Item, m_container, temp);
			Logger.Finish();
		}
Exemple #13
0
        public TentReimbursementDeed(BaseContainer c)
            : base(0x14F0)
        {
            base.Weight   = 1.0;
            base.LootType = LootType.Newbied;                                                   // newbie shouldn't loose this
            base.Name     = "tent reimbursement deed";
            m_container   = c;                                                                  // the storage container
            m_ContainerID = (int)m_container.Serial;                                            // identifies the prize
            LogHelper Logger = new LogHelper("TentReimbursementDeed.log", false);
            string    temp   = String.Format("A Tent Reimbursement Deed ({0}) has been created.", this.Serial);

            Logger.Log(LogType.Item, m_container, temp);
            Logger.Finish();
        }
        public PlayerQuestDeed(BaseContainer c) : base(0x14F0)
        {
            base.Weight = 1.0;
            base.Name   = "a quest ticket";
            m_container = c;                                                    // the prize
            m_expires   = DateTime.Now + TimeSpan.FromHours(24.0);              // Heartbeat has it's own hadrcoded notion of 24 hours not tied to this value
            m_PrizeID   = (int)m_container.Serial;                              // identifies the prize
            PlayerQuestManager.Deeds.Add(this);                                 // add to our managers list
            PlayerQuestManager.Announce();                                      // force an announcement now
            LogHelper Logger = new LogHelper("PlayerQuest.log", false);
            string    temp   = String.Format("A Player Quest Deed({0}) has been created.", this.Serial);

            Logger.Log(LogType.Item, m_container, temp);
            Logger.Finish();
        }
Exemple #15
0
 public override void OnDoubleClick(Mobile from)
 {
     if (from.InRange(this.GetWorldLocation(), 4))
     {
         BankBox box = from.BankBox;
         if (box != null)
         {
             box.GumpID = BaseContainer.BankGump(from, box);
             box.Open();
         }
     }
     else
     {
         from.SendLocalizedMessage(502138);                   // That is too far away for you to use
     }
 }
Exemple #16
0
        public override void OnDoubleClick(Mobile from)
        {
            if (from.InRange(GetWorldLocation(), 2))
            {
                if (m_Held > 0)
                {
                    Container pack = from.Backpack;

                    if (pack != null && ((IsJarPotion(m_Type) && pack.ConsumeTotal(typeof(Jar), 1)) || (!IsJarPotion(m_Type) && pack.ConsumeTotal(typeof(Bottle), 1))))
                    {
                        from.SendLocalizedMessage(502242);                           // You pour some of the keg's contents into an empty bottle...

                        BasePotion pot = FillBottle();

                        if (pack.TryDropItem(from, pot, false))
                        {
                            BaseContainer.DropItemFix(pot, from, from.Backpack.ItemID, from.Backpack.GumpID);
                            from.SendLocalizedMessage(502243);                               // ...and place it into your backpack.
                            from.PlaySound(0x240);

                            if (--Held == 0)
                            {
                                from.SendLocalizedMessage(502245);                                   // The keg is now empty.
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(502244);                               // ...but there is no room for the bottle in your backpack.
                            pot.Delete();
                        }
                    }
                    else
                    {
                        // TODO: Target a bottle
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502246);                       // The keg is empty.
                }
                SetColorKeg(this, this);
            }
            else
            {
                from.LocalOverheadMessage(Network.MessageType.Regular, 0x3B2, 1019045);                   // I can't reach that.
            }
        }
Exemple #17
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!Movable)
            {
                return;
            }

            if (from.InRange(this.GetWorldLocation(), 1))
            {
                if (!RequireFreeHand || HasFreeHand(from))
                {
                    if (this is BaseExplosionPotion && Amount > 1)
                    {
                        BasePotion pot = (BasePotion)Activator.CreateInstance(this.GetType());

                        if (pot != null)
                        {
                            Amount--;

                            if (from.Backpack != null && !from.Backpack.Deleted)
                            {
                                from.Backpack.DropItem(pot);
                                BaseContainer.DropItemFix(pot, from, from.Backpack.ItemID, from.Backpack.GumpID);
                            }
                            else
                            {
                                pot.MoveToWorld(from.Location, from.Map);
                            }
                            pot.Drink(from);
                        }
                    }
                    else
                    {
                        this.Drink(from);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502172);                     // You must have a free hand to drink a potion.
                }
            }
            else
            {
                from.SendLocalizedMessage(502138);                   // That is too far away for you to use
            }
        }
Exemple #18
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            m_container   = reader.ReadItem() as BaseContainer;
            m_ContainerID = reader.ReadInt();

            if (m_container == null)
            {
                LogHelper Logger = new LogHelper("TentReimbursementDeed.log", false);
                string    temp;
                temp = String.Format("Orphaned Tent Reimbursement Deed({0}) loaded for nonexistent Backpack(0x{1:X}).", this.Serial, m_ContainerID);
                Logger.Log(LogType.Text, temp);
                Logger.Finish();
            }
        }
        public override void Open(Mobile from)
        {
            int amount = 50;

            if (this.Weight > 2.0)
            {
                Item i = null;
                i = new BatWing(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);
                i = new GraveDust(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);
                i = new DaemonBlood(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);
                i = new NoxCrystal(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);
                i = new PigIron(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);

                this.Weight = 2.0;
            }

            base.Open(from);
        }
        public BuriedChest(int level, string who, Mobile digger) : base(0xe40)
        {
            if (who == "")
            {
                who = ContainerFunctions.GetOwner("Chest");
            }
            else
            {
                string[] vAdj = new string[] { "Exotic", "Mysterious", "Marvelous", "Amazing", "Astonishing", "Mystical", "Astounding", "Magnificent", "Phenomenal", "Fantastic", "Incredible", "Extraordinary", "Fabulous", "Wondrous", "Glorious", "Lost", "Fabled", "Legendary", "Mythical", "Missing", "Ancestral", "Ornate", "Wonderful", "Sacred", "Unspeakable", "Unknown", "Forgotten" };
                string   sAdj = vAdj[Utility.RandomMinMax(0, (vAdj.Length - 1))];
                who = "The " + sAdj + " Chest of " + who;
            }

            ContainerFunctions.BuildContainer(this, 0, Utility.RandomList(1, 2), 0, 0);
            Name = who;
            ContainerFunctions.FillTheContainer(level, this, digger);
            if (GetPlayerInfo.LuckyPlayer(digger.Luck))
            {
                ContainerFunctions.FillTheContainer(level, this, digger);
            }

            if (level > 4)
            {
                ContainerFunctions.FillTheContainer(level, this, digger);
            }
            if (level > 8)
            {
                ContainerFunctions.FillTheContainer(level, this, digger);
            }

            ContainerFunctions.LockTheContainer(level, this, 1);

            int xTraCash = Utility.RandomMinMax((level * 300), (level * 500));

            ContainerFunctions.AddGoldToContainer(xTraCash, this, 0, digger);

            if (Utility.RandomMinMax(0, 500) < (level))
            {
                Item arty = ArtifactBuilder.CreateArtifact("random");
                DropItem(arty);
                BaseContainer.DropItemFix(arty, digger, ItemID, GumpID);
            }
        }
        protected override void OnTarget(Mobile from, object target)           // Override the protected OnTarget() for our feature
        {
            // Check targetted thing is a container

            if (target is BaseContainer)
            {
                // Is a container, so cast

                BaseContainer bc = (BaseContainer)target;

                // Check player crafted

                if (bc.PlayerCrafted == false)
                {
                    from.SendMessage("This tool can only be used on crafted containers.");
                    return;
                }

                // Make sure it's in backpack too

                if (!bc.IsChildOf(from.Backpack))
                {
                    from.SendMessage("The container you wish to engrave must be in your backpack.");
                    return;
                }

                if (bc.Name != null)
                {
                    // Already engraved
                    from.SendMessage("This piece has already been engraved.");
                    return;
                }

                from.SendMessage("Please enter the words you wish to engrave :");
                from.Prompt = new RenamePrompt(from, bc, m_Graver);
            }
            else
            {
                // Not a container

                from.SendMessage("This tool can only be used on a container.");
            }
        }
Exemple #22
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is BaseContainer)
                {
                    m_engtarg = (BaseContainer)targeted;

                    if (!from.InRange(m_Engraver.GetWorldLocation(), 2) || !from.InRange(m_engtarg.GetWorldLocation(), 2))
                    {
                        from.SendLocalizedMessage(500446);                                   // That is too far away.
                    }
                    else if (m_engtarg.Parent == null)
                    {
                        BaseHouse house = BaseHouse.FindHouseAt(m_engtarg);

                        if (house == null || !house.IsSecure(m_engtarg))
                        {
                            from.SendMessage("You must Secure your container before you can Engrave it.");
                        }

                        else if (!house.IsCoOwner(from))
                        {
                            from.SendLocalizedMessage(501023);                                                       // You must be the owner to use this item.
                        }
                        else
                        {
                            from.Prompt = new RenameContPrompt(m_engtarg);
                            from.SendMessage("What would you like to engrave on the container ?");
                            m_Engraver.Charges = (m_Engraver.Charges - 1);
                            from.SendMessage("You use your Engraver. You now have {0} uses left.", m_Engraver.Charges);

                            if (m_Engraver.Charges == 0)
                            {
                                from.SendMessage("You have ran out of uses, the Engraver has been removed.");
                                m_Engraver.Delete();
                            }
                        }
                    }
                }
                else
                {
                    from.SendMessage("You cannot engrave that.");
                }
            }
        public override void Open(Mobile from)
        {
            if (this.Weight > 50)
            {
                Movable = true;
                int FillMeUpLevel = (int)(this.Weight - 51);
                this.Weight = 5.0;

                if (GetPlayerInfo.LuckyPlayer(from.Luck))
                {
                    FillMeUpLevel = FillMeUpLevel + Utility.RandomMinMax(1, 2);
                }

                ContainerFunctions.FillTheContainer(FillMeUpLevel, this, from);

                BaseContainer.OrderContainer(this, from);
            }

            base.Open(from);
        }
		public override void AddContents( BaseContainer cont, Mobile creature, out int contentValue )
		{
			base.AddContents( cont, creature, out contentValue );

			if ( m_BookChance > Utility.RandomDouble() )
			{
				BaseSpellbookLootSet spellbookloot = MagicSpellbookLootSets.LootSet( m_SpellbookGrade );

				if ( spellbookloot != null ) //sanity check
				{
					Tuple<Item[], int> spelltuple = spellbookloot.GenerateLootItem( creature );
					if ( spelltuple.Item1 != null ) // another sanity check
						for ( int i = 0;i < spelltuple.Item1.Length; i++ )
							if ( spelltuple.Item1[i] != null ) // more sanity checks
								cont.DropItem( spelltuple.Item1[i] );

					contentValue += spelltuple.Item2;
				}
			}
		}
        public override void Open(Mobile from)
        {
            if (this.Weight > 50)
            {
                int FillMeUpLevel = (int)(this.Weight - 51);
                this.Weight = 5.0;

                if (GetPlayerInfo.LuckyPlayer(from.Luck))
                {
                    FillMeUpLevel = FillMeUpLevel + Utility.RandomMinMax(1, 2);
                }

                ContainerFunctions.FillTheContainer(FillMeUpLevel, this, from);

                BaseContainer.OrderContainer(this, from);
            }

            base.Open(from);

            Server.Items.CharacterDatabase.LootContainer(from, this);
        }
        public override void Open(Mobile from)
        {
            int amount = 50;

            if (this.Weight > 2.0)
            {
                Item i = null;
                i = new BlackPearl(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);
                i = new Bloodmoss(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);
                i = new Garlic(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);
                i = new Ginseng(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);
                i = new MandrakeRoot(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);
                i = new Nightshade(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);
                i = new SulfurousAsh(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);
                i = new SpidersSilk(amount); DropItem(i); BaseContainer.DropItemFix(i, from, ItemID, GumpID);

                this.Weight = 2.0;
            }

            base.Open(from);
        }
Exemple #27
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker))
            {
                return;
            }

            ClearCurrentAbility(attacker);

            Item toDisarm = defender.FindItemOnLayer(Layer.OneHanded);

            if (toDisarm == null || !toDisarm.Movable)
            {
                toDisarm = defender.FindItemOnLayer(Layer.TwoHanded);
            }

            Container pack = defender.Backpack;

            if (pack == null || (toDisarm != null && !toDisarm.Movable))
            {
                attacker.SendLocalizedMessage(1004001);                   // You cannot disarm your opponent.
            }
            else if (toDisarm == null || toDisarm is BaseShield || toDisarm is Spellbook && !Core.ML)
            {
                attacker.SendLocalizedMessage(1060849);                   // Your target is already unarmed!
            }
            else if (CheckMana(attacker, true))
            {
                attacker.SendLocalizedMessage(1060092);                   // You disarm their weapon!
                defender.SendLocalizedMessage(1060093);                   // Your weapon has been disarmed!

                defender.PlaySound(0x3B9);
                defender.FixedParticles(0x37BE, 232, 25, 9948, EffectLayer.LeftHand);

                pack.DropItem(toDisarm); BaseContainer.DropItemFix(toDisarm, defender, pack.ItemID, pack.GumpID);

                BaseWeapon.BlockEquip(defender, BlockEquipDuration);
            }
        }
Exemple #28
0
        // Override added to perform LOS check and prevent unauthorized viewiing
        // of locked down containers in houses
        public override void OnDoubleClick(Mobile from)
        {
            if (!from.InLOS(this))
            {
                from.SendLocalizedMessage(500237);                   // Target can not be seen.
                return;
            }

            int           range = 2;
            BaseContainer c     = this;

            while (c.Parent != null)
            {
                if (c.Parent is VendorBackpack)
                {
                    range = 3;
                    break;
                }

                if (c.Parent is BaseContainer)
                {
                    c = (BaseContainer)c.Parent;
//					continue;
                }
                else
                {
                    break;
                }
            }

            if (from.AccessLevel > AccessLevel.Player || from.InRange(this.GetWorldLocation(), range))
            {
                DisplayTo(from);
            }
            else
            {
                from.SendLocalizedMessage(500446);                   // That is too far away.
            }
        }
Exemple #29
0
        private void seachbag(Item b, Mobile from)
        {
            BaseContainer bag   = (BaseContainer)b;
            List <Item>   items = bag.Items;
            List <Item>   delme = new List <Item>();
            List <Item>   movme = new List <Item>();

            foreach (Item i in items)
            {
                if (i is Gold || i.CheckNewbied() || i.Insured || i.PayedInsurance)
                {
                    movme.Add(i);
                    continue;
                }
                if (i is BaseContainer)
                {
                    seachbag(i, from);
                }
                delme.Add(i);
            }

            foreach (Item i in movme)
            {
                if (!i.Deleted)
                {
                    from.PlaceInBackpack(i);
                }
            }

            foreach (Item i in delme)
            {
                if (!i.Deleted)
                {
                    m_Points += i.Amount;
                    i.Delete();
                }
            }
        }
Exemple #30
0
        public override void OnDoubleClick(Mobile from)
        {
            if (from.Blessed && from != m_Owner)
            {
                from.SendMessage("You cannot look through the corpse while in this state.");
            }
            else
            {
                if (from.Hidden && from is PlayerMobile && from.Skills[SkillName.Hiding].Value < Utility.RandomMinMax(1, 125))
                {
                    from.RevealingAction();
                }

                if (from is PlayerMobile && Weight > 0)
                {
                    CharacterDatabase DB = Server.Items.CharacterDatabase.GetDB(from);
                    int interfaces       = DB.Hue;

                    if (interfaces == 3)
                    {
                        Weight = 0.0;
                        GumpID = 10913;

                        List <Item> belongings = new List <Item>();
                        foreach (Item i in this.Items)
                        {
                            belongings.Add(i);
                        }
                        foreach (Item stuff in belongings)
                        {
                            BaseContainer.DropItemFix(stuff, from, 999999, GumpID);
                        }
                    }
                }
                Open(from, Core.AOS);
            }
        }
Exemple #31
0
        public override void Open(Mobile from)
        {
            if (this.Weight > 50)
            {
                int FillMeUpLevel = Utility.RandomList(5, 4, 4, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 1);

                if (GetPlayerInfo.LuckyPlayer(from.Luck))
                {
                    FillMeUpLevel = FillMeUpLevel + Utility.RandomMinMax(1, 2);
                }

                if (Utility.RandomBool())
                {
                    int[] list = new int[]
                    {
                        0xECA, 0xECB, 0xECC, 0xECD, 0xECE, 0xECF, 0xED0,
                        0xED1, 0xED2, 0x1B09, 0x1B0A, 0x1B0B, 0x1B0C,
                        0x1B0D, 0x1B0E, 0x1B0F, 0x1B10,
                    };

                    Item bones = new BodyPart(Utility.RandomList(list));
                    bones.Name = ContainerFunctions.GetOwner("BodySailor");
                    this.DropItem(bones);
                    BaseContainer.DropItemFix(bones, from, ItemID, GumpID);
                }

                ContainerFunctions.FillTheContainer(FillMeUpLevel, this, from);

                this.Weight = 5.0;
                LoggingFunctions.LogLoot(from, this.Name, "boat");
            }

            base.Open(from);

            Server.Items.CharacterDatabase.LootContainer(from, this);
        }
        public static int Announce(out int PlayerQuestsAnnounced)
        {
            PlayerQuestsAnnounced = 0;
            //LogHelper Logger = new LogHelper("PlayerQuest.log", false);
            int count = 0;

            try
            {
                int       msgndx       = 0;
                ArrayList ToDelete     = new ArrayList();
                ArrayList ParentMobile = new ArrayList();

                // clear any messages currently on the TC
                PlayerQuestManager.ClearAllMessages();

                // find expired
                foreach (object o in PlayerQuestManager.Deeds)
                {
                    if (o is PlayerQuestDeed == false)
                    {
                        continue;
                    }
                    PlayerQuestDeed pqd = o as PlayerQuestDeed;

                    if (pqd.Deleted == true)
                    {
                        ToDelete.Add(pqd);
                    }
                    else
                    {
                        object root = pqd.RootParent;
                        //bool exclude = false;
                        count++;

                        // don't announce an expired quest
                        if (pqd.Expired == true)
                        {
                            continue;
                        }

                        // don't announce if in a locked down container in a house
                        if (root is BaseContainer && Server.Multis.BaseHouse.FindHouseAt(pqd) != null)
                        {
                            BaseContainer bc = root as BaseContainer;
                            if (bc.IsLockedDown == true || bc.IsSecure == true)
                            {
                                continue;
                            }
                        }

                        // don't announce if locked down or secure
                        if (pqd.IsLockedDown == true || pqd.IsSecure == true)
                        {
                            continue;
                        }

                        // don't announce if on the internal map
                        if (pqd.Map == Map.Internal || root is Mobile && (root as Mobile).Map == Map.Internal)
                        {
                            continue;
                        }

                        // don't announce if in bankbox
                        if (root is Mobile && pqd.IsChildOf((root as Mobile).BankBox))
                        {
                            continue;
                        }

                        // only announce 1 ticket per mobile or container
                        // (15 tickets on a mob, or in a chest should generate 1 announcement)
                        if (root != null)
                        {
                            if (ParentMobile.Contains(root))
                            {
                                continue;
                            }
                        }

                        // only public houses
                        Server.Multis.BaseHouse house = null;
                        if (root is Item)
                        {
                            house = Server.Multis.BaseHouse.FindHouseAt(root as Item);
                        }
                        if (root is Mobile)
                        {
                            house = Server.Multis.BaseHouse.FindHouseAt(root as Mobile);
                        }
                        if (house != null && house.Public == false)
                        {
                            continue;
                        }

                        ///////////////////////////////////////////////////////
                        // okay announce it !
                        // record the parent
                        if (root != null)
                        {
                            ParentMobile.Add(root);
                        }

                        // format the message
                        string[] lines = new string[2];
                        if (root is Mobile)
                        {
                            Mobile mob = root as Mobile;
                            lines[0] = String.Format(
                                "{0} was last seen near {1}. {2} is not to be trusted.",
                                mob.Name,
                                BaseOverland.DescribeLocation(mob),
                                mob.Female == true ? "She" : "He");

                            lines[1] = String.Format(
                                "Do what you will with {0}, but get that quest ticket {1} carries.",
                                mob.Female == true ? "her" : "him",
                                mob.Female == true ? "she" : "he");
                        }
                        else
                        {
                            lines[0] = String.Format(
                                "A quest ticket was last seen near {0}",
                                BaseOverland.DescribeLocation(root == null ? pqd : root as Item));

                            lines[1] = String.Format(
                                "It may be of significant value, but be careful!");
                        }

                        // queue it
                        PlayerQuestManager.SetMessage(lines, msgndx++);

                        // count it
                        PlayerQuestsAnnounced++;
                    }

                    // record the expiring quest chest
                    //Logger.Log(LogType.Item, bc, "Player Quest prize being deleted because the quest has expired.");
                }

                // cleanup
                for (int i = 0; i < ToDelete.Count; i++)
                {
                    PlayerQuestDeed pqd = ToDelete[i] as PlayerQuestDeed;
                    if (pqd != null)
                    {
                        PlayerQuestManager.Deeds.Remove(pqd);
                    }
                }
            }
            catch (Exception e)
            {
                LogHelper.LogException(e);
                Console.WriteLine("Exception while running PlayerQuestManager.Announce() job");
                Console.WriteLine(e);
            }
            finally
            {
                //Logger.Finish();
            }

            return(count);
        }
 public ContainerRenamePrompt(BaseContainer cont)
 {
     this.Container = cont;
 }
Exemple #34
0
        public SunkenChest(int level, Mobile digger, int ancient) : base(0x455)
        {
            level = level + 4;
            if (level > 10)
            {
                level = 10;
            }

            ContainerFunctions.BuildContainer(this, 0, Utility.RandomList(1, 2), 0, 0);

            int xTraCash = Utility.RandomMinMax((level * 500), (level * 800));

            ContainerFunctions.AddGoldToContainer(xTraCash, this, 0, digger);

            if (level > 0)
            {
                ContainerFunctions.FillTheContainer(level, this, digger);
            }
            if (level > 3)
            {
                ContainerFunctions.FillTheContainer(level, this, digger);
            }
            if (level > 7)
            {
                ContainerFunctions.FillTheContainer(level, this, digger);
            }
            if (GetPlayerInfo.LuckyPlayer(digger.Luck))
            {
                ContainerFunctions.FillTheContainer(level, this, digger);
            }

            ContainerOwner  = ContainerFunctions.GetOwner("Sunken");
            ContainerDigger = digger.Name;

            Name = "sunken chest";

            // = ARTIFACTS
            int artychance = GetPlayerInfo.LuckyPlayerArtifacts(digger.Luck) + 10;

            if (Utility.RandomMinMax(0, 100) < ((level * 10) + artychance))
            {
                Item arty = ArtifactBuilder.CreateArtifact("random");
                switch (Utility.RandomMinMax(1, 20))
                {
                case 1: arty = ArtifactBuilder.CreateArtifact("driftwood");   break;

                case 2: arty = ArtifactBuilder.CreateArtifact("kelp");                break;

                case 3: arty = ArtifactBuilder.CreateArtifact("barnacle");    break;

                case 4: arty = ArtifactBuilder.CreateArtifact("neptune");             break;

                case 5: arty = ArtifactBuilder.CreateArtifact("bronzed");             break;
                }
                DropItem(arty);
                BaseContainer.DropItemFix(arty, digger, ItemID, GumpID);
            }

            int  giveRelics = level;
            Item relic      = Loot.RandomRelic();

            while (giveRelics > 0)
            {
                relic = Loot.RandomRelic();
                ContainerFunctions.RelicValueIncrease(level, relic);
                DropItem(relic);
                BaseContainer.DropItemFix(relic, digger, ItemID, GumpID);
                giveRelics = giveRelics - 1;
            }

            if (ancient > 0)
            {
                Name = "ancient sunken chest";
                Hue  = Utility.RandomList(0xB8E, 0xB8F, 0xB90, 0xB91, 0xB92, 0xB89, 0xB8B);
                Item net = new FabledFishingNet();
                DropItem(net);
                BaseContainer.DropItemFix(net, digger, ItemID, GumpID);
            }
            else
            {
                Item net = new FishingNet();
                if (Utility.RandomMinMax(1, 3) == 1)
                {
                    net = new SpecialFishingNet();
                }
                DropItem(net);
                BaseContainer.DropItemFix(net, digger, ItemID, GumpID);
                ItemID = Utility.RandomList(0x52E2, 0x52E3, 0x507E, 0x507F, 0x4910, 0x4911, 0x3332, 0x3333, 0x4FF4, 0x4FF5);
                Hue    = 0;
            }
        }
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();
			m_container = reader.ReadItem() as BaseContainer;
			m_expires = reader.ReadDateTime();
			m_PrizeID = reader.ReadInt();

			// okay, add deeds read from disk to our quest manager
			if (m_container != null && Expired == false)
				// when we deserialize we don't know the ordr in which the deeds will be read,
				//	so insure they are stored sorted.
				PlayerQuestManager.AddSorted(this);
			else
			{
				LogHelper Logger = new LogHelper("PlayerQuest.log", false);
				string temp;
				if (m_container == null)
					temp = String.Format("Orphaned Quest Deed({0}) loaded for nonexistent Chest(0x{1:X}).", this.Serial, m_PrizeID);
				else // Expired == true
					temp = String.Format("Expired Quest Deed({0}) loaded for (non)existent Chest(0x{1:X}).", this.Serial, m_PrizeID);
				Logger.Log(LogType.Text, temp);
				Logger.Finish();
			}
		}
			public RenamePrompt(Mobile from, BaseContainer container, SquareGraver graver)
			{
				m_from   = from;
				m_container = container;
				m_graver = graver;
			}
Exemple #37
0
        public override void OnDoubleClick(Mobile from)
        {
            if (from.Blessed)
            {
                from.SendMessage("You cannot look through that while in this state.");
            }
            else if (!from.InRange(GetWorldLocation(), 3))
            {
                from.SendMessage("You will have to get closer to it!");
            }
            else if (m_Uses < 5)
            {
                m_Uses++;
                if (Server.Misc.GetPlayerInfo.LuckyPlayer(from.Luck) && Utility.RandomBool())
                {
                    m_Uses--;
                }

                from.PlaySound(0x2E5);
                from.SendMessage("You pull something from the treasure hoard!");

                Item item = null;

                switch (Utility.Random(17))
                {
                case 0:
                    item = Loot.RandomArty();
                    break;

                case 1:
                    item = DungeonLoot.RandomSlayer();
                    break;

                case 2:
                    item = Loot.RandomSArty();
                    break;

                case 3:
                    if (Server.Misc.GetPlayerInfo.EvilPlay(from) == true && Utility.RandomMinMax(0, 10) == 10)
                    {
                        item = DungeonLoot.RandomEvil();
                    }
                    else
                    {
                        item = Loot.RandomRelic();
                        if (item is DDRelicWeapon && Server.Misc.GetPlayerInfo.OrientalPlay(from) == true)
                        {
                            Server.Items.DDRelicWeapon.MakeOriental(item);
                        }
                        else if (item is DDRelicStatue && Server.Misc.GetPlayerInfo.OrientalPlay(from) == true)
                        {
                            Server.Items.DDRelicStatue.MakeOriental(item);
                        }
                        else if (item is DDRelicBanner && item.ItemID != 0x2886 && item.ItemID != 0x2887 && Server.Misc.GetPlayerInfo.OrientalPlay(from) == true)
                        {
                            Server.Items.DDRelicBanner.MakeOriental(item);
                        }
                    }
                    break;

                case 4:
                    item = DungeonLoot.RandomRare();
                    if (item.Stackable == true)
                    {
                        item.Amount = Utility.RandomMinMax(5, 20);
                    }
                    break;

                case 5:
                    item = DungeonLoot.RandomLoreBooks();
                    break;

                case 6:
                    if (Utility.Random(4) != 1)
                    {
                        item = Loot.RandomScroll(0, 7, SpellbookType.Regular);
                    }
                    else
                    {
                        item = Loot.RandomScroll(0, 17, SpellbookType.Necromancer);
                    }
                    break;

                case 7:
                    int luckMod = from.Luck; if (luckMod > 2000)
                    {
                        luckMod = 2000;
                    }

                    if ((Region.Find(from.Location, from.Map)).IsPartOf("the Ancient Crash Site") ||
                        (Region.Find(from.Location, from.Map)).IsPartOf("the Ancient Sky Ship"))
                    {
                        item = new DDXormite((luckMod + Utility.RandomMinMax(333, 666)));
                    }
                    else if (Worlds.GetMyWorld(from.Map, from.Location, from.X, from.Y) == "the Mines of Morinia")
                    {
                        item = new Crystals((luckMod + Utility.RandomMinMax(200, 400)));
                    }
                    else if (Worlds.GetMyWorld(from.Map, from.Location, from.X, from.Y) == "the Underworld")
                    {
                        item = new DDJewels((luckMod + Utility.RandomMinMax(500, 1000)));
                    }
                    else
                    {
                        item = new Gold((luckMod + Utility.RandomMinMax(1000, 2000)));
                    }
                    break;

                case 8:
                case 9:
                case 10:
                case 11:
                    item = Loot.RandomArmorOrShieldOrWeaponOrJewelry(Server.LootPackEntry.IsInIslesDread(from));
                    ContainerFunctions.LootMutate(from, Server.LootPack.GetRegularLuckChance(from), item, from.Backpack, Utility.RandomMinMax(5, 10));
                    break;

                case 12:
                    item = Loot.RandomInstrument();

                    int attributeCount;
                    int min, max;
                    Server.Misc.ContainerFunctions.GetRandomAOSStats(out attributeCount, out min, out max, 6);

                    BaseInstrument instr = (BaseInstrument)item;

                    int cHue = 0;
                    int cUse = 0;

                    switch (instr.Resource)
                    {
                    case CraftResource.AshTree: cHue = MaterialInfo.GetMaterialColor("ash", "", 0); cUse = 20; break;

                    case CraftResource.CherryTree: cHue = MaterialInfo.GetMaterialColor("cherry", "", 0); cUse = 40; break;

                    case CraftResource.EbonyTree: cHue = MaterialInfo.GetMaterialColor("ebony", "", 0); cUse = 60; break;

                    case CraftResource.GoldenOakTree: cHue = MaterialInfo.GetMaterialColor("gold", "", 0); cUse = 80; break;

                    case CraftResource.HickoryTree: cHue = MaterialInfo.GetMaterialColor("hickory", "", 0); cUse = 100; break;

                    case CraftResource.MahoganyTree: cHue = MaterialInfo.GetMaterialColor("mahogany", "", 0); cUse = 120; break;

                    case CraftResource.DriftwoodTree: cHue = MaterialInfo.GetMaterialColor("driftwood", "", 0); cUse = 120; break;

                    case CraftResource.OakTree: cHue = MaterialInfo.GetMaterialColor("oak", "", 0); cUse = 140; break;

                    case CraftResource.PineTree: cHue = MaterialInfo.GetMaterialColor("pine", "", 0); cUse = 160; break;

                    case CraftResource.RosewoodTree: cHue = MaterialInfo.GetMaterialColor("rosewood", "", 0); cUse = 180; break;

                    case CraftResource.WalnutTree: cHue = MaterialInfo.GetMaterialColor("walnute", "", 0); cUse = 200; break;
                    }

                    if (!(Server.Misc.Worlds.IsOnSpaceship(from.Location, from.Map)))
                    {
                        if (cHue > 0)
                        {
                            item.Hue = cHue;
                        }
                        else if (Utility.RandomMinMax(1, 4) == 1)
                        {
                            item.Hue = Utility.RandomColor(0);
                        }
                        Server.Misc.MorphingTime.MakeOrientalItem(item, from);
                        item.Name = LootPackEntry.MagicItemName(item, from, Region.Find(from.Location, from.Map));
                    }
                    else
                    {
                        string newName = "odd alien";
                        switch (Utility.RandomMinMax(0, 6))
                        {
                        case 0: newName = "odd"; break;

                        case 1: newName = "unusual"; break;

                        case 2: newName = "bizarre"; break;

                        case 3: newName = "curious"; break;

                        case 4: newName = "peculiar"; break;

                        case 5: newName = "strange"; break;

                        case 6: newName = "weird"; break;
                        }

                        switch (Utility.RandomMinMax(1, 4))
                        {
                        case 1: item = new Pipes();             item.Name = newName + " " + Server.Misc.RandomThings.GetRandomAlienRace() + " pipes";           break;

                        case 2: item = new Pipes();             item.Name = newName + " " + Server.Misc.RandomThings.GetRandomAlienRace() + " pan flute";       break;

                        case 3: item = new Fiddle();    item.Name = newName + " " + Server.Misc.RandomThings.GetRandomAlienRace() + " violin";          break;

                        case 4: item = new Fiddle();    item.Name = newName + " " + Server.Misc.RandomThings.GetRandomAlienRace() + " fiddle";          break;
                        }

                        BaseInstrument lute = (BaseInstrument)item;
                        lute.Resource = CraftResource.None;

                        item.Hue = Utility.RandomColor(0);
                    }

                    instr.UsesRemaining = instr.UsesRemaining + cUse;

                    BaseRunicTool.ApplyAttributesTo((BaseInstrument)item, attributeCount, min, max);

                    SlayerName slayer = BaseRunicTool.GetRandomSlayer();

                    instr.Quality = InstrumentQuality.Regular;
                    if (Utility.RandomMinMax(1, 4) == 1)
                    {
                        instr.Quality = InstrumentQuality.Exceptional;
                    }

                    if (Utility.RandomMinMax(1, 4) == 1)
                    {
                        instr.Slayer = slayer;
                    }

                    break;

                case 13:
                    item = Loot.RandomGem();
                    break;

                case 14:
                    item = Loot.RandomPotion();
                    break;

                case 15:
                    item = Loot.RandomWand(); Server.Misc.MaterialInfo.ColorMetal(item, 0); string wandOwner = ""; if (Utility.RandomMinMax(1, 3) == 1)
                    {
                        wandOwner = Server.LootPackEntry.MagicWandOwner() + " ";
                    }
                    item.Name = wandOwner + item.Name;
                    break;

                case 16:
                    m_Uses = 6;                             // STOP GIVING LOOT WHEN THEY GET A CONTAINER
                    int chestLuck = Server.Misc.GetPlayerInfo.LuckyPlayerArtifacts(from.Luck);
                    if (chestLuck < 3)
                    {
                        chestLuck = 3;
                    }
                    if (chestLuck > 8)
                    {
                        chestLuck = 8;
                    }
                    item        = new LootChest(Utility.RandomMinMax(3, chestLuck));
                    item.ItemID = Utility.RandomList(0x9AB, 0xE40, 0xE41, 0xE7C);
                    item.Hue    = Utility.RandomList(0x961, 0x962, 0x963, 0x964, 0x965, 0x966, 0x967, 0x968, 0x969, 0x96A, 0x96B, 0x96C, 0x96D, 0x96E, 0x96F, 0x970, 0x971, 0x972, 0x973, 0x974, 0x975, 0x976, 0x977, 0x978, 0x979, 0x97A, 0x97B, 0x97C, 0x97D, 0x97E, 0x4AA);

                    Region reg = Region.Find(from.Location, from.Map);

                    string box = "hoard chest";
                    switch (Utility.RandomMinMax(0, 7))
                    {
                    case 0: box = "hoard chest";            break;

                    case 1: box = "treasure chest";         break;

                    case 2: box = "secret chest";           break;

                    case 3: box = "fabled chest";           break;

                    case 4: box = "legendary chest";        break;

                    case 5: box = "mythical chest";         break;

                    case 6: box = "lost chest";                     break;

                    case 7: box = "stolen chest";           break;
                    }

                    if (Server.Misc.Worlds.IsOnSpaceship(from.Location, from.Map))
                    {
                        Server.Misc.ContainerFunctions.MakeSpaceCrate(((LockableContainer)item));
                        box = item.Name;
                    }

                    switch (Utility.RandomMinMax(0, 1))
                    {
                    case 0: item.Name = box + " from " + Server.Misc.Worlds.GetRegionName(from.Map, from.Location);       break;

                    case 1: item.Name = box + " of " + HoardName;   break;
                    }
                    int xTraCash = Utility.RandomMinMax(5000, 8000);

                    int zone = 0;
                    if (Worlds.IsOnSpaceship(from.Location, from.Map))
                    {
                        zone = 1;
                    }
                    else if (Worlds.GetMyWorld(from.Map, from.Location, from.X, from.Y) == "the Underworld")
                    {
                        zone = 2;
                    }

                    ContainerFunctions.AddGoldToContainer(xTraCash, (LootChest)item, zone, from);
                    int artychance = GetPlayerInfo.LuckyPlayerArtifacts(from.Luck) + 10;
                    if (Utility.RandomMinMax(0, 100) < artychance)
                    {
                        Item artys = Loot.RandomArty(); ((LootChest)item).DropItem(artys); BaseContainer.DropItemFix(artys, from, ((LootChest)item).ItemID, ((LootChest)item).GumpID);
                    }
                    break;
                }

                if (item != null)
                {
                    if (Worlds.IsOnSpaceship(from.Location, from.Map))
                    {
                        Server.Misc.MorphingTime.MakeSpaceAceItem(item, from);
                    }

                    if (item is Container)
                    {
                        item.MoveToWorld(from.Location, from.Map);
                    }
                    else
                    {
                        from.AddToBackpack(item);
                    }
                }
                else
                {
                    if (Worlds.IsOnSpaceship(from.Location, from.Map))
                    {
                        item = new DDXormite((from.Luck + Utility.RandomMinMax(333, 666)));
                    }
                    else if (Worlds.GetMyWorld(from.Map, from.Location, from.X, from.Y) == "the Underworld")
                    {
                        item = new DDJewels((from.Luck + Utility.RandomMinMax(500, 1000)));
                    }
                    else
                    {
                        item = new Gold((from.Luck + Utility.RandomMinMax(1000, 2000)));
                    }
                    if (item != null)
                    {
                        from.AddToBackpack(item);
                    }
                }
            }
            else
            {
                from.SendMessage("There is nothing else worth taking from this pile!");
                this.Delete();
            }
        }
 public ContainerRenameEntry( Mobile from, BaseContainer cont )
     : base(5104)
 {
     m_From = from;
     i_Cont = cont;
 }
Exemple #39
0
		public ReagentStackPrompt( BaseContainer cont )
		{
			m_Container = cont;
		}
            protected override void OnTarget( Mobile from, object targeted )
			{
				if ( targeted is BaseContainer )
				{
					m_engtarg = (BaseContainer)targeted;

					if ( !from.InRange( m_Engraver.GetWorldLocation(), 2 ) || !from.InRange( m_engtarg.GetWorldLocation(), 2 ) )
							from.SendLocalizedMessage( 500446 ); // That is too far away.
					else if ( m_engtarg.Parent == null )
								{
									BaseHouse house = BaseHouse.FindHouseAt( m_engtarg );

									if ( house == null || !house.IsSecure( m_engtarg ) )
										from.SendMessage( "You must Secure your container before you can Engrave it." );

									else if ( !house.IsCoOwner( from ) )
										from.SendLocalizedMessage( 501023 ); // You must be the owner to use this item.

									else
										{
											from.Prompt = new RenameContPrompt( m_engtarg );
											from.SendMessage( "What would you like to engrave on the container ?" );
										        m_Engraver.Charges = ( m_Engraver.Charges - 1 );
						                                        from.SendMessage( "You use your Engraver. You now have {0} uses left.", m_Engraver.Charges );

						                                        if ( m_Engraver.Charges == 0 )
						                                        {
							                                     from.SendMessage( "You have ran out of uses, the Engraver has been removed." );
							                                      m_Engraver.Delete();

                                                                                        }
                                                                                }
								}
				}
				else
				{
					from.SendMessage( "You cannot engrave that." );
				}

			}
 public ContainerRenameEntry(Mobile mob, BaseContainer cont)
     : base(5104)
 {
     this.Mobile = mob;
     this.Container = cont;
 }
        private static void MakeCopy(Item toCopy, ref List<Item> itemList, BaseContainer parentCont)
        {
            Item newItem = null;
            

            try
            {
                newItem = (Item) Activator.CreateInstance(toCopy.GetType());
            }
            catch
            {
                Console.WriteLine("SupplySystem error, cannot create {0}, no parameterless constructor defined?", toCopy.GetType());
            }

            if (newItem == null)
                return;

            //Copy all the "item" related properties
            CopyBaseProperties(toCopy, newItem);

            if (newItem is Container)
            {
                Container newContainer = ((Container)newItem);

                // If a container gets duplicated it needs to get emptied.
                // ("BagOfReagents" problem, items which create content in the constructors have unwanted
                // contents after duping under certain circumstances.)
                Item[] found;

                //Delete all the items from the constructor
                found = newContainer.FindItemsByType(typeof(Item), false);
                for (int j = 0; j < found.Length; j++)
                    found[j].Delete();

                //Add the items from the orginal bag.
                found = ((Container)toCopy).FindItemsByType(typeof(Item), false);
                for (int i = 0; i < found.Length; i++)
                    MakeCopy(found[i], ref itemList, (BaseContainer)newItem);

            }
            else if (newItem is BaseWeapon)
                CopyProperties((BaseWeapon)toCopy, (BaseWeapon)newItem);
            else if (newItem is BaseArmor)
                CopyProperties((BaseArmor)toCopy, (BaseArmor)newItem);
            else if (newItem is BaseClothing)
                CopyProperties((BaseClothing)toCopy, (BaseClothing)newItem);
            else if (toCopy is Spellbook && newItem is Spellbook)
            {
                Spellbook bookToCopy = toCopy as Spellbook;
                Spellbook newBook = newItem as Spellbook;

                newBook.Content = bookToCopy.Content;
            }

            if (parentCont != null)
                parentCont.DropItem(newItem);

            itemList.Add(newItem);

        }
 public NameContainerPrompt( BaseContainer container )
 {
     m_Container = container;
 }
		public abstract void AddContents( BaseContainer cont, Mobile creature, out int contentValue );
Exemple #45
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Bag.Deleted)
                {
                    return;
                }

                if (from.Region.IsPartOf(typeof(Regions.Jail)))
                {
                    from.SendMessage("You may not do that in jail.");
                }
                else if (!m_Bag.IsChildOf(from.Backpack))
                {
                    MessageHelper.SendLocalizedMessageTo(m_Bag, from, 1062334, 0x59);                     // The bag of sending must be in your backpack. 1054107 is gone from client, using generic response
                }
                else if (m_Bag.Charges == 0)
                {
                    MessageHelper.SendLocalizedMessageTo(m_Bag, from, 1042544, 0x59);                       // This item is out of charges.
                }
                else if (targeted is Item)
                {
                    Item item       = (Item)targeted;
                    int  reqCharges = (int)Math.Max(1, Math.Ceiling(item.TotalWeight / 10.0));

                    if (!item.IsChildOf(from.Backpack))
                    {
                        MessageHelper.SendLocalizedMessageTo(m_Bag, from, 1054152, 0x59);                         // You may only send items from your backpack to your bank box.
                    }
                    else if (item is BagOfSending || item is Container)
                    {
                        from.Send(new AsciiMessage(m_Bag.Serial, m_Bag.ItemID, MessageType.Regular, 0x3B2, 3, "", "You cannot send a container through the bag of sending."));
                    }
                    else if (item.LootType == LootType.Cursed)
                    {
                        MessageHelper.SendLocalizedMessageTo(m_Bag, from, 1054108, 0x59);                           // The bag of sending rejects the cursed item.
                    }
                    else if (!item.VerifyMove(from) || item is Server.Engines.Quests.QuestItem)
                    {
                        MessageHelper.SendLocalizedMessageTo(m_Bag, from, 1054109, 0x59);                           // The bag of sending rejects that item.
                    }
                    else if (Spells.SpellHelper.IsDoomGauntlet(from.Map, from.Location))
                    {
                        from.SendLocalizedMessage(1062089);                           // You cannot use that here.
                    }
                    else if (!from.BankBox.TryDropItem(from, item, false))
                    {
                        BaseContainer.DropItemFix(item, from, from.BankBox.ItemID, from.BankBox.GumpID);
                        MessageHelper.SendLocalizedMessageTo(m_Bag, from, 1054110, 0x59);                           // Your bank box is full.
                    }
                    else if (Core.ML && reqCharges > m_Bag.Charges)
                    {
                        from.SendLocalizedMessage(1079932);                           //You don't have enough charges to send that much weight
                    }
                    else
                    {
                        m_Bag.Charges -= (Core.ML ? reqCharges : 1);

                        MessageHelper.SendLocalizedMessageTo(m_Bag, from, 1054150, 0x59);                           // The item was placed in your bank box.
                    }
                }
            }
 public ContainerRenamePrompt( Mobile m, BaseContainer cont )
 {
     m_Mobile = m;
     i_Cont = cont;
 }
		public MoveReagentsTarget( BaseContainer cont, int amount ) : base( 10, true, TargetFlags.None )
		{
			m_Container = cont;
			m_Amount = amount;
		}
Exemple #48
0
		public ReagentMoveEntry( Mobile from, BaseContainer cont ) : base( 10066 )
		{
			m_From = from;
			m_Container = cont;
		}
		public RenameContPrompt( BaseContainer rcont )
		{
			m_engtarg = rcont;
		}
 //Inscribe
 public NameContainerEntry( Mobile from, BaseContainer container)
     : base(6175)
 {
     m_From = from;
     m_Container = container;
 }