Guest User

Untitled

a guest
Jul 20th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.30 KB | None | 0 0
  1. import java.util.*;
  2. import java.awt.*;
  3. import java.awt.event.KeyEvent;
  4.  
  5. import org.rsbot.bot.*;
  6. import org.rsbot.event.listeners.*;
  7. import org.rsbot.script.*;
  8. import org.rsbot.script.wrappers.*;
  9. import org.rsbot.util.*;
  10.  
  11. @ScriptManifest(
  12. authors = { "Absox, Nogueira" },
  13. category = "Magic",
  14. name = "MTAEnchant",
  15. version = .57,
  16.  
  17. description = "<html>" +
  18. "<head><style type=\"text/css\">\n" +
  19. "body {\n" +
  20. "font-family: Arial, Helvetica, sans-serif;\n" +
  21. "}\n" +
  22. "\n" +
  23. "p {\n" +
  24. "size: 12px;\n" +
  25. "}\n" +
  26. "</style></head>\n" +
  27. "<body>\n" +
  28. "<center><h2>MageTrainingEnchanter v" + .57 + "</h2>" +
  29. "<p>By Absox, Fixed and improved by Nogueira</p></center>\n" +
  30. "<p>Script Description:\n" +
  31. "<ul>\n" +
  32. "<li>XP Mode: Picks up orbs and enchants them, then deposits</li>\n" +
  33. "<li>Pizazz Points Mode: Picks up dragonstones, enchants them, then world hops</li>\n" +
  34. "<li>Most cost efficient at 87+ Magic, 57+ minimum requirement</li>\n" +
  35. "<li>Start in Mage Training Arena, <b>inside</b> Enchantment Arena</li>\n" +
  36. "<li>Bring cosmics, and staff to supply all elemental runes for desired enchant-jewelry spell</li>\n" +
  37. "<li>Make sure to have all your spells sort by combat and only have the Skill realated spells selected</li>\n"+
  38. "<li>For your world select screen, make sure you have <b>Members</b> worlds on top</li>\n" +
  39. "</ul>\n" +
  40. "</p><br>\n" +
  41. "<p>Spell: \n" +
  42. "<select name=\"castType\">\n" +
  43. "<option>Dragonstone</option>\n" +
  44. "<option>Onyx</option>\n" +
  45. "<option>Diamond</option>\n" +
  46. "</select><br>\n" +
  47. "Mode: \n" +
  48. "<select name=\"mode\">\n" +
  49. "<option>XP</option>\n" +
  50. "<option>Pizazz Points</option><br>\n" +
  51. "Antiban: <input type=\"checkbox\" name=\"antiban\" value=\"true\" checked=\"checked\" /><br>\n" +
  52. "Debug Logs: <input type=\"checkbox\" name=\"debug\" value=\"true\" /></p>\n" +
  53. "</body>\n" +
  54. "</html>"
  55.  
  56. )
  57.  
  58. public class MTAEnchanter extends Script implements PaintListener {
  59.  
  60. public long startTime;
  61. public long antiTime;
  62.  
  63. public int castCount;
  64. public int startMageLevel;
  65. public int startMageXp;
  66. public int startPoints;
  67. public int pointsGained;
  68.  
  69. public String castType;
  70. public String state;
  71. public String status = "Starting...";
  72. public String mode;
  73.  
  74. public boolean StartedY;
  75. public boolean antiban;
  76. public boolean debug;
  77.  
  78. public int[] shapeIDs = { 10799, 10800, 10801, 10802 };
  79. public int dstoneID = 6903;
  80. public int[] shapeItemIDs = { 6898, 6899, 6900, 6901, 6903 };
  81. public int depositwell = 10803;
  82.  
  83. //3354, 9640 3353, 9627 3348, 9626 3363, 9649 3373, 9651 3379, 9652
  84. //3363, 9630 3375, 9628 3378, 9623 3354, 9640 3352, 9649 3349, 9655
  85.  
  86. //red shapes
  87. public RSTile[] pathToShapes1 = {
  88. new RSTile (3356, 9634),
  89. new RSTile (3354, 9630),
  90. new RSTile (3351, 9627),
  91. new RSTile (3348, 9626)
  92. };
  93.  
  94. //yellow shapes
  95. public RSTile[] pathToShapes2 = {
  96. new RSTile (3357, 9644),
  97. new RSTile (3354, 9648),
  98. new RSTile (3350, 9652)
  99.  
  100. };
  101.  
  102. //blue shapes
  103. public RSTile[] pathToShapes3 = {
  104. new RSTile (3366, 9635),
  105. new RSTile (3370, 9631),
  106. new RSTile (3374, 9628),
  107. new RSTile (3377, 9625)
  108.  
  109. };
  110.  
  111. //green shapes
  112. public RSTile[] pathToShapes4 = {
  113. new RSTile (3371, 9644),
  114. new RSTile (3373, 9648),
  115. new RSTile (3376, 9661)
  116.  
  117. };
  118.  
  119. //yellow shapes
  120. public RSTile[] pathToDeposit1 = {
  121. new RSTile (3351, 9652),
  122. new RSTile (3354, 9648),
  123. new RSTile (3358, 9644),
  124. new RSTile (3360, 9642)
  125. };
  126.  
  127. //red shapes
  128. public RSTile[] pathToDeposit2 = {
  129. new RSTile (3349, 9628),
  130. new RSTile (3354, 9631),
  131. new RSTile (3358, 9633),
  132. new RSTile (3361, 9637)
  133. };
  134.  
  135. //green shapes
  136. public RSTile[] pathToDeposit3 = {
  137. new RSTile (3376, 9653),
  138. new RSTile (3374, 9649),
  139. new RSTile (3370, 9645),
  140. new RSTile (3366, 9643)
  141. };
  142.  
  143. //blue shapes
  144. public RSTile[] pathToDeposit4 = {
  145.  
  146. new RSTile (3377, 9627),
  147. new RSTile (3374, 9630),
  148. new RSTile (3371, 9632),
  149. new RSTile (3368, 9635),
  150. new RSTile (3366, 9638)
  151. };
  152.  
  153. public RSTile[] dstoneSpawns = {
  154. new RSTile (3359, 9632),
  155. new RSTile (3354, 9646),
  156. new RSTile (3353, 9635),
  157. new RSTile (3375, 9633),
  158. new RSTile (3374, 9643),
  159. new RSTile (3373, 9651)
  160. };
  161.  
  162. //red shapes
  163. public RSTile[] pathBackToShapes1 = {
  164. new RSTile (3354, 9631),
  165. new RSTile (3348, 9626)
  166. };
  167.  
  168. //yellow shapes
  169. public RSTile[] pathBackToShapes2 = {
  170. new RSTile (3354, 9649),
  171. new RSTile (3350, 9653)
  172.  
  173. };
  174.  
  175. //blue shapes
  176. public RSTile[] pathBackToShapes3 = {
  177. new RSTile (3370, 9633),
  178. new RSTile (3377, 9626)
  179.  
  180. };
  181.  
  182. //green shapes
  183. public RSTile[] pathBackToShapes4 = {
  184. new RSTile (3370, 9646),
  185. new RSTile (3376, 9653)
  186.  
  187. };
  188.  
  189. public boolean isWelcomeButton() {
  190. final RSInterface welcomeInterface = RSInterface.getInterface(378);
  191. if (welcomeInterface.getChild(45).getAbsoluteX() > 20
  192. || !welcomeInterface.getChild(117).getText().equals(
  193. "10.1120.190")
  194. && !welcomeInterface.getChild(117).getText().equals("")) {
  195. log("We still are in Welcome Screen");
  196. return true;
  197. } else {
  198. return false;
  199. }
  200. }
  201.  
  202. public boolean onStart(Map<String, String> args) {
  203. castType = args.get("castType");
  204.  
  205. mode = args.get("mode");
  206.  
  207. if (args.get("antiban") != null) {
  208. antiban = true;
  209. }
  210.  
  211. if (args.get("debug") != null) {
  212. debug = true;
  213. }
  214.  
  215. return true;
  216. }
  217.  
  218. public void onRepaint (Graphics g) {
  219.  
  220. Color BG = new Color (50, 50, 50, 200);
  221. int x = 10;
  222. int y = 4;
  223. int mageXpGained = 0;
  224.  
  225. if (startTime == 0) {
  226. startTime = System.currentTimeMillis();
  227. int interval = random(30000, 50000);
  228. antiTime = System.currentTimeMillis() + interval;
  229.  
  230. if (debug)
  231. log ("Engaging antiban in " + interval / 1000 + " seconds...");
  232.  
  233. }
  234.  
  235. if (startMageXp == 0) {
  236. startMageXp = skills.getCurrentSkillExp(Constants.STAT_MAGIC);
  237. }
  238.  
  239. RSInterface enchantPanel = RSInterface.getInterface(195);
  240. if (enchantPanel.isValid()) {
  241.  
  242. if (startPoints == 0) {
  243. startPoints = Integer.parseInt(enchantPanel.getChild(9).getText());
  244. }
  245.  
  246. pointsGained = Integer.parseInt(enchantPanel.getChild(9).getText()) - startPoints;
  247. }
  248.  
  249. mageXpGained = skills.getCurrentSkillExp(Constants.STAT_MAGIC) - startMageXp;
  250.  
  251. long millis = System.currentTimeMillis() - startTime;
  252. long hours = millis / (1000 * 60 * 60);
  253. millis -= hours * 1000 * 60 * 60;
  254. long minutes = millis / (1000 * 60);
  255. millis -= minutes * 1000 * 60;
  256. long seconds = millis / 1000;
  257.  
  258. if (castType.equals("Dragonstone")) {
  259. castCount = (int) Math.round((mageXpGained / 58.5));
  260. } else if (castType.equals("Onyx")) {
  261. castCount = (int) Math.round((mageXpGained / 72.75));
  262. } else {
  263. castCount = (int) Math.round((mageXpGained / 50.25));
  264. }
  265.  
  266. g.setColor(BG);
  267. g.fill3DRect(x-6, y, 250, 150, true);
  268.  
  269. g.setColor(Color.cyan);
  270. g.setFont(new Font("Verdana", Font.BOLD, 14));
  271. g.drawString("MageTrainingEnchanter v" + getClass().getAnnotation(ScriptManifest.class).version(), x, y+=15);
  272. g.setFont(new Font("Verdana", Font.PLAIN, 12));
  273. g.drawString("Casting: " + castType, x, y+=15);
  274. g.drawString("Status: " + status, x, y+=15);
  275. g.drawString("Runtime: " + hours + ":" + minutes + ":" + seconds, x, y+=15);
  276. g.drawString("Casts: " + castCount, x, y+=15);
  277. g.drawString("Magic EXP Gained: " + mageXpGained, x, y+=15);
  278. g.drawString("Pizazz Points Gained: " + pointsGained, x, y+=15);
  279. g.drawString("Mode: " + mode, x, y+=15);
  280.  
  281. if (antiban) {
  282. g.drawString("Antiban On", x, y+=15);
  283. } else {
  284. g.drawString("Antiban Off", x, y+=15);
  285. }
  286.  
  287. }
  288.  
  289. public void onFinish() {
  290. ScreenshotUtil.takeScreenshot(isLoggedIn());
  291. log(castCount + " Casts completed.");
  292. log(pointsGained + " Pizazz Points gained.");
  293. }
  294.  
  295. /* Walks to the nearest tile in an array of tiles (path) */
  296. public void walkToNearest (RSTile[] array) {
  297.  
  298. if(!isRunning()){
  299. setRun(true);
  300. }
  301.  
  302. int nearest = 0;
  303. int distance = 1000;
  304.  
  305. for (int counter = 0; counter < array.length; counter++) {
  306. if (distanceTo(array[counter]) < distance) {
  307. nearest = counter;
  308. distance = distanceTo(array[counter]);
  309. }
  310. }
  311.  
  312. while(distanceTo(array[nearest]) > 5) {
  313. walkTileMM(randomizeTile(array[nearest], 2, 2));
  314. wait (distance * 200 + random (-100, 100));
  315. }
  316.  
  317. return;
  318. }
  319.  
  320. public void toPortal() {
  321.  
  322. setCameraAltitude(true);
  323.  
  324. RSTile halfTile = new RSTile (3363, 3314);
  325. RSTile portalTile = new RSTile(3361, 3318);
  326.  
  327. if(!isRunning()){
  328. setRun(true);
  329. }
  330.  
  331. while (distanceTo(halfTile) > 5) {
  332. walkTileMM(halfTile);
  333. wait (distanceTo(halfTile) * 200 + random (-100, 100));
  334. }
  335.  
  336. while(distanceTo(portalTile) > 5) {
  337. walkTileMM(portalTile);
  338. wait (distanceTo(portalTile) * 200 + random (-100, 100));
  339. }
  340.  
  341. state = "enter";
  342.  
  343. return;
  344. }
  345.  
  346. public boolean checkLocation () {
  347.  
  348. if (getMyPlayer().getLocation().equals(new RSTile(3363, 9649)) ||
  349. getMyPlayer().getLocation().equals(new RSTile(3373, 9640)) ||
  350. getMyPlayer().getLocation().equals(new RSTile(3363, 9630)) ||
  351. getMyPlayer().getLocation().equals(new RSTile(3354, 9640))) {
  352.  
  353. if (mode.equals("XP")) {
  354. state = "run";
  355. return true;
  356. } else {
  357. state = "stones";
  358. return true;
  359. }
  360. }
  361. return false;
  362. }
  363.  
  364. public void inPortal() {
  365.  
  366. final RSObject portal = findObject(10779);
  367. while(!checkLocation()) {
  368.  
  369. setCameraRotation(getAngleToObject(portal) + random(-15, 15));
  370. atObject(portal, "Enter");
  371. wait (random (2000, 3000));
  372.  
  373. }
  374. return;
  375. }
  376.  
  377. public RSItemTile getNearestTile (RSItemTile[] array) {
  378.  
  379. int nearest = 0;
  380. int distance = 1000;
  381.  
  382. for (int counter = 0; counter < array.length; counter++) {
  383. if (distanceTo(array[counter]) < distance) {
  384. nearest = counter;
  385. distance = distanceTo(array[counter]);
  386. }
  387. }
  388.  
  389. return array[nearest];
  390. }
  391.  
  392. public RSItemTile[] getItemTiles(RSTile[] array) {
  393.  
  394. RSItemTile[] ItemTiles = new RSItemTile[6];
  395. int arrayLength = 0;
  396.  
  397. for (int counter = 0; counter < array.length; counter++) {
  398. RSItemTile[] RawItemTiles = getGroundItemsAt(array[counter]);
  399.  
  400. for(int counter2 = 0; counter2 < RawItemTiles.length; counter2++) {
  401. int itemID = RawItemTiles[counter2].getItem().getID();
  402. if(itemID == dstoneID) {
  403. ItemTiles[arrayLength] = (RawItemTiles[counter2]);
  404. arrayLength++;
  405. }
  406. }
  407. }
  408.  
  409. RSItemTile[] finalItemTiles = new RSItemTile[arrayLength];
  410. System.arraycopy(ItemTiles, 0, finalItemTiles, 0, arrayLength);
  411.  
  412. return finalItemTiles;
  413. }
  414.  
  415. public void getDstone() {
  416. log("getting Dstones");
  417.  
  418. setRun(true);
  419.  
  420. RSItemTile dstoneTile;
  421.  
  422. while(getGroundItemByID(dstoneID) != null) {
  423.  
  424. dstoneTile = getNearestTile(getItemTiles(dstoneSpawns));
  425.  
  426. turnToTile(dstoneTile, 15);
  427.  
  428. int distance = distanceTo(dstoneTile);
  429. RSTile myLocation = getMyPlayer().getLocation();
  430.  
  431. if (distance > 15) {
  432. RSTile midway = new RSTile(
  433. (dstoneTile.getX() + myLocation.getX()) / 2,
  434. (dstoneTile.getY() + myLocation.getY()) / 2
  435. );
  436.  
  437. while(distanceTo(midway) > 5) {
  438. walkTileMM(randomizeTile(midway, 2, 2));
  439. wait(distanceTo(midway) * 200 + random (-100, 100));
  440. }
  441.  
  442. while(distanceTo(dstoneTile) > 5) {
  443. walkTileMM(randomizeTile(dstoneTile, 2, 2));
  444. wait(distanceTo(midway) * 200 + random (-100, 100));
  445. }
  446.  
  447. } else if (distance >= 5) {
  448.  
  449. while(distanceTo(dstoneTile) > 4) {
  450. walkTileMM(randomizeTile(dstoneTile, 2, 2));
  451. wait(distance * 200 + random (-100, 100));
  452. }
  453. }
  454.  
  455. int oldCount = getInventoryCount(dstoneID);
  456.  
  457. wait(random(200, 500));
  458.  
  459. while (getInventoryCount(dstoneID) == oldCount && dstoneTile.getItem() != null) {
  460.  
  461. atTile(dstoneTile, "Take");
  462. wait(random(800, 1200));
  463.  
  464. }
  465.  
  466. }
  467.  
  468. if (getInventoryCount(dstoneID) != 0) {
  469. state = "cast";
  470. } else {
  471. state = "hop";
  472. }
  473. return;
  474. }
  475.  
  476. public void toShapes() {
  477. log("running to shapes");
  478.  
  479.  
  480. if (distanceTo(getDestination()) < random(5, 12)) {
  481. if (!walkPathMM(pathToShapes1)) {
  482. walkToClosestTile(pathToShapes1);
  483. }
  484. }
  485.  
  486.  
  487. if (distanceTo(getDestination()) < random(5, 12)) {
  488. if (!walkPathMM(pathToShapes2)) {
  489. walkToClosestTile(pathToShapes2);
  490. }
  491. }
  492.  
  493.  
  494. if (distanceTo(getDestination()) < random(5, 12)) {
  495. if (!walkPathMM(pathToShapes3)) {
  496. walkToClosestTile(pathToShapes3);
  497. }
  498. }
  499.  
  500.  
  501. if (getMyPlayer().getLocation().equals(new RSTile(3354, 9640))) {
  502. if (distanceTo(getDestination()) < random(5, 12)) {
  503. if (!walkPathMM(pathToShapes4)) {
  504. walkToClosestTile(pathToShapes4);
  505. }
  506. }
  507.  
  508.  
  509. }
  510.  
  511. RSObject shape = getNearestObjectByID (shapeIDs);
  512. RSTile shapeLocation = shape.getLocation();
  513.  
  514. if (distanceTo(shapeLocation) == 5) {
  515. turnToObject(shape);
  516. wait (random(500, 1000));
  517. }
  518.  
  519. while (distanceTo(shapeLocation) > random(4, 5)) {
  520. walkTileMM(shapeLocation);
  521. wait (distanceTo(shapeLocation) * 100 + random (-200, 200));
  522. }
  523.  
  524. state = "pickup";
  525.  
  526. return;
  527. }
  528.  
  529. public void takeShapes() {
  530. RSObject shape = getNearestObjectByID (shapeIDs);
  531.  
  532. while(!isInventoryFull()) {
  533. atObject (shape, "Take-from");
  534. wait(random(500, 750));
  535. }
  536.  
  537. state = "cast";
  538. return;
  539. }
  540.  
  541. public void cast() {
  542.  
  543. if (getCurrentTab()==Constants.TAB_INVENTORY){
  544. openTab(Constants.TAB_MAGIC);
  545. wait (random (100, 150));
  546.  
  547. }
  548. if (getCurrentTab()== Constants.TAB_MAGIC){
  549.  
  550.  
  551. if (castType.equals("Dragonstone")) {
  552.  
  553. clickMouse(669 + random(-4, 4),231 + random(-4, 4),true);
  554. wait(random(900, 1100));
  555.  
  556. if (getCurrentTab()== Constants.TAB_INVENTORY){
  557.  
  558. RSItem shapes = getInventoryItemByID(shapeItemIDs);
  559. if (shapes == null) {
  560. log("iventory is full of orbs");
  561.  
  562. if (mode.equals("XP")) {
  563. state = "deposit";
  564. } else {
  565. state = "hop";
  566. }
  567. } else {
  568. RSItem castItem = getInventoryItemByID(shapeItemIDs);
  569. atInventoryItem(castItem.getID(), "Cast");
  570. wait (random(20, 100));
  571.  
  572. }
  573.  
  574.  
  575. }
  576. return;
  577.  
  578.  
  579. } else if (castType.equals("Onyx")) {
  580.  
  581. clickMouse(692 + random(-4, 4),230 + random(-4, 4),true);
  582. wait(random(750, 1000));
  583.  
  584.  
  585. if (getCurrentTab()== Constants.TAB_INVENTORY){
  586.  
  587. RSItem shapes = getInventoryItemByID(shapeItemIDs);
  588. if (shapes == null) {
  589. log("iventory is full of orbs");
  590.  
  591. if (mode.equals("XP")) {
  592. state = "deposit";
  593. } else {
  594. state = "hop";
  595. }
  596. } else {
  597. RSItem castItem = getInventoryItemByID(shapeItemIDs);
  598. atInventoryItem(castItem.getID(), "Cast");
  599. wait (random(20, 100));
  600.  
  601. }
  602.  
  603.  
  604. }
  605. return;
  606.  
  607. } else if (castType.equals("Diamond")) {
  608.  
  609. clickMouse(646 + random(-4, 4),231 + random(-4, 4),true);
  610. wait(random(750, 1000));
  611.  
  612.  
  613. if (getCurrentTab()== Constants.TAB_INVENTORY){
  614.  
  615. RSItem shapes = getInventoryItemByID(shapeItemIDs);
  616. if (shapes == null) {
  617. log("iventory is full of orbs");
  618.  
  619. if (mode.equals("XP")) {
  620. state = "deposit";
  621. } else {
  622. state = "hop";
  623. }
  624. } else {
  625. RSItem castItem = getInventoryItemByID(shapeItemIDs);
  626. atInventoryItem(castItem.getID(), "Cast");
  627. wait (random(40, 100));
  628.  
  629. }
  630.  
  631.  
  632. }
  633. return;
  634.  
  635. }
  636. }
  637. return;
  638. }
  639.  
  640. public void deposit() {
  641. log("depositing..");
  642.  
  643. if (distanceTo(getDestination()) < random(5, 12)) {
  644. if (!walkPathMM(pathToDeposit1)) {
  645. walkToClosestTile(pathToDeposit1);
  646. }
  647. }
  648.  
  649. if (distanceTo(getDestination()) < random(5, 12)) {
  650. if (!walkPathMM(pathToDeposit2)) {
  651. walkToClosestTile(pathToDeposit2);
  652. }
  653. }
  654.  
  655. if (distanceTo(getDestination()) < random(5, 12)) {
  656. if (!walkPathMM(pathToDeposit3)) {
  657. walkToClosestTile(pathToDeposit3);
  658. }
  659. }
  660.  
  661. if (distanceTo(getDestination()) < random(5, 12)) {
  662. if (!walkPathMM(pathToDeposit4)) {
  663. walkToClosestTile(pathToDeposit4);
  664. }
  665. }
  666.  
  667. while (getInventoryCount(6902) != 0) {
  668. RSObject well = getNearestObjectByID(depositwell);
  669. atObject(well, "Deposit");
  670. wait (random(500, 750));
  671. }
  672.  
  673. if (mode.equals("XP")) {
  674. state = "run";
  675. } else {
  676. state = "stones";
  677. }
  678. log("back to shapes");
  679.  
  680.  
  681.  
  682. return;
  683. }
  684.  
  685.  
  686.  
  687. public void antiban() {
  688.  
  689. final char[] rotateLR = new char[] { KeyEvent.VK_LEFT,
  690. KeyEvent.VK_RIGHT };
  691.  
  692. int selector = random (1, 5);
  693.  
  694. int rand = random (0, 2);
  695. int period = random (200, 600);
  696.  
  697. switch (selector) {
  698.  
  699. case 1:
  700.  
  701. if (debug)
  702. log("Antiban: Moving camera...");
  703.  
  704. Thread changeAltitude = new Thread (new Runnable() {
  705. public void run() {
  706. int altitude = random (30, 99);
  707. setCameraAltitude(altitude);
  708. }
  709. }
  710. );
  711.  
  712. Bot.getInputManager().pressKey(rotateLR[rand]);
  713. try {
  714.  
  715. changeAltitude.run();
  716. Thread.sleep(period);
  717.  
  718. } catch (final Exception e) {
  719. log("Failed.");
  720. }
  721. Bot.getInputManager().releaseKey(rotateLR[rand]);
  722.  
  723. wait (random(100, 250));
  724.  
  725. case 2:
  726.  
  727. if (debug)
  728. log("Antiban: Opening random tab...");
  729. openTab(random(0, 7));
  730. wait (random(400, 1200));
  731.  
  732. case 3:
  733.  
  734. if (debug)
  735. log("Antiban: Checking XP til next level...");
  736. openTab(Constants.TAB_STATS);
  737. wait(random(1, 20));
  738. moveMouse(567 + random(0, 25), 393 + random(0, 14));
  739. wait (random(800, 1600));
  740.  
  741. case 4:
  742.  
  743. if (debug)
  744. log("Antiban: Moving mouse...");
  745. moveMouse(random(1, 760), random(1, 499));
  746.  
  747. }
  748.  
  749. int interval = random(15000, 60000);
  750. antiTime = System.currentTimeMillis() + interval;
  751.  
  752. if (debug)
  753. log ("Engaging antiban in " + interval / 1000 + " seconds...");
  754.  
  755. return;
  756.  
  757. }
  758.  
  759. public boolean worldhop() {
  760. if (debug)
  761. log("Worldhopping, this may take 1-2 Minutes.");
  762. logout();
  763. if (RSInterface.getInterface(744).getChild(580).isValid()) {
  764. int x9 = random(345, 415);
  765. int y9 = random(242, 250);
  766. moveMouse(x9, y9);
  767. int positionX = (input.getX());
  768. int positionY = (input.getY());
  769. boolean succsess = false;
  770. wait(random(400, 800));
  771. if (positionX == x9 && positionY == y9) {
  772. succsess = true;
  773. }
  774. if (!succsess) {
  775. worldhop();
  776. }
  777. clickMouse(true);
  778. wait(random(4000, 6000));
  779.  
  780. int x10 = random(84, 296);
  781. int y10 = random(148, 450);
  782. moveMouse(x10, y10);
  783. clickMouse(true);
  784. wait(random(4000, 6000));
  785. boolean loggedin = true;
  786. if (RSInterface.getInterface(744).getChild(639).isValid()) {
  787.  
  788. String text1 = RSInterface.getInterface(744).getChild(639).getText();
  789. if (text1.equals("World 2")
  790. || text1.equals("World 6")
  791. || text1.equals("World 31")
  792. || text1.equals("World 144")
  793. || text1.equals("World 44")) {
  794. log("This is a Heavily Populated World, Choosing another one");
  795. loggedin = false;
  796.  
  797. } else if (text1.contains("World 137")
  798. || text1.contains("World 65")
  799. || text1.contains("World 26")
  800. || text1.contains("World 124")
  801. || text1.contains("World 18")
  802. || text1.contains("World 86")
  803. || text1.contains("World 72")) {
  804.  
  805. log("This is a PvP World, Choosing another one");
  806. loggedin = false;
  807. }
  808.  
  809. if (loggedin) {
  810. login();
  811. } else {
  812. worldhop();
  813. }
  814.  
  815. }
  816. }
  817. return isLoggedIn();
  818.  
  819. }
  820.  
  821. @SuppressWarnings("deprecation")
  822. public int loop() {
  823. if (!isLoggedIn() || isWelcomeButton() || !StartedY) {
  824. StartedY = true;
  825. wait(1000);
  826. return random(250, 500);
  827. }
  828.  
  829. if (getInventoryCount(564) == 0) {
  830. log ("Out of Cosmic runes");
  831. stopAllScripts();
  832. }
  833.  
  834. if (getMyPlayer().getLocation().equals(new RSTile (3363, 3302))) {
  835. state = "portal";
  836. } else if (state == null && mode.equals("XP")) {
  837. state = "run";
  838. } else if (state == null && mode.equals("Pizazz Points")) {
  839. state = "stones";
  840. }
  841.  
  842. if (state.equals("portal")) {
  843. status = "Running to portal";
  844. toPortal();
  845. }
  846.  
  847. if (state.equals("enter")) {
  848. status = "Entering portal";
  849. inPortal();
  850. }
  851.  
  852. if (mode.equals("XP")) {
  853.  
  854. if (state.equals("run")) {
  855. status = "Running to shapes";
  856. toShapes();
  857. }
  858.  
  859. if (state.equals("pickup")) {
  860. status = "Picking up shapes";
  861. takeShapes();
  862. }
  863.  
  864. if (state.equals("cast")) {
  865. status = "Casting enchantment spell";
  866. cast();
  867. }
  868.  
  869. if (state.equals("deposit")) {
  870. status = "Depositing orbs";
  871. deposit();
  872. }
  873. } else {
  874.  
  875. if (state.equals("stones")) {
  876. status = "Gathering Dragonstones";
  877. getDstone();
  878. }
  879.  
  880. if (state.equals("cast")) {
  881. status = "Casting enchantment spell";
  882. cast();
  883. }
  884.  
  885. if (state.equals("hop")) {
  886. status = "World hopping";
  887. worldhop();
  888. }
  889.  
  890. }
  891.  
  892. if (System.currentTimeMillis() > antiTime && antiban && state != "hop") {
  893. status = "Engaging Antiban";
  894. antiban();
  895. }
  896.  
  897. return random(100, 150);
  898. }
  899.  
  900. }
Add Comment
Please, Sign In to add comment