示例#1
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!from.InRange(GetWorldLocation(), 1))
            {
                SendLocalizedMessageTo(from, 501816);                 // You are too far away to do that.
            }
            else
            {
                Cotton cotton = new Cotton();
                cotton.MoveToWorld(new Point3D(this.X, this.Y, this.Z), this.Map);

                this.Delete();
            }
        }
		public override void OnDoubleClick( Mobile from ) 
		{ 
		    if ( from.InRange( this.GetWorldLocation(), 2 ) ) 
		    { 
		    int pick = Utility.Random( 1,3 );
			Cotton crop = new Cotton( pick ); 
			from.AddToBackpack( crop );
			this.Delete();
		    }
		    else
		    { 
			from.SendMessage( "You are too far away to harvest anything." ); 
		    } 
		}
示例#3
0
		public override void OnDoubleClick( Mobile from )
		{
			if (!from.InRange(GetWorldLocation(), 1))
			{
				SendLocalizedMessageTo(from, 501816); // You are too far away to do that.
			}
			else
			{
				Cotton cotton = new Cotton();
				cotton.MoveToWorld(new Point3D(this.X, this.Y, this.Z), this.Map);

				this.Delete();
			}
		}
示例#4
0
 public override bool LootItem(Mobile from)
 {
     if (Utility.RandomDouble() <= .05)
     {
         CottonSeed item = new CottonSeed();
         from.AddToBackpack(item);
         from.SendMessage("You manage to gather 1 cotton seed.");
     }
     Cotton c = new Cotton();
     c.ItemID = 3577;
     from.AddToBackpack(c);
     from.SendMessage("You manage to gather 1 cotton crop.");
     return true;
 }
 public override void OnDoubleClick(Mobile from)
 {
     if (from.InRange(this.GetWorldLocation(), 2))
     {
         int    pick = Utility.Random(1, 3);
         Cotton crop = new Cotton(pick);
         from.AddToBackpack(crop);
         this.Delete();
     }
     else
     {
         from.SendMessage("You are too far away to harvest anything.");
     }
 }
示例#6
0
文件: Cotton.cs 项目: Godkong/Origins
 public PickWheelTarget( Cotton cotton )
     : base(3, false, TargetFlags.None)
 {
     m_Cotton = cotton;
 }
示例#7
0
 public PickWheelTarget(Cotton cotton)
     : base(3, false, TargetFlags.None)
 {
     m_Cotton = cotton;
 }
		public override void OnDoubleClick( Mobile from ) 
		{ 
			if ( m_sower == null || m_sower.Deleted ) 
				m_sower = from;

			if ( from.Mounted && !CropHelper.CanWorkMounted )
			{
				from.SendMessage(AgriTxt.CannotWorkMounted); 
				return; 
			}

			if ( DateTime.Now > lastpicked.AddSeconds(3) ) // 3 seconds between picking
			{
				lastpicked = DateTime.Now;
			
				int lumberValue = (int)from.Skills[SkillName.Lumberjacking].Value / 5;
				if ( lumberValue < 2 )
				{
					from.SendMessage(AgriTxt.DunnoHowTo); 
					return;
				}

				if ( from.InRange( this.GetWorldLocation(), 2 ) ) 
				{ 
					if ( m_yield < 1 )
					{
						from.SendMessage(AgriTxt.NoCrop); 

						if ( PlayerCanDestroy && !( m_sower.AccessLevel > AccessLevel.Counselor ) )
						{  
							UpRootGump g = new UpRootGump( from, this );
							from.SendGump( g );
						}
					}
					else //check skill and sower
					{
						from.Direction = from.GetDirectionTo( this );

						from.Animate( from.Mounted ? 29:32, 5, 1, true, false, 0 ); 

						if ( from == m_sower ) 
						{
							lumberValue *= 2;
							m_lastvisit = DateTime.Now;
						}

						if ( lumberValue > m_yield ) 
							lumberValue = m_yield + 1;

						int pick = Utility.Random( lumberValue );
						if ( pick == 0 )
						{
							from.SendMessage(AgriTxt.ZeroPicked); 
							return;
						}
					
						m_yield -= pick;
						from.SendMessage( AgriTxt.YouPick + " {0} coton{1}!", pick, ( pick == 1 ? "" : "s" ) ); 

						//PublicOverheadMessage( MessageType.Regular, 0x3BD, false, string.Format( "{0}", m_yield )); 
						((Item)this).ItemID = pickedGraphic;

						Cotton crop = new Cotton( pick ); 
						from.AddToBackpack( crop );

						if ( SowerPickTime != TimeSpan.Zero && m_lastvisit + SowerPickTime < DateTime.Now && !( m_sower.AccessLevel > AccessLevel.Counselor ) )
						{
							this.UpRoot( from );
							return;
						}

						if ( !regrowTimer.Running )
						{
							//regrowTimer = new CropTimer( this );
							regrowTimer.Start();
						}
					}
				} 
				else 
				{ 
					from.SendMessage(AgriTxt.TooFar); 
				} 
			}
		} 
		public override void OnDoubleClick( Mobile from ) 
		{ 
			if ( m_sower == null || m_sower.Deleted ) 
				m_sower = from;

			if ( from.Mounted && !CropHelper.CanWorkMounted )
			{
				from.SendMessage( "You cannot harvest a crop while mounted." ); 
				return; 
			}

			if ( DateTime.Now > lastpicked.AddSeconds(1) ) // 3 seconds between picking changed to 1 sec
			{
				lastpicked = DateTime.Now;
			
				int tailorValue = (int)from.Skills[SkillName.Tailoring].Value / 20;
				if ( tailorValue == 0 )
				{
					from.SendMessage( "You have no idea how to harvest this crop." ); 
					return;
				}

				if ( from.InRange( this.GetWorldLocation(), 1 ) ) 
				{ 
					if ( m_yield < 1 )
					{
						from.SendMessage( "There is nothing here to harvest." ); 

						if ( PlayerCanDestroy && !( m_sower.AccessLevel > AccessLevel.Counselor ) )
						{  
							UpRootGump g = new UpRootGump( from, this );
							from.SendGump( g );
						}
					}
					else //check skill and sower
					{
						from.Direction = from.GetDirectionTo( this );

						from.Animate( from.Mounted ? 29:32, 5, 1, true, false, 0 ); 

						if ( from == m_sower ) 
						{
							tailorValue *= 2;
							m_lastvisit = DateTime.Now;
						}

						if ( tailorValue > m_yield ) 
							tailorValue = m_yield + 1;

						int pick = Utility.Random( tailorValue );
						if ( pick == 0 )
						{
							from.SendMessage( "You do not manage to harvest any crops." ); 
							return;
						}
					
						m_yield -= pick;
						from.SendMessage( "You harvest {0} crop{1}!", pick, ( pick == 1 ? "" : "s" ) ); 

						//PublicOverheadMessage( MessageType.Regular, 0x3BD, false, string.Format( "{0}", m_yield )); 
						((Item)this).ItemID = pickedGraphic;

						Cotton crop = new Cotton( pick ); 
						from.AddToBackpack( crop );

						if ( SowerPickTime != TimeSpan.Zero && m_lastvisit + SowerPickTime < DateTime.Now && !( m_sower.AccessLevel > AccessLevel.Counselor ) )
						{
							this.UpRoot( from );
							return;
						}

						if ( !regrowTimer.Running )
						{
							//regrowTimer = new CropTimer( this );
							regrowTimer.Start();
						}
					}
				} 
				else 
				{ 
					from.SendMessage( "You are too far away to harvest anything." ); 
				} 
			}
		} 
示例#10
0
        public override void OnDoubleClick( Mobile from )
        {
            if ( m_sower == null || m_sower.Deleted )
                m_sower = from;

            if ( from.Mounted && !CropHelper.CanWorkMounted )
            {
                from.SendMessage( "You cannot harvest a crop while mounted." );
                return;
            }

            if ( DateTime.Now > lastpicked.AddSeconds(3) ) // 3 seconds between picking
            {
                lastpicked = DateTime.Now;
                int tailorValue = Math.Max( (int)(from.Skills[SkillName.Peacemaking].Base * 0.1), (int)(from.Skills[SkillName.Peacemaking].Base * 0.1) );

                if ( tailorValue == 0  )
                {
                    from.SendMessage( "You have no idea how to harvest this crop." );
                    return;
                }

                if ( from.InRange( this.GetWorldLocation(), 1 ) )
                {
                    if ( m_yield < 1 )
                    {
                        from.SendMessage( "There is nothing here to harvest." );

                        if ( PlayerCanDestroy && !( m_sower.AccessLevel > AccessLevel.Counselor ) )
                        {
                            UpRootGump g = new UpRootGump( from, this );
                            from.SendGump( g );
                        }
                    }
                    else //check skill and sower
                    {
                        from.Direction = from.GetDirectionTo( this );

                        from.Animate( from.Mounted ? 29:32, 5, 1, true, false, 0 );

                        if ( from == m_sower )
                        {
                            tailorValue *= 2;
                            m_lastvisit = DateTime.Now;
                        }

                        if ( tailorValue > m_yield )
                            tailorValue = m_yield + 1;

                        int pick = Utility.Random( tailorValue );
                        if ( pick == 0 || ((PlayerMobile)from).Feats.GetFeatLevel(FeatList.Farming) < 1 )
                        {
                            from.SendMessage( "You do not manage to harvest any crops." );
                            return;
                        }

                        m_yield -= pick;

                        if( from is PlayerMobile )
                        {
                            PlayerMobile m = from as PlayerMobile;
                            pick += m.Feats.GetFeatLevel(FeatList.EnhancedHarvesting);

                            if( DateTime.Now > (m.LastCottonFlaxHarvest + TimeSpan.FromHours(1)) )
                                m.HarvestedCrops = 0;

                            if( DateTime.Compare( m.NextHarvestAllowed, DateTime.Now ) > 0 )
                            {
                                m.SendMessage( "The local farmer forbids you to harvest any more crops after reminding you that this is a public farm and that you should leave some crops for the others." );
                                m.HarvestedCrops = 0;
                                return;
                            }

                            if( pick + m.HarvestedCrops > 100 )
                            {
                                m.NextHarvestAllowed = DateTime.Now + TimeSpan.FromHours( 1 );
                                m.HarvestedCrops = 0;
                            }

                            m.HarvestedCrops += pick;
                            m.LastCottonFlaxHarvest = DateTime.Now;
                        }

                        from.SendMessage( "You harvest {0} crop{1}!", pick, ( pick == 1 ? "" : "s" ) );
                        Seed.PickCropSeed(from, "CottonCrop");

                        if( from is PlayerMobile )
                        {
                            ( (PlayerMobile)from ).Crafting = true;
                            Misc.LevelSystem.AwardMinimumXP( (PlayerMobile)from, 1 );
                            ( (PlayerMobile)from ).Crafting = false;
                        }

                        //PublicOverheadMessage( MessageType.Regular, 0x3BD, false, string.Format( "{0}", m_yield ));
                        ((Item)this).ItemID = pickedGraphic;

                        Cotton crop = new Cotton( pick );
                        from.AddToBackpack( crop );

                        if ( SowerPickTime != TimeSpan.Zero && m_lastvisit + SowerPickTime < DateTime.Now && !( m_sower.AccessLevel > AccessLevel.Counselor ) )
                        {
                            this.UpRoot( from );
                            return;
                        }

                        if ( !regrowTimer.Running )
                        {
                            //regrowTimer = new CropTimer( this );
                            regrowTimer.Start();
                        }
                    }
                }
                else
                {
                    from.SendMessage( "You are too far away to harvest anything." );
                }
            }
        }