Jump to content

F2pChopper || FREE || Automatic Change tree,area,axe from lvl 1-60 || Powerchoping and Banking


kadiem

Recommended Posts

F2pChopper

My first release

 

Good morning everyone i'm releasing my first script, hopping that it could be useful for some people

 

 

Features:

  • Changes axe according to WC level
  • Changes tree/area according to WC level
  • Drops logs when PowerChopping(Before level 60) and stores Yew logs(At 60 and above)

 

 

Requirements:

  • Have Bronze, Steel, Black, Mithril, Adamant, Rune axes in your bank

 

Source:

package Chopper;

import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.map.Position;
import org.osbot.rs07.api.map.constants.Banks;
import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.model.Item;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.api.ui.*;
import org.osbot.rs07.api.util.Utilities;
import org.osbot.rs07.script.Script;

import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;

import java.awt.*;
import java.util.List;

@ScriptManifest(name = "F2pChopper", author = "Kadhim", version = 1.6, info = "Chopper", logo = "")

public class Main extends Script {

    Timer BanTimer;
    long Timer;
    int LogChopped;
    Area WithdrawAxesBank = Banks.DRAYNOR;
    Area Bankyew = Banks.GRAND_EXCHANGE;
    Area WILLOWAREA = new Area(
            new int[][]{
                    {2968, 3188},
                    {2959, 3192},
                    {2961, 3201},
                    {2966, 3201},
                    {2969, 3200},
                    {2972, 3197},
                    {2975, 3195},
                    {2976, 3194}
            }
    );
    Area TREESAREA = new Area(
            new int[][]{
                    {2909, 3308},
                    {2923, 3301},
                    {2928, 3313},
                    {2921, 3318}
            }
    );
    Area OAKAREA = new Area(3151, 3458, 3170, 3450);
    Area YEWAREA = new Area(
            new int[][]{
                    { 3201, 3505 },
                    { 3225, 3505 },
                    { 3222, 3498 },
                    { 3207, 3498 },
                    { 3207, 3498 },
                    { 3207, 3499 }
            }
    );

    @Override

    public void onStart() {
        BanTimer = new Timer(0);
        Timer = System.currentTimeMillis();
    }

    @Override

    public int onLoop() throws InterruptedException {

        CheckContMessage();

        if (BanTimer.Passed(random(10, 15))) {
            ANTI_BAN();
            log("Anti-Ban");
            BanTimer.reset();
        }


        if(!inventory.contains(Axe())){
            WithdrawAxes();
        }

        if(skills.getDynamic(Skill.WOODCUTTING) < 60){
            if(!inventory.isFull()){
                PowerChopping();
            }else{
                if(inventory.isFull()){
                    Drop();
                }
            }
        }

        if(skills.getDynamic(Skill.WOODCUTTING) >= 60){
            if(!inventory.isFull()){
                ChopYews();
            }else{
                if(inventory.isFull()){
                    BankYew();
                }
            }
        }

        return 100;

    }

    public void PowerChopping() throws InterruptedException {
        if(skills.getDynamic(Skill.WOODCUTTING) < 15){
            this.ChopTrees();
        }
        if(skills.getDynamic(Skill.WOODCUTTING) >= 15 && skills.getDynamic(Skill.WOODCUTTING) < 30){
            this.ChopOaks();
        }
        if(skills.getDynamic(Skill.WOODCUTTING) >= 30 && skills.getDynamic(Skill.WOODCUTTING) < 60){
            this.ChopWillows();
        }
    }


    private void CheckContMessage() {
        RS2Widget lvlUp = widgets.get(233, 11);
        RS2Widget cont = widgets.get(233, 2);

        if (lvlUp != null) {
            cont.interact(new String[]{"Continue"});
        }

        if (cont != null) {
            cont.interact(new String[]{"Continue"});
        }
    }

    private void ANTI_BAN() throws InterruptedException {
        switch (random((int)0, (int)9)) {
            case 0: {
                //Hovering
                for (int x = 0; x < 5; x = x + random(0,5)){
                    switch (random((int)0, (int)1)) {
                        case 0: {
                            for (int z = 0; z < 5; z = z + random(0,5)) {
                                inventory.hover(random(0, 27));
                            }
                            break;
                        }
                        case 1: {
                            Entity TREE_STUMP = objects.closest("Tree stump");
                            if(TREE_STUMP != null){
                                TREE_STUMP.hover();
                            }
                            break;
                        }
                    }
                }
                break;
            }



            case 1: {
                //Typing
                switch (random((int)0, (int)3)) {
                    case 0: {
                        keyboard.typeString("Type something", true);
                        break;
                    }
                    case 1: {
                        keyboard.typeString("Type something", true);
                        break;
                    }
                    case 2: {
                        keyboard.typeString("Type something", true);
                        break;
                    }
                    case 3: {
                        keyboard.typeString("Type something", true);
                        break;
                    }
                    case 4: {
                        keyboard.typeString("Type something", false);
                        break;
                    }
                }
                break;
            }



            case 2: {
                //Move mouse out of screen
                mouse.moveOutsideScreen();
                sleep(random(1000,10000));
                break;
            }


            case 3: {
                //Check skill xp
                getSkills().hoverSkill(Skill.WOODCUTTING);
                sleep(random(2000,3000));
                break;
            }


            case 4: {
                //Examine inventory
                Item Axe = getInventory().getItem(Axe());
                Item Logs = getInventory().getItem(LogsInInv());
                switch (random((int)0, (int)1)) {
                    case 0: {
                        Axe.interact("Examine");
                        break;
                    }
                    case 1: {
                        Logs.interact("Examine");
                        break;
                    }
                }
                break;
            }
            case 5: {
                //Open random tabs
                tabs.open(Tab.forId(random(0,13)));
                break;
            }
        }
    }





    private void ChopYews() throws InterruptedException {
        Entity YEW = objects.closest("Yew");

        if(!YEWAREA.contains(myPlayer())){
            walking.webWalk(YEWAREA);
        }

        if(YEWAREA.contains(myPlayer())){
            if (YEW != null && !myPlayer().isMoving() && !myPlayer().isAnimating()) {
                YEW.interact("Chop down");    
                new ConditionalSleep(Script.random(10000, 15000)) {
                    public boolean condition()
                            throws InterruptedException {
                        return !myPlayer().isAnimating();
                    }
                }.sleep();
            }
        }
    }







    private void ChopWillows() throws InterruptedException {
        if(!WILLOWAREA.contains(myPlayer())){
            walking.webWalk(WILLOWAREA);
        }
        if(WILLOWAREA.contains(myPlayer())){
            Entity WTREE = objects.closest("Willow");

                if (WTREE != null && !myPlayer().isMoving() && !myPlayer().isAnimating()) {
                    WTREE.interact("Chop down");
                    new ConditionalSleep(Script.random(10000, 15000)) {
                        public boolean condition()
                                throws InterruptedException {
                            return !myPlayer().isAnimating();
                        }
                    }.sleep();
                }
            }
        }








    private void ChopOaks() throws InterruptedException {
        if(!OAKAREA.contains(myPlayer())){
            walking.webWalk(OAKAREA);
        }
        if(OAKAREA.contains(myPlayer())){
            Entity OTREE = objects.closest("Oak");


            if (OTREE != null && !myPlayer().isMoving() && !myPlayer().isAnimating()) {
                OTREE.interact("Chop down");
                new ConditionalSleep(Script.random(10000, 15000)) {
                    public boolean condition()
                            throws InterruptedException {
                        return !myPlayer().isAnimating();
                    }
                }.sleep();
            }
        }
    }









    private void ChopTrees() throws InterruptedException {
        if(!TREESAREA.contains(myPlayer())){
            walking.webWalk(TREESAREA);
        }

        if(TREESAREA.contains(myPlayer())){
            Entity TREE = objects.closest("Tree");


            if (TREE != null && !myPlayer().isMoving() && !myPlayer().isAnimating()) {
                    TREE.interact("Chop down");
                    new ConditionalSleep(Script.random(10000, 15000)) {
                        public boolean condition()
                                throws InterruptedException {
                            return !myPlayer().isAnimating();
                        }
                    }.sleep();
                }
            }
    }


    public void WithdrawAxes() throws InterruptedException {
        if(!WithdrawAxesBank.contains(myPlayer())){
            walking.webWalk(WithdrawAxesBank);
        }
        if(WithdrawAxesBank.contains(myPlayer())){
            if(!bank.isOpen()){
                bank.open();
            }
            if(bank.isOpen()){
                if(bank.contains(Axe())){
                    bank.depositAll();
                    bank.withdraw(Axe(),1);
                }else{
                    log("Bank does not contain " +Axe());
                    logoutTab.logOut();
                }
            }
        }
    }

    public void BankYew() throws InterruptedException {
        if(!Bankyew.contains(myPlayer())){
            walking.webWalk(Bankyew);
        }
        if(Bankyew.contains(myPlayer())){
            if(!bank.isOpen()){
                bank.open();
            }
            if(bank.isOpen()){
                bank.depositAllExcept(Axe());
            }
        }
    }

    public void Drop(){
        inventory.dropAllExcept(Axe());
    }

    public String LogsInInv(){
        if(inventory.contains("Logs")){
            return "Logs";
        }
        if(inventory.contains("Oak logs")){
            return "Oak logs";
        }
        if(inventory.contains("Willow logs")){
            return "Willow logs";
        }
        if(inventory.contains("Yew logs")){
            return "Yew logs";
        }
        return null;
    }


    public String Axe(){
        if(skills.getDynamic(Skill.WOODCUTTING) < 6){
            return "Bronze axe";
        }
        if(skills.getDynamic(Skill.WOODCUTTING) >= 6 && skills.getDynamic(Skill.WOODCUTTING) < 11){
            return "Steel axe";
        }
        if(skills.getDynamic(Skill.WOODCUTTING) >= 11 && skills.getDynamic(Skill.WOODCUTTING) < 21){
            return "Black axe";
        }
        if(skills.getDynamic(Skill.WOODCUTTING) >= 21 && skills.getDynamic(Skill.WOODCUTTING) < 31){
            return "Mithril axe";
        }
        if(skills.getDynamic(Skill.WOODCUTTING) >= 31 && skills.getDynamic(Skill.WOODCUTTING) < 41){
            return "Adamant axe";
        }
        if(skills.getDynamic(Skill.WOODCUTTING) >= 41){
            return "Rune axe";
        }
        return null;
    }


    @Override

    public void onPaint(Graphics2D g) {

        g.setFont(new Font("Arial",Font.BOLD,18));
        g.setColor(Color.CYAN);

        long timeRan = System.currentTimeMillis() - this.Timer;
        g.drawString("Time Ran: " + this.formatTime(timeRan), 25, 282);
        g.drawString("Current level: " + this.skills.getDynamic(Skill.WOODCUTTING), 25, 300);
        g.drawString("Yew logs: " + LogChopped, 25, 320);
    }
    public final String formatTime(long ms) {
        long s = ms / 1000;
        long m = s / 60;
        long h = m / 60;
        return String.format("%02d:%02d:%02d", h %= 24, m %= 60, s %= 60);
    }
    public void onMessage(Message m){

        if(m.getMessage().contains("You get some yew logs")){
            LogChopped++;
        }
    }

}

 

 

Paste this to timer class

public boolean Passed(long Minutes ){
        return (Minutes * 60000) - getElapsed() < 0;
    }

 

Progresses:

Spoiler

QMEe7iw.jpg

aUU7tjJ.jpg

Nscc8gw.jpg

 

Edited by kadiem
  • Like 1
Link to comment
Share on other sites

Nice work (: Just a few things 

  • Be sure to check out the official naming conventions ( http://www.oracle.com/technetwork/java/codeconventions-135099.html )
  • For your axe level checks, you don't need to check either side of the limit, but that's minor
  • That 'anti-ban' looks like it will if anything increase your chances of being banned
  • Consider making your area global variables final, and private since they don't need to more accessibly than that
  • Consider expanding into multiple classes for scripts which do more than one thing. As was mentioned above, enums are your friend and i'm sure you could make good use of interfaces or inheritance in a script such as this!

Thanks for sharing!

Apa

  • Like 1
Link to comment
Share on other sites

38 minutes ago, Apaec said:

Nice work (: Just a few things 

  • Be sure to check out the official naming conventions ( http://www.oracle.com/technetwork/java/codeconventions-135099.html )
  • For your axe level checks, you don't need to check either side of the limit, but that's minor
  • That 'anti-ban' looks like it will if anything increase your chances of being banned
  • Consider making your area global variables final, and private since they don't need to more accessibly than that
  • Consider expanding into multiple classes for scripts which do more than one thing. As was mentioned above, enums are your friend and i'm sure you could make good use of interfaces or inheritance in a script such as this!

Thanks for sharing!

Apa

Yh still trying to make good anti-ban:doge:

52 minutes ago, Rekt said:

use enums m9 use enums

I tried using enums but for some reasons it made the script laggy i dont know why

Edited by kadiem
Link to comment
Share on other sites

Good first attempt :)

You don't need to use widgets for checking to see if its in dialogue or level up dialogue (it's counted as a dialogue)

if (getDialogues().isPendingContinuation) {

getDialogues().completeDialogue();

}

 

Also try to stay away from using static widgets (widget ids) as they will commonly break during updates.

You can use containingText instead for widgets.

Edited by seeker
Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...