コード例 #1
0
        public void Chop(Mobile from)
        {
            if (from.InRange(this.GetWorldLocation(), 2))
            {
                if ((chopTimer == null) || (!chopTimer.Running))
                {
                    if ((TreeHelper.TreeOrdinance) && (from.AccessLevel == AccessLevel.Player))
                    {
                        if (from.Region is Regions.GuardedRegion)
                        {
                            from.CriminalAction(true);
                        }
                    }

                    chopTimer = new TreeHelper.ChopAction(from);

                    Point3D pnt = this.Location;
                    Map     map = this.Map;

                    from.Direction = from.GetDirectionTo(this);
                    chopTimer.Start();

                    double lumberValue = from.Skills[SkillName.Lumberjacking].Value / 100;
                    if ((lumberValue > .5) && (Utility.RandomDouble() <= lumberValue))
                    {
                        Apple fruit = new Apple((int)Utility.Random(13) + m_yield);
                        from.AddToBackpack(fruit);

                        int cnt  = Utility.Random((int)(lumberValue * 10) + 1);
                        Log logs = new Log(cnt); // Fruitwood Logs ??
                        from.AddToBackpack(logs);

                        FruitTreeStump i_stump = new FruitTreeStump(typeof(AppleTree));
                        Timer          poof    = new StumpTimer(this, i_stump, from);
                        poof.Start();
                    }
                    else
                    {
                        from.SendLocalizedMessage(500495);  // You hack at the tree for a while, but fail to produce any useable wood.
                    }
                    //PublicOverheadMessage( MessageType.Regular, 0x3BD, false, string.Format( "{0}", lumberValue ));
                }
            }
            else
            {
                from.SendLocalizedMessage(500446);   // That is too far away.
            }
        }
コード例 #2
0
        public void Chop(Mobile from)
        {
            if (from.InRange(this.GetWorldLocation(), 2))
            {
                if ((chopTimer == null) || (!chopTimer.Running))
                {
                    if ((TreeHelper.TreeOrdinance) && (from.AccessLevel == AccessLevel.Player))
                    {
                        if (from.Region is Regions.GuardedRegion)
                        {
                            from.CriminalAction(true);
                        }
                    }

                    chopTimer = new TreeHelper.ChopAction(from);

                    Point3D pnt = this.Location;
                    Map     map = this.Map;

                    from.Direction = from.GetDirectionTo(this);
                    chopTimer.Start();

                    double cookValue = from.Skills[SkillName.Lumberjacking].Value / 100;
                    if ((cookValue > .5) && (Utility.RandomDouble() <= cookValue))
                    {
                        Pear fruit = new Pear((int)Utility.Random(13) + m_yield);
                        from.AddToBackpack(fruit);

                        int cnt  = Utility.Random((int)(cookValue * 10) + 1);
                        Log logs = new Log(cnt);
                        from.AddToBackpack(logs);

                        FruitTreeStump i_stump = new FruitTreeStump(typeof(PearTree));
                        Timer          poof    = new StumpTimer(this, i_stump, from);
                        poof.Start();
                    }
                    else
                    {
                        from.SendLocalizedMessage(500495);
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(500446);
            }
        }
コード例 #3
0
        public void Chop( Mobile from )
        {
            if ( from.InRange( this.GetWorldLocation(), 1 ) )
            {
                if ( ( chopTimer == null ) || ( !chopTimer.Running ) )
                {
                    if ( ( TreeHelper.TreeOrdinance ) && ( from.AccessLevel == AccessLevel.Player ) )
                    {
                        if ( from.Region is Regions.GuardedRegion )
                            from.CriminalAction( true );
                    }

                    chopTimer = new TreeHelper.ChopAction( from );

                    Point3D pnt = this.Location;
                    Map map =  this.Map;

                    from.Direction = from.GetDirectionTo( this );
                    chopTimer.Start();

                    double lumberValue = from.Skills[SkillName.Lumberjacking].Value / 100;
                    if ( ( lumberValue > .5 ) && ( Utility.RandomDouble() <= lumberValue ) )
                    {
                        Blueberries fruit = new Blueberries( (int)Utility.Random( 13 ) + m_yield );
                        from.AddToBackpack( fruit );

                        int cnt = Utility.Random( (int)( lumberValue * 10 ) + 1 );
                        Log logs = new Log( cnt ); // Fruitwood Logs ??
                        from.AddToBackpack( logs );

                        FruitTreeStump i_stump = new FruitTreeStump( typeof( BlueberryTree ) );
                        Timer poof = new StumpTimer( this, i_stump, from );
                        poof.Start();
                    }
                    else from.SendLocalizedMessage( 500495 ); // You hack at the tree for a while, but fail to produce any useable wood.
                    //PublicOverheadMessage( MessageType.Regular, 0x3BD, false, string.Format( "{0}", lumberValue ));
                }
            }
            else from.SendLocalizedMessage( 500446 );  // That is too far away.
        }