Example #1
0
        public static void init( AppleSapling plant )
        {
            TimeSpan delay = TreeHelper.SaplingTime;
            plant.treeTime = DateTime.Now + delay;

            plant.thisTimer = new TreeHelper.TreeTimer( plant, typeof(AppleTree), delay );
            plant.thisTimer.Start();
        }
Example #2
0
        public override void OnDoubleClick(Mobile from)
        {
            if (from.Mounted && !CropHelper.CanWorkMounted)
            {
                from.SendMessage(AgriTxt.CannotWorkMounted);
                return;
            }

            Point3D m_pnt = from.Location;
            Map     m_map = from.Map;

            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042010); //You must have the object in your backpack to use it.
                return;
            }

            else if (!CropHelper.CheckCanGrow(this, m_map, m_pnt.X, m_pnt.Y))
            {
                from.SendMessage(AgriTxt.CannotGrowHere);
                return;
            }

            //check for BaseCrop on this tile
            ArrayList cropshere = CropHelper.CheckCrop(m_pnt, m_map, 0);

            if (cropshere.Count > 0)
            {
                from.SendMessage(AgriTxt.AlreadyCrop);
                return;
            }

            //check for over planting prohibt if 4 maybe 3 neighboring crops
            ArrayList cropsnear = CropHelper.CheckCrop(m_pnt, m_map, 2);                   //1

            if ((cropsnear.Count > 1) || ((cropsnear.Count == 1) && Utility.RandomBool())) //3
            {
                from.SendMessage(AgriTxt.TooMuchCrops);
                return;
            }

            if (this.BumpZ)
            {
                ++m_pnt.Z;
            }

            if (!from.Mounted)
            {
                from.Animate(32, 5, 1, true, false, 0); // Bow
            }
            from.SendMessage(AgriTxt.CropPlanted);
            this.Consume();
            Item item = new AppleSapling();// from );

            item.Location = m_pnt;
            item.Map      = m_map;
        }
Example #3
0
        public static void init(AppleSapling plant)
        {
            TimeSpan delay = TreeHelper.SaplingTime;

            plant.treeTime = DateTime.Now + delay;

            plant.thisTimer = new TreeHelper.TreeTimer(plant, typeof(AppleTree), delay);
            plant.thisTimer.Start();
        }
Example #4
0
        public override void OnDoubleClick(Mobile from)
        {
            if (from.Mounted && !CropHelper.CanWorkMounted)
            {
                from.SendMessage("You cannot plant a seed while mounted.");
                return;
            }

            Point3D m_pnt = from.Location;
            Map     m_map = from.Map;

            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042010);                   //You must have the object in your backpack to use it.
                return;
            }

            else if (!CropHelper.CheckCanGrow(this, m_map, m_pnt.X, m_pnt.Y))
            {
                from.SendMessage("This seed will not grow here.");
                return;
            }

            //check for BaseCrop on this tile
            ArrayList cropshere = CropHelper.CheckCrop(m_pnt, m_map, 0);

            if (cropshere.Count > 0)
            {
                from.SendMessage("There is already a crop growing here.");
                return;
            }

            //check for over planting prohibt if 6 maybe 5 neighboring crops
            ArrayList cropsnear = CropHelper.CheckCrop(m_pnt, m_map, 1);

            if ((cropsnear.Count > 5) || ((cropsnear.Count == 5) && Utility.RandomBool()))
            {
                from.SendMessage("There are too many crops nearby.");
                return;
            }

            if (this.BumpZ)
            {
                ++m_pnt.Z;
            }

            if (!from.Mounted)
            {
                from.Animate(32, 5, 1, true, false, 0);                   // Bow
            }
            from.SendMessage("You plant the seed.");
            this.Consume();
            Item item = new AppleSapling();

            item.Location = m_pnt;
            item.Map      = m_map;
        }
		public override void OnDoubleClick( Mobile from ) 
		{ 
			if ( from.Mounted && !CropHelper.CanWorkMounted )
			{
				from.SendMessage( "You cannot plant a seed while mounted." ); 
				return; 
			}

			Point3D m_pnt = from.Location;
			Map m_map = from.Map;

			if ( !IsChildOf( from.Backpack ) ) 
			{ 
				from.SendLocalizedMessage( 1042010 ); //You must have the object in your backpack to use it. 
				return; 
			} 

			else if ( !CropHelper.CheckCanGrow( this, m_map, m_pnt.X, m_pnt.Y ) )
			{
				from.SendMessage( "This seed will not grow here." ); 
				return; 
			}
			
			//check for BaseCrop on this tile
			ArrayList cropshere = CropHelper.CheckCrop( m_pnt, m_map, 0 );
			if ( cropshere.Count > 0 )
			{
				from.SendMessage( "There is already a crop growing here." ); 
				return;
			}

			//check for over planting prohibt if 6 maybe 5 neighboring crops
			ArrayList cropsnear = CropHelper.CheckCrop( m_pnt, m_map, 1 );
			if ( ( cropsnear.Count > 5 ) || (( cropsnear.Count == 5 ) && Utility.RandomBool() ) )
			{
				from.SendMessage( "There are too many crops nearby." ); 
				return;
			}

			if ( this.BumpZ ) ++m_pnt.Z;

			if ( !from.Mounted )
				from.Animate( 32, 5, 1, true, false, 0 ); // Bow

			from.SendMessage("You plant the seed."); 
			this.Consume(); 
			Item item = new AppleSapling(); 
			item.Location = m_pnt; 
			item.Map = m_map; 
			
		} 
        public override void OnDoubleClick(Mobile from)
        {
            if (from.Mounted && !CropHelper.CanWorkMounted)
            {
                from.SendMessage(AgriTxt.CannotWorkMounted);
                return;
            }

            Point3D m_pnt = from.Location;
            Map m_map = from.Map;

            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042010); //You must have the object in your backpack to use it. 
                return;
            }

            else if (!CropHelper.CheckCanGrow(this, m_map, m_pnt.X, m_pnt.Y))
            {
                from.SendMessage(AgriTxt.CannotGrowHere);
                return;
            }

            //check for BaseCrop on this tile
            ArrayList cropshere = CropHelper.CheckCrop(m_pnt, m_map, 0);
            if (cropshere.Count > 0)
            {
                from.SendMessage(AgriTxt.AlreadyCrop);
                return;
            }

            //check for over planting prohibt if 4 maybe 3 neighboring crops
            ArrayList cropsnear = CropHelper.CheckCrop(m_pnt, m_map, 2);//1
            if ((cropsnear.Count > 1) || ((cropsnear.Count == 1) && Utility.RandomBool()))//3
            {
                from.SendMessage(AgriTxt.TooMuchCrops);
                return;
            }

            if (this.BumpZ) ++m_pnt.Z;

            if (!from.Mounted)
                from.Animate(32, 5, 1, true, false, 0); // Bow

            from.SendMessage(AgriTxt.CropPlanted);
            this.Consume();
            Item item = new AppleSapling();// from ); 
            item.Location = m_pnt;
            item.Map = m_map;

        }