Advertisement
dzik

Diablo 2 - ETAL - NTPickUp.ntj

Jun 25th, 2014
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  Written By nullard and revised by Diabolic
  2.  
  3. Include('libs/common/NTCommon.ntl');
  4. Include('NTBot/char_configs/NTConfig.ntl');
  5. NTC_IncludeLibs();
  6. var _endTime = null;
  7. var justGrabIt = false;
  8. var mulepos = NT_File("AMS/MuleStatus/" + me.account + "_locstatus.txt", 0);
  9. var muleAccount = NT_File("AMS/MuleStatus/" + me.account + "_muleaccount.txt", 0);
  10.  
  11. function NTMain()
  12. {
  13.     _endTime = GetTickCount() + 1000 * 60 * 3 + 1000 * 15;
  14.    
  15.     Say("mule position is " + mulepos);
  16.    
  17.     if(justGrabIt)
  18.         _endTime = GetTickCount() + 1000 * 60 * 1;
  19.        
  20.     Delay(1000);
  21.     var _counter = 0;
  22.     while (_counter < 10) {
  23.         Delay(500);
  24.         _counter++;
  25.     }
  26.     NTConfig_NIPFilePath = ['PickupEverything.nip'];
  27.     NTConfig_Columns[0] = [1,1,1,1,1,1,1,1,1,1];
  28.     NTConfig_Columns[1] = [1,1,1,1,1,1,1,1,1,1];
  29.     NTConfig_Columns[2] = [1,1,1,1,1,1,1,1,1,1];
  30.     NTConfig_Columns[3] = [1,1,1,1,1,1,1,1,1,1];
  31.     NTSI_LoadNIPFiles('NTBot/item_configs');
  32.  
  33.     NTConfig_SnagRange = 30;
  34.     NTConfig_FreeSpace = 2;
  35.     NTTM_CheckAct(1);
  36.    
  37.     SetUIState(0x01,true);
  38.         var _items = me.GetItems();
  39.             for(var i = 0 ; i < _items.length ; i++) {
  40.                 if(_items[i].mode == 0 && (_items[i].classid == 529 || _items[i].classid == 530)) {
  41.             NTT_DropItem(_items[i]);
  42.         }
  43.     }
  44.     SetUIState(0x01,false);
  45.    
  46.     for (var _ctr=0;_ctr<5; _ctr++) {
  47.         if (!_ItemsOnGround()) {
  48.             NTMU_TLMuleInventory();
  49.             while (GetTickCount() < _endTime) {
  50.                 SetStatusText('Finished muling. Time until NG (' +
  51.                         parseInt((_endTime - GetTickCount())/1000) + 's)');
  52.                 Delay(1000);
  53.             }
  54.             NT_File("AMS/MuleStatus/" + me.account + "_charstatus.txt", 1, "Main");
  55.                 NTC_Delay(500);
  56.                     NT_File("AMS/MuleStatus/" + me.account + "_mulingstatus.txt", 1, "false");
  57.                 NTC_Delay(500);
  58.             NT_File("AMS/MuleStatus/" + me.account + "_mulegame.txt", 1);
  59.             CloseD2();
  60.         }
  61.         NTTM_TownMove('stash');
  62.         _stash = NTC_FindUnit(NTC_UNIT_OBJECT, NTC_UNIT_STASH);
  63.         if (!NTT_DoInteract(_stash)) NTT_DoInteract(_stash);
  64.         if (!NTT_ManageStash()) NTT_ManageStash();
  65.         Delay(1500);
  66.         me.Cancel(1);
  67.         if (!_GrabItems() && _ItemsOnGround() && !_GrabItems()) {
  68.             NTMU_TLMuleInventory();
  69.             while (GetTickCount() < _endTime) {
  70.                 SetStatusText('Waiting before next mule(' +
  71.                         parseInt((_endTime - GetTickCount())/1000) + 's)');
  72.                 Delay(1000);
  73.             }
  74.             if(!_GrabItems()) {
  75.             nextMulePos(mulepos);
  76.             NTC_Delay(500);
  77.             CloseD2();
  78.             }
  79.         }
  80.     }
  81.     NTMU_TLInventory();
  82.     while (GetTickCount() < _endTime) {
  83.         SetStatusText('Finished muling. Time until NG (' +
  84.                 parseInt((_endTime - GetTickCount())/1000) + 's)');
  85.         Delay(1000);
  86.     }
  87.     NT_File("AMS/MuleStatus/" + me.account + "_charstatus.txt", 1, "Main");
  88.         NTC_Delay(500);
  89.             NT_File("AMS/MuleStatus/" + me.account + "_mulingstatus.txt", 1, "false");
  90.         NTC_Delay(500);
  91.     NT_File("AMS/MuleStatus/" + me.account + "_mulegame.txt", 1);  
  92.     ExitGame();
  93. }
  94.  
  95. function _GrabItems()
  96. {
  97.     var _item = NTC_FindUnit(NTC_UNIT_ITEM);
  98.     var _itemsChecked = [];
  99.     if(!_item) return false;
  100.     var _pickedOne = false;
  101.     do {
  102.         if(_item.mode == 3 || _item.mode == 5) {
  103.             if(NTSI_IsIgnoredItemInt(_item.classid) || _item.classid == 529 || _item.classid == 530)
  104.                 continue;
  105.  
  106.             if (NTSI_CheckItem(_item, false)[0]) {
  107.                 _itemsChecked.push(new NTSI_ItemInt(_item, true));
  108.             }
  109.         }
  110.     } while(_item.GetNext());
  111.     var _checkedItem = null;
  112.     while (_itemsChecked.length) {
  113.         _checkedItem = _itemsChecked.pop();
  114.         _item = NTC_FindUnit(NTC_UNIT_ITEM, _checkedItem.GID);
  115.         if (NTT_CheckSpace(_item.xsize, _item.ysize)) {
  116.             if (NTSI_PickUpItemInt(_item)) _pickedOne = true;
  117.         }
  118.         else if (!NTT_CheckSpace(1, 1)) return _pickedOne;
  119.     }
  120.     return _pickedOne;
  121. }
  122.  
  123. var _ItemsOnGround = function() {
  124.     var _item = NTC_FindUnit(NTC_UNIT_ITEM);
  125.     if (!_item) return false;
  126.     do {
  127.         if(_item.mode == 3 || _item.mode == 5) {
  128.             if(NTSI_IsIgnoredItemInt(_item.classid) || _item.classid == 529 || _item.classid == 530)
  129.                 continue;
  130.                 }
  131.             return true;
  132.     } while(_item.GetNext());
  133.     return false;
  134. };
  135.  
  136.  
  137. function NTMU_TLMuleInventory() {
  138.     NTConfig_TLInventory_SkipEquipped   = true;         // true = just log stash and inventory
  139.     NTConfig_TLInventory_Delimeter      = "-";            // output file delimiter - see function TTL_WriteIt()
  140.     NTConfig_TLInventory_SortOrder      = "QUALITY|TYPE|CLASS|NAME";
  141.    
  142.     Print(COLOR_3 + "[Toothless Inventory] - Load");
  143.    
  144.     TLI_MuledIt();
  145.     Print ("Finished");
  146. }
  147.  
  148. function TLI_MuledIt(verbose) {
  149.     Print ("Attempting to log inventory ...");
  150.    
  151.     if(arguments.length < 1)
  152.         var verbose = false;
  153.        
  154.     var items = me.GetItems();
  155.     items.sort(function(a, b){
  156.         var nameA=a.name.toLowerCase(), nameB=b.name.toLowerCase()
  157.         if (nameA < nameB) //sort string ascending
  158.             return -1
  159.         if (nameA > nameB)
  160.             return 1
  161.         return 0 //default return value (no sorting)
  162.     });
  163.     var logged = new Array();
  164.     if (items) {
  165.         for(var i = 0 ; i < items.length ; i++) {
  166.             item = items[i];
  167.             ignore = _NTT_IgnoredItems.join("-");
  168.             ignore += "-box";
  169.          
  170.             if(ignore.indexOf(item.code) == -1) {
  171.                 if(!NTConfig_TLInventory_SkipEquipped)
  172.                     logged.push(item);
  173.                 else if (item.mode == 0)
  174.                     logged.push(item);
  175.             }
  176.         }
  177.         if (logged.length) {
  178.             var fileName = "AMS/MuleLogs/" + muleAccount + "_" + me.name + ".txt";
  179.             _file = FileOpen(fileName, 1);
  180.             if (_file) {
  181.                 for (var i = 0; i < logged.length; i++)
  182.                     TLI_LogItem(_file, logged[i], verbose);
  183.                 _file.Close();
  184.                 Print (COLOR_2 + logged.length + " items written to - " + fileName + " -");
  185.             }
  186.             else
  187.                 Print(COLOR_1 + "Unable to write file to - " + fileName);
  188.         }
  189.         else
  190.             Print(COLOR_1 + "No items on this character to log");
  191.     }
  192.     else
  193.         Print(COLOR_1 + "No items on this character to log");
  194. }
  195.  
  196. function nextMulePos(pos)
  197. {
  198.     switch(pos)
  199.         {
  200.         case "0":
  201.             {
  202.             //NT_File("AMS/MuleStatus/" + me.account + "_charstatus.txt", 1, "New");
  203.             NTC_Delay(500);
  204.             NT_File("AMS/MuleStatus/" + me.account + "_locstatus.txt", 1, "1");
  205.             NTC_Delay(500);
  206.             break;
  207.             }
  208.         case "1":
  209.             {
  210.             //NT_File("AMS/MuleStatus/" + me.account + "_charstatus.txt", 1, "New");
  211.             NTC_Delay(500);
  212.             NT_File("AMS/MuleStatus/" + me.account + "_locstatus.txt", 1, "2");
  213.             NTC_Delay(500);
  214.             break;
  215.             }
  216.         case "2":
  217.             {
  218.             //NT_File("AMS/MuleStatus/" + me.account + "_charstatus.txt", 1, "New");
  219.             NTC_Delay(500);
  220.             NT_File("AMS/MuleStatus/" + me.account + "_locstatus.txt", 1, "3");
  221.             NTC_Delay(500);
  222.             break;
  223.             }
  224.         case "3":
  225.             {
  226.             //NT_File("AMS/MuleStatus/" + me.account + "_charstatus.txt", 1, "New");
  227.             NTC_Delay(500);
  228.             NT_File("AMS/MuleStatus/" + me.account + "_locstatus.txt", 1, "4");
  229.             NTC_Delay(500);
  230.             break;
  231.             }
  232.         case "4":
  233.             {
  234.             //NT_File("AMS/MuleStatus/" + me.account + "_charstatus.txt", 1, "New");
  235.             NTC_Delay(500);
  236.             NT_File("AMS/MuleStatus/" + me.account + "_locstatus.txt", 1, "5");
  237.             NTC_Delay(500);
  238.             break;
  239.             }
  240.         case "5":
  241.             {
  242.             //NT_File("AMS/MuleStatus/" + me.account + "_charstatus.txt", 1, "New");
  243.             NTC_Delay(500);
  244.             NT_File("AMS/MuleStatus/" + me.account + "_locstatus.txt", 1, "6");
  245.             NTC_Delay(500);
  246.             break;
  247.             }
  248.         case "6":
  249.             {
  250.             //NT_File("AMS/MuleStatus/" + me.account + "_charstatus.txt", 1, "New");
  251.             NTC_Delay(500);
  252.             NT_File("AMS/MuleStatus/" + me.account + "_locstatus.txt", 1, "7");
  253.             NTC_Delay(500);
  254.             break;
  255.             }
  256.         case "7":
  257.             {
  258.             //NT_File("AMS/MuleStatus/" + me.account + "_charstatus.txt", 1, "Account");
  259.             NTC_Delay(500);
  260.             NT_File("AMS/MuleStatus/" + me.account + "_locstatus.txt", 1, "0");
  261.             NTC_Delay(500);
  262.             break;
  263.             }
  264.         default:
  265.             {
  266.             while(1) {
  267.                 Say("!Where is the mule!");
  268.                 NTC_Delay(5000);
  269.                 }
  270.             break;
  271.             }
  272.         }
  273. }
  274.  
  275. function tryItemsAgain()
  276. {
  277.     var _item = NTC_FindUnit(NTC_UNIT_ITEM);
  278.     for(var i = 0; i < _item.length; i++) {
  279.         if(_item.mode == 3 || _item.mode == 5) {
  280.             if(!NTSI_IsIgnoredItemInt(_item.classid) && _item.classid != 529 && _item.classid != 530) {
  281.                 NTSI_PickUpItemInt(_item);
  282.             }
  283.         }
  284.     }
  285.     return;
  286. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement