Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 39.17 KB | None | 0 0
  1. import java.awt.Graphics;
  2. import java.awt.Color;
  3. import java.awt.event.KeyEvent;
  4. import java.awt.event.MouseEvent;
  5. import java.awt.event.MouseListener;
  6. import java.awt.event.MouseMotionListener;
  7. import java.awt.*;
  8. import java.awt.image.BufferedImage;
  9. import java.net.MalformedURLException;
  10. import javax.imageio.ImageIO;
  11. import java.io.IOException;
  12. import java.net.URL;
  13. import java.net.URLConnection;
  14. import java.awt.Font;
  15. import java.io.BufferedReader;
  16. import java.io.InputStreamReader;
  17. import org.rsbot.bot.*;
  18. import org.rsbot.client.input.Mouse;
  19. import org.rsbot.script.ScriptManifest;
  20. import org.rsbot.event.listeners.PaintListener;
  21. import org.rsbot.script.Script;
  22. import org.rsbot.script.methods.Game;
  23. import org.rsbot.script.methods.Skills;
  24. import org.rsbot.script.wrappers.RSInterface;
  25. import org.rsbot.script.wrappers.RSComponent;
  26. import org.rsbot.script.wrappers.RSGroundItem;
  27. import org.rsbot.script.wrappers.RSObject;
  28. import org.rsbot.script.wrappers.RSTile;
  29. import org.rsbot.script.wrappers.RSNPC;
  30. import org.rsbot.event.listeners.ServerMessageListener;
  31.  
  32.  
  33. @ScriptManifest(name = "Tutorial Solver Revamped", authors = { "Fred,Infected_" }, version = 1.92, description = "Solves the Tutorial Quest for you")
  34. public class TutSolver extends Script implements PaintListener {
  35. boolean autoCreate = false, usernameTaken = false,
  36. passwordDunMatch = false;
  37. String prefix, password, username;
  38. int[] interfaceID;
  39. int suffix = -1;
  40. RSTile referenceTile;
  41. RSObject hole, plank, bag;
  42. RSNPC Vant, Goblin, Vant2, Roddeck;
  43. int[] NPCIDs = { 8850, 8862, 8848, 8867 };
  44. int[] armoursonfloor = { 1117, 1173, 1277 };
  45. int accountsCreated = 0;
  46. int height = 1;
  47. long startTime = 0;
  48. long totalTime = 0;
  49. long averageTime = 0;
  50. boolean mining = true;
  51. String blabla = "random stuff";
  52. public long BOT_TIME = 0,
  53. BOT_SEC = 0,
  54. BOT_MIN = 0,
  55. BOT_HOURS = 0,
  56. STAT_CHECK = System.currentTimeMillis(),
  57. START_TIME = System.currentTimeMillis();
  58.  
  59.  
  60. @Override
  61. public boolean onStart() {
  62. env.disableRandom("Login");
  63. env.enableRandom("InterfaceCloser");
  64. TISolverGUI gui = new TISolverGUI();
  65. gui.setVisible(true);
  66. while (gui.isVisible()) {
  67. sleep(500);
  68. }
  69. if (gui.autoCheck.isSelected()) {
  70. autoCreate = true;
  71. prefix = gui.prefixText.getText();
  72. password = gui.passwordText.getText();
  73. }
  74. if (gui.skillCombo.getSelectedItem() == "Woodcutting") {
  75. mining = false;
  76. }
  77. return true;
  78. }
  79.  
  80. @Override
  81. public void onFinish() {
  82. env.enableRandom("LoginBot");
  83. }
  84.  
  85. @Override
  86. public int loop() {
  87.  
  88. if (!game.isLoggedIn()) {
  89. if (autoCreate) {
  90. startTime = System.currentTimeMillis();
  91. if (interfaceThatContains("Create a Free") == null) {
  92. if (!interfaces.getComponent(596, 85).isValid()) {
  93. return random(250, 300);
  94. }
  95. interfaces.getComponent(596, 85).doClick();
  96. sleep(random(1000, 1500));
  97. }
  98. interfaces.getComponent(673, 81).doClick();
  99. sleep(random(1000, 1500));
  100. do {
  101. if (usernameTaken) {
  102. interfaceThatContains("close").doClick();
  103. int numberOfCharToDelete = (suffix - 1 == -1) ? 0
  104. : ("" + suffix).length();
  105. for (int i = 0; i < numberOfCharToDelete; i++) {
  106. keyboard.pressKey((char) java.awt.event.KeyEvent.VK_BACK_SPACE);
  107. sleep(random(200, 300));
  108. keyboard.releaseKey((char) java.awt.event.KeyEvent.VK_BACK_SPACE);
  109. }
  110. }
  111. username = prefix + ((suffix == -1) ? "" : ("" + suffix));
  112. if (username.length() > 12) {
  113. log("Used up all account names");
  114. stopScript();
  115. return -1;
  116. }
  117. if (usernameTaken) {
  118. keyboard.sendText("" + suffix, false);
  119. } else {
  120. keyboard.sendText(username, false);
  121. }
  122. suffix++;
  123. interfaces.getComponent(673, 65).doClick();
  124. sleep(random(1500, 2000));
  125. while (interfaceThatContains("Please wait...") != null) {
  126. sleep(100);
  127. }
  128. usernameTaken = true;
  129. } while (interfaces.getComponent(673, 84).getBackgroundColor() != 1803);
  130. usernameTaken = false;
  131. do {
  132. if (passwordDunMatch) {
  133. RSComponent temp = interfaces.getComponent(673, 65);
  134. mouse.move(
  135. random(temp.getAbsoluteX() + 142,
  136. temp.getAbsoluteX() + temp.getWidth()),
  137. random(temp.getAbsoluteY(), temp.getAbsoluteY()
  138. + temp.getHeight()));
  139. mouse.click(true);
  140. sleep(random(1000, 1500));
  141. int numberOfCharInTextBox = interfaces
  142. .getComponent(673, 66).getText().length();
  143. for (int i = 0; i < numberOfCharInTextBox; i++) {
  144. keyboard.pressKey((char) java.awt.event.KeyEvent.VK_BACK_SPACE);
  145. sleep(random(200, 300));
  146. keyboard.releaseKey((char) java.awt.event.KeyEvent.VK_BACK_SPACE);
  147. }
  148. }
  149. sleep(random(1000, 1500));
  150. keyboard.sendText(password, false);
  151. if (passwordDunMatch) {
  152. RSComponent temp = interfaces.getComponent(673, 49);
  153. mouse.move(
  154. random(temp.getAbsoluteX() + 142,
  155. temp.getAbsoluteX() + temp.getWidth()),
  156. random(temp.getAbsoluteY(), temp.getAbsoluteY()
  157. + temp.getHeight()));
  158. mouse.click(true);
  159. sleep(random(1000, 1500));
  160. int numberOfCharInTextBox = interfaces
  161. .getComponent(673, 50).getText().length();
  162. for (int i = 0; i < numberOfCharInTextBox; i++) {
  163. keyboard.pressKey((char) java.awt.event.KeyEvent.VK_BACK_SPACE);
  164. sleep(random(200, 300));
  165. keyboard.releaseKey((char) java.awt.event.KeyEvent.VK_BACK_SPACE);
  166. }
  167. } else {
  168. interfaces.getComponent(673, 49).doClick();
  169. }
  170. sleep(random(1000, 1500));
  171. keyboard.sendText(password, false);
  172. interfaces.getComponent(673, 28).doClick();
  173. sleep(random(1500, 2000));
  174. passwordDunMatch = true;
  175. } while (interfaceThatContains("Please make sure both passwords match") != null);
  176. passwordDunMatch = false;
  177. while (interfaceThatContains("Please wait...") != null) {
  178. sleep(100);
  179. }
  180. while (interfaceThatContains("Play RuneScape") != null) {
  181. interfaces.getComponent(669, 18).doClick();
  182. sleep(random(1000, 2000));
  183. }
  184. interfaces.getComponent(596, 55).doClick();
  185. sleep(random(1000, 1500));
  186. keyboard.sendText(username, false);
  187. interfaces.getComponent(596, 62).doClick();
  188. sleep(random(1000, 1500));
  189. keyboard.sendText(password, false);
  190. while (interfaceThatContains("Click Here To Play") == null) {
  191. interfaces.getComponent(596, 63).doClick();
  192. sleep(random(2000, 3000));
  193. }
  194. sleep(random(750, 1000));
  195. while (interfaceThatContains("Date of Birth Entry") == null
  196. || interfaceThatContains("Click Here To Play") != null) {
  197. interfaces.getComponent(906, 170).doClick();
  198. sleep(random(3000, 4000));
  199. }
  200. interfaces.getComponent(204, 29).doClick();
  201. sleep(random(500, 1000));
  202. interfaces.getComponent(204, 86).getComponent(0).doClick();
  203. sleep(random(500, 1000));
  204. interfaces.getComponent(204, 45).doClick();
  205. sleep(random(500, 1000));
  206. interfaces.getComponent(204, 98).getComponent(0).doClick();
  207. sleep(random(500, 1000));
  208. interfaces.getComponent(204, 61).doClick();
  209. sleep(random(500, 1000));
  210. mouse.move(interfaces.getComponent(204, 111).getComponent(1)
  211. .getLocation());
  212. sleep(500);
  213. mouse.drag(interfaces.getComponent(204, 111).getComponent(5)
  214. .getLocation());
  215. sleep(500);
  216. interfaces.getComponent(204, 110).getComponent(2).doClick();
  217. sleep(random(500, 1000));
  218. interfaces.getComponent(204, 18).doClick();
  219. sleep(random(1000, 1500));
  220. while (interfaceThatContains("Select Character") == null) {
  221. interfaces.getComponent(1051, 14).doClick();
  222. sleep(random(2000, 3000));
  223. }
  224. interfaces.getComponent(1028, random(17, 37)).doClick();
  225. sleep(random(500, 1000));
  226. interfaces.getComponent(1028, 94).doClick();
  227. sleep(random(500, 1000));
  228. interfaces.getComponent(1028, 96).doClick();
  229. sleep(random(2000, 3000));
  230. return 100;
  231. } else {
  232. log("Please login first =)");
  233. stopScript();
  234. return -1;
  235. }
  236. }
  237. if (canContinue()) {
  238. clickContinue();
  239. return random(200, 300);
  240. }
  241. if (!interfaces.getComponent(752, 4).getText().contains(blabla)) {
  242.  
  243.  
  244.  
  245. blabla = interfaces.getComponent(752, 4).getText();
  246. mouse.move(random(188, 332), random(444, 453));
  247. mouse.click(true);
  248. return random(750, 1000);
  249. }
  250. if (interfaceThatContains("Controls") != null) {
  251. int key = java.awt.event.KeyEvent.VK_UP;
  252. keyboard.pressKey((char) key);
  253. sleep(random(1000, 1500));
  254. keyboard.releaseKey((char) key);
  255. key = (random(0, 2) == 0) ? java.awt.event.KeyEvent.VK_LEFT
  256. : java.awt.event.KeyEvent.VK_RIGHT;
  257. keyboard.pressKey((char) key);
  258. sleep(random(1000, 1500));
  259. keyboard.releaseKey((char) key);
  260. return random(200, 300);
  261. }
  262. if (interfaceThatContains("Roddeck would like to offer you some") != null) {
  263.  
  264. camera.setPitch(true);
  265. Roddeck = npcs.getNearest(NPCIDs[3]);
  266. camera.turnToCharacter(Roddeck, random(60,90));
  267. if (!Roddeck.isOnScreen()) {
  268.  
  269. camera.turnToCharacter(Roddeck, random(60,90));
  270. }
  271. Roddeck.doAction("Talk");
  272. return random(500, 750);
  273. }
  274. if (interfaceThatContains("Rotate the camera using the arrow") != null
  275. || interfaceThatContains("Talk to Sir Vant to find out") != null) {
  276. if (interfaceThatContains("Great, you've got the dragon in the right place") != null) {
  277. Vant = npcs.getNearest(NPCIDs[2]);
  278. } else {
  279. Vant = npcs.getNearest(NPCIDs[0]);
  280. }
  281. if (Vant == null) {
  282. return random(200, 300);
  283. }
  284. if (!Vant.isOnScreen()) {
  285. walking.walkTo(Vant.getLocation());
  286. sleepUntilNotMoving();
  287. }
  288. Vant.doAction("Talk");
  289. sleep(random(1000, 2000));
  290. return random(200, 300);
  291. }
  292. if (interfaceThatContains("You may now leave via the door") != null) {
  293. interfaceThatHasAction("Face North").doClick();
  294. RSObject door = objects.getNearest(45801);
  295. if (door == null) {
  296. return random(200, 300);
  297. }
  298. door.doAction("Open");
  299. mouse.click(true);
  300. return random(500, 750);
  301. }
  302. if (interfaceThatContains("Right-click on the items on the floor") != null) {
  303. RSObject door = objects.getNearest(3550);
  304. camera.turnToObject(door,random(80,180));
  305. RSGroundItem stuff = groundItems.getNearest(armoursonfloor);
  306. while (stuff != null) {
  307.  
  308. stuff.doAction("Take");
  309. sleep(random(500, 750));
  310. stuff = groundItems.getNearest(armoursonfloor);
  311. }
  312. return random(200, 300);
  313. }
  314. if (interfaceThatContains("Click on the flashing") != null) {
  315. if (interfaceThatContains("worn items") != null) {
  316. game.openTab(Game.TAB_EQUIPMENT);
  317. } else if (interfaceThatContains("quest journal") != null) {
  318. game.openTab(Game.TAB_QUESTS);
  319. } else if (interfaceThatContains("objectives") != null) {
  320. interfaceThatHasAction("Objectives").doClick();
  321. } else if (interfaceThatContains("stats") != null) {
  322. game.openTab(Game.TAB_STATS);
  323. } else {
  324. game.openTab(Game.TAB_INVENTORY);
  325. }
  326. return random(200, 300);
  327. }
  328. if (interfaceThatContains("Right-click on an item in your inventory") != null) {
  329. while (inventory.getCount(1117) == 1) {
  330. inventory.getItem(1117).doAction("Wear");
  331. sleep(random(500, 750));
  332. }
  333. while (inventory.getCount(1173) == 1) {
  334. inventory.getItem(1173).doAction("Wield");
  335. sleep(random(500, 750));
  336. }
  337. while (inventory.getCount(1277) == 1) {
  338. inventory.getItem(1277).doAction("Wield");
  339. sleep(random(500, 750));
  340. }
  341. return random(200, 300);
  342. }
  343. if (interfaceThatContains("Your worn items screen shows you") != null) {
  344. while ((Goblin = npcs.getNearest(NPCIDs[1])) != null) {
  345. if (Goblin.getAnimation() == 6182) {
  346. break;
  347. }
  348. if (!Goblin.isOnScreen()) {
  349. walking.walkTo(Goblin.getLocation());
  350. sleepUntilNotMoving();
  351. }
  352. if (!getMyPlayer().isInCombat()) {
  353. Goblin.doAction("Attack");
  354. sleep(random(3000, 4000));
  355. }
  356. }
  357. return random(300, 500);
  358. }
  359. if (interfaceThatContains("You'll see that Unstable Foundations is") != null) {
  360. game.openTab(Game.TAB_QUESTS);
  361. mouse.move(random(564, 664), random(268, 277));
  362. mouse.click(true);
  363. return random(750, 1000);
  364. }
  365. if (interfaceThatContains("Now click on the world map") != null) {
  366. mouse.move(random(725, 750), random(135, 165));
  367. mouse.click(true);
  368. interfaces.getComponent(732, 154).doClick();
  369. return random(2000, 3500);
  370. }
  371. if (interfaceThatContains("Click on the compass") != null) {
  372. while (interfaces.getComponent(755, 0).getComponents().length > 0) {
  373. sleep(100);
  374. }
  375. interfaceThatHasAction("Face North").doClick();
  376. return random(750, 1000);
  377. }
  378. if (interfaceThatContains("Time to get on with the quest") != null) {
  379. if (interfaceThatContains("You'll need to climb over") != null) {
  380. hole = objects.getNearest(45603);
  381. hole.doAction("Climb");
  382. return random(750, 1000);
  383. }
  384. bag = objects.getNearest(45783);
  385. while (inventory.getCount(15277) == 0) {
  386. if (!calc.tileOnScreen(bag.getLocation())) {
  387. walking.walkTo(bag.getLocation());
  388. sleepUntilNotMoving();
  389. }
  390. if(!bag.doAction("Search"))
  391. mouse.click(true);
  392. sleep(random(6000, 7000));
  393. }
  394. return random(750, 1000);
  395. }
  396. if (interfaceThatContains("The wall is too high") != null) {
  397. plank = objects.getNearest(45652);
  398. camera.setPitch(true);
  399. plank.doAction("Take");
  400. return random(1500, 2000);
  401. }
  402. if (interfaceThatContains("Right-click on the plank in your inventory") != null) {
  403. hole = objects.getNearest(45603);
  404. game.openTab(Game.TAB_INVENTORY);
  405. while (inventory.getCount(15276) == 1) {
  406. inventory.getItem(15276).doAction("Use");
  407. sleep(random(750, 1000));
  408. hole.doAction("Use");
  409. sleep(random(2000, 3000));
  410. }
  411. return random(750, 1000);
  412. }
  413. if (interfaceThatContains("The ramp should make it possible for you") != null) {
  414. hole = objects.getNearest(45603);
  415. RSTile currentTile = getMyPlayer().getLocation();
  416. while (getMyPlayer().getLocation().getY() == currentTile.getY()) {
  417. hole.doAction("Climb");
  418. sleep(random(1000, 1500));
  419. while (getMyPlayer().getAnimation() != -1) {
  420. sleep(100);
  421. }
  422. }
  423. return random(2000, 3000);
  424. }
  425. if (objects.getNearest(45795) != null) {
  426. if (calc.distanceTo(objects.getNearest(45795).getLocation()) < 5) {
  427. while (inventory.getCount(15277) == 1) {
  428. inventory.getItem(15277).doAction("Use");
  429. sleep(random(300, 500));
  430. objects.getNearest(45795).doAction("Use");
  431. sleep(random(3000, 5000));
  432. }
  433. return random(200, 300);
  434. }
  435. }
  436. if (interfaceThatContains("Explore the cellar until") != null) {
  437. referenceTile = objects.getNearest(45563).getLocation();
  438. if (calc.distanceTo(new RSTile(referenceTile.getX() - 1,
  439. referenceTile.getY() + 17)) > 5
  440. && getMyPlayer().getLocation().getY() < referenceTile
  441. .getY() + 17) {
  442. walking.walkTo(new RSTile(referenceTile.getX() - 1,
  443. referenceTile.getY() + 17));
  444. sleepUntilNotMoving();
  445. walking.setRun(true);
  446. walking.walkTo(new RSTile(referenceTile.getX() - 1,
  447. referenceTile.getY() + 17));
  448. sleepUntilNotMoving();
  449. }
  450. walking.walkTo(new RSTile(referenceTile.getX() - 15, referenceTile
  451. .getY() + 24));
  452. sleepUntilNotMoving();
  453. return random(750, 1000);
  454. }
  455. if (interfaceThatContains("Check the quest journal") != null) {
  456. camera.setPitch(true);
  457. if (inventory.getCount(590) == 0) {
  458. bag = objects.getNearest(45783);
  459. while (inventory.getCount(590) == 0) {
  460. if (!calc.tileOnScreen(bag.getLocation())) {
  461. walking.walkTo(bag.getLocation());
  462. sleepUntilNotMoving();
  463. }
  464. bag.doAction("Search");
  465. sleep(random(6000, 7000));
  466. }
  467. return random(500, 750);
  468. }
  469. if (inventory.getCount(15278) == 1) {
  470. inventory.getItem(15278).doAction("Rip");
  471. return random(500, 750);
  472. }
  473.  
  474. if (inventory.getCount(15280) > 0) {
  475. inventory.getItem(15284).doAction("Use");
  476. sleep(random(500, 750));
  477. inventory.getItem(15280).doAction("Use");
  478. return random(500, 750);
  479. }
  480. RSObject Pillar = objects.getNearest(45564);
  481. camera.turnToObject(Pillar, random(60,90));
  482. if (inventory.getCount(15281) == 2) {
  483. if(!inventory.getItem(15281).doAction("Use"))
  484. mouse.click(true);
  485. sleep(random(500, 750));
  486. if(!Pillar.doAction("Use"))
  487. mouse.click(true);
  488. return random(1000, 1500);
  489. }
  490. if (inventory.getCount(15282) == 1) {
  491. if(!inventory.getItem(15282).doAction("Use"))
  492. mouse.click(true);
  493. sleep(random(500, 750));
  494. if(!Pillar.doAction("Use"))
  495. mouse.click(true);
  496. return random(1000, 1500);
  497. }
  498. Pillar = objects.getNearest(45565);
  499. if (!calc.tileOnScreen(Pillar.getLocation())) {
  500. // camera.turnToObject(Pillar, random(60,90));
  501. walking.walkTo(Pillar.getLocation());
  502. sleepUntilNotMoving();
  503. return random(500, 750);
  504. }
  505. if (inventory.getCount(15281) == 1) {
  506. if(!inventory.getItem(15281).doAction("Use"))
  507. mouse.click(true);
  508. sleep(random(500, 750));
  509. if(!Pillar.doAction("Use"))
  510. mouse.click(true);
  511. return random(1000, 1500);
  512. }
  513. if (inventory.getCount(15283) == 1) {
  514. if(!inventory.getItem(15283).doAction("Use"))
  515. mouse.click(true);
  516. sleep(random(500, 750));
  517. if(!Pillar.doAction("Use"))
  518. mouse.click(true);
  519. return random(1000, 1500);
  520. }
  521.  
  522. }
  523. if (interfaceThatContains("To give Sir Vant a tinderbox") != null) {
  524. camera.setPitch(true);
  525. Vant = npcs.getNearest(NPCIDs[2]);
  526. if (Vant == null) {
  527. return random(500, 750);
  528. }
  529. if (!calc.pointOnScreen(Vant.getScreenLocation())) {
  530. walking.walkTo(Vant.getLocation());
  531. sleepUntilNotMoving();
  532. }
  533. while (inventory.getCount(590) > 1) {
  534. if(!inventory.getItem(590).doAction("Use"))
  535. mouse.click(true);
  536. sleep(random(500, 750));
  537. if (!Vant.doAction("Use")) {
  538. mouse.click(true);
  539. camera.setAngle(random(0, 360));
  540. }
  541. return random(2000, 3000);
  542. }
  543. }
  544. if (interfaceThatContains("Use your tinderbox on the pillar") != null) {
  545. camera.setPitch(true);
  546. RSObject Pillar = objects.getNearest(45565);
  547. if (!calc.tileOnScreen(Pillar.getLocation())) {
  548. walking.walkTo(Pillar.getLocation());
  549. sleepUntilNotMoving();
  550. }
  551. if(!inventory.getItem(590).doAction("Use"))
  552. mouse.click(true);
  553.  
  554. sleep(random(500, 750));
  555. if(!Pillar.doAction("Use"))
  556. mouse.click(true);
  557. return random(3000, 4000);
  558. }
  559. if (interfaceThatContains("RUN! RUN! RUN!") != null) {
  560. RSObject Pillar = objects.getNearest(45565);
  561. walking.walkTo(new RSTile(Pillar.getLocation().getX() + 7, Pillar
  562. .getLocation().getY()));
  563. return random(2000, 3000);
  564. }
  565. if (interfaceThatContains("Congratulations, the dragon's dead!") != null) {
  566. Roddeck = npcs.getNearest(NPCIDs[3]);
  567. if(!Roddeck.doAction("Talk"))
  568. mouse.click(true);
  569. return random(1000, 1500);
  570. }
  571. if (interfaceThatContains("Click on the question mark button") != null) {
  572. interfaceThatHasAction("Advisor").doClick();
  573. return random(500, 750);
  574. }
  575. if (interfaceThatContains("Sir Vant wants his squire's kit back") != null) {
  576. game.openTab(Game.TAB_EQUIPMENT);
  577. sleep(random(500, 750));
  578. while (equipment.getItem(17).getID() != -1) {
  579. equipment.getItem(17).doAction("Remove");
  580. sleep(random(750, 1000));
  581. }
  582. while (equipment.getItem(20).getID() != -1) {
  583. equipment.getItem(20).doAction("Remove");
  584. sleep(random(750, 1000));
  585. }
  586. while (equipment.getItem(23).getID() != -1) {
  587. equipment.getItem(23).doAction("Remove");
  588. sleep(random(750, 1000));
  589. }
  590. return random(500, 750);
  591. }
  592. if (interfaceThatContains("To give Sir Vant an item") != null) {
  593. game.openTab(Game.TAB_INVENTORY);
  594. sleep(random(500, 750));
  595. Vant = npcs.getNearest(NPCIDs[2]);
  596. if (!Vant.isOnScreen()) {
  597. walking.walkTo(Vant.getLocation());
  598. sleepUntilNotMoving();
  599. }
  600. while (inventory.getCount(590) == 1) {
  601. inventory.getItem(590).doAction("Use");
  602. sleep(random(500, 750));
  603. if (!Vant.doAction("Use")) {
  604. camera.setAngle(random(0, 360));
  605. }
  606. return random(2000, 3000);
  607. }
  608. return random(500, 750);
  609. }
  610. if (interfaceThatContains("Okay, I'll get on with it") != null) {
  611. interfaceThatContains("Okay, I'll get on with it").doClick();
  612. return random(500, 750);
  613. }
  614. if (interfaceThatContains("I'll mine through the rocks") != null) {
  615. if (mining) {
  616. interfaceThatContains("I'll mine through the rocks").doClick();
  617. } else {
  618. interfaceThatContains("I'll chop through the roots").doClick();
  619. }
  620. return random(500, 750);
  621. }
  622. if (interfaceThatContains("Speak to Roddeck, your advisor, about breaking") != null) {
  623. camera.setPitch(true);
  624. Roddeck = npcs.getNearest(NPCIDs[3]);
  625. camera.turnToCharacter(Roddeck, random(60,90));
  626. if (!Roddeck.isOnScreen()) {
  627. walking.walkTo(Roddeck.getLocation());
  628. sleepUntilNotMoving();
  629. }
  630. Roddeck.doAction("Talk");
  631. return random(500, 750);
  632. }
  633. if (interfaceThatContains("While you've got a pickaxe") != null) {
  634. RSObject damagedWallRock = objects.getNearest(45595);
  635. if (!calc.tileOnScreen(damagedWallRock.getLocation())) {
  636. walking.walkTo(damagedWallRock.getLocation());
  637. sleepUntilNotMoving();
  638. }
  639. damagedWallRock.doAction("Mine");
  640. sleep(random(5000, 6000));
  641. return random(500, 750);
  642. }
  643. if (interfaceThatContains("While you've got a hatchet") != null) {
  644. RSObject roots = objects.getNearest(45598);
  645. if (!calc.tileOnScreen(roots.getLocation())) {
  646. walking.walkTo(roots.getLocation());
  647. sleepUntilNotMoving();
  648. }
  649. roots.doAction("Chop");
  650. sleep(random(5000, 6000));
  651. return random(500, 750);
  652. }
  653. if (interfaceThatContains("Your current objective is to raise your Mining level") != null) {
  654. camera.setPitch(true);
  655. RSObject Rocks = objects.getNearest(45580);
  656. if (!calc.tileOnScreen(Rocks.getLocation())) {
  657. walking.walkTo(Rocks.getLocation());
  658. sleepUntilNotMoving();
  659. }
  660. while (skills.getCurrentLevel(Skills.MINING) < 2) {
  661. Rocks.doAction("Mine");
  662. sleep(random(2000, 3000));
  663. while (getMyPlayer().getAnimation() == 6747) {
  664. sleep(100);
  665. }
  666. }
  667. return random(500, 750);
  668. }
  669. if (interfaceThatContains("Your current objective is to raise your Woodcutting level") != null) {
  670. camera.setPitch(true);
  671. RSObject treeRoots = objects.getTopAt(new RSTile(objects
  672. .getNearest(45589).getLocation().getX(), objects
  673. .getNearest(45589).getLocation().getY() + 1));
  674. if (!calc.tileOnScreen(treeRoots.getLocation())) {
  675. walking.walkTo(treeRoots.getLocation());
  676. sleepUntilNotMoving();
  677. }
  678. while (skills.getCurrentLevel(Skills.WOODCUTTING) < 2) {
  679. treeRoots.doAction("Chop");
  680. sleep(random(2000, 3000));
  681. while (getMyPlayer().getAnimation() == 879) {
  682. sleep(100);
  683. }
  684. }
  685. return random(500, 750);
  686. }
  687. if (interfaceThatContains("set yourself an objective") != null) {
  688. interfaceThatHasAction("Objectives").doClick();
  689. sleep(random(1000, 1500));
  690. if (mining) {
  691. if (interfaceThatContains("Increase Mining from") == null) {
  692. interfaceThatHasAction("Give random objective").doClick();
  693. }
  694. sleep(random(1000, 1500));
  695. interfaceThatContains("Increase Mining from").doClick();
  696. sleep(random(500, 750));
  697. } else {
  698. if (interfaceThatContains("Increase Woodcutting from") == null) {
  699. interfaceThatHasAction("Give random objective").doClick();
  700. }
  701. sleep(random(1000, 1500));
  702. interfaceThatContains("Increase Woodcutting from").doClick();
  703. sleep(random(500, 750));
  704. }
  705. if (interfaceThatContains("Advisor") == null) {
  706. interfaceThatHasAction("Advisor").doClick();
  707. }
  708. return random(1000, 2000);
  709. }
  710. if (interfaceThatContains("advisor button") != null) {
  711. if (interfaceThatContains("How can I raise my") == null) {
  712. interfaceThatHasAction("Advisor").doClick();
  713. }
  714. sleep(random(1000, 1500));
  715. if (interfaceThatContains("How can I raise my") == null) {
  716. return random(500, 750);
  717. }
  718. interfaceThatContains("How can I raise my").doClick();
  719. return random(500, 750);
  720. }
  721. if (interfaceThatContains("Your Mining level is now high enough") != null) {
  722. RSObject damagedWallRock = objects.getNearest(45595);
  723. if (damagedWallRock != null) {
  724. if (!calc.tileOnScreen(damagedWallRock.getLocation())) {
  725. walking.walkTo(damagedWallRock.getLocation());
  726. sleepUntilNotMoving();
  727. }
  728. damagedWallRock.doAction("Mine");
  729. return random(500, 750);
  730. } else {
  731. damagedWallRock = objects.getNearest(45597);
  732. if (damagedWallRock == null) {
  733. return random(200, 300);
  734. }
  735. damagedWallRock.doAction("Climb");
  736. sleep(random(750, 1000));
  737. while (getMyPlayer().getAnimation() == 12280
  738. || getMyPlayer().isMoving()) {
  739. sleep(100);
  740. }
  741. return random(500, 750);
  742. }
  743. }
  744. if (interfaceThatContains("Your Woodcutting level is now high enough") != null) {
  745. RSObject root = objects.getNearest(45598);
  746. if (root != null) {
  747. if (!calc.tileOnScreen(root.getLocation())) {
  748. walking.walkTo(root.getLocation());
  749. sleepUntilNotMoving();
  750. }
  751. root.doAction("Chop");
  752. return random(500, 750);
  753. } else {
  754. root = objects.getNearest(45600);
  755. if (root == null) {
  756. return random(200, 300);
  757. }
  758. root.doAction("Climb");
  759. sleep(random(750, 1000));
  760. while (getMyPlayer().isMoving()) {
  761. sleep(100);
  762. }
  763. return random(500, 750);
  764. }
  765. }
  766. if (interfaceThatContains("Escape up the ladder to freedom!") != null) {
  767. game.openTab(Game.TAB_INVENTORY);
  768. while (inventory.contains(15286)) {
  769. inventory.getItem(15286).doAction("Drop");
  770. sleep(random(500, 750));
  771. clickContinue();
  772. }
  773. while (inventory.contains(15285)) {
  774. inventory.getItem(15285).doAction("Drop");
  775. sleep(random(500, 750));
  776. clickContinue();
  777. }
  778. RSObject ladder = objects.getNearest(45784);
  779. if (ladder == null) {
  780. return random(250, 300);
  781. }
  782. interfaceThatHasAction("Face North").doClick();
  783. if (calc.distanceTo(ladder.getLocation()) > 3) {
  784. walking.walkTo(ladder.getLocation());
  785. sleepUntilNotMoving();
  786. }
  787. while (interfaceThatContains("Thank you again") == null) {
  788. ladder = objects.getNearest(45784);
  789. if (ladder == null) {
  790. break;
  791. }
  792. ladder.doAction("Climb");
  793. }
  794. return random(500, 750);
  795. }
  796. if (interfaceThatContains("completed") != null) {
  797. sleep(random(3500, 5000));
  798. mouse.move(random(460,480), random(69,89));
  799. mouse.click(true);
  800. sleep(random(500,1000));
  801. interfaceThatHasAction("Face North").doClick();
  802. }
  803. if (interfaceThatContains("level") != null) {
  804. Vant = npcs.getNearest(NPCIDs[2]);
  805. if (Vant == null) {
  806. mouse.move(random(188, 332), random(444, 453));
  807. mouse.click(true);
  808. return random(500, 750);
  809. }
  810. if (Vant.isMoving()) {
  811. mouse.move(random(188, 332), random(444, 453));
  812. mouse.click(true);
  813. return random(500, 750);
  814. }
  815. walking.walkTo(Vant.getLocation());
  816. camera.setPitch(true);
  817. sleepUntilNotMoving();
  818. if (!calc.pointOnScreen(Vant.getScreenLocation())) {
  819. walking.walkTo(Vant.getLocation());
  820. sleepUntilNotMoving();
  821. }
  822. Vant.doAction("Talk");
  823. return random(500, 750);
  824. }
  825. //this is now on the first line.... the roddeck speaking to
  826. // also door opening
  827. if (calc.distanceTo(new RSTile(3204, 3246)) < 8) {
  828. if (!autoCreate) {
  829. log("Tutorial Finished! =)");
  830. game.logout(false);
  831. stopScript();
  832. } else {
  833. java.io.BufferedWriter out;
  834. java.io.FileWriter fstream;
  835. java.io.File accounts = new java.io.File("Accounts.txt");
  836. if (accounts.exists()) {
  837. try {
  838. fstream = new java.io.FileWriter("Accounts.txt", true);
  839. out = new java.io.BufferedWriter(fstream);
  840. out.newLine();
  841. out.write(username);
  842. out.close();
  843. } catch (java.io.IOException e) {
  844. }
  845. } else {
  846. try {
  847. fstream = new java.io.FileWriter("Accounts.txt", false);
  848. out = new java.io.BufferedWriter(fstream);
  849. out.write(username);
  850. out.close();
  851. } catch (java.io.IOException e) {
  852. }
  853. }
  854. log("Account " + username + " has been saved");
  855. accountsCreated++;
  856. totalTime += System.currentTimeMillis() - startTime;
  857. averageTime = totalTime / accountsCreated;
  858. game.logout(true);
  859. sleep(random(4000, 6500));
  860. sleep(random(1000, 1500));
  861. while (game.isLoggedIn()) {
  862. game.logout(true);
  863. }
  864. return random(2000, 3000);
  865. }
  866. }
  867. return random(200, 300);
  868. }
  869. private final RenderingHints antialiasing = new RenderingHints(
  870. RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
  871.  
  872. private final Color color1 = new Color(0, 255, 204, 105);
  873. private final Color color2 = new Color(0, 0, 0);
  874.  
  875. private final BasicStroke stroke1 = new BasicStroke(2);
  876.  
  877. private final Font font1 = new Font("Arial", 1, 22);
  878. private final Font font2 = new Font("Arial", 0, 20);
  879.  
  880. public void onRepaint(Graphics g1) {
  881. Graphics2D g = (Graphics2D)g1;
  882. g.drawLine(0, (int)(mouse.getLocation().getY()), 800, (int)(mouse.getLocation().getY()));
  883. g.drawLine((int)(mouse.getLocation().getX()), 0, (int)(mouse.getLocation().getX()), 800);
  884. g.setRenderingHints(antialiasing);
  885. BOT_TIME = 0;
  886. BOT_SEC = 0;
  887. BOT_MIN = 0;
  888. BOT_HOURS = 0;
  889. BOT_TIME = System.currentTimeMillis() - START_TIME;
  890. BOT_SEC = BOT_TIME / 1000;
  891. if (BOT_SEC >= 60) {
  892. BOT_MIN = BOT_SEC / 60;
  893. BOT_SEC -= (BOT_MIN * 60);
  894. }
  895. if (BOT_MIN >= 60) {
  896. BOT_HOURS = BOT_MIN / 60;
  897. BOT_MIN -= (BOT_HOURS * 60);
  898. }
  899. g.setColor(color1);
  900. g.fillRoundRect(8, 10, 307, 125, 16, 16);
  901. g.setColor(color2);
  902. g.setStroke(stroke1);
  903. g.drawRoundRect(8, 10, 307, 125, 16, 16);
  904. g.setFont(font1);
  905. g.drawString("Tutorial Solver Revamped", 27, 35);
  906. g.setFont(font2);
  907. g.drawString("Accounts Made: " + accountsCreated, 30, 63);
  908. g.drawString("Time Ran: " + BOT_HOURS + ":" + BOT_MIN + ":" + BOT_SEC, 32, 91);
  909. g.drawString("Created By Infected", 129, 129);
  910. }
  911.  
  912.  
  913.  
  914.  
  915.  
  916. public RSComponent interfaceThatContains(String str) {
  917. for (RSInterface i : interfaces.getAll()) {
  918. if (i.isValid()) {
  919. for (RSComponent children : i.getComponents()) {
  920. if (children.isValid()) {
  921. if (children.getComponents().length > 0) {
  922. for (RSComponent component : children
  923. .getComponents()) {
  924. if (component.isValid()) {
  925. if (component.containsText(str)) {
  926. return component;
  927. }
  928. }
  929. }
  930. } else {
  931. if (children.containsText(str)) {
  932. return children;
  933. }
  934. }
  935. }
  936. }
  937. }
  938. }
  939. return null;
  940. }
  941.  
  942. public RSComponent interfaceThatHasAction(String str) {
  943. for (RSInterface i : interfaces.getAll()) {
  944. if (i.isValid()) {
  945. for (RSComponent child : i.getComponents()) {
  946. if (child.isValid()) {
  947. if (child.getActions() != null) {
  948. for (String s : child.getActions()) {
  949. if (s != null && s.contains(str)) {
  950. return child;
  951. }
  952. }
  953. }
  954. if (child.getComponents().length > 0) {
  955. for (RSComponent component : child.getComponents()) {
  956. if (component.isValid()
  957. && component.getActions() != null) {
  958. for (String s : component.getActions()) {
  959. if (s != null && s.contains(str)) {
  960. return component;
  961. }
  962. }
  963. }
  964. }
  965. }
  966. }
  967. }
  968. }
  969. }
  970. return null;
  971. }
  972.  
  973. public void sleepUntilNotMoving() {
  974. sleep(random(700, 1000));
  975. while (getMyPlayer().isMoving()) {
  976. sleep(random(25, 100));
  977. }
  978. }
  979.  
  980. public RSComponent getContinueChildInterface() {
  981. RSInterface[] valid = interfaces.getAll();
  982. for (RSInterface iface : valid) {
  983. if (iface.getIndex() != 137 && iface.getIndex() != 752) {
  984. int len = iface.getChildCount();
  985. for (int i = 0; i < len; i++) {
  986. RSComponent child = iface.getComponent(i);
  987. if (child.containsText("Click here to continue")
  988. && child.getWidth() > 30
  989. && child.getAbsoluteY() > 337) {
  990. return child;
  991. }
  992. }
  993. }
  994. }
  995. return null;
  996. }
  997.  
  998. public boolean canContinue() {
  999. return getContinueChildInterface() != null;
  1000. }
  1001.  
  1002. public boolean clickContinue() {
  1003. RSComponent cont = getContinueChildInterface();
  1004. return !(cont != null && cont.isValid()) || cont.doClick();
  1005. }
  1006.  
  1007. public class TISolverGUI extends javax.swing.JFrame {
  1008.  
  1009. /** Creates new form TISolverGUI */
  1010. public TISolverGUI() {
  1011. initComponents();
  1012. setLocationRelativeTo(getOwner());
  1013. }
  1014.  
  1015. /**
  1016. * This method is called from within the constructor to initialize the
  1017. * form. WARNING: Do NOT modify this code. The content of this method is
  1018. * always regenerated by the Form Editor.
  1019. */
  1020. @SuppressWarnings("unchecked")
  1021. // <editor-fold defaultstate="collapsed" desc="Generated Code">
  1022. private void initComponents() {
  1023.  
  1024. autoCheck = new javax.swing.JCheckBox();
  1025. jLabel1 = new javax.swing.JLabel();
  1026. prefixText = new javax.swing.JTextField();
  1027. jLabel2 = new javax.swing.JLabel();
  1028. passwordText = new javax.swing.JTextField();
  1029. jLabel3 = new javax.swing.JLabel();
  1030. skillCombo = new javax.swing.JComboBox();
  1031. jButton1 = new javax.swing.JButton();
  1032.  
  1033. setTitle("Settings");
  1034. addWindowListener(new java.awt.event.WindowAdapter() {
  1035. public void windowClosing(java.awt.event.WindowEvent evt) {
  1036. formWindowClosing(evt);
  1037. }
  1038. });
  1039.  
  1040. autoCheck.setText("Auto-Create Account");
  1041. autoCheck.addActionListener(new java.awt.event.ActionListener() {
  1042. public void actionPerformed(java.awt.event.ActionEvent evt) {
  1043. autoCheckActionPerformed(evt);
  1044. }
  1045. });
  1046.  
  1047. jLabel1.setText("Prefix:");
  1048.  
  1049. prefixText.setEditable(false);
  1050.  
  1051. jLabel2.setText("Password:");
  1052.  
  1053. passwordText.setEditable(false);
  1054.  
  1055. jLabel3.setText("Train Skill:");
  1056.  
  1057. skillCombo.setModel(new javax.swing.DefaultComboBoxModel(
  1058. new String[] { "Mining", "Woodcutting" }));
  1059.  
  1060. jButton1.setText("OK");
  1061. jButton1.addActionListener(new java.awt.event.ActionListener() {
  1062. public void actionPerformed(java.awt.event.ActionEvent evt) {
  1063. jButton1ActionPerformed(evt);
  1064. }
  1065. });
  1066.  
  1067. javax.swing.GroupLayout layout = new javax.swing.GroupLayout(
  1068. getContentPane());
  1069. getContentPane().setLayout(layout);
  1070. layout.setHorizontalGroup(layout
  1071. .createParallelGroup(
  1072. javax.swing.GroupLayout.Alignment.LEADING)
  1073. .addGroup(
  1074. layout.createSequentialGroup()
  1075. .addContainerGap()
  1076. .addGroup(
  1077. layout.createParallelGroup(
  1078. javax.swing.GroupLayout.Alignment.TRAILING)
  1079. .addComponent(jButton1)
  1080. .addGroup(
  1081. layout.createParallelGroup(
  1082. javax.swing.GroupLayout.Alignment.LEADING,
  1083. false)
  1084. .addComponent(
  1085. autoCheck)
  1086. .addGroup(
  1087. layout.createSequentialGroup()
  1088. .addGap(21,
  1089. 21,
  1090. 21)
  1091. .addGroup(
  1092. layout.createParallelGroup(
  1093. javax.swing.GroupLayout.Alignment.LEADING)
  1094. .addComponent(
  1095. jLabel2)
  1096. .addComponent(
  1097. jLabel1))
  1098. .addPreferredGap(
  1099. javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1100. .addGroup(
  1101. layout.createParallelGroup(
  1102. javax.swing.GroupLayout.Alignment.LEADING,
  1103. false)
  1104. .addComponent(
  1105. prefixText)
  1106. .addComponent(
  1107. passwordText,
  1108. javax.swing.GroupLayout.DEFAULT_SIZE,
  1109. 101,
  1110. Short.MAX_VALUE)))
  1111. .addGroup(
  1112. layout.createSequentialGroup()
  1113. .addComponent(
  1114. jLabel3)
  1115. .addPreferredGap(
  1116. javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1117. .addComponent(
  1118. skillCombo,
  1119. 0,
  1120. javax.swing.GroupLayout.DEFAULT_SIZE,
  1121. Short.MAX_VALUE))))
  1122. .addContainerGap(
  1123. javax.swing.GroupLayout.DEFAULT_SIZE,
  1124. Short.MAX_VALUE)));
  1125. layout.setVerticalGroup(layout
  1126. .createParallelGroup(
  1127. javax.swing.GroupLayout.Alignment.LEADING)
  1128. .addGroup(
  1129. layout.createSequentialGroup()
  1130. .addContainerGap()
  1131. .addComponent(autoCheck)
  1132. .addPreferredGap(
  1133. javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1134. .addGroup(
  1135. layout.createParallelGroup(
  1136. javax.swing.GroupLayout.Alignment.BASELINE)
  1137. .addComponent(jLabel1)
  1138. .addComponent(
  1139. prefixText,
  1140. javax.swing.GroupLayout.PREFERRED_SIZE,
  1141. javax.swing.GroupLayout.DEFAULT_SIZE,
  1142. javax.swing.GroupLayout.PREFERRED_SIZE))
  1143. .addPreferredGap(
  1144. javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1145. .addGroup(
  1146. layout.createParallelGroup(
  1147. javax.swing.GroupLayout.Alignment.BASELINE)
  1148. .addComponent(jLabel2)
  1149. .addComponent(
  1150. passwordText,
  1151. javax.swing.GroupLayout.PREFERRED_SIZE,
  1152. javax.swing.GroupLayout.DEFAULT_SIZE,
  1153. javax.swing.GroupLayout.PREFERRED_SIZE))
  1154. .addGap(18, 18, 18)
  1155. .addGroup(
  1156. layout.createParallelGroup(
  1157. javax.swing.GroupLayout.Alignment.BASELINE)
  1158. .addComponent(jLabel3)
  1159. .addComponent(
  1160. skillCombo,
  1161. javax.swing.GroupLayout.PREFERRED_SIZE,
  1162. javax.swing.GroupLayout.DEFAULT_SIZE,
  1163. javax.swing.GroupLayout.PREFERRED_SIZE))
  1164. .addPreferredGap(
  1165. javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1166. .addComponent(jButton1)
  1167. .addContainerGap(
  1168. javax.swing.GroupLayout.DEFAULT_SIZE,
  1169. Short.MAX_VALUE)));
  1170.  
  1171. pack();
  1172. }// </editor-fold>
  1173.  
  1174. private void autoCheckActionPerformed(java.awt.event.ActionEvent evt) {
  1175. if (autoCheck.isSelected()) {
  1176. prefixText.setEditable(true);
  1177. passwordText.setEditable(true);
  1178. } else {
  1179. prefixText.setEditable(false);
  1180. passwordText.setEditable(false);
  1181. }
  1182. }
  1183.  
  1184. private void formWindowClosing(java.awt.event.WindowEvent evt) {
  1185. stopScript();
  1186. }
  1187.  
  1188. private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
  1189. setVisible(false);
  1190. }
  1191.  
  1192.  
  1193. // Variables declaration - do not modify
  1194. public javax.swing.JCheckBox autoCheck;
  1195. private javax.swing.JButton jButton1;
  1196. private javax.swing.JLabel jLabel1;
  1197. private javax.swing.JLabel jLabel2;
  1198. private javax.swing.JLabel jLabel3;
  1199. private javax.swing.JTextField passwordText;
  1200. public javax.swing.JTextField prefixText;
  1201. public javax.swing.JComboBox skillCombo;
  1202. // End of variables declaration
  1203. }
  1204. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement