コード例 #1
0
 public InternalTarget(Sugarcane item) : base(1, false, TargetFlags.None)
 {
     m_Item = item;
 }
コード例 #2
0
ファイル: Sugarcane.cs プロジェクト: justdanofficial/khaeros
 public InternalTarget( Sugarcane item )
     : base(1, false, TargetFlags.None)
 {
     m_Item = item;
 }
コード例 #3
0
ファイル: SugarCrop.cs プロジェクト: justdanofficial/khaeros
        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 cookValue = (int)(from.Skills[SkillName.Peacemaking].Base * 0.1);
                if ( cookValue == 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 )
                        {
                            cookValue *= 2;
                            m_lastvisit = DateTime.Now;
                        }

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

                        int pick = Utility.Random( cookValue );
                        if ( pick == 0 || ((PlayerMobile)from).Feats.GetFeatLevel(FeatList.Farming) < 1 )
                        {
                            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" ) );
                        Seed.PickCropSeed(from, "SugarCrop");

                        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 )); // use for debuging
                        ((Item)this).ItemID = pickedGraphic;

                        Sugarcane crop = new Sugarcane( 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.Start();
                        }
                    }
                }
                else
                {
                    from.SendMessage( "You are too far away to harvest anything." );
                }
            }
        }