Esempio n. 1
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))
            {
                if (m_Logs > 0)
                {
                    Item logs = null;

                    switch (Utility.Random(7))
                    {
                    case 0: logs = new Log(); break;

                    case 1: logs = new AshLog(); break;

                    case 2: logs = new OakLog(); break;

                    case 3: logs = new YewLog(); break;

                    case 4: logs = new HeartwoodLog(); break;

                    case 5: logs = new BloodwoodLog(); break;

                    case 6: logs = new FrostwoodLog(); break;
                    }

                    int amount = Math.Min(10, m_Logs);
                    logs.Amount = amount;

                    if (!from.PlaceInBackpack(logs))
                    {
                        logs.Delete();
                        from.SendLocalizedMessage(1078837);                           // Your backpack is full! Please make room and try again.
                    }
                    else
                    {
                        m_Logs -= amount;
                        PublicOverheadMessage(MessageType.Regular, 0, 1094719, m_Logs.ToString());                           // Logs: ~1_COUNT~
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1094720);                       // There are no more logs available.
                }
            }
            else
            {
                from.SendLocalizedMessage(1061637);                   // You are not allowed to access this.
            }
        }
Esempio 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 ) )
			{
				if ( m_Logs > 0 )
				{
					Item logs = null;

					switch ( Utility.Random( 7 ) )
					{
						case 0: logs = new Log(); break;
						case 1: logs = new AshLog(); break;
						case 2: logs = new OakLog(); break;
						case 3: logs = new YewLog(); break;
						case 4: logs = new HeartwoodLog(); break;
						case 5: logs = new BloodwoodLog(); break;
						case 6: logs = new FrostwoodLog(); break;
					}
					
					int amount = Math.Min( 10, m_Logs );
					logs.Amount = amount;

					if ( !from.PlaceInBackpack( logs ) )
					{
						logs.Delete();
						from.SendLocalizedMessage( 1078837 ); // Your backpack is full! Please make room and try again.
					}
					else
					{
						m_Logs -= amount;
						PublicOverheadMessage( MessageType.Regular, 0, 1094719, m_Logs.ToString() ); // Logs: ~1_COUNT~
					}
				}
				else 
					from.SendLocalizedMessage( 1094720 ); // There are no more logs available.
			}
			else 
				from.SendLocalizedMessage( 1061637 ); // You are not allowed to access this.
		}
Esempio n. 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))
            {
                if (m_Logs > 0)
                {
                    Item logs = null;

                    switch (Utility.Random(7))
                    {
                    case 0:
                        logs = new Log();
                        break;

                    case 1:
                        logs = new AshLog();
                        break;

                    case 2:
                        logs = new OakLog();
                        break;

                    case 3:
                        logs = new YewLog();
                        break;

                    case 4:
                        logs = new HeartwoodLog();
                        break;

                    case 5:
                        logs = new BloodwoodLog();
                        break;

                    case 6:
                        logs = new FrostwoodLog();
                        break;
                    }

                    int amount = Math.Min(10, m_Logs);
                    logs.Amount = amount;

                    if (!from.PlaceInBackpack(logs))
                    {
                        logs.Delete();
                        from.SendLocalizedMessage(1078837); // Your backpack is full! Please make room and try again.
                    }
                    else
                    {
                        m_Logs -= amount;
                        PublicOverheadMessage(MessageType.Regular, 0, 1094719, m_Logs.ToString()); // Logs: ~1_COUNT~
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1094720); // There are no more logs available.
                }
            }
            else
            {
                from.SendLocalizedMessage(1061637); // You are not allowed to access
            }
        }
Esempio 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(this.GetWorldLocation(), 2) || !from.InLOS(this) || !((from.Z - this.Z) > -3 && (from.Z - this.Z) < 3))
            {
                from.LocalOverheadMessage(Network.MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
            }
            else if (house != null && house.HasSecureAccess(from, SecureLevel.Friends))
            {
                if (this.m_Logs > 0)
                {
                    Item logs = null;

                    switch ( Utility.Random(7) )
                    {
                        case 0:
                            logs = new Log();
                            break;
                        case 1:
                            logs = new AshLog();
                            break;
                        case 2:
                            logs = new OakLog();
                            break;
                        case 3:
                            logs = new YewLog();
                            break;
                        case 4:
                            logs = new HeartwoodLog();
                            break;
                        case 5:
                            logs = new BloodwoodLog();
                            break;
                        case 6:
                            logs = new FrostwoodLog();
                            break;
                    }

                    int amount = Math.Min(10, this.m_Logs);
                    logs.Amount = amount;

                    if (!from.PlaceInBackpack(logs))
                    {
                        logs.Delete();
                        from.SendLocalizedMessage(1078837); // Your backpack is full! Please make room and try again.
                    }
                    else
                    {
                        this.m_Logs -= amount;
                        this.PublicOverheadMessage(MessageType.Regular, 0, 1094719, m_Logs.ToString()); // Logs: ~1_COUNT~
                    }
                }
                else
                    from.SendLocalizedMessage(1094720); // There are no more logs available.
            }
            else
                from.SendLocalizedMessage(1061637); // You are not allowed to access this.
        }
Esempio n. 5
0
        public override bool Give( Mobile m, Item item, bool placeAtFeet )
        {
            if( m is PlayerMobile )
            {
                PlayerMobile pm = m as PlayerMobile;
                pm.Crafting = true;
                LevelSystem.AwardMinimumXP( pm, 1 );
                pm.Crafting = false;
                Log log = new Log();
                Item controller = null;

                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 = 25; break;
                                case VeinIntensity.Average: chance = 50; break;
                                case VeinIntensity.Full: chance = 75; break;
                            }

                            if( chance >= Utility.RandomMinMax( 1, 1000 ) )
                            {
                                switch( rescontroller.ControlledResource )
                                {
                                    case ControlledResource.Oak: item = log; break;

                                    case ControlledResource.Yew:
                                    {
                                        if( ( pm.Skills[SkillName.Lumberjacking].Fixed / 10 ) >= 60 )
                                        {
                                            YewLog newlog = new YewLog();
                                            item = newlog;
                                        }
                                        break;
                                    }

                                    case ControlledResource.Redwood:
                                    {
                                        if( ( pm.Skills[SkillName.Lumberjacking].Fixed / 10 ) >= 70 )
                                        {
                                            RedwoodLog newlog = new RedwoodLog();
                                            item = newlog;
                                        }
                                        break;
                                    }

                                    case ControlledResource.Ash:
                                    {
                                        if( ( pm.Skills[SkillName.Lumberjacking].Fixed / 10 ) >= 80 )
                                        {
                                            AshLog newlog = new AshLog();
                                            item = newlog;
                                        }
                                        break;
                                    }

                                    case ControlledResource.Greenheart:
                                    {
                                        if( ( pm.Skills[SkillName.Lumberjacking].Fixed / 10 )>= 95 )
                                        {
                                            GreenheartLog newlog = new GreenheartLog();
                                            item = newlog;
                                            item.Amount = 10;
                                        }
                                        break;
                                    }

                                    case ControlledResource.Amber:
                                    {
                                        if( ( pm.Skills[SkillName.Lumberjacking].Fixed / 10 ) >= 90 )
                                        {
                                            Amber gem = new Amber();
                                            item = gem;
                                        }
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }

                if( pm.GemHarvesting && pm.Feats.GetFeatLevel(FeatList.GemHarvesting) > 0 && Utility.RandomMinMax( 1, 100 ) > 99 )
                    item = new Amber();

                if( pm.Nation != Nation.Alyrian )
                    pm.LastOffenseToNature = DateTime.Now;

                if( (item is Amber && pm.Feats.GetFeatLevel(FeatList.GemHarvesting) < 1) || (item is GreenheartLog && pm.Feats.GetFeatLevel(FeatList.Greenheart) < 1) )
                    item = log;
            }

            string logname = "some oak logs";

            if( item is YewLog )
                logname = "some yew logs";

            else if( item is RedwoodLog )
                logname = "some redwood logs";

            else if( item is AshLog )
                logname = "some ash logs";

            else if( item is GreenheartLog )
                logname = "some greenheart logs";

            else if( item is Amber )
                logname = "an amber";

            m.SendMessage( "You put " + logname + " into your backpack." );

            return base.Give( m, item, placeAtFeet );
        }
Esempio n. 6
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            int amounttocut = 0;

            if (!from.InRange(this.GetWorldLocation(), 1))
            {
                from.SendMessage(89, "You are too far from the machine, step closer.");
                return(false);
            }
            else
            {
                if (dropped is Log) // Log is now BaseLog
                {
                    if (dropped is OakLog)
                    {
                        // It's an OAK log
                        OakLog yourlogs = (OakLog)dropped;
                        dropped.Delete();
                        amounttocut = yourlogs.Amount;
                        from.SendMessage(89, "You recieve {0} boards", amounttocut);
                        Effects.PlaySound(from.Location, from.Map, 0x218);  // Plays the saw sound
                        Item spawn = new OakBoard(amounttocut);
                        spawn.MoveToWorld(new Point3D(this.X, this.Y - 3, this.Z + 3), this.Map);
                        return(true);
                    }

                    else if (dropped is AshLog)
                    {
                        // It's an ASH log
                        AshLog yourlogs = (AshLog)dropped;
                        dropped.Delete();
                        amounttocut = yourlogs.Amount;
                        from.SendMessage(89, "You recieve {0} boards", amounttocut);
                        Effects.PlaySound(from.Location, from.Map, 0x218);  // Plays the saw sound
                        Item spawn = new AshBoard(amounttocut);
                        spawn.MoveToWorld(new Point3D(this.X, this.Y - 3, this.Z + 3), this.Map);
                        return(true);
                    }

                    else if (dropped is YewLog)
                    {
                        // It's a YEW log
                        YewLog yourlogs = (YewLog)dropped;
                        dropped.Delete();
                        amounttocut = yourlogs.Amount;
                        from.SendMessage(89, "You recieve {0} boards", amounttocut);
                        Effects.PlaySound(from.Location, from.Map, 0x218);  // Plays the saw sound
                        Item spawn = new YewBoard(amounttocut);
                        spawn.MoveToWorld(new Point3D(this.X, this.Y - 3, this.Z + 3), this.Map);
                        return(true);
                    }

                    else if (dropped is HeartwoodLog)
                    {
                        // It's a HEARTWOOD log
                        HeartwoodLog yourlogs = (HeartwoodLog)dropped;
                        dropped.Delete();
                        amounttocut = yourlogs.Amount;
                        from.SendMessage(89, "You recieve {0} boards", amounttocut);
                        Effects.PlaySound(from.Location, from.Map, 0x218);  // Plays the saw sound
                        Item spawn = new HeartwoodBoard(amounttocut);
                        spawn.MoveToWorld(new Point3D(this.X, this.Y - 3, this.Z + 3), this.Map);
                        return(true);
                    }

                    else if (dropped is BloodwoodLog)
                    {
                        // It's a BLOODWOOD log
                        BloodwoodLog yourlogs = (BloodwoodLog)dropped;
                        dropped.Delete();
                        amounttocut = yourlogs.Amount;
                        from.SendMessage(89, "You recieve {0} boards", amounttocut);
                        Effects.PlaySound(from.Location, from.Map, 0x218);  // Plays the saw sound
                        Item spawn = new BloodwoodBoard(amounttocut);
                        spawn.MoveToWorld(new Point3D(this.X, this.Y - 3, this.Z + 3), this.Map);
                        return(true);
                    }

                    else if (dropped is FrostwoodLog)
                    {
                        // It's a FROSTWOOD log
                        FrostwoodLog yourlogs = (FrostwoodLog)dropped;
                        dropped.Delete();
                        amounttocut = yourlogs.Amount;
                        from.SendMessage(89, "You recieve {0} boards", amounttocut);
                        Effects.PlaySound(from.Location, from.Map, 0x218);  // Plays the saw sound
                        Item spawn = new FrostwoodBoard(amounttocut);
                        spawn.MoveToWorld(new Point3D(this.X, this.Y - 3, this.Z + 3), this.Map);
                        return(true);
                    }

                    else if (dropped is Log)
                    {
                        // It's a NORMAL log
                        Log yourlogs = (Log)dropped;
                        dropped.Delete();
                        amounttocut = yourlogs.Amount;
                        from.SendMessage(89, "You recieve {0} boards", amounttocut);
                        Effects.PlaySound(from.Location, from.Map, 0x218);  // Plays the saw sound
                        Item spawn = new Board(amounttocut);
                        spawn.MoveToWorld(new Point3D(this.X, this.Y - 3, this.Z + 3), this.Map);
                        return(true);
                    }
                }

                from.SendMessage(89, "This can only cut logs.");
                return(false);
            }
            return(false);
        }
Esempio n. 7
0
        public override void OnComponentUsed(AddonComponent c, Mobile from)
        {
            BaseHouse house = BaseHouse.FindHouseAt(this);

            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))
            {
                if (m_Logs > 0)
                {
                    Item logs = null;

                    switch (Utility.Random(14))
                    {
                    case 0: logs = new Log(); break;

                    case 1: logs = new AshLog(); break;

                    case 2: logs = new CherryLog(); break;

                    case 3: logs = new EbonyLog(); break;

                    case 4: logs = new GoldenOakLog(); break;

                    case 5: logs = new HickoryLog(); break;

                    case 6: logs = new MahoganyLog(); break;

                    case 7: logs = new OakLog(); break;

                    case 8: logs = new PineLog(); break;

                    case 9: logs = new RosewoodLog(); break;

                    case 10: logs = new WalnutLog(); break;

                    case 11: logs = new GhostLog(); break;

                    case 12: logs = new PetrifiedLog(); break;

                    case 13: logs = new ElvenLog(); break;
                    }

                    int amount = Math.Min(10, m_Logs);
                    logs.Amount = amount;

                    if (!from.PlaceInBackpack(logs))
                    {
                        logs.Delete();
                        from.SendLocalizedMessage(1078837);                           // Your backpack is full! Please make room and try again.
                    }
                    else
                    {
                        m_Logs -= amount;
                        PublicOverheadMessage(MessageType.Regular, 0, 1094719, m_Logs.ToString());                           // Logs: ~1_COUNT~
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1094720);                       // There are no more logs available.
                }
            }
            else
            {
                from.SendLocalizedMessage(1061637);                   // You are not allowed to access this.
            }
        }