Advertisement
Guest User

Untitled

a guest
Oct 18th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.25 KB | None | 0 0
  1. /**
  2. * @filename Revive.js
  3. * @author kolton
  4. * @desc handle revive
  5. */
  6.  
  7. js_strict(true);
  8.  
  9. include("json2.js");
  10. include("NTItemParser.dbl");
  11. include("OOG.js");
  12. include("Gambling.js");
  13. include("CraftingSystem.js");
  14. include("common/Attack.js");
  15. include("common/Cubing.js");
  16. include("common/Config.js");
  17. include("common/CollMap.js");
  18. include("common/Loader.js");
  19. include("common/Misc.js");
  20. include("common/Pickit.js");
  21. include("common/Pather.js");
  22. include("common/Precast.js");
  23. include("common/Prototypes.js");
  24. include("common/Runewords.js");
  25. include("common/Storage.js");
  26. include("common/Town.js");
  27.  
  28. function main() {
  29. var townCheck = false;
  30.  
  31. this.togglePause = function () {
  32. var i, script,
  33. scripts = ["default.dbj", "tools/antihostile.js", "tools/rushthread.js", "tools/CloneKilla.js"];
  34.  
  35. for (i = 0; i < scripts.length; i += 1) {
  36. script = getScript(scripts[i]);
  37.  
  38. if (script) {
  39. if (script.running) {
  40. if (i === 0) { // default.dbj
  41. print("ÿc1Pausing.");
  42. }
  43.  
  44. script.pause();
  45. } else {
  46. if (i === 0) { // default.dbj
  47. if (!getScript("tools/clonekilla.js")) { // resume only if clonekilla isn't running
  48. print("ÿc2Resuming.");
  49. script.resume();
  50. }
  51. } else {
  52. script.resume();
  53. }
  54. }
  55. }
  56. }
  57.  
  58. return true;
  59. };
  60.  
  61. addEventListener("scriptmsg",
  62. function (msg) {
  63. if (msg === "townCheck") {
  64. if (me.area === 136) {
  65. print("Can't tp from uber trist.");
  66. } else {
  67. townCheck = true;
  68. }
  69. }
  70. });
  71.  
  72. // Init config and attacks
  73. D2Bot.init();
  74. Config.init();
  75. Pickit.init();
  76. Attack.init();
  77. Storage.Init();
  78. CraftingSystem.buildLists();
  79. Runewords.init();
  80. Cubing.init();
  81.  
  82. if (Config.Revive === true && me.mode === 17) {
  83. var corpse, bodyarea;
  84. rev = false;
  85. corpse = getUnit(0, me.name, 17);
  86. bodyarea = me.area;
  87. //this.togglePause();
  88. me.revive();
  89. print("bodyarea " + bodyarea + " corpse " + corpse);
  90. Pather.journeyTo(bodyarea, true);
  91.  
  92. while (corpse && me.area === bodyarea) {
  93. if (getDistance(me, corpse) <= 15) {
  94. Pather.moveToUnit(corpse);
  95. corpse.interact();
  96. delay(500);
  97. rev = true;
  98. }
  99. if (rev) {
  100. this.togglePause();
  101. rev = false;
  102. //return true;
  103. }
  104. }
  105. }
  106.  
  107.  
  108.  
  109. while (true) {
  110. if (Config.Revive === true && me.mode === 17) {
  111. var corpse, bodyarea,
  112. rev = false;
  113. corpse = getUnit(0, me.name, 17);
  114. bodyarea = me.area;
  115. this.togglePause();
  116. me.revive();
  117. print("bodyarea " + bodyarea + " corpse " + corpse);
  118.  
  119.  
  120. while (!me.gameReady) {
  121. delay(100);
  122. }
  123.  
  124. try {
  125. //Pather.journeyTo(bodyarea, true);
  126. while (corpse) {
  127. if (me.area !== bodyarea) {
  128. Pather.journeyTo(bodyarea, true);
  129. } else if (me.area === bodyarea/*getDistance(me, corpse) <= 15*/) {
  130. me.overhead("Getting my body");
  131. Pather.moveToUnit(corpse);
  132. corpse.interact();
  133. delay(500);
  134. rev = true;
  135. }
  136. }
  137. } catch (e) {
  138. Misc.errorReport(e, "Revive.js");
  139. scriptBroadcast("quit");
  140.  
  141. return;
  142. } finally {
  143. this.togglePause();
  144.  
  145. rev = false;
  146. }
  147. }
  148.  
  149. delay(50);
  150. }
  151. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement