Guest User

Untitled

a guest
Jan 21st, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.73 KB | None | 0 0
  1. import java.awt.*;
  2. import java.util.*;
  3. import java.util.List;
  4. import java.util.logging.Level;
  5. import javax.accessibility.*;
  6. import javax.swing.*;
  7.  
  8. import org.rsbot.script.wrappers.RSObject;
  9. import org.rsbot.script.wrappers.RSTile;
  10. import org.rsbot.script.wrappers.RSInterface;
  11. import org.rsbot.bot.Bot;
  12. import org.rsbot.script.*;
  13. import org.rsbot.script.wrappers.*;
  14. import org.rsbot.accessors.*;
  15. import org.rsbot.event.listeners.PaintListener;
  16. import org.rsbot.event.listeners.ServerMessageListener;
  17. import org.rsbot.event.events.ServerMessageEvent;
  18. import org.rsbot.util.ScreenshotUtil;
  19. import org.rsbot.script.Script;
  20. import org.rsbot.script.ScriptManifest;
  21. import org.rsbot.script.wrappers.RSObject;
  22. import org.rsbot.script.wrappers.RSTile;
  23. import org.rsbot.event.listeners.*;
  24. import org.rsbot.event.events.ServerMessageEvent;
  25. import org.rsbot.event.listeners.PaintListener;
  26. import org.rsbot.event.listeners.ServerMessageListener;
  27.  
  28. @ScriptManifest(authors = { "Mistersnappy" }, category = "Woodcutting", name = "TreeMurder", version = 2.0, description = "<html><head>"
  29. + "</head><body bgcolor=\"000000\" color=\"ff0000\" font face=\"Arial\">"
  30. + "<center><h1>TreeMurder" + " v2.0</h1></center><br>"
  31. + "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"ff0000\"><tr><td bgcolor=\"ff0000\" colspan=\"2\"><font color=\"black\"><b>AUTOMATIC LOGOFF SETTINGS</td></tr>"
  32. + "<tr><td>Logs to cut before logoff:<br><input type=\"text\" name=\"number\" value=\"100000\"></td></tr>"
  33. + "<tr><td bgcolor=\"ff0000\" colspan=\"2\"><font color=\"black\"><b>CHOPPING SETTINGS</td></tr>"
  34. + "<tr><td>"
  35. + "Location:"
  36. + "<select name='location'>"
  37. + "<option>Camelot"
  38. + "<option>Catherby"
  39. + "<option>Draynor"
  40. + "<option>Edgeville"
  41. + "<option>Falador"
  42. + "<option>Varrock"
  43. + "<option>Grand Exchange"
  44. + "<option>Neitiznot"
  45. + "<option>Seers"
  46. + "</select><br>Tree:"
  47. + "<select name='tree3000'>"
  48. + "<option>Maples"
  49. + "<option>Willows"
  50. + "<option>Yews"
  51. + "<option>Oaks"
  52. + "<option>Normal"
  53. + "<option>Arctic Pines"
  54. + "<option>Magics"
  55. + "</select>"
  56. + "</td>"
  57. + "<td>Would you like to bank or powerchop?<br>"
  58. + "<select name='power'>"
  59. + "<option>Bank"
  60. + "<option>Powerchop"
  61. + "</select></td></tr></table>"
  62. + "</body>\n"
  63. + "</html\n")
  64. public class TreeMurder extends Script implements PaintListener, ServerMessageListener {
  65.  
  66. //Paint Variables\\
  67. private String status = "";
  68. public int startlvl = 0;
  69. public int startexp;
  70. public int logscut;
  71. public int levelsgained;
  72. public long startTime;
  73. public int total;
  74.  
  75. //Args Variables\\
  76. public int rest;
  77. public int Magics;
  78. public int Oaks;
  79. public int Willows;
  80. public int Maples;
  81. public int Yews;
  82. public int Pines;
  83. public int treeType;
  84. public int wantstobank;
  85.  
  86. //Variables\\
  87. public int[] strangerock = { 15541, 15542, 15543, 15544 };
  88. public boolean edge;
  89. public int[] donotdrop = { 5075, 5074, 5073, 5072, 5071, 5070, 7413, 1359, 1349, 1351, 1353, 1355, 1357, 1361, 6739 };
  90. public int[] nestID = { 5075, 5074, 5073, 5072, 5071, 5070, 7413 };
  91. private String reply = "";
  92. public double x1, x2 = 1.5;
  93. public int number;
  94. public int sethour;
  95. public int setminute;
  96. public int[] axes = {1359, 1349, 1351, 1353, 1355, 1357, 1361, 6739};
  97. public int[] treeID;
  98. public int wcanimation = 2846;
  99. public int bankBooth;
  100. public int number1;
  101. public int number2;
  102. public int ivyID = 11686;
  103. public int ivyanimation = 870;
  104.  
  105. //Paths\\
  106. RSTile[] toWillows;
  107. RSTile[] toBank;
  108.  
  109.  
  110.  
  111. public boolean onStart(Map<String, String> args) {
  112. Bot.getEventManager().addListener(PaintListener.class, this);
  113. Bot.getEventManager().addListener(ServerMessageListener.class, this);
  114. if (getEnergy() > random(30, 50)) {
  115. setRun(true);
  116. }
  117.  
  118. //////////////////////////Args\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  119.  
  120. if (args.get("power").equals("Bank")) {
  121. wantstobank = 1;
  122. }
  123. if (args.get("power").equals("Powerchop")) {
  124. wantstobank = 0;
  125. }
  126.  
  127. //////////////////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  128.  
  129. if (args.get("location").equals("Camelot") && args.get("tree3000").equals("Willows")) {
  130. treeID = new int[] {5553, 5552, 5551};
  131. toWillows = new RSTile[] {new RSTile(2719, 3503), new RSTile(2713, 3511)};
  132. toBank = new RSTile[] {new RSTile(2719, 3504), new RSTile(2725, 3493)};
  133. bankBooth = 25808;
  134. treeType = Willows;
  135. rest = 0;
  136. }
  137. if (args.get("location").equals("Camelot") && args.get("tree3000").equals("Maples")) {
  138. treeID = new int[] {1307};
  139. toWillows = new RSTile[] {new RSTile(2729, 3500)};
  140. toBank = new RSTile[] {new RSTile(2726, 3492)};
  141. bankBooth = 25808;
  142. treeType = Maples;
  143. rest = 0;
  144. }
  145. if (args.get("location").equals("Catherby") && args.get("tree3000").equals("Willows")) {
  146. treeID = new int[] {5553, 5552, 5551};
  147. toWillows = new RSTile[] {new RSTile(2794, 3434), new RSTile(2783, 3430)};
  148. toBank = new RSTile[] {new RSTile(2793, 3433), new RSTile(2807, 3440)};
  149. bankBooth = 2213;
  150. treeType = Willows;
  151. rest = 0;
  152. }
  153. if (args.get("location").equals("Draynor") && args.get("tree3000").equals("Willows")) {
  154. treeID = new int[] {5553, 5552, 5551};
  155. toWillows = new RSTile[] {new RSTile(3086, 3232)};
  156. toBank = new RSTile[] {new RSTile(3093, 3243)};
  157. bankBooth = 2213;
  158. treeType = Willows;
  159. rest = 0;
  160. }
  161. if (args.get("location").equals("Edgeville") && args.get("tree3000").equals("Yews")) {
  162. treeID = new int[] {1309};
  163. toWillows = new RSTile[] {new RSTile(3093, 3478), new RSTile(3086, 3474)};
  164. toBank = new RSTile[] {new RSTile(3092, 3481), new RSTile(3093, 3493)};
  165. bankBooth = 26972;
  166. treeType = Yews;
  167. rest = 1;
  168. }
  169. if (args.get("location").equals("Falador") && args.get("tree3000").equals("Yews")) {
  170. treeID = new int[] {1309};
  171. toWillows = new RSTile[] {new RSTile(3007, 3342), new RSTile(3006, 3327), new RSTile(3018, 3318)};
  172. toBank = new RSTile[] {new RSTile(3006, 3326), new RSTile(3006, 3342), new RSTile(3011, 3356)};
  173. bankBooth = 11758;
  174. treeType = Yews;
  175. rest = 1;
  176. }
  177. if (args.get("location").equals("Varrock") && args.get("tree3000").equals("Yews")) {
  178. treeID = new int[] {1309};
  179. toWillows = new RSTile[] {new RSTile(3253, 3420), new RSTile(3251, 3429), new RSTile(3244, 3443), new RSTile(3245, 3470)};
  180. toBank = new RSTile[] {new RSTile(3245, 3470), new RSTile(3244, 3443), new RSTile(3251, 3429), new RSTile(3253, 3420)};
  181. bankBooth = 11402;
  182. treeType = Yews;
  183. rest = 1;
  184. }
  185. if (args.get("location").equals("Grand Exchange") && args.get("tree3000").equals("Yews")) {
  186. treeID = new int[] { 1309, 1212 };
  187. toWillows = new RSTile[] { new RSTile(3168, 3488),
  188. new RSTile(3174, 3488), new RSTile(3180, 3488),
  189. new RSTile(3185, 3488), new RSTile(3191, 3488),
  190. new RSTile(3195, 3491), new RSTile(3196, 3495),
  191. new RSTile(3209, 3501) };
  192.  
  193. toBank = reversePath(toWillows);
  194. bankBooth = 6533;
  195. treeType = Yews;
  196. rest = 1;
  197. }
  198. if (args.get("location").equals("Draynor") && args.get("tree3000").equals("Oaks")) {
  199. treeID = new int[] { 1281, 1212 };
  200. toWillows = new RSTile[] { new RSTile(3092, 3245),
  201. new RSTile(3100, 3245) };
  202.  
  203. toBank = reversePath(toWillows);
  204. bankBooth = 2213;
  205. treeType = Oaks;
  206. rest = 0;
  207. }
  208. if (args.get("location").equals("Catherby") && args.get("tree3000").equals("Yews")) {
  209. treeID = new int[] { 1309, 1212 };
  210.  
  211. toWillows = new RSTile[] { new RSTile(2808, 3439),
  212. new RSTile(2805, 3433), new RSTile(2796, 3433),
  213. new RSTile(2783, 3432), new RSTile(2771, 3430),
  214. new RSTile(2763, 3429) };
  215.  
  216. toBank = reversePath(toWillows);
  217. bankBooth = 2213;
  218. treeType = Yews;
  219. rest = 1;
  220. }
  221. if (args.get("location").equals("Neitiznot") && args.get("tree3000").equals("Arctic Pines")) {
  222. treeID = new int[] { 21273 };
  223.  
  224. toWillows = new RSTile[] { new RSTile(2329, 3829) };
  225.  
  226. toBank = reversePath(toWillows);
  227. bankBooth = 2213;
  228. treeType = Pines;
  229. rest = 0;
  230. }
  231. if (args.get("location").equals("Seers") && args.get("tree3000").equals("Magics")) {
  232. treeID = new int[] { 1306 };
  233. toWillows = new RSTile[] {new RSTile(2724, 3478), new RSTile(2721, 3461), new RSTile(2721, 3445), new RSTile(2717, 3429), new RSTile(2712, 3415), new RSTile(2710, 3398), new RSTile(2702, 3399)};
  234. toBank = new RSTile[] {new RSTile(2700, 3397), new RSTile(2715, 3400), new RSTile(2722, 3417), new RSTile(2722, 3434), new RSTile(2721, 3453), new RSTile(2722, 3472), new RSTile(2725, 3490)};
  235. bankBooth = 25808;
  236. treeType = Magics;
  237. rest = 1;
  238. }
  239.  
  240. int nunber = Integer.parseInt(args.get("number"));
  241. number = nunber - 1;
  242.  
  243.  
  244. return true;
  245. }
  246.  
  247. public boolean isDoingSomething() {
  248. if (getMyPlayer().getAnimation() != -1) {
  249. return true;
  250. }
  251. if (getMyPlayer().isMoving()) {
  252. return true;
  253. }
  254. return false;
  255. }
  256. public void pause() {
  257. wait(random(500, 2500));
  258.  
  259. }
  260. public boolean doRest() {
  261. if (getEnergy() < random(10, 16)) {
  262. clickMouse(725 + random(-10, 7), 109 + random(-8, 10), false);
  263. atMenu("Rest");
  264. wait(random(25000, 35000));
  265. setRun(true);
  266. }
  267. return true;
  268. }
  269.  
  270. //////////START Chopping Method By Epic\\\\\\\\\\
  271.  
  272. public boolean atTreeEpic33(final RSObject tree, final String action) {
  273. try {
  274. final RSTile loc1 = tree.getLocation();
  275. final RSTile loc4 = new RSTile(loc1.getX() + 1, loc1.getY() + 1);
  276.  
  277. final Point screenLoc = Calculations.tileToScreen(loc4.getX(), loc4.getY(), 10);
  278. if (screenLoc.x == -1 || screenLoc.y == -1) {
  279. return false;
  280. }
  281.  
  282. moveMouse(screenLoc, 3, 3);
  283. wait(random(200, 300));
  284. clickMouse(true);
  285. wait(random(200, 300));
  286. return atMenu(action);
  287. } catch (final Exception e) {
  288. return false;
  289. }
  290. }
  291.  
  292. public boolean atTreeEpic(final RSObject tree, final String action) {
  293. try {
  294. final RSTile loc1 = tree.getLocation();
  295. @SuppressWarnings("unused")
  296. final RSTile loc2 = new RSTile(loc1.getX() + 1, loc1.getY());
  297. @SuppressWarnings("unused")
  298. final RSTile loc3 = new RSTile(loc1.getX(), loc1.getY() + 1);
  299. final RSTile loc4 = new RSTile(loc1.getX() + 1, loc1.getY() + 1);
  300.  
  301. final Point sloc1 = Calculations.tileToScreen(loc1.getX(), loc1.getY(),
  302. 10);
  303. final Point sloc2 = Calculations.tileToScreen(loc4.getX(), loc4.getY(),
  304. 10);
  305. final Point screenLoc = new Point((sloc1.x + sloc2.x) / 2,
  306. (sloc1.y + sloc2.y) / 2);
  307. if (screenLoc.x == -1 || screenLoc.y == -1) {
  308. return false;
  309. }
  310.  
  311. moveMouse(screenLoc, 3, 3);
  312. wait(random(200, 300));
  313. clickMouse(true);
  314. wait(random(200, 300));
  315. return atMenu(action);
  316. } catch (final Exception e) {
  317. return false;
  318. }
  319. }
  320.  
  321.  
  322. public RSObject getLowestCorner(final RSObject testObj) {
  323. RSObject cur = null;
  324. int testID = testObj.getID();
  325. int lowestX = -1;
  326. int lowestY = -1;
  327. int x, y;
  328.  
  329. for (x = 0; x < 5; x++) {
  330. final RSObject o = getObjectAt(testObj.getLocation().getX() - x, testObj.getLocation().getY());
  331. if (o != null) {
  332. if (o.getID() != testID && lowestX == -1) {
  333. lowestX = testObj.getLocation().getX() - x + 1;
  334. }
  335. } else if (lowestX == -1) {
  336. lowestX = testObj.getLocation().getX() - x + 1;
  337. }
  338.  
  339. }
  340. for (y = 0; y < 5; y++) {
  341. final RSObject o = getObjectAt(lowestX, testObj.getLocation().getY() - y);
  342. if (o != null) {
  343. if (o.getID() != testID && lowestY == -1) {
  344. lowestY = testObj.getLocation().getY() - y + 1;
  345. }
  346. } else if (lowestY == -1) {
  347. lowestY = testObj.getLocation().getY() - y + 1;
  348. }
  349. }
  350.  
  351. cur = getObjectAt(lowestX, lowestY);
  352. return cur;
  353.  
  354. }
  355. //////////END Chopping Method By Epic\\\\\\\\\\
  356. public RSObject getClosestTreeByID(final int... ids) {
  357. RSObject cur = null;
  358. double dist = -1;
  359.  
  360. for (int x = 0; x < 104; x++) {
  361. outer: for (int y = 0; y < 104; y++) {
  362. final RSObject o = getObjectAt(x + Bot.getClient().getBaseX(),
  363. y + Bot.getClient().getBaseY());
  364.  
  365. if (o != null) {
  366. boolean isObject = false;
  367. for (final int id : ids) {
  368. if (o.getID() == id) {
  369. isObject = true;
  370. break;
  371. }
  372. }
  373. if (isObject) {
  374. final RSObject tl = getObjectAt(x
  375. + Bot.getClient().getBaseX() - 1, y
  376. + Bot.getClient().getBaseY());
  377. final RSObject tb = getObjectAt(x
  378. + Bot.getClient().getBaseX(), y
  379. + Bot.getClient().getBaseY() - 1);
  380. final int id = o.getID();
  381. if (tl != null && tl.getID() == id || tb != null
  382. && tb.getID() == id) {
  383. continue outer;
  384. }
  385. final double distTmp = calculateDistance(getMyPlayer()
  386. .getLocation(), o.getLocation());
  387.  
  388. if (cur == null || distTmp < dist) {
  389. dist = distTmp;
  390. cur = o;
  391. }
  392. }
  393. }
  394. }
  395. }
  396. return cur;
  397. }
  398.  
  399. public boolean atTree(final RSTile tile) {
  400. try {
  401. final Point location = Calculations.tileToScreen(tile.getX(), tile
  402. .getY(), x1, x2, 0);
  403.  
  404. if (location.x == -1 || location.y == -1 || location.x > 513
  405. || location.y > 335 || location.x < 0 || location.y < 0) {
  406. return false;
  407. }
  408. if (getMenuActions().get(0).toLowerCase().contains("down")) {
  409. clickMouse(true, 10);
  410. wait(random(1000, 2000));
  411. return true;
  412. }
  413. moveMouse(location, 6, 6);
  414. if (getMyPlayer().isMoving()) {
  415. if (getMenuActions().get(0).toLowerCase().contains("down")) {
  416. if (edge) {
  417. atMenu("down");
  418. } else {
  419. clickMouse(true);
  420. }
  421. wait(random(1000, 2000));
  422. return true;
  423. }
  424. }
  425. return false;
  426. } catch (final Exception e) {
  427. e.printStackTrace();
  428. }
  429. return true;
  430. }
  431.  
  432. public boolean clickTree(RSTile tile) {
  433. try {
  434. Point location = Calculations.tileToScreen(tile.getX(), tile.getY(), x1, x1, 0);
  435. if (location.x == -1 || location.y == -1) return false;
  436. moveMouse(location, 3, 3);
  437. clickMouse(true);
  438. } catch (Exception e) {
  439. return false;
  440. }
  441. return false;
  442. }
  443.  
  444. public boolean cutTree() {
  445. if(!isDoingSomething()) {
  446. RSObject Tree = getNearestObjectByID(treeID);
  447. if (Tree == null)
  448. return false;
  449. final RSTile treeLoc = Tree.getLocation();
  450.  
  451. /*if (distanceTo(treeLoc) == 5) {
  452. turnToTile(treeLoc);
  453. wait(random(800, 1000));
  454. }
  455. */
  456. if (distanceTo(treeLoc) >= random(4, 5) && distanceTo(treeLoc) <= random(11, 12)) {
  457. walkTileMM(treeLoc);
  458. wait(random(800, 1000));
  459. }
  460. if (random(1,20) == 10) {
  461. walkTileMM(treeLoc);
  462. wait(random(800, 1000));
  463. }
  464.  
  465.  
  466. RSObject finalTree = getLowestCorner(Tree);
  467.  
  468. if (treeType == Pines) {
  469. return atTreeEpic33(finalTree, "Cut");
  470. }
  471.  
  472. if (treeType == Yews) {
  473. return atTreeEpic33(finalTree, "Chop");
  474. } else {
  475. return atTreeEpic(finalTree, "Chop");
  476. }
  477. }
  478. return false;
  479. }
  480.  
  481. private boolean openBank() {
  482. status = "Opening Bank";
  483. try {
  484. RSObject bank = findObject(bankBooth);
  485. return atObject(bank, "Use-quickly");
  486. } catch (final Exception e) {
  487. return false;
  488. }
  489. }
  490.  
  491. public boolean depositLogs1(){
  492. status = "Depositing Logs";
  493. if(!bank.isOpen()) return false;
  494. bank.depositAllExcept(axes);
  495. bank.close();
  496. return true;
  497. }
  498.  
  499. public boolean handleBank() {
  500. walkPathMM(toBank);
  501.  
  502. RSObject thebank = findObject(bankBooth);
  503. if(!bank.isOpen()) {
  504. if (thebank != null)
  505. atObject(thebank, "Use-quickly");
  506. number1 = 700;
  507. number2 = 1200;
  508. wait(random(number1,number2));
  509. }
  510.  
  511. if(bank.isOpen() && isInventoryFull()){
  512. bank.depositAllExcept(axes);
  513. }
  514.  
  515. if(bank.isOpen()){
  516. bank.close();
  517. }
  518. return true;
  519. }
  520. public boolean nestPickup(){
  521. RSItemTile nest = getGroundItemByID(nestID);
  522. if(nest == null) {
  523. return false;
  524. }
  525. log("NEST PCIKING(BETA): Nest found, picking up...");
  526. return atTile(nest, "Take");
  527. }
  528.  
  529.  
  530.  
  531. ////////////////////Auto-Reply\\\\\\\\\\\\\\\\\\\\\
  532. public boolean replyToPlayer(String text) {
  533. text=text.toLowerCase();
  534. reply="NO REPLY";
  535. Boolean doPrefix = true;
  536. int oldTab = -1;
  537.  
  538.  
  539. if (text.contains("botting?") || text.contains("ur a bot") || text.contains("bot?") || text.contains("macro?") || text.contains("bot..")) {
  540. String[] bottingArray = {"botting is lame","bots r for losers!","id never bot","lol botting fails","i sure ain't a bot"};
  541. String botting=bottingArray[random(0,bottingArray.length)];
  542. sendText(botting,true);
  543. reply=botting;
  544. return true;
  545. }
  546. if((text.contains("level") || text.contains("lv")) && (text.indexOf(" ") == text.lastIndexOf(" ") || text.startsWith("what") || text.endsWith("?") || text.endsWith("lv") || text.endsWith("lvl") || text.endsWith("lev") || text.endsWith("level"))) { //asking for a level
  547. String[] lvlArray = {"Mines + wclevel +","+ wclevel +"};
  548. String lvl=lvlArray[random(0,lvlArray.length)];
  549. sendText(lvl,true);
  550. reply=lvl;
  551. int wclevel = skills.getCurrentSkillLevel(STAT_WOODCUTTING);
  552. return true;
  553. }
  554. return true;
  555. }
  556.  
  557. public void serverMessageRecieved(final ServerMessageEvent arg0) {
  558. final String s = arg0.getMessage();
  559. if (s.contains("You've just advanced")) {
  560. levelsgained++;
  561. }
  562. if (s.contains("You get some")) {
  563. logscut++;
  564. }
  565. if (s.contains("A bird's nest falls")) {
  566. nestPickup();
  567. }
  568. }
  569.  
  570. public void onRepaint(Graphics g) {
  571. if (isLoggedIn()) {
  572. int xpGained = 0;
  573. if ( startexp == 0) {
  574. startexp = skills.getCurrentSkillExp(STAT_WOODCUTTING);
  575. }
  576. if ( startlvl == 0) {
  577. startlvl = skills.getCurrentSkillLevel(STAT_WOODCUTTING);
  578. }
  579. if ( startTime == 0) {
  580. startTime = System.currentTimeMillis();
  581. }
  582. levelsgained = skills.getCurrentSkillLevel(STAT_WOODCUTTING) - startlvl;
  583. xpGained = skills.getCurrentSkillExp(STAT_WOODCUTTING) - startexp;
  584. long millis = System.currentTimeMillis() - startTime;
  585. long hours = millis / (1000 * 60 * 60);
  586. millis -= hours * (1000 * 60 * 60);
  587. long minutes = millis / (1000 * 60);
  588. millis -= minutes * (1000 * 60);
  589. long seconds = millis / 1000;
  590. long minutes2 = minutes + (hours * 60);
  591. int total = number + 1;
  592. int logpercent = (logscut / number) * 100;
  593. int ptf = (number - logscut) / 100;
  594. int ptl = skills.getPercentToNextLevel(Constants.STAT_WOODCUTTING);
  595. int tolevel = skills.getPercentToNextLevel(Constants.STAT_WOODCUTTING);
  596. int nextlevel = skills.getCurrentSkillLevel(STAT_WOODCUTTING) + 1;
  597. int logsleft = total - logscut;
  598.  
  599. g.setColor(Color.black);
  600. g.fill3DRect(4, 172, 120, 167, true);
  601.  
  602. g.setColor(Color.red);
  603. g.fill3DRect(9, 262, 100, 16, true);
  604. g.setColor(Color.green);
  605. g.fill3DRect(9, 262, ptl, 16, true);
  606.  
  607. g.setColor(Color.green);
  608. g.fill3DRect(9, 307, 100, 16, true);
  609. g.setColor(Color.red);
  610. g.fill3DRect(9, 307, ptl, 16, true);
  611.  
  612. g.setColor(Color.white);
  613. g.drawString(+ tolevel +"%", 260, 470);
  614.  
  615. g.setColor(Color.red);
  616. g.drawString("TreeMurder v2.0", 9, 185);
  617. g.drawString("Progress:", 9, 200);
  618. g.setColor(Color.white);
  619. g.drawString("Runtime: " + hours + ":" + minutes + ":"
  620. + seconds + "." , 9, 215);
  621. g.drawString("Logs Cut: " + logscut + "/"+ total, 9, 230);
  622. g.drawString("XP Gained: " + xpGained, 9, 245);
  623. g.drawString("Levels Gained: " + levelsgained, 9, 260);
  624.  
  625. g.setColor(Color.black);
  626. g.drawString( + tolevel + "% TO " + nextlevel, 12, 275);
  627. g.setColor(Color.white);
  628. g.drawString( + tolevel + "% TO " + nextlevel, 13, 276);
  629.  
  630. g.setColor(Color.red);
  631. g.drawString("What's Left:", 9, 290);
  632. g.setColor(Color.white);
  633. g.drawString("Logs Left: " + logsleft, 9, 305);
  634.  
  635. g.setColor(Color.black);
  636. g.drawString( + 100 - tolevel + "% LEFT TO " + nextlevel, 12, 320);
  637. g.setColor(Color.white);
  638. g.drawString( + 100 - tolevel + "% LEFT TO " + nextlevel, 13, 321);
  639. g.setColor(Color.red);
  640. }
  641. }
  642.  
  643. public boolean walkToBank(){
  644. try {
  645. return walkPathMM(randomizePath(toBank, 2 , 2) , 17);
  646. } catch (final Exception e) {
  647. log("Caught Exception");
  648. }
  649. return false;
  650. }
  651.  
  652. public boolean walkToTrees(){
  653. try {
  654. return walkPathMM(randomizePath(toWillows, 2 , 2) , 17);
  655. } catch (final Exception e) {
  656. log("Caught Exception");
  657. }
  658. return false;
  659. }
  660.  
  661. public int loop() {
  662.  
  663. if (inventoryContains(15541, 15542, 15543, 15544)) {
  664. atInventoryItem(15542, "Destroy");
  665. wait(random(400,700));
  666. atInventoryItem(15543, "Destroy");
  667. wait(random(600,900));
  668. clickMouse(324 + random(-2, 3), 389 + random(-3, 2), true);
  669. }
  670.  
  671. if (getEnergy() > random(90, 99) && getMyPlayer().getAnimation() == 11786) {
  672. walkPathMM(toWillows);
  673. }
  674.  
  675. if(logscut >= number){
  676. log("Cut the logs asked for...ending script");
  677. logout();
  678. }
  679. if(getMyPlayer().isMoving()){
  680. return 700;
  681. }
  682. if(getMyPlayer().getAnimation() == wcanimation){
  683. status = "Chopping Logs";
  684. return 700;
  685. }
  686. if(isInventoryFull() && wantstobank == 1){
  687. status = "Walking to Bank";
  688. walkToBank();
  689. wait(random(800, 1001));
  690. if(bank.isOpen()){
  691. depositLogs1();
  692. return 800;
  693. }
  694. if(!bank.isOpen()){
  695. openBank();
  696. return 800;
  697. }
  698. }
  699. if(isInventoryFull() && wantstobank == 0){
  700. try {
  701. dropAllExcept(donotdrop);
  702. } catch (final Exception e) {
  703. return 20;
  704. }
  705. }
  706. status = "Walking to Trees...";
  707. doRest();
  708. walkToTrees();
  709. cutTree();
  710.  
  711. return random(800, 1000);
  712. }
  713.  
  714. public void onFinish() {
  715. Bot.getEventManager().removeListener(PaintListener.class, this);
  716. Bot.getEventManager().removeListener(ServerMessageListener.class, this);
  717. ScreenshotUtil.takeScreenshot(true);
  718. }
  719. }
Add Comment
Please, Sign In to add comment