Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.calems.bots.elder;
- import com.runemate.game.api.client.paint.PaintListener;
- import com.runemate.game.api.hybrid.RuneScape;
- import com.runemate.game.api.hybrid.entities.GameObject;
- import com.runemate.game.api.hybrid.entities.Player;
- import com.runemate.game.api.hybrid.entities.definitions.ItemDefinition;
- import com.runemate.game.api.hybrid.local.Camera;
- import com.runemate.game.api.hybrid.local.Skill;
- import com.runemate.game.api.hybrid.local.hud.interfaces.Bank;
- import com.runemate.game.api.hybrid.local.hud.interfaces.Inventory;
- import com.runemate.game.api.hybrid.location.Area;
- import com.runemate.game.api.hybrid.location.Coordinate;
- import com.runemate.game.api.hybrid.location.navigation.Path;
- import com.runemate.game.api.hybrid.location.navigation.basic.PredefinedPath;
- import com.runemate.game.api.hybrid.region.GameObjects;
- import com.runemate.game.api.hybrid.region.Players;
- import com.runemate.game.api.hybrid.util.StopWatch;
- import com.runemate.game.api.rs3.net.GrandExchange;
- import com.runemate.game.api.rs3.net.GrandExchange.Item;
- import com.runemate.game.api.script.Execution;
- import com.runemate.game.api.script.framework.LoopingScript;
- import com.runemate.game.api.script.framework.listeners.InventoryListener;
- import com.runemate.game.api.script.framework.listeners.SkillListener;
- import com.runemate.game.api.script.framework.listeners.events.ItemEvent;
- import com.runemate.game.api.script.framework.listeners.events.SkillEvent;
- import java.awt.*;
- public class chopper extends LoopingScript implements PaintListener, InventoryListener, SkillListener {
- private final static Player player = Players.getLocal();
- private final static String LOG = "Elder Tree";
- private final static Area chopArea = new Area.Rectangular(new Coordinate(cord, cord, c), new Coordinate(cord, cord, c));
- private final static Area bankArea = new Area.Rectangular(new Coordinate(cord, cord, c), new Coordinate(cord, cord, c));
- private final static StopWatch runtime = new StopWatch();
- private static int logCount = 0;
- private static int logPrice = 0;
- private static int levelsGained = 0;
- private static boolean isInChop() {
- return chopArea.contains(player);
- }
- private static boolean isInBank() {
- return bankArea.contains(player);
- }
- @Override
- public void onStart(String... args) {
- setLoopDelay(250, 700);
- getEventDispatcher().addListener(this);
- final Item oreGE = GrandExchange.lookup(438);
- if (oreGE != null) logPrice = oreGE.getPrice();
- runtime.start();
- }
- @Override
- public void onLoop() {
- GameObject ore = GameObjects.newQuery().names(LOG).within(chopArea).results().nearest();
- GameObject minedOre = GameObjects.newQuery().names("Logs").within(chopArea).results().nearest();
- if (!Inventory.isFull() && ChopisIn()) { // cutting
- if (ore != null && isIdle() && ore.isVisible()) {
- if (ore.interact("Chop down"))
- Execution.delayWhile(player::isMoving, 250, 350);
- } else if (ore != null && ore.isVisible() && minedOre != null && player.isFacing(minedOre)) {
- if (ore.interact("Chop down"))
- Execution.delayWhile(player::isMoving, 250, 350);
- } else if (ore != null && !ore.isVisible()) {
- Camera.turnTo(ore);
- }
- } else if (Inventory.isFull() && !isInBank()) { // WalkingToBank to bank
- final Path bankPath = PredefinedPath.create(new Coordinate(3285, 3366, 0), new Coordinate(3287, 3371, 0), new Coordinate(3290, 3375, 0), new Coordinate(3293, 3380, 0), new Coordinate(3292, 3385, 0), new Coordinate(3292, 3392, 0), new Coordinate(3292, 3397, 0), new Coordinate(3292, 3404, 0), new Coordinate(3292, 3405, 0), new Coordinate(3288, 3412, 0), new Coordinate(3286, 3417, 0), new Coordinate(3283, 3420, 0), new Coordinate(3280, 3425, 0), new Coordinate(3275, 3428, 0), new Coordinate(3269, 3428, 0), new Coordinate(3264, 3428, 0), new Coordinate(3259, 3428, 0), new Coordinate(3254, 3426, 0), new Coordinate(3254, 3422, 0));
- bankPath.step();
- } else if (Inventory.isFull() && isIdle() && isInBank()) { // Banking.
- if (!Bank.isOpen()) {
- Bank.open();
- Execution.delayUntil(Bank::isOpen, 250, 2000);
- } else {
- Bank.depositInventory();
- Execution.delayUntil(Inventory::isEmpty, 250, 1500);
- }
- } else if (!Inventory.isFull() && !isInChop()) { // WalkingToBank to tress
- final Path minePath = PredefinedPath.create(new Coordinate(3285, 3366, 0), new Coordinate(3287, 3371, 0), new Coordinate(3290, 3375, 0), new Coordinate(3293, 3380, 0), new Coordinate(3292, 3385, 0), new Coordinate(3292, 3392, 0), new Coordinate(3292, 3397, 0), new Coordinate(3292, 3404, 0), new Coordinate(3292, 3405, 0), new Coordinate(3288, 3412, 0), new Coordinate(3286, 3417, 0), new Coordinate(3283, 3420, 0), new Coordinate(3280, 3425, 0), new Coordinate(3275, 3428, 0), new Coordinate(3269, 3428, 0), new Coordinate(3264, 3428, 0), new Coordinate(3259, 3428, 0), new Coordinate(3254, 3426, 0), new Coordinate(3254, 3422, 0)).reverse();
- minePath.step();
- }
- }
- private boolean ChopisIn() {
- }
- private boolean isInCutt() {
- }
- @Override
- public void onPaint(Graphics2D g) {
- Color transBlack = new Color(0, 0, 0, 150);
- //Draw trans rect
- g.setColor(transBlack);
- g.fillRect(0, 0, 200, 100);
- //Draw border of rect
- g.setColor(Color.blue);
- g.drawRect(0, 0, 200, 100);
- //Draw green underline under title
- g.drawLine(5, 20, 195, 20);
- //Draw text
- g.setColor(Color.white);
- // Text
- g.drawString("Calem's_chopperr", 80, 15);
- g.drawString("Run time: " + runtime.getRuntimeAsString(), 5, 35);
- if (RuneScape.isLoggedIn()) {
- g.drawString("Woodcutting level: " + Skill.WOODCUTTING.getCurrentLevel() + " + " + levelsGained, 5, 50);
- g.drawString("Experience to level: " + Skill.WOODCUTTING.getExperienceToNextLevel(), 5, 65);
- g.drawString("Logs chopped: " + logCount, 5, 80);
- g.drawString("Money gained: " + logPrice * logCount, 5, 95);
- }
- }
- @Override
- public void onItemAdded(ItemEvent event) {
- ItemDefinition definition = event.getItem().getDefinition();
- if (definition != null && definition.getName().equals("Elder tree")) {
- logCount++;
- }
- }
- @Override
- public void onLevelUp(SkillEvent event) {
- if (event.getSkill().equals(Skill.WOODCUTTING)) {
- ++levelsGained;
- }
- }
- private boolean isIdle() {
- return player.getAnimationId() == -1 && !player.isMoving();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement