Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.scripts;
- import com.kbot2.scriptable.Script;
- import com.kbot2.scriptable.*;
- import com.kbot2.scriptable.methods.*;
- import com.kbot2.scriptable.methods.data.*;
- import com.kbot2.scriptable.methods.wrappers.*;
- import com.kbot2.scriptable.methods.data.Inventory.*;
- import com.kbot2.handlers.eventSystem.eventListeners.PaintListener;
- import com.kbot2.handlers.eventSystem.eventListeners.ServerMessageListener;
- import java.awt.Graphics;
- import java.awt.Color;
- import java.awt.Font;
- import java.awt.*;
- public class CutBurn extends Script implements PaintListener, ServerMessageListener {
- //~ Tree ID ~\\
- public int willowTree[] = {5551, 5552, 5553, 1308};
- //~ Paint Variables ~\\
- public int NumberCut = 0;
- public int NumberBurnt = 0;
- public double xpCutLog = 0;
- public double xpBurnLog = 0;
- public int origWoodcut = 0;
- public int origFiremake = 0;
- long startTime = System.currentTimeMillis();
- //~ Other Variables ~\\
- public Tile[] pathToBurn = new Tile[]{ new Tile(2913,3306), new Tile(2916,3302), new Tile(2921,3301), new Tile(2923,3296), new Tile(2928,3295), new Tile(2933,3296), new Tile(2938,3295), };
- public int cuttingID = 867;
- public int antibanTimer = -1;
- public boolean burnFlag = false;
- public Tile startTile = new Tile(2940, 3293);
- public int TinderboxID = 590;
- public int WillowLogID = 1519;
- //~ Basic Script Information ~\\
- public String getName() { return "Cut And Burn"; }
- public String getAuthor() { return "santa"; }
- public String getDescription() { return "Cuts willows outside crafting guild /n and then burns them. /n /n Written by santa."; }
- public double getVersion() { return 1.0; } //First
- //~ Starting and Ending the Script ~\\
- public boolean onStart() {
- origWoodcut = skills.getLevel(Skills.SKILL_WOODCUTTING);
- origFiremake = skills.getLevel(Skills.SKILL_FIREMAKING);
- log("Cut and Burner version " + getVersion() + " written by santa.");
- return true; }
- public void onStop(){
- log("Cut and Burner version " + getVersion() + " written by santa.");
- log(" ");
- log("Cut: " + NumberCut + " willow logs");
- log("Burnt: " + NumberBurnt + " willow logs");
- log("Gained " + (xpCutLog * NumberCut) + " woodcutting xp and " + (xpBurnLog * NumberBurnt) + " firemaking xp.");
- return; }
- //~ The stuff that controls your character ~\\
- public int loop() {
- /* Do you have inventory spaces? */
- if(inventory.isFull()) {
- burnFlag = true; //Says we should be burning logs
- if(walking.getEnergy() > random(30,45)) walking.setRunning(true); //turns on run
- antiban();
- walking.walkPath(walking.randomizePath(pathToBurn, 3, 3)); //walks to burning spot.
- /* Burn the first log */
- inventory.atItem("Use", TinderboxID);
- inventory.atItem("->", WillowLogID);
- return random(1300,1600);
- }
- /* Burn the rest of the logs */
- if(burnFlag == true && inventory.contains(true, WillowLogID)) {
- inventory.atItem("Use", TinderboxID);
- inventory.atItem("->", WillowLogID);
- antiban();
- return random(900,1300); }
- /* Set burnFlag to false and empty rest of inventory if we're out of willows */
- if(inventory.contains(false, WillowLogID)) {
- burnFlag = false;
- inventory.dropAllExcept(TinderboxID);
- return random(800,1000); }
- /* Are you currently walking around? */
- if (getMyPlayer().isMoving()) {
- setAltitude(true);
- return random(1000,1500); }
- /*Currently not doing anything, so we can burn logs */
- Obj tree = getClosestObject(25, willowTree);
- if (tree == null) return random(800,1000);
- setMouseSpeed(random(0,4));
- tree.doAction("Chop Down");
- antiban();
- return random(800,1000);
- }
- //~ Check to see if log is cut and burnt ~\\
- public void onServerMessage(String m) {
- if(m.contains("You get some")) { NumberCut++; }
- if(m.contains("fire catches")) { NumberBurnt++; }
- }
- //~ Antiban ~\\
- public void antiban() {
- int banNumber = random(1,9);
- /* This one will examine random things if you're cutting a tree */
- if (banNumber == 1 && getMyPlayer().getAnimation() == cuttingID) {
- Obj[] objectsAround = objects.getObjects(10);
- if(objectsAround.length == 0) // Shouldnt be 0;
- return;
- int randObjs = random(0, objectsAround.length-1);
- objectsAround[randObjs].doAction("Examine"); }
- /* This one will open the friends tab on rare occasions if you're cutting a tree */
- if (banNumber == 2 && (random(0,2) == 1) && (getMyPlayer().getAnimation() == cuttingID)) {
- gameScreen.openTab(GameScreen.TAB_FRIENDS);
- sleep(800, 1500); }
- /* This one will check your woodcutting lvl and xp every so often */
- if (banNumber == 3 && getMyPlayer().getAnimation() == cuttingID) {
- gameScreen.openTab(GameScreen.TAB_STATS);
- int xx = 666;
- int yy = 393;
- moveMouse(new Point(xx, yy), 43, 17);
- sleep(2000, 4000); }
- /* this will move the mouse in random positions whilst cutting trees */
- if ((banNumber == 4 || banNumber = 9) && (getMyPlayer().getAnimation() == cuttingID)) {
- mouse.moveMouse(random(5, 420), random(5, 420));
- sleep(300, 700); }
- /* This will move camera up or down at any random time */
- if (banNumber == 5 || banNumber == 6) {
- char k = (random(0, 1) == 0 ? (char)KeyEvent.VK_DOWN : (char)KeyEvent.VK_UP);
- keyboard.pressKey(k);
- sleep(random(10, 400));
- keyboard.releaseKey(k); }
- /* This one will spin the camera round at any random time */
- if (banNumber == 7 || banNumber == 8) camera.setAngle(random(1, 359));
- /* This sets a timer for doing the antiban again */
- gameScreen.openTab(GameScreen.TAB_INVENTORY);
- antibanTimer = System.currentTimeMillis() + random(15000, 40000);
- }
- //~ Paint ~\\
- public void onRepaint(Graphics g) {
- long runTime = System.currentTimeMillis() - startTime;
- int secs = ((int) ((runTime / 1000) % 60));
- int mins = ((int) (((runTime / 1000) / 60) % 60));
- int hours = ((int) ((((runTime / 1000) / 60) / 60) % 60));
- g.setColor(new Color(0, 0, 0, 155));
- int x = 10;
- int y = 235;
- g.fill3DRect(x, y, 215, 100, true);
- x += 5;
- y += 15;
- g.setColor(Color.RED);
- g.drawString("santa's Cut and Burner v" + getVersion(), x, y);
- g.setColor(Color.WHITE);
- y += 20;
- g.drawString("Logs cut & burnt: " + NumberBurnt, x, y);
- y += 15;
- g.drawString("Run time: " + (hours < 10 ? "0" : "") + hours + ":" + (mins < 10 ? "0" : "") + mins + ":" + (secs < 10 ? "0" : "") + secs, x, y);
- y += 15;
- g.drawString("Woodcutting Levels gained: " + (skills.getLevel(Skills.SKILL_WOODCUTTING) - origWoodcut), x, y);
- y += 15;
- g.drawString("Firemaking Levels gained: " + (skills.getLevel(Skills.SKILL_FIREMAKING) - origFiremake), x, y);
- y += 15;
- g.drawString("Woodcut XP gained: " + (xpCutLog * NumberCut), x, y);
- y += 15;
- g.drawString("Firemake XP gained: " + (NumberBurnt * xpBurnLog), x, y);
- }
- }
Add Comment
Please, Sign In to add comment