Exemplo n.º 1
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.
		}
Exemplo n.º 2
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.
        }
Exemplo n.º 3
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;
        }
Exemplo n.º 4
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 this.
            }
        }