Guest User

Untitled

a guest
Jun 21st, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.65 KB | None | 0 0
  1. package com.scripts;
  2.  
  3. import com.kbot2.handlers.eventSystem.eventListeners.ServerMessageListener;
  4. import com.kbot2.scriptable.Script;
  5. import com.kbot2.scriptable.methods.wrappers.*;
  6. import com.kbot2.scriptable.methods.data.Skills;
  7. import com.kbot2.scriptable.methods.data.GameScreen;
  8. import com.kbot2.scriptable.methods.data.Bank;
  9. import com.kbot2.scriptable.methods.data.Interfaces;
  10. import com.kbot2.scriptable.methods.data.GroundItems;
  11. import com.kbot2.scriptable.methods.wrappers.Tile;
  12. import com.kbot2.scriptable.methods.wrappers.Character;
  13. import com.kbot2.scriptable.methods.wrappers.Player;
  14.  
  15.  
  16.  
  17. import java.awt.Graphics;
  18. import javax.swing.*;
  19. import java.awt.event.ActionEvent;
  20. import java.awt.event.ActionListener;
  21. import java.awt.Point;
  22. import java.awt.event.KeyEvent;
  23. import java.text.DecimalFormat;
  24.  
  25.  
  26.  
  27. public class DugsWillowBurner extends Script implements ServerMessageListener {
  28.  
  29.  
  30.  
  31. int [] trees = {1308, 5551, 5552, 5553, 8481, 8482, 8483,
  32. 8484, 8485, 8486, 8487, 8488};
  33. int [] axes = {1351, 1357, 1361, 6739, 1349, 1355, 1359, 1353};
  34. int [] tinderbox = {590, 2946};
  35. int log = 1519;
  36. String Status;
  37. Obj t;
  38. Obj b;
  39. int fireTries = 0;
  40. Tile lastChopped = null;
  41. int status = 0;
  42. boolean useLogs = false;
  43. boolean waitItOut = false;
  44. boolean nextLocation = false;
  45. long antibanTimer = 0;
  46. Tile[] toSarim = new Tile[]{new Tile(3050,3265), new Tile(3056,3265), new Tile(3059,3261), new Tile(3058,3256), };
  47. Tile sTreeTile = new Tile(3060,3253);
  48.  
  49. //Paint
  50.  
  51. String statusMsg = "Loading...";
  52. int numBurned = 0;
  53. long startTime = System.currentTimeMillis();
  54. int origExp = 0;
  55. int origLvl = 1;
  56.  
  57.  
  58. public String[] getTags() { return new String[]{"Duggypkers", "Willow Cutter/Burner"}; }
  59.  
  60. public boolean active() {
  61. return true;
  62. }
  63.  
  64. @Override
  65. public boolean onStart() {
  66. log("Starting the Script...");
  67. return true;
  68. }
  69.  
  70. public String getName() {
  71. return "DugsWillowburner";
  72. }
  73.  
  74. public String getAuthor() {
  75. return "Duggypker";
  76. }
  77.  
  78. public String getDescription() {
  79. return "Cuts willows and then burns them.";
  80. }
  81.  
  82. public void onServerMessage(String P) {
  83. if (P.contains("You can't")) {
  84. status = 3;
  85. }
  86. }
  87.  
  88. public void antiban() {
  89.  
  90. int ab = random(0, 3);
  91.  
  92. if(ab == 0 || ab == 1) { // Move camera up and down
  93. char k = (random(0, 1) == 0 ? (char)KeyEvent.VK_DOWN : (char)KeyEvent.VK_UP);
  94. keyboard.pressKey(k);
  95. sleep(random(10, 400));
  96. keyboard.releaseKey(k);
  97. }
  98. if(ab == 2 || ab == 3) // Rotate camera
  99. camera.setAngle(camera.getAngle() + random(-90, 90));
  100.  
  101. gameScreen.openTab(GameScreen.TAB_INVENTORY);
  102. antibanTimer = System.currentTimeMillis() + random(15000, 30000);
  103.  
  104. }
  105.  
  106.  
  107. public int loop() {
  108.  
  109. setMouseSpeed(random(3,5));
  110.  
  111. if(getMyPlayer().getAnimation() != -1 || getMyPlayer().isMoving()) {
  112. if(System.currentTimeMillis() > antibanTimer)
  113. antiban();
  114. return 100;
  115. }
  116.  
  117. switch (status) {
  118.  
  119. case 0:
  120. if (inventory.isFull()) {
  121. status = 2;
  122. } else if (!inventory.isFull()) {
  123. status = 1;
  124. }
  125.  
  126.  
  127.  
  128. if(walking.getEnergy() > 40) walking.setRunning(true);
  129.  
  130.  
  131.  
  132. case 1:
  133. // Chopping Tree
  134. t = getClosestObject(7, trees);
  135. if (t != null && t.getLocation().getX() != -1
  136. && t.getLocation().getY() != 1
  137. && getMyPlayer().getAnimation() == -1)
  138. t.doAction("Chop Down");
  139. lastChopped = getMyPlayer().getLocation(); /*shorter version of the bottom code, gets the location of player.*/
  140. /*Tile lastChopped = new Tile(getMyPlayer().getLocation().getX(), getMyPlayer().getLocation().getY());*/ //reads the x and Y variables...
  141. if (t == null)
  142. return random(100, 200);
  143. if (inventory.isFull()) {
  144. status = 2;
  145. }
  146. return random(150, 300);
  147.  
  148.  
  149.  
  150.  
  151. case 2:
  152. if(inventory.contains(tinderbox) && inventory.getCount() > 0) {
  153. /*walking.walkToMM(new Tile(3069, 3237));*/
  154. if(!useLogs) {
  155. inventory.atItem("Use", tinderbox);
  156. int idx = 0;
  157. for(int i = 0; i < inventory.getItems().length; i++) {
  158. if(inventory.getItems()[i].getID() == log) {
  159. idx = i;
  160. break;
  161. }
  162. }
  163. Point P = inventory.getInventoryItemLoc(idx);
  164. moveMouse(P, 10, 10);
  165. mouse.clickMouse(true);
  166. if(inventory.getCount() == 1)
  167. if (distanceTo(lastChopped) > 10);
  168. walking.walkToMM(lastChopped);
  169. status = 1;
  170. } else {
  171. inventory.atItem("Use", log);
  172. }
  173. }
  174. else {
  175. if(!inventory.contains(tinderbox)) {
  176. GroundItem tboxOnGround = groundItems.getClosestItem(10, tinderbox);
  177. if(tboxOnGround != null) {
  178. log("Droped the Tinderbox...");
  179. if(tboxOnGround.doAction("Take Tinderbox"))
  180. sleep(300, 500);
  181. }
  182. } else {
  183. waitItOut = false;
  184. return 700;
  185. }
  186. }
  187. return 700;
  188.  
  189. case 3:
  190. if(getMyPlayer().getAnimation() == -1) {
  191. walking.walkToMM(new Tile (getMyPlayer().getLocation().getX()
  192. +random(1, 5), getMyPlayer().getLocation().getY()+random(1, 5)));
  193.  
  194. status = 2;
  195. }
  196. else {
  197. return 700;
  198. }
  199.  
  200. }
  201. return random(1000, 2000);
  202. }
  203.  
  204. }
Add Comment
Please, Sign In to add comment