Advertisement
kolton

Untitled

Aug 7th, 2012
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.59 KB | None | 0 0
  1. getWP: function (area) {
  2. var i, j, wp, preset,
  3. wpIDs = [119, 145, 156, 157, 237, 238, 288, 323, 324, 398, 402, 429, 494, 496, 511, 539];
  4.  
  5. this.journeyTo(area);
  6.  
  7. for (i = 0; i < wpIDs.length; i += 1) {
  8. preset = getPresetUnit(area, 2, wpIDs[i]);
  9.  
  10. if (preset) {
  11. this.moveToUnit(preset);
  12.  
  13. wp = getUnit(2, "waypoint");
  14.  
  15. if (wp) {
  16. for (j = 0; j < 10; j += 1) {
  17. wp.interactEx();
  18.  
  19. if (getUIFlag(0x14)) {
  20. me.cancel();
  21.  
  22. return true;
  23. }
  24.  
  25. delay(500);
  26. }
  27. }
  28. }
  29. }
  30.  
  31. return false;
  32. },
  33.  
  34. // TODO: Hell levels
  35. journeyTo: function (area) {
  36. var i, special, unit, tick,
  37. arr = this.plotCourse(area);
  38.  
  39. // handle variable flayer jungle entrances
  40. if (arr.indexOf(78) > -1) {
  41. Town.goToTown(3); // without initiated act, getArea().exits will crash
  42.  
  43. special = getArea(78);
  44.  
  45. if (special) {
  46. special = special.exits;
  47.  
  48. for (i = 0; i < special.length; i += 1) {
  49. if (special[i].target === 77) {
  50. arr.splice(arr.indexOf(78), 0, 77); // add great marsh if needed
  51.  
  52. break;
  53. }
  54. }
  55. }
  56. }
  57.  
  58. while (arr.length) {
  59. if (!me.inTown) {
  60. Precast.doPrecast(false);
  61. }
  62.  
  63. if (me.inTown && this.wpAreas.indexOf(arr[0]) > -1 && getWaypoint(this.wpAreas.indexOf(arr[0]))) {
  64. this.useWaypoint(arr[0], true);
  65. } else if (me.area === 109 && arr[0] === 110) { // Harrogath -> Bloody Foothills
  66. this.moveTo(5026, 5095);
  67.  
  68. unit = getUnit(2, 449); // Gate
  69.  
  70. if (unit) {
  71. for (i = 0; i < 3; i += 1) {
  72. unit.interactEx();
  73.  
  74. tick = getTickCount();
  75.  
  76. while (getTickCount() - tick < 3000) {
  77. if (unit.mode === 2) {
  78. delay(1000);
  79.  
  80. break;
  81. }
  82. }
  83. }
  84. }
  85.  
  86. this.moveToExit(arr[0], true);
  87. } else if (me.area === 4 && arr[0] === 38) { // Stony Field -> Tristram
  88. this.moveToPreset(me.area, 1, 737, 0, 0, false, true);
  89.  
  90. for (i = 0; i < 5; i += 1) {
  91. if (this.usePortal(38)) {
  92. break;
  93. }
  94.  
  95. delay(1000);
  96. }
  97. } else if (me.area === 74 && arr[0] === 46) { // Arcane Sanctuary -> Canyon of the Magi
  98. this.moveToPreset(me.area, 2, 357);
  99.  
  100. for (i = 0; i < 5; i += 1) {
  101. unit = getUnit(2, 357);
  102.  
  103. unit.interactEx();
  104. delay(1000);
  105. me.cancel();
  106.  
  107. if (this.usePortal(46)) {
  108. break;
  109. }
  110. }
  111. } else if (me.area === 54 && arr[0] === 74) { // Palace -> Arcane
  112. this.moveTo(10073, 8670);
  113. this.usePortal(null);
  114. } else if (me.area === 109 && arr[0] === 121) { // Harrogath -> Nihlathak's Temple
  115. Town.move("anya");
  116. this.usePortal(121);
  117. } else {
  118. this.moveToExit(arr[0], true);
  119. }
  120.  
  121. arr.shift();
  122. }
  123. },
  124.  
  125. plotCourse: function (dest) {
  126. var arr = [],
  127. previousAreas = [0, 1, 1, 2, 3, 10, 5, 6, 2, 3, 4, 6, 7, 9, 10, 11, 12, 3, 17, 17, 6, 20, 21, 22, 23, 24, 7, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 4, 1, 1, 40, 41, 42, 43, 44, 74, 40, 47, 48, 40, 50, 51, 52, 53, 41, 42, 56, 45, 55, 57, 58, 43, 62, 63, 44, 46, 46, 46, 46, 46, 46, 46, 1, 54, 1, 75, 76, 76, 78, 79, 80, 81, 82, 76, 76, 78, 86, 78, 88, 87, 89, 80, 92, 80, 80, 81, 81, 82, 82, 83, 100, 101, 102, 103, 104, 105, 106, 107, 103, 109, 110, 111, 112, 113, 113, 115, 115, 117, 118, 118, 109, 121, 122, 123, 0, 112, 117, 120, 128, 129, 130, 131, 109, 109, 109, 109],
  128. target = dest;
  129.  
  130. while (true) {
  131. arr.push(target);
  132.  
  133. if (this.wpAreas.indexOf(target) > -1 && getWaypoint(this.wpAreas.indexOf(target))) {
  134. break;
  135. }
  136.  
  137. target = previousAreas[target];
  138.  
  139. if (target === me.area) {
  140. break;
  141. }
  142. }
  143.  
  144. return arr.reverse();
  145. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement