Advertisement
kolton

Untitled

Oct 31st, 2011
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function FindXPShrine() {
  2.     if (!NTTM_TownMove("waypoint")) {
  3.         return false;
  4.     }
  5.    
  6.     if (!NTM_UsePortal("Waypoint", 4)) {
  7.         return false;
  8.     }
  9.    
  10.     if (!FindShrines(4)) {
  11.         if (!FindShrines(3)) {
  12.             if (!FindShrines(2)) {
  13.                 NTTM_CheckAct();
  14.                 me.overhead("No XP shrines :(");
  15.                
  16.                 return true;
  17.             }
  18.         }
  19.     }
  20.    
  21.     me.overhead("Shrine found!");
  22.    
  23.     return true;
  24. }
  25.  
  26. function FindShrines(area) {
  27.     var i, n, room, shrine,
  28.         ShrineIds = [2, 81, 83],
  29.         ShrineLocs = [],
  30.         unit = getPresetUnits(area);
  31.        
  32.     if (unit) {
  33.         for (i = 0; i < unit.length; i += 1) {
  34.             for (n = 0; n < ShrineIds.length; n = n + 1) {
  35.                 if (ShrineIds[n] === unit[i].id) {
  36.                     ShrineLocs.push([unit[i].roomx * 5 + unit[i].x, unit[i].roomy * 5 + unit[i].y]);
  37.                 }
  38.             }
  39.         }
  40.     }
  41.    
  42.     while (ShrineLocs.length > 0) {
  43.         ShrineLocs.sort(Sort);
  44.        
  45.         room = ShrineLocs.shift();
  46.        
  47.         NTM_MoveTo(room[0] + 3, room[1]);
  48.        
  49.         shrine = NTC_GetUnit(NTC_UNIT_OBJECT);
  50.        
  51.         if (shrine) {
  52.             do {
  53.                 if (shrine.objtype === 15 && getDistance(me, shrine) <= 10) {
  54.                     for (i = 0; i < 30; i += 1) {
  55.                         if (i % 10 === 0 && NTM_GetCloserInt(shrine)) {
  56.                             shrine.interact()
  57.                         }
  58.                        
  59.                         NTC_Delay(200);
  60.                        
  61.                         if (shrine.mode) {
  62.                             NTTM_CheckAct();
  63.                            
  64.                             return true;
  65.                         }
  66.                     }
  67.                 }
  68.             } while (shrine.getNext());
  69.         }
  70.     }
  71.    
  72.     return false;
  73. }
  74.    
  75. function Sort (a, b) {
  76.     return (getDistance(me.x, me.y, a[0], a[1]) - getDistance(me.x, me.y, b[0], b[1]));
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement