Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.calem.elder.tasks;
- import com.runemate.game.api.hybrid.input.Mouse;
- import com.runemate.game.api.hybrid.local.Camera;
- import com.runemate.game.api.hybrid.local.Screen;
- import com.runemate.game.api.hybrid.local.hud.Menu;
- import com.runemate.game.api.hybrid.local.hud.interfaces.Bank;
- import com.runemate.game.api.hybrid.location.navigation.Traversal;
- import com.runemate.game.api.hybrid.location.navigation.basic.BresenhamPath;
- import com.runemate.game.api.hybrid.location.navigation.web.WebPath;
- import com.runemate.game.api.hybrid.region.Banks;
- import com.runemate.game.api.hybrid.region.Players;
- import com.runemate.game.api.hybrid.util.calculations.Random;
- import com.runemate.game.api.script.Execution;
- import com.runemate.game.api.script.framework.task.Task;
- /**
- * Created by Calem on 30.4.2015.
- */
- public class banking extends Task {
- @Override
- public boolean validate() {
- return 1 > 0; // execute when inventory is full. Change this to anything else when you want the script to bank.
- }
- @Override
- public void execute() {
- if (Banks.getLoaded() != null) {
- System.out.println("Not null");
- if (Banks.getLoaded().nearest().getPosition().distanceTo(Players.getLocal()) <= 10) {
- System.out.println("Under 10");
- if (Banks.getLoaded().nearest().isVisible()) {
- System.out.println("Visible");
- if (Banks.getLoaded().nearest().interact("Bank")) {
- System.out.println("Interact");
- Execution.delayUntil(() -> Bank.isOpen(), Random.nextInt(800, 2000));
- } else {
- System.out.println("Failed interaction.");
- if (Menu.isOpen() && !Menu.contains("Bank")) {
- switch (Random.nextInt(1, 5)) {
- case 3:
- Menu.close();
- break;
- default:
- Mouse.move(Screen.getBounds().getInteractionPoint());
- break;
- }
- }
- switch (Random.nextInt(1, 10)) {
- case 5:
- Mouse.move(Screen.getBounds().getInteractionPoint());
- break;
- }
- }
- } else {
- System.out.println("Not visible");
- Camera.passivelyTurnTo(Random.nextInt(1, 359));
- }
- } else {
- System.out.println("More than 10");
- WebPath path = Traversal.getDefaultWeb().getPathBuilder().buildTo(Banks.getLoaded().sortByDistance().limit(3).random().getPosition().randomize(1, 3));
- if (path != null) {
- if (path.step(true)) {
- switch (Random.nextInt(1, 7)) {
- case 5:
- Camera.passivelyTurnTo(Random.nextInt(1, 359));
- break;
- }
- }
- } else {
- BresenhamPath p = BresenhamPath.buildTo(Banks.getLoaded().sortByDistance().limit(3).random().getPosition().randomize(1, 3));
- if (p != null) {
- if (p.step(true)) {
- switch (Random.nextInt(1, 7)) {
- case 5:
- Camera.passivelyTurnTo(Random.nextInt(1, 359));
- break;
- }
- }
- }
- }
- }
- } else {
- System.out.println("we are fucked");
- }
- }
- }
Add Comment
Please, Sign In to add comment