Advertisement
kolton

Untitled

Jun 10th, 2012
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.48 KB | None | 0 0
  1. /**
  2. * @filename Andariel.js
  3. * @author kolton
  4. * @desc Universal Baal leecher by Kolton with Autoleader by Ethic
  5. * Pure leech script for throne and Baal
  6. * Reenters throne/chamber upon death and picks the corpse back up
  7. * Make sure you setup safeMsg and baalMsg accordingly
  8. */
  9.  
  10. function AutoBaal() {
  11. // editable variables
  12. var safeMsg = ["safe", "throne clear", "leechers can come", "tp is up", "1 clear"], // safe message - casing doesn't matter
  13. baalMsg = ["baal", "submortal"], // baal message - casing doesn't matter
  14. hotMsg = ["hot"], // used for shrine hunt
  15. // internal variables
  16. i, baalCheck, throneCheck, hotCheck, leader, suspect, solofail, portal, baal;
  17.  
  18. addEventListener('chatmsg', // chat event, listen to what leader says
  19. function (nick, msg) { // handler function
  20. var i;
  21.  
  22. if (nick === leader) { // filter leader messages
  23. for (i = 0; i < hotMsg.length; i += 1) { // loop through all predefined messages to find a match
  24. if (msg.toLowerCase().indexOf(hotMsg[i].toLowerCase()) > -1) { // leader says a hot tp message
  25. hotCheck = true; // safe to enter baal chamber
  26. break;
  27. }
  28. }
  29.  
  30. for (i = 0; i < safeMsg.length; i += 1) { // loop through all predefined messages to find a match
  31. if (msg.toLowerCase().indexOf(safeMsg[i].toLowerCase()) > -1) { // leader says a safe tp message
  32. throneCheck = true; // safe to enter throne
  33. break;
  34. }
  35. }
  36.  
  37. for (i = 0; i < baalMsg.length; i += 1) { // loop through all predefined messages to find a match
  38. if (msg.toLowerCase().indexOf(baalMsg[i].toLowerCase()) > -1) { // leader says a baal message
  39. baalCheck = true; // safe to enter baal chamber
  40. break;
  41. }
  42. }
  43. }
  44. }
  45. );
  46.  
  47. function AutoLeaderDetect(destination) { // autoleader by Ethic
  48. do {
  49. solofail = 0;
  50. suspect = getParty(); // get party object (players in game)
  51.  
  52. do {
  53. if (suspect.name !== me.name) { // player isn't alone
  54. solofail += 1;
  55. }
  56.  
  57. if (suspect.area === destination) { // first player in our party found in destination area...
  58. leader = suspect.name; // ... is our leader
  59. print("ÿc4AutoBaal: ÿc0Autodetected " + leader);
  60. return true;
  61. }
  62. } while (suspect.getNext());
  63.  
  64. if (solofail === 0) { // empty game, nothing left to do
  65. return false;
  66. }
  67.  
  68. delay(500);
  69. } while (!leader); // repeat until leader is found (or until game is empty)
  70.  
  71. return false;
  72. }
  73.  
  74. if (!Town.goToTown(5)) {
  75. throw new Error("Town.goToTown failed."); // critical error - can't reach harrogath
  76. }
  77.  
  78. Town.doChores();
  79.  
  80. if (Config.AutoBaal.FindShrine) {
  81. Pather.useWaypoint(4);
  82.  
  83. for (i = 4; i > 1; i -= 1) {
  84. if (Misc.getShrinesInArea(i, 15)) {
  85. break;
  86. }
  87. }
  88.  
  89. if (i === 1) {
  90. Town.goToTown();
  91. Pather.useWaypoint(5);
  92.  
  93. for (i = 5; i < 8; i += 1) {
  94. if (Misc.getShrinesInArea(i, 15)) {
  95. break;
  96. }
  97. }
  98. }
  99.  
  100. Town.goToTown(5);
  101. Town.move("portalspot");
  102. }
  103.  
  104. Town.move("portalspot");
  105.  
  106. if (AutoLeaderDetect(131)) { // find the first player in area 131 - throne of destruction
  107. while (Misc.inMyParty(leader)) { // do our stuff while partied
  108. if (throneCheck && me.area === 109) { // wait for throne signal - leader's safe message
  109. print("ÿc4AutoBaal: ÿc0Trying to take TP to throne.");
  110. Pather.usePortal(131, leader); // take TP to throne
  111. delay(500);
  112. Pather.moveTo(15113, 5050); // move to a safe spot
  113. Precast.doPrecast(true);
  114. Town.getCorpse(); // check for corpse - happens if you die and reenter
  115. }
  116.  
  117. if (baalCheck && me.area === 131) { // wait for baal signal - leader's baal message
  118. Pather.moveTo(15092, 5010); // move closer to chamber portal
  119. Precast.doPrecast(true);
  120.  
  121. while (getUnit(1, 543)) { // wait for baal to go through the portal
  122. delay(500);
  123. }
  124.  
  125. portal = getUnit(2, 563);
  126.  
  127. delay(5000); // wait for others to enter first - helps with curses and tentacles from spawning around you
  128. print("ÿc4AutoBaal: ÿc0Entering chamber.");
  129.  
  130. if (Pather.usePortal(null, null, portal)) { // enter chamber
  131. Pather.moveTo(15166, 5903); // go to a safe position
  132. }
  133.  
  134. Town.getCorpse(); // check for corpse - happens if you die and reenter
  135. }
  136.  
  137. baal = getUnit(1, 544);
  138.  
  139. if (baal && (baal.mode === 0 || baal.mode === 12)) {
  140. break;
  141. }
  142.  
  143. if (me.mode === 17) { // death check
  144. me.revive(); // revive if dead
  145. }
  146.  
  147. delay(500);
  148. }
  149. } else {
  150. throw new Error("Empty game.");
  151. }
  152.  
  153. return true;
  154. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement