Jump to content

Collection Adventurer Jon Path Rewards


TheKevin
 Share

Recommended Posts

GET rdy for it guys @veedubman87 and me finished and i tested it: Adventurer Jon Collection without anything to do self. 
So it will go to the Jon, claim what is claimable and walk to the castle bank to deposit all (inv. & Euip) and stops.

Edit: Found a problem by some more and longer testings, its fixed. Problem with script stucks sometime by jon doesnt appear anymore.

Edit 2: Last fix now with a area updated.
 

import com.epicbot.api.shared.APIContext;
import com.epicbot.api.shared.GameType;
import com.epicbot.api.shared.entity.NPC;
import com.epicbot.api.shared.model.Area;
import com.epicbot.api.shared.script.LoopScript;
import com.epicbot.api.shared.script.ScriptManifest;
import com.epicbot.api.shared.util.time.Time;


@ScriptManifest(name = "Adventurer Jon Collector", gameType = GameType.OS)
public class CollectPathRewards extends LoopScript {
    
    private final Area FrontAdventureJon = new Area (3231, 3233, 3233, 3235);
    private final Area Lumbridge_Bank = new Area(2, 3207, 3222, 3210, 3215);
    public int Phase = 1;
    APIContext ctx;

    @Override
    public boolean onStart(String... strings) {
        System.out.println("Walk to Jon to collect the Rewards");
        ctx = getAPIContext();
        return true;
    }

    @Override
    protected int loop() {
        System.out.println(FrontAdventureJon);
        if (Phase == 3) {
            System.out.println("Banking");
            walkBank();
        }else if (!FrontAdventureJon.contains(ctx.localPlayer().getLocation()) || Phase == 1) {
            System.out.println("Walk to Jon");
            walkToAdventurePathDude();
        }else if (FrontAdventureJon.contains(ctx.localPlayer().getLocation()) && Phase == 2) {
            System.out.println("Collecting Items");
            collect();
        }
        else{
            System.out.println("Failed");
            getAPIContext().game().logout();
        }
        return 100;
    }

    public void walkToAdventurePathDude(){

        if ((getAPIContext().walking().getRunEnergy() >= 40) && (!getAPIContext().walking().isRunEnabled())){
            getAPIContext().walking().setRun(true);
        }

        if (!isActioning()){
            getAPIContext().webWalking().walkTo(FrontAdventureJon.getCentralTile());
        }

        if (FrontAdventureJon.contains(ctx.localPlayer().getLocation())){
            Phase = 2;
        }
    }

    public void collect (){

        if (getAPIContext().dialogues().isDialogueOpen()) {
            if (getAPIContext().dialogues().canContinue()) {
                getAPIContext().dialogues().selectContinue();
                Time.sleep(3000);
            } else {
                Phase = 3;
            }
        } else {
            NPC Jon = ctx.npcs().query().nameMatches("Adventurer Jon").results().first();
            if (Jon.interact("Claim")) {
                Time.sleep(3000 , () -> getAPIContext().dialogues().isDialogueOpen());
            }
        }
    }

    public void walkBank(){

        if ((getAPIContext().walking().getRunEnergy() > 40 && !(getAPIContext().walking().isRunEnabled()))){
            getAPIContext().walking().setRun(true);
        }
        if (Lumbridge_Bank.contains(ctx.localPlayer().getLocation())) {
            if (ctx.bank().isOpen()) {
                if (!ctx.inventory().isEmpty()) {
                    ctx.bank().depositEquipment();
                    Time.sleep(2000, () -> ctx.equipment().isEmpty());
                    ctx.bank().depositInventory();
                    Time.sleep(2000, () -> ctx.inventory().isEmpty());
                }
                else {
                    ctx.script().stop("Rewards Collected");
                }
            }
            else {
                ctx.bank().open();
            }
        }
        else {
            ctx.webWalking().walkTo(Lumbridge_Bank.getCentralTile());
        }
    }

    public boolean isActioning(){
        return getAPIContext().localPlayer().isAnimating() || getAPIContext().localPlayer().isMoving();
    }
}

 

 

 

CollectPathRewards.class

Edited by TheKevin
Area for Jon wasnt good
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.

 Share

×
×
  • Create New...