Advertisement
gtoilet

clear any area wp grabber

Jun 15th, 2020
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. /**
  2. * @filename ClearAnyArea.js
  3. * @author kolton
  4. * @desc Clears any area
  5. */
  6.  
  7. function ClearAnyArea() {
  8. this.clickWP = function () { // Move to nearest wp and click it.
  9. var i, j, wp, presetUnit,
  10. wpIDs = [119, 145, 156, 157, 237, 238, 288, 323, 324, 398, 402, 429, 494, 496, 511, 539];
  11.  
  12. for (i = 0 ; i < wpIDs.length ; i += 1) {
  13. presetUnit = getPresetUnit(me.area, 2, wpIDs[i]);
  14.  
  15. if (presetUnit) {
  16. print("going to nearest WP");
  17.  
  18. while (getDistance(me.x, me.y, presetUnit.roomx * 5 + presetUnit.x, presetUnit.roomy * 5 + presetUnit.y) > 10) {
  19. try {
  20. Pather.moveToPreset(me.area, 2, wpIDs[i], 0, 0, Config.ClearType, false);
  21. } catch (e) {
  22. print("Caught Error.");
  23.  
  24. print(e);
  25. }
  26.  
  27. Packet.flash(me.gid);
  28.  
  29. delay(me.ping * 2 + 500);
  30. }
  31.  
  32. wp = getUnit(2, "waypoint");
  33.  
  34. if (wp) {
  35. for (j = 0 ; j < 10 ; j += 1) {
  36. sendPacket(1, 0x13, 4, wp.type, 4, wp.gid);
  37.  
  38. delay(me.ping * 2 + 500);
  39.  
  40. if (getUIFlag(0x14)) {
  41.  
  42.  
  43. me.cancel();
  44.  
  45. break;
  46. }
  47.  
  48. Packet.flash(me.gid);
  49.  
  50. delay(me.ping * 2 + 500);
  51.  
  52. Pather.moveToUnit(presetUnit, 0, 0, Config.ClearType, false);
  53. }
  54. }
  55. }
  56. }
  57. };
  58. var room, i;
  59.  
  60. Town.doChores();
  61.  
  62. for (i = 0; i < Config.ClearAnyArea.AreaList.length; i += 1) {
  63. if (Pather.journeyTo(Config.ClearAnyArea.AreaList[i])) {
  64. this.clickWP();
  65. Attack.clearLevel(Config.ClearType);
  66. }
  67. }
  68.  
  69. return true;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement