Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.scripts;
- import com.kbot2.handlers.eventSystem.eventListeners.ServerMessageListener;
- import com.kbot2.scriptable.Script;
- import com.kbot2.scriptable.methods.wrappers.*;
- import com.kbot2.scriptable.methods.data.Skills;
- import com.kbot2.scriptable.methods.data.GameScreen;
- import com.kbot2.scriptable.methods.data.Bank;
- import com.kbot2.scriptable.methods.data.Interfaces;
- import com.kbot2.scriptable.methods.data.GroundItems;
- import com.kbot2.scriptable.methods.wrappers.Tile;
- import com.kbot2.scriptable.methods.wrappers.Character;
- import com.kbot2.scriptable.methods.wrappers.Player;
- import java.awt.Graphics;
- import javax.swing.*;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.awt.Point;
- import java.awt.event.KeyEvent;
- import java.text.DecimalFormat;
- public class DugsWillowBurner extends Script implements ServerMessageListener {
- int [] trees = {1308, 5551, 5552, 5553, 8481, 8482, 8483,
- 8484, 8485, 8486, 8487, 8488};
- int [] axes = {1351, 1357, 1361, 6739, 1349, 1355, 1359, 1353};
- int [] tinderbox = {590, 2946};
- int log = 1519;
- String Status;
- Obj t;
- Obj b;
- int fireTries = 0;
- Tile lastChopped = null;
- int status = 0;
- boolean useLogs = false;
- boolean waitItOut = false;
- boolean nextLocation = false;
- long antibanTimer = 0;
- Tile[] toSarim = new Tile[]{new Tile(3050,3265), new Tile(3056,3265), new Tile(3059,3261), new Tile(3058,3256), };
- Tile sTreeTile = new Tile(3060,3253);
- //Paint
- String statusMsg = "Loading...";
- int numBurned = 0;
- long startTime = System.currentTimeMillis();
- int origExp = 0;
- int origLvl = 1;
- public String[] getTags() { return new String[]{"Duggypkers", "Willow Cutter/Burner"}; }
- public boolean active() {
- return true;
- }
- @Override
- public boolean onStart() {
- log("Starting the Script...");
- return true;
- }
- public String getName() {
- return "DugsWillowburner";
- }
- public String getAuthor() {
- return "Duggypker";
- }
- public String getDescription() {
- return "Cuts willows and then burns them.";
- }
- public void onServerMessage(String P) {
- if (P.contains("You can't")) {
- status = 3;
- }
- }
- public void antiban() {
- int ab = random(0, 3);
- if(ab == 0 || ab == 1) { // Move camera up and down
- char k = (random(0, 1) == 0 ? (char)KeyEvent.VK_DOWN : (char)KeyEvent.VK_UP);
- keyboard.pressKey(k);
- sleep(random(10, 400));
- keyboard.releaseKey(k);
- }
- if(ab == 2 || ab == 3) // Rotate camera
- camera.setAngle(camera.getAngle() + random(-90, 90));
- gameScreen.openTab(GameScreen.TAB_INVENTORY);
- antibanTimer = System.currentTimeMillis() + random(15000, 30000);
- }
- public int loop() {
- setMouseSpeed(random(3,5));
- if(getMyPlayer().getAnimation() != -1 || getMyPlayer().isMoving()) {
- if(System.currentTimeMillis() > antibanTimer)
- antiban();
- return 100;
- }
- switch (status) {
- case 0:
- if (inventory.isFull()) {
- status = 2;
- } else if (!inventory.isFull()) {
- status = 1;
- }
- if(walking.getEnergy() > 40) walking.setRunning(true);
- case 1:
- // Chopping Tree
- t = getClosestObject(7, trees);
- if (t != null && t.getLocation().getX() != -1
- && t.getLocation().getY() != 1
- && getMyPlayer().getAnimation() == -1)
- t.doAction("Chop Down");
- lastChopped = getMyPlayer().getLocation(); /*shorter version of the bottom code, gets the location of player.*/
- /*Tile lastChopped = new Tile(getMyPlayer().getLocation().getX(), getMyPlayer().getLocation().getY());*/ //reads the x and Y variables...
- if (t == null)
- return random(100, 200);
- if (inventory.isFull()) {
- status = 2;
- }
- return random(150, 300);
- case 2:
- if(inventory.contains(tinderbox) && inventory.getCount() > 0) {
- /*walking.walkToMM(new Tile(3069, 3237));*/
- if(!useLogs) {
- inventory.atItem("Use", tinderbox);
- int idx = 0;
- for(int i = 0; i < inventory.getItems().length; i++) {
- if(inventory.getItems()[i].getID() == log) {
- idx = i;
- break;
- }
- }
- Point P = inventory.getInventoryItemLoc(idx);
- moveMouse(P, 10, 10);
- mouse.clickMouse(true);
- if(inventory.getCount() == 1)
- if (distanceTo(lastChopped) > 10);
- walking.walkToMM(lastChopped);
- status = 1;
- } else {
- inventory.atItem("Use", log);
- }
- }
- else {
- if(!inventory.contains(tinderbox)) {
- GroundItem tboxOnGround = groundItems.getClosestItem(10, tinderbox);
- if(tboxOnGround != null) {
- log("Droped the Tinderbox...");
- if(tboxOnGround.doAction("Take Tinderbox"))
- sleep(300, 500);
- }
- } else {
- waitItOut = false;
- return 700;
- }
- }
- return 700;
- case 3:
- if(getMyPlayer().getAnimation() == -1) {
- walking.walkToMM(new Tile (getMyPlayer().getLocation().getX()
- +random(1, 5), getMyPlayer().getLocation().getY()+random(1, 5)));
- status = 2;
- }
- else {
- return 700;
- }
- }
- return random(1000, 2000);
- }
- }
Add Comment
Please, Sign In to add comment