Advertisement
kolton

Untitled

Oct 22nd, 2011
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function NTMain() {
  2.     Include("libs/common/NTCommon.ntl");
  3.     NTC_IncludeLibs();
  4.  
  5.     NTC_IncludeConfig("NTBot/char_configs");
  6.     NT_LoadConfig();
  7.  
  8.     NTSI_LoadNIPFiles("NTBot/item_configs");
  9.    
  10.     NTA_Initialize();
  11.    
  12.     StackSafe(); // this should be called early in ntbotgame
  13.    
  14.     var i, stackCount,
  15.         NTConfig_StackHelm = true,
  16.         NTConfig_StackArmor = false;
  17.    
  18.     SetUIState(0x24, true);
  19.     SetUIState(0x01, true);
  20.    
  21.     stackCount = 10; // temp
  22.    
  23.     for (i = 0; i < stackCount; i += 1) {
  24.         if (NTConfig_StackHelm) {
  25.             Stack.itemToCursor(1, 1);
  26.             Stack.swapItem(1);
  27.         }
  28.        
  29.         if (NTConfig_StackArmor) {
  30.             Stack.itemToCursor(3, 1);
  31.             Stack.swapItem(3);
  32.         }
  33.     }
  34.    
  35.     me.Cancel(1);
  36.    
  37.     Say("!Done!");
  38. }
  39.  
  40. function StackSafe() {
  41.     if (!me.itemoncursor) { // nothing to do
  42.         return true;
  43.     }
  44.    
  45.     var i, items, merc, loc,
  46.         item = me.GetCursorItem();
  47.        
  48.     switch (item.itemprefix) { // check cursor item. !!add dragon!!
  49.     case 20535: // dream
  50.         Print("ÿc4StackSafeÿc0: ÿc1Dream on cursor!");
  51.     default: // exit StackSafe
  52.         return true;
  53.     }
  54.    
  55.     loc = item.itemtype === 37 ? 1 : 3;
  56.    
  57.     SetUIState(0x24, true);
  58.     SetUIState(0x01, true);
  59.     Delay(500);
  60.    
  61.     items = me.GetItems();
  62.    
  63.     for (i = 0; i < items.length; i += 1) {
  64.         if (items[i].mode === 1 && items[i].itemloc === loc) {
  65.             Print("ÿc4StackSafeÿc0: Player has a Dream. Moving on to merc.");
  66.             break;
  67.         }
  68.     }
  69.    
  70.     if (i === items.length) { // player needs to equip
  71.         while (me.itemoncursor) {
  72.             me.ClickItem(1);
  73.             Delay(500);
  74.         }
  75.     } else { // merc needs to equip
  76.         merc = NTC_GetMerc();
  77.        
  78.         if (!merc) {
  79.             Print("ÿc4StackSafeÿc0: ÿc1Fatal error! Merc not found.");
  80.            
  81.             while (1) {
  82.                 Delay(500);
  83.             }
  84.         }
  85.        
  86.         me.ClickMercItem(1);
  87.         Delay(500);
  88.     }
  89.    
  90.     if (me.itemoncursor) {
  91.         Print("ÿc4StackSafeÿc0: ÿc1Fatal error! Failed to eqip the item.");
  92.        
  93.         while (1) {
  94.             Delay(500);
  95.         }
  96.     }
  97.    
  98.     me.Cancel(1);
  99.     Delay(500);
  100.     Print("ÿc4StackSafeÿc0: ÿc2Done!");
  101.    
  102.     return true;
  103. }
  104.  
  105. var Stack = new function () {
  106.     this.itemToCursor = function (location, mode) { // mode: 0 - player, 1 - merc
  107.         var i;
  108.        
  109.         for (i = 0; i < 50; i += 1) {
  110.             if (i % 10 === 0) {
  111.                 mode ? me.ClickMercItem(location) : me.ClickItem(location);
  112.             }
  113.            
  114.             Delay(100);
  115.            
  116.             if (me.itemoncursor) {
  117.                 break;
  118.             }
  119.         }
  120.     }
  121.    
  122.     this.getItem = function (location, mode) { // mode: 0 - player, 1 - merc
  123.         var i, items;
  124.        
  125.         items = mode ? NTC_GetMerc().GetItems() : me.GetItems();
  126.        
  127.         for (i = 0; i < items.length; i += 1) {
  128.             if (items[i].mode === 1 && items[i].itemloc === location) {
  129.                 return items[i];
  130.             }
  131.         }
  132.        
  133.         return false;
  134.     }
  135.    
  136.     this.swapItem = function (location) {
  137.         var i, stackedItem;
  138.        
  139.         stackedItem = Stack.getItem(1, 0);
  140.        
  141.         for (i = 0; i < 50; i = i + 1) {
  142.             if (i % 10 === 0) {
  143.                 me.ClickItem(location);
  144.             }
  145.            
  146.             Delay(100);
  147.            
  148.             if (stackedItem !== Stack.getItem(location, 0)) {
  149.                 break;
  150.             }
  151.         }
  152.        
  153.         for (i = 0; i < 50; i = i + 1) {
  154.             if (i % 10 === 0) {
  155.                 me.ClickMercItem(location);
  156.             }
  157.            
  158.             Delay(100);
  159.            
  160.             if (!me.itemoncursor) {
  161.                 break;
  162.             }
  163.         }
  164.     }
  165. }
  166.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement