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

            if (house != null && house.HasSecureAccess(from, SecureLevel.Friends))
            {
                switch (m_CartType)
                {
                case MiningCartType.OreSouth:
                case MiningCartType.OreEast:
                    if (m_Ore > 0)
                    {
                        Item ingots = null;

                        switch (Utility.Random(9))
                        {
                        case 0: ingots = new IronIngot(); break;

                        case 1: ingots = new DullCopperIngot(); break;

                        case 2: ingots = new ShadowIronIngot(); break;

                        case 3: ingots = new CopperIngot(); break;

                        case 4: ingots = new BronzeIngot(); break;

                        case 5: ingots = new GoldIngot(); break;

                        case 6: ingots = new AgapiteIngot(); break;

                        case 7: ingots = new VeriteIngot(); break;

                        case 8: ingots = new ValoriteIngot(); break;
                        }

                        int amount = Math.Min(10, m_Ore);
                        ingots.Amount = amount;

                        if (!from.PlaceInBackpack(ingots))
                        {
                            ingots.Delete();
                            from.SendLocalizedMessage(1078837);                                       // Your backpack is full! Please make room and try again.
                        }
                        else
                        {
                            PublicOverheadMessage(MessageType.Regular, 0, 1094724, amount.ToString());                                      // Ore: ~1_COUNT~
                            m_Ore -= amount;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1094725);                                   // There are no more resources available at this time.
                    }
                    break;

                case MiningCartType.GemSouth:
                case MiningCartType.GemEast:
                    if (m_Gems > 0)
                    {
                        Item gems = null;

                        switch (Utility.Random(17))
                        {
                        case 0: gems = new Amber(); break;

                        case 1: gems = new Amethyst(); break;

                        case 2: gems = new Citrine(); break;

                        case 3: gems = new Diamond(); break;

                        case 4: gems = new Emerald(); break;

                        case 5: gems = new Ruby(); break;

                        case 6: gems = new Sapphire(); break;

                        case 7: gems = new StarSapphire(); break;

                        case 8: gems = new Tourmaline(); break;

                        // Mondain's Legacy gems
                        case 9: gems = new PerfectEmerald(); break;

                        case 10: gems = new DarkSapphire(); break;

                        case 11: gems = new Turquoise(); break;

                        case 12: gems = new EcruCitrine(); break;

                        case 13: gems = new WhitePearl(); break;

                        case 14: gems = new FireRuby(); break;

                        case 15: gems = new BlueDiamond(); break;

                        case 16: gems = new BrilliantAmber(); break;
                        }

                        int amount = Math.Min(5, m_Gems);
                        gems.Amount = amount;

                        if (!from.PlaceInBackpack(gems))
                        {
                            gems.Delete();
                            from.SendLocalizedMessage(1078837);                                       // Your backpack is full! Please make room and try again.
                        }
                        else
                        {
                            PublicOverheadMessage(MessageType.Regular, 0, 1094723, amount.ToString());                                       // Gems: ~1_COUNT~
                            m_Gems -= amount;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1094725);                                   // There are no more resources available at this time.
                    }
                    break;
                }
            }
            else
            {
                from.SendLocalizedMessage(1061637);                   // You are not allowed to access this.
            }
        }
Example #2
0
        public override void OnComponentUsed(AddonComponent c, Mobile from)
        {
            BaseHouse house = BaseHouse.FindHouseAt(this);

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

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

                        switch (Utility.Random(9))
                        {
                        case 0:
                            ingots = new IronIngot();
                            break;

                        case 1:
                            ingots = new DullCopperIngot();
                            break;

                        case 2:
                            ingots = new ShadowIronIngot();
                            break;

                        case 3:
                            ingots = new CopperIngot();
                            break;

                        case 4:
                            ingots = new BronzeIngot();
                            break;

                        case 5:
                            ingots = new GoldIngot();
                            break;

                        case 6:
                            ingots = new AgapiteIngot();
                            break;

                        case 7:
                            ingots = new VeriteIngot();
                            break;

                        case 8:
                            ingots = new ValoriteIngot();
                            break;
                        }

                        int amount = Math.Min(10, m_Ore);
                        ingots.Amount = amount;

                        if (!from.PlaceInBackpack(ingots))
                        {
                            ingots.Delete();
                            from.SendLocalizedMessage(1078837);     // Your backpack is full! Please make room and try again.
                        }
                        else
                        {
                            PublicOverheadMessage(MessageType.Regular, 0, 1094724, amount.ToString());     // Ore: ~1_COUNT~
                            m_Ore -= amount;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1094725);     // There are no more resources available at this time.
                    }
                    break;

                case MiningCartType.GemSouth:
                case MiningCartType.GemEast:
                    if (m_Gems > 0)
                    {
                        Item gems = null;

                        switch (Utility.Random(15))
                        {
                        case 0:
                            gems = new Amber();
                            break;

                        case 1:
                            gems = new Amethyst();
                            break;

                        case 2:
                            gems = new Citrine();
                            break;

                        case 3:
                            gems = new Diamond();
                            break;

                        case 4:
                            gems = new Emerald();
                            break;

                        case 5:
                            gems = new Ruby();
                            break;

                        case 6:
                            gems = new Sapphire();
                            break;

                        case 7:
                            gems = new StarSapphire();
                            break;

                        case 8:
                            gems = new Tourmaline();
                            break;

                        // Mondain's Legacy gems
                        case 9:
                            gems = new PerfectEmerald();
                            break;

                        case 10:
                            gems = new DarkSapphire();
                            break;

                        case 11:
                            gems = new Turquoise();
                            break;

                        case 12:
                            gems = new EcruCitrine();
                            break;

                        case 13:
                            gems = new FireRuby();
                            break;

                        case 14:
                            gems = new BlueDiamond();
                            break;
                        }

                        int amount = Math.Min(5, m_Gems);
                        gems.Amount = amount;

                        if (!from.PlaceInBackpack(gems))
                        {
                            gems.Delete();
                            from.SendLocalizedMessage(1078837);     // Your backpack is full! Please make room and try again.
                        }
                        else
                        {
                            PublicOverheadMessage(MessageType.Regular, 0, 1094723, amount.ToString());     // Gems: ~1_COUNT~
                            m_Gems -= amount;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1094725);     // There are no more resources available at this time.
                    }
                    break;
                }
            }
            else
            {
                from.SendLocalizedMessage(1061637); // You are not allowed to access
            }
        }
Example #3
0
		public override void OnComponentUsed( AddonComponent c, Mobile from )
		{
			BaseHouse house = BaseHouse.FindHouseAt( this );

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

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

							switch ( Utility.Random( 9 ) )
							{
								case 0: ingots = new IronIngot(); break;
								case 1: ingots = new DullcopperIngot(); break;
								case 2: ingots = new ShadowIngot(); break;
								case 3: ingots = new CopperIngot(); break;
								case 4: ingots = new BronzeIngot(); break;
								case 5: ingots = new GoldIngot(); break;
								case 6: ingots = new AgapiteIngot(); break;
								case 7: ingots = new VeriteIngot(); break;
								case 8: ingots = new ValoriteIngot(); break;
							}

							int amount = Math.Min( 10, m_Ore );
							ingots.Amount = amount;

							if ( !from.PlaceInBackpack( ingots ) )
							{
								ingots.Delete();
								from.SendLocalizedMessage( 1078837 ); // Your backpack is full! Please make room and try again.
							}
							else
							{
								PublicOverheadMessage(MessageType.Regular, 0, 1094724, amount.ToString() ); // Ore: ~1_COUNT~
								m_Ore -= amount;
							}
						}
						else
							from.SendLocalizedMessage( 1094725 ); // There are no more resources available at this time.

						break;
					case MiningCartType.GemSouth:
					case MiningCartType.GemEast:
						if ( m_Gems > 0 )
						{
							Item gems = null;

							switch ( Utility.Random( 15 ) )
							{
								case 0: gems = new Amber(); break;
								case 1: gems = new Amethyst(); break;
								case 2: gems = new Citrine(); break;
								case 3: gems = new Diamond(); break;
								case 4: gems = new Emerald(); break;
								case 5: gems = new Ruby(); break;
								case 6: gems = new Sapphire(); break;
								case 7: gems = new StarSapphire(); break;
								case 8: gems = new Tourmaline(); break;

								// Mondain's Legacy gems
								case 9: gems = new PerfectEmerald(); break;
								case 10: gems = new DarkSapphire(); break;
								case 11: gems = new Turquoise(); break;
								case 12: gems = new EcruCitrine(); break;
								case 13: gems = new FireRuby(); break;
								case 14: gems = new BlueDiamond(); break;
							}

							int amount = Math.Min( 5, m_Gems );
							gems.Amount = amount;

							if ( !from.PlaceInBackpack( gems ) )
							{
								gems.Delete();
								from.SendLocalizedMessage( 1078837 ); // Your backpack is full! Please make room and try again.
							}
							else
							{
								PublicOverheadMessage( MessageType.Regular, 0, 1094723, amount.ToString() ); // Gems: ~1_COUNT~
								m_Gems -= amount;
							}
						}
						else
							from.SendLocalizedMessage( 1094725 ); // There are no more resources available at this time.

						break;
				}
			}
			else
				from.SendLocalizedMessage( 1061637 ); // You are not allowed to access this.
		}
Example #4
0
        public override bool Give( Mobile m, Item item, bool placeAtFeet )
        {
            PlayerMobile pm = m as PlayerMobile;

            if( m is PlayerMobile )
            {
                pm.Crafting = true;
                LevelSystem.AwardMinimumXP( pm, 1 );
                pm.Crafting = false;
                Item controller = null;
                CopperOre ore = new CopperOre();

                if( pm.UniqueSpot != null )
                {
                    if( World.FindItem( pm.UniqueSpot.Serial ) != null )
                    {
                        controller = World.FindItem( pm.UniqueSpot.Serial );

                        if( controller is ResourceController && pm.InRange( controller, ( (ResourceController)controller ).Range ) )
                        {
                            ResourceController rescontroller = controller as ResourceController;
                            double chance = 0;

                            switch( rescontroller.Intensity )
                            {
                                case VeinIntensity.Low: chance = 4; break;
                                case VeinIntensity.Average: chance = 6; break;
                                case VeinIntensity.Full: chance = 8; break;
                            }

                            if( chance >= Utility.RandomMinMax( 1, 100 ) )
                            {
                                if( m.AccessLevel > AccessLevel.Player )
                                    m.SendMessage( "Debug message: resource controller activated." );

                                switch( rescontroller.ControlledResource )
                                {
                                    case ControlledResource.Copper: item = ore; break;

                                    case ControlledResource.Tin:
                                    {
                                        TinOre newore = new TinOre();
                                        item = newore;
                                        break;
                                    }

                                    case ControlledResource.Iron:
                                    {
                                        if( pm.Skills[SkillName.Mining].Base >= 80 )
                                        {
                                            IronOre newore = new IronOre();
                                            item = newore;
                                        }
                                        break;
                                    }

                                    case ControlledResource.Obsidian:
                                    {
                                        ObsidianIngot newore = new ObsidianIngot();
                                        item = newore;
                                        item.Amount = 5;
                                        break;
                                    }

                                    case ControlledResource.Silver:
                                    {
                                        if( pm.Skills[SkillName.Mining].Base >= 85 )
                                        {
                                            SilverOre newore = new SilverOre();
                                            item = newore;
                                        }
                                        break;
                                    }

                                    case ControlledResource.Gold:
                                    {
                                        if( pm.Skills[SkillName.Mining].Base >= 95 )
                                        {
                                            GoldOre newore = new GoldOre();
                                            item = newore;
                                        }
                                        break;
                                    }

                                    case ControlledResource.Citrine:
                                    {
                                        if( pm.Skills[SkillName.Mining].Base >= 80 )
                                        {
                                            Citrine gem = new Citrine();
                                            item = gem;
                                        }
                                        break;
                                    }

                                    case ControlledResource.Tourmaline:
                                    {
                                        if( pm.Skills[SkillName.Mining].Base >= 80 )
                                        {
                                            Tourmaline gem = new Tourmaline();
                                            item = gem;
                                        }
                                        break;
                                    }

                                    case ControlledResource.Amethyst:
                                    {
                                        if( pm.Skills[SkillName.Mining].Base >= 90 )
                                        {
                                            Amethyst gem = new Amethyst();
                                            item = gem;
                                        }
                                        break;
                                    }

                                    case ControlledResource.Emerald:
                                    {
                                        if( pm.Skills[SkillName.Mining].Base >= 90 )
                                        {
                                            Emerald gem = new Emerald();
                                            item = gem;
                                        }
                                        break;
                                    }

                                    case ControlledResource.Ruby:
                                    {
                                        if( pm.Skills[SkillName.Mining].Base >= 90 )
                                        {
                                            Ruby gem = new Ruby();
                                            item = gem;
                                        }
                                        break;
                                    }

                                    case ControlledResource.Sapphire:
                                    {
                                        if( pm.Skills[SkillName.Mining].Base >= 85 )
                                        {
                                            Sapphire gem = new Sapphire();
                                            item = gem;
                                        }
                                        break;
                                    }

                                    case ControlledResource.StarSapphire:
                                    {
                                        if( pm.Skills[SkillName.Mining].Base >= 95 )
                                        {
                                            StarSapphire gem = new StarSapphire();
                                            item = gem;
                                        }
                                        break;
                                    }

                                    case ControlledResource.Diamond:
                                    {
                                        if( pm.Skills[SkillName.Mining].Base >= 95 )
                                        {
                                            Diamond gem = new Diamond();
                                            item = gem;
                                        }
                                        break;
                                    }

                                    case ControlledResource.Coal:
                                    {
                                        if( pm.Feats.GetFeatLevel( FeatList.Sculptor ) > 0 )
                                        {
                                            Coal coal = new Coal();
                                            item = coal;
                                        }
                                        break;
                                    }

                                    case ControlledResource.Cinnabar:
                                    {
                                        if (pm.Feats.GetFeatLevel(FeatList.GemHarvesting) > 2)
                                        {
                                            Cinnabar cinnabar = new Cinnabar();
                                            item = cinnabar;
                                        }
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }

                if( item is Citrine || item is Tourmaline || item is Amethyst )
                {
                    if( pm.Feats.GetFeatLevel(FeatList.GemHarvesting) < 1 || !pm.GemHarvesting)
                        item = ore;
                }

                else if( item is Emerald || item is Ruby || item is Sapphire )
                {
                    if( pm.Feats.GetFeatLevel(FeatList.GemHarvesting) < 2 )
                        item = ore;

                    if( !pm.GemHarvesting )
                    {
                        TinOre tin = new TinOre();
                        item = tin;
                    }
                }

                else if( item is StarSapphire || item is Diamond || item is Cinnabar)
                {
                    if( pm.Feats.GetFeatLevel(FeatList.GemHarvesting) < 3 )
                        item = ore;

                    if( !pm.GemHarvesting )
                    {
                        IronOre iron = new IronOre();
                        item = iron;
                    }
                }

                else if( item is ObsidianIngot && pm.Feats.GetFeatLevel(FeatList.Obsidian) < 1 )
                    item = ore;
            }

            if( m is PlayerMobile && pm.Feats.GetFeatLevel(FeatList.GemHarvesting) > 0 && pm.GemHarvesting && item is CopperOre && Utility.RandomMinMax( 1, 100 ) > 95 )
            {
                int roll = Utility.RandomMinMax( 1, 100 );
                if (roll > 95 && pm.Feats.GetFeatLevel(FeatList.GemHarvesting) > 2)
                    item = new Cinnabar();
                if( roll > 90 && pm.Feats.GetFeatLevel(FeatList.GemHarvesting) > 2)
                    item = new Diamond();
                else if( roll > 80 && pm.Feats.GetFeatLevel(FeatList.GemHarvesting) > 2 )
                    item = new StarSapphire();
                else if( roll > 70 && pm.Feats.GetFeatLevel(FeatList.GemHarvesting) > 1 )
                    item = new Ruby();
                else if( roll > 59 && pm.Feats.GetFeatLevel(FeatList.GemHarvesting) > 1 )
                    item = new Emerald();
                else if( roll > 48 && pm.Feats.GetFeatLevel(FeatList.GemHarvesting) > 1 )
                    item = new Sapphire();
                else if( roll > 37 )
                    item = new Amethyst();
                else if( roll > 20 )
                    item = new Tourmaline();
                else
                    item = new Citrine();
            }

            string orename = "some copper ore";

            if( item is TinOre )
                orename = "some tin ore";

            else if( item is IronOre )
                orename = "some iron ore";

            else if( item is ObsidianIngot )
                orename = "some obsidian";

            else if( item is SilverOre )
                orename = "some silver ore";

            else if( item is GoldOre )
                orename = "some gold ore";

            else if( item is Citrine )
                orename = "a citrine";

            else if( item is Tourmaline )
                orename = "a tourmaline";

            else if( item is Emerald )
                orename = "an emerald";

            else if( item is Amethyst )
                orename = "an amethyst";

            else if( item is Ruby )
                orename = "a ruby";

            else if( item is Sapphire )
                orename = "a sapphire";

            else if( item is StarSapphire )
                orename = "a star sapphire";

            else if( item is Diamond )
                orename = "a diamond";

            else if( item is Sand )
                orename = "some sand";

            else if( item is Coal )
                orename = "some coal";

            m.SendMessage( "You dig " + orename + " and put it in your backpack." );

            if ( m.PlaceInBackpack( item ) )
                return true;

            if ( !placeAtFeet )
                return false;

            Map map = m.Map;

            if ( map == null )
                return false;

            ArrayList atFeet = new ArrayList();

            foreach ( Item obj in m.GetItemsInRange( 0 ) )
                atFeet.Add( obj );

            for ( int i = 0; i < atFeet.Count; ++i )
            {
                Item check = (Item)atFeet[i];

                if ( check.StackWith( m, item, false ) )
                    return true;
            }

            item.MoveToWorld( m.Location, map );
            return true;
        }
            public override void OnClick()
            {
                if (m_From.InRange(m_Fountain.GetWorldLocation(), 4))
                {
                    if (m_From.Backpack.ConsumeTotal(typeof(Gold), 1))
                    {
                        m_Fountain.Jackpot++;

                        switch (m_Fountain.MessageNum)
                        {
                        case MagicFountainAddon.FountainMessage.Cool: {
                            if (0.001 > Utility.RandomDouble())
                            {
                                Gold gold = new Gold();
                                gold.Amount = m_Fountain.Jackpot;                                         // no need to test, it's always at least 1

                                if (!m_From.AddToBackpack(gold))
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain! But you can't hold it! You accidentally drop it back in the fountain, where it vanishes.");
                                    gold.Delete();
                                }
                                else
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain!");
                                    m_Fountain.Jackpot = 0;
                                }
                            }
                            else if (0.001 > Utility.RandomDouble())
                            {
                                Gold gold = new Gold();
                                gold.Amount = m_Fountain.Jackpot;                                         // no need to test, it's always at least 1

                                if (!m_From.AddToBackpack(gold))
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain! But you can't hold it! You accidentally drop it back in the fountain, where it vanishes.");
                                    gold.Delete();
                                }
                                else
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain!");
                                    m_Fountain.Jackpot = 0;
                                }
                            }
                            else
                            {
                                m_From.SendMessage("You toss a coin in ... but nothing happens.");
                            }

                            break;
                        }


                        case MagicFountainAddon.FountainMessage.Warm: {
                            if (0.01 > Utility.RandomDouble())
                            {
                                Item item = null;

                                switch (Utility.RandomMinMax(1, 10))
                                {
                                case 1:  item = new TinkerTools();                              break;

                                case 2:  item = new Lockpick(3);                                break;

                                case 3:  item = new Pitchfork();                                break;

                                case 4:  item = new Dagger();                                   break;

                                case 5:  item = new Emerald();                                  break;

                                case 6:  item = new Ruby();                                     break;

                                case 7:  item = new Amber();                                    break;

                                case 8:  item = new Server.Engines.Mahjong.MahjongGame();       break;

                                case 9:  item = new SewingKit();                                break;

                                case 10: item = new SmithHammer();                              break;
                                }

                                if (!m_From.AddToBackpack(item))
                                {
                                    m_From.SendMessage("You toss a coin in ... and an item appears! But you can't hold it! You accidentally drop it back in the fountain, where it vanishes.");
                                    item.Delete();
                                }
                                else
                                {
                                    m_From.SendMessage("You toss a coin in ... and an item appears!");

                                    if (m_Fountain.Jackpot > 10)
                                    {
                                        m_Fountain.Jackpot = m_Fountain.Jackpot - 5;
                                    }
                                }
                            }
                            else if (0.001 > Utility.RandomDouble())
                            {
                                Gold gold = new Gold();
                                gold.Amount = m_Fountain.Jackpot;                                         // no need to test, it's always at least 1

                                if (!m_From.AddToBackpack(gold))
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain! But you can't hold it! You accidentally drop it back in the fountain, where it vanishes.");
                                    gold.Delete();
                                }
                                else
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain!");
                                    m_Fountain.Jackpot = 0;
                                }
                            }
                            else
                            {
                                m_From.SendMessage("You toss a coin in ... but nothing happens.");
                            }

                            break;
                        }


                        case MagicFountainAddon.FountainMessage.Clean: {
                            if (0.05 > Utility.RandomDouble())
                            {
                                Item food = null;

                                switch (Utility.RandomMinMax(1, 10))
                                {
                                case 1:  food = new Bacon();            break;

                                case 2:  food = new CookedBird();       break;

                                case 3:  food = new Ham();                      break;

                                case 4:  food = new Ribs();                     break;

                                case 5:  food = new Sausage();          break;

                                case 6:  food = new Cookies();          break;

                                case 7:  food = new Muffins(3);         break;

                                case 8:  food = new ApplePie();         break;

                                case 9:  food = new PeachCobbler();             break;

                                case 10: food = new Lime();             break;
                                }

                                if (!m_From.AddToBackpack(food))
                                {
                                    m_From.SendMessage("You toss a coin in ... and food appears! But you can't hold it! You accidentally drop it back in the fountain, where it vanishes.");
                                    food.Delete();
                                }
                                else
                                {
                                    m_From.SendMessage("You toss a coin in ... and food appears!");

                                    if (m_Fountain.Jackpot > 10)
                                    {
                                        m_Fountain.Jackpot = m_Fountain.Jackpot - 5;
                                    }
                                }
                            }
                            else if (0.001 > Utility.RandomDouble())
                            {
                                Gold gold = new Gold();
                                gold.Amount = m_Fountain.Jackpot;                                         // no need to test, it's always at least 1

                                if (!m_From.AddToBackpack(gold))
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain! But you can't hold it! You accidentally drop it back in the fountain, where it vanishes.");
                                    gold.Delete();
                                }
                                else
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain!");
                                    m_Fountain.Jackpot = 0;
                                }
                            }
                            else
                            {
                                m_From.SendMessage("You toss a coin in ... but nothing happens.");
                            }

                            break;
                        }

                        case MagicFountainAddon.FountainMessage.Calm: {
                            if (0.005 > Utility.RandomDouble())
                            {
                                Horse horse = new Horse();

                                horse.Map      = m_From.Map;
                                horse.Location = m_From.Location;

                                if ((m_From.Followers + horse.ControlSlots) <= m_From.FollowersMax)
                                {
                                    // set up the horse... =P
                                    horse.Controlled    = true;
                                    horse.ControlMaster = m_From;

                                    horse.OwnerAbandonTime = DateTime.MinValue;
                                    horse.BondingBegin     = DateTime.MinValue;

                                    horse.ControlOrder  = OrderType.Follow;
                                    horse.ControlTarget = m_From;
                                    horse.Owners.Add(m_From);                                                // seems to be new in 2.0
                                    // horse.Loyalty = PetLoyalty.WonderfullyHappy;  // doesn't work in 2.0 but seems unnecessary

                                    m_From.SendMessage("You toss a coin in ... and a horse appears!");
                                }
                                else
                                {
                                    m_From.SendMessage("You toss a coin in ... and a horse appears! But you have too many pets to control this one too. The horse runs off!");
                                    horse.Delete();
                                }

                                if (m_Fountain.Jackpot > 20)
                                {
                                    m_Fountain.Jackpot = m_Fountain.Jackpot - 10;
                                }
                            }
                            else if (0.001 > Utility.RandomDouble())
                            {
                                Gold gold = new Gold();
                                gold.Amount = m_Fountain.Jackpot;                                         // no need to test, it's always at least 1

                                if (!m_From.AddToBackpack(gold))
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain! But you can't hold it! You accidentally drop it back in the fountain, where it vanishes.");
                                    gold.Delete();
                                }
                                else
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain!");
                                    m_Fountain.Jackpot = 0;
                                }
                            }
                            else
                            {
                                m_From.SendMessage("You toss a coin in ... but nothing happens.");
                            }

                            break;
                        }


                        case MagicFountainAddon.FountainMessage.Fruit: {
                            if (0.05 > Utility.RandomDouble())
                            {
                                Item fruit = null;

                                switch (Utility.RandomMinMax(1, 10))
                                {
                                case 1:  fruit = new Watermelon();      break;

                                case 2:  fruit = new Apple();           break;

                                case 3:  fruit = new Pear();            break;

                                case 4:  fruit = new Peach();           break;

                                case 5:  fruit = new Lime();            break;

                                case 6:  fruit = new Lemon();           break;

                                case 7:  fruit = new Coconut();         break;

                                case 8:  fruit = new Grapes();          break;

                                case 9:  fruit = new Bananas();         break;

                                case 10: fruit = new Cantaloupe();      break;
                                }

                                if (!m_From.AddToBackpack(fruit))
                                {
                                    m_From.SendMessage("You toss a coin in ... and fruit appears! But you can't hold it! You accidentally drop it back in the fountain, where it vanishes.");
                                    fruit.Delete();
                                }
                                else
                                {
                                    m_From.SendMessage("You toss a coin in ... and fruit appears!");

                                    if (m_Fountain.Jackpot > 10)
                                    {
                                        m_Fountain.Jackpot = m_Fountain.Jackpot - 5;
                                    }
                                    else
                                    {
                                        m_Fountain.Jackpot = 0;
                                    }
                                }
                            }
                            else if (0.001 > Utility.RandomDouble())
                            {
                                Gold gold = new Gold();
                                gold.Amount = m_Fountain.Jackpot;                                         // no need to test, it's always at least 1

                                if (!m_From.AddToBackpack(gold))
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain! But you can't hold it! You accidentally drop it back in the fountain, where it vanishes.");
                                    gold.Delete();
                                }
                                else
                                {
                                    m_From.SendMessage("You toss a coin in ... and a shower of gold leaps back out of the fountain!");
                                    m_Fountain.Jackpot = 0;
                                }
                            }
                            else
                            {
                                m_From.SendMessage("You toss a coin in ... but nothing happens.");
                            }

                            break;
                        }
                        }
                    }
                    else
                    {
                        m_From.SendMessage("You don't have a coin to toss in.");
                    }
                }
                else
                {
                    m_From.SendMessage("Get closer.");
                }
            }
Example #6
0
        public override void OnComponentUsed( AddonComponent c, Mobile from )
        {
            BaseHouse house = BaseHouse.FindHouseAt( this );

            if ( !from.InRange( GetWorldLocation(), 2 ) )
            {
                from.LocalOverheadMessage( Network.MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
            }
            else if ( house != null && house.HasSecureAccess( from, SecureLevel.Friends ) )
            {
                switch ( m_CartType )
                {
                    case MiningCartType.OreSouth:
                    case MiningCartType.OreEast:
                        if ( m_Ore > 0 )
                        {
                            Item ingots = null;

                            switch ( Utility.Random( 9 ) )
                            {
                                case 0: ingots = new IronIngot(); break;
                                case 1: ingots = new DullCopperIngot(); break;
                                case 2: ingots = new ShadowIronIngot(); break;
                                case 3: ingots = new CopperIngot(); break;
                                case 4: ingots = new BronzeIngot(); break;
                                case 5: ingots = new GoldIngot(); break;
                                case 6: ingots = new AgapiteIngot(); break;
                                case 7: ingots = new VeriteIngot(); break;
                                case 8: ingots = new ValoriteIngot(); break;
                            }

                            int amount = Math.Min( 10, m_Ore );
                            ingots.Amount = amount;

                            if ( !from.PlaceInBackpack( ingots ) )
                            {
                                ingots.Delete();
                                from.SendLocalizedMessage( 1078837 ); // Your backpack is full! Please make room and try again.
                            }
                            else
                            {
                                PublicOverheadMessage(MessageType.Regular, 0, 1094724, amount.ToString() ); // Ore: ~1_COUNT~
                                m_Ore -= amount;
                            }
                        }
                        else
                            from.SendLocalizedMessage( 1094725 ); // There are no more resources available at this time.

                        break;
                    case MiningCartType.GemSouth:
                    case MiningCartType.GemEast:
                        if ( m_Gems > 0 )
                        {
                            Item gems = null;

                            switch ( Utility.Random( 15 ) )
                            {
                                case 0: gems = new Amber(); break;
                                case 1: gems = new Amethyst(); break;
                                case 2: gems = new Citrine(); break;
                                case 3: gems = new Diamond(); break;
                                case 4: gems = new Emerald(); break;
                                case 5: gems = new Ruby(); break;
                                case 6: gems = new Sapphire(); break;
                                case 7: gems = new StarSapphire(); break;
                                case 8: gems = new Tourmaline(); break;

                                // Mondain's Legacy gems
                                case 9: gems = new PerfectEmerald(); break;
                                case 10: gems = new DarkSapphire(); break;
                                case 11: gems = new Turquoise(); break;
                                case 12: gems = new EcruCitrine(); break;
                                case 13: gems = new FireRuby(); break;
                                case 14: gems = new BlueDiamond(); break;
                            }

                            int amount = Math.Min( 5, m_Gems );
                            gems.Amount = amount;

                            if ( !from.PlaceInBackpack( gems ) )
                            {
                                gems.Delete();
                                from.SendLocalizedMessage( 1078837 ); // Your backpack is full! Please make room and try again.
                            }
                            else
                            {
                                PublicOverheadMessage( MessageType.Regular, 0, 1094723, amount.ToString() ); // Gems: ~1_COUNT~
                                m_Gems -= amount;
                            }
                        }
                        else
                            from.SendLocalizedMessage( 1094725 ); // There are no more resources available at this time.

                        break;
                }
            }
            else
                from.SendLocalizedMessage( 1061637 ); // You are not allowed to access this.
        }
        public static void Fill(LockableContainer cont, int level)
        {
            bool isFelucca = (cont.Map == Map.Felucca);
            bool inTokuno  = (cont.Map == Map.Tokuno);
            bool SoS       = false;

            if (cont.IsShipwreckedItem == true)
            {
                SoS = true;
            }

            cont.Movable = false;
            cont.Locked  = true;
            int numberItems;

            if (level == 0)
            {
                cont.LockLevel = 0; // Can't be unlocked

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

                if (Utility.RandomDouble() < 0.75)
                {
                    cont.DropItem(new TreasureMap(0, Map.Trammel));
                }
            }
            else
            {
                cont.TrapType  = TrapType.ExplosionTrap;
                cont.TrapPower = level * 25;
                cont.TrapLevel = level;

                // = Chest Lock Levels (~40% to open at cont.RequiredSkill / 100% at cont.MaxLockLevel)
                switch (level)
                {
                case 1: cont.RequiredSkill = 5; cont.LockLevel = -25; cont.MaxLockLevel = 55; break;

                case 2: cont.RequiredSkill = 45; cont.LockLevel = 25; cont.MaxLockLevel = 75; break;

                case 3: cont.RequiredSkill = 65; cont.LockLevel = 45; cont.MaxLockLevel = 95; break;

                case 4: cont.RequiredSkill = 75; cont.LockLevel = 55; cont.MaxLockLevel = 105; break;

                case 5: cont.RequiredSkill = 75; cont.LockLevel = 55; cont.MaxLockLevel = 105; break;

                case 6: cont.RequiredSkill = 80; cont.LockLevel = 60; cont.MaxLockLevel = 110; break;

                case 7: cont.RequiredSkill = 80; cont.LockLevel = 60; cont.MaxLockLevel = 110; break;
                }

                // = GOLD PIECES
                cont.DropItem(new Gold(level * 5000));

                // = TREASURE MAP or MiB
                if (!SoS)
                {
                    if (Utility.RandomDouble() < 0.2)
                    {
                        cont.DropItem(new TreasureMap(level, MapItem.GetRandomFacet()));
                    }
                    else if ((level < 7) && (Utility.RandomDouble() < 0.025))
                    {
                        cont.DropItem(new TreasureMap(level + 1, MapItem.GetRandomFacet()));
                    }
                    else if (Utility.RandomDouble() > 0.8)
                    {
                        if (Utility.RandomDouble() > 0.5)
                        {
                            cont.DropItem(new MessageInABottle(Map.Felucca));
                        }
                        else
                        {
                            cont.DropItem(new MessageInABottle(Map.Trammel));
                        }
                    }
                }
                else if (!SoS)
                {
                    int soslvl = Utility.Random(level) + 1;

                    if (Utility.RandomDouble() < 0.2)
                    {
                        cont.DropItem(new TreasureMap(soslvl, MapItem.GetRandomFacet()));
                    }
                }

                // = LEVEL 8 ARCANE SCROLLS
                for (int i = 0; i < level; ++i)
                {
                    cont.DropItem(Loot.RandomScroll(57, 64, SpellbookType.Regular));
                }

                // = MAGIC ITEMS
                Item item;

                numberItems = 24 + (level * 8);
                for (int i = 0; i < numberItems; ++i)
                {
                    if (Core.AOS)
                    {
                        item = Loot.RandomArmorOrShieldOrWeaponOrJewelry(inTokuno);
                    }
                    else
                    {
                        item = Loot.RandomArmorOrShieldOrWeapon(inTokuno);
                    }

                    if (item is BaseWeapon)
                    {
                        BaseWeapon weapon = (BaseWeapon)item;

                        if (Core.AOS)
                        {
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats(level, out attributeCount, out min, out max);

                            BaseRunicTool.ApplyAttributesTo(weapon, attributeCount, min, max);
                        }
                        else
                        {
                            weapon.DamageLevel     = (WeaponDamageLevel)Utility.Random(6);
                            weapon.AccuracyLevel   = (WeaponAccuracyLevel)Utility.Random(6);
                            weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(6);
                        }

                        cont.DropItem(item);
                    }
                    else if (item is BaseArmor)
                    {
                        BaseArmor armor = (BaseArmor)item;

                        if (Core.AOS)
                        {
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats(level, out attributeCount, out min, out max);

                            BaseRunicTool.ApplyAttributesTo(armor, attributeCount, min, max);
                        }
                        else
                        {
                            armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(6);
                            armor.Durability      = (ArmorDurabilityLevel)Utility.Random(6);
                        }

                        cont.DropItem(item);
                    }
                    else if (item is BaseHat)
                    {
                        BaseHat hat = (BaseHat)item;

                        if (Core.AOS)
                        {
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats(level, out attributeCount, out min, out max);

                            BaseRunicTool.ApplyAttributesTo(hat, attributeCount, min, max);
                        }

                        cont.DropItem(item);
                    }
                    else if (item is BaseJewel)
                    {
                        int attributeCount;
                        int min, max;

                        GetRandomAOSStats(level, out attributeCount, out min, out max);

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

                        cont.DropItem(item);
                    }
                }
            }

            // = REAGENTS
            int reagents;

            if (level == 0)
            {
                reagents = 10;
            }
            else
            {
                reagents = 3 + level;
            }

            for (int i = 0; i < reagents; i++)
            {
                Item itr = Loot.RandomPossibleReagent();
                itr.Amount = Utility.RandomMinMax(40, 60);
                cont.DropItem(itr);
            }
            // = STACK OF GEMS
            int gems;

            if (level == 0)
            {
                gems = 3;
            }
            else
            {
                gems = 1 + level * 3;
            }

            Item itg  = new Citrine();
            int  rndG = Utility.Random(9) + 1;

            if (rndG == 1)
            {
                itg = new Amber(gems);
            }
            if (rndG == 2)
            {
                itg = new Amethyst(gems);
            }
            if (rndG == 3)
            {
                itg = new Citrine(gems);
            }
            if (rndG == 4)
            {
                itg = new Diamond(gems);
            }
            if (rndG == 5)
            {
                itg = new Emerald(gems);
            }
            if (rndG == 6)
            {
                itg = new Ruby(gems);
            }
            if (rndG == 7)
            {
                itg = new Sapphire(gems);
            }
            if (rndG == 8)
            {
                itg = new StarSapphire(gems);
            }
            if (rndG == 9)
            {
                itg = new Tourmaline(gems);
            }
            cont.DropItem(itg);

            // = SCROLL OF ALACRITY or POWERSCROLL
            if (level > 1)
            {
                if (Utility.RandomDouble() < (0.02 + (level / 200)))
                {
                    SkillName WhatS = (SkillName)Utility.Random(SkillInfo.Table.Length);
                    cont.DropItem(PowerScroll.CreateRandomNoCraft(5, 5));
                }
                else if (Utility.RandomDouble() < 0.075)
                {
                    SkillName WhatS = (SkillName)Utility.Random(SkillInfo.Table.Length);
                    cont.DropItem(new ScrollofAlacrity(WhatS));
                }
            }

            // = SCROLL OF TRANCENDENCE
            if (level >= 4 && isFelucca && Utility.RandomDouble() > 0.9)
            {
                cont.DropItem(ScrollofTranscendence.CreateRandom(level, level * 5));
            }

            // = CREEPING VINES
            if (!SoS && Utility.RandomDouble() < 0.075)
            {
                cont.DropItem(new CreepingVines());
            }

            // = ILSHENAR LESSER ARTIFACT
            if (level >= 6 && Core.AOS)
            {
                cont.DropItem((Item)Activator.CreateInstance(m_Artifacts[Utility.Random(m_Artifacts.Length)]));
            }

            // = SKELETON KEY
            if (level < 7)
            {
                if (!SoS && Utility.RandomDouble() > (0.92 - (level / 100)))
                {
                    cont.DropItem(new SFSkeletonKey());
                }
            }
            // = [LVL 7] = MASTER SKELETON KEY
            if (level == 7)
            {
                if (Utility.RandomDouble() < 0.10)
                {
                    cont.DropItem(new SFMasterSkeletonKey());
                }
            }
        }