Advertisement
Guest User

Untitled

a guest
Aug 13th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var _NTLW_timerLastDrink = new Array(5);
  2. var _player;
  3. var _checkPlayers = true;
  4. var _otherParty = false;
  5. var _playerCount = 0;
  6. var _partyTick = getTickCount();
  7.  
  8. function main()
  9. {
  10.     include("common/NTCommon.dbl");
  11.     include("common/NTCubing.dbl");
  12.     NTC_IncludeConfig();
  13.    
  14.     var _count = 0;
  15.     var _mercHP;
  16.     var _party, _mypartyid;
  17.  
  18.     print("ÿc3Start ToolsThread script");
  19.  
  20.     NT_LoadConfig();
  21.  
  22.     /*if(NTConfig_LifeChicken > 0)
  23.         me.chickenhp = parseInt((me.hpmax*NTConfig_LifeChicken)/100);
  24.  
  25.     if(NTConfig_ManaChicken > 0)
  26.         me.chickenmp = parseInt((me.mpmax*NTConfig_ManaChicken)/100);*/
  27.  
  28.     for(var i = 0 ; i < 5 ; i++)
  29.         _NTLW_timerLastDrink[i] = 0;
  30.    
  31.     addEventListener("melife", NT_LifeWatch);
  32.     addEventListener("memana", NT_ManaWatch);
  33.    
  34.     while(me.ingame)
  35.     {
  36.         if(!NTC_InTown())
  37.         {
  38.             _mercHP = getMercHP();
  39.  
  40.             if(_mercHP > 0)
  41.             {
  42.                 if(_mercHP < NTConfig_MercChicken)
  43.                 {                  
  44.                     quit();
  45.                     break;
  46.                 }
  47.  
  48.                 if(_mercHP < NTConfig_MercRejuvThresh)
  49.                     NTLW_DrinkPotInt(4);
  50.                 else if(_mercHP < NTConfig_MercLifeThresh)
  51.                     NTLW_DrinkPotInt(3);
  52.             }
  53.         }
  54.  
  55.         if(NTConfig_PublicMode)
  56.         {
  57.             if(_checkPlayers)
  58.             {
  59.                 _player = getParty();
  60.                
  61.                 do
  62.                 {
  63.                     _playerCount++;
  64.                 }while(_player.getNext());
  65.                
  66.                 if(_playerCount == 1)
  67.                     print("ÿc3Send Invites.");
  68.                 else
  69.                     print("ÿc3Wait for invites.");
  70.                    
  71.                 _checkPlayers = false;
  72.             }
  73.            
  74.             _player = getParty();
  75.            
  76.             _mypartyid = _player.partyid;
  77.            
  78.             do
  79.             {
  80.                 if(_playerCount == 1)
  81.                 {
  82.                     if(_player.partyid == 65535 && _player.partyflag != 4)
  83.                     {
  84.                         clickParty(_player, 2);
  85.                         delay(40);
  86.                     }
  87.                 }
  88.                 else
  89.                 {
  90.                     if(_player.partyid != 65535 && _player.partyid != _mypartyid)
  91.                         _otherParty = _player.partyid;
  92.                        
  93.                     if((getTickCount() - _partyTick >= (_playerCount + 1)*1000 && !_otherParty || _mypartyid == _otherParty) && _player.partyflag != 4
  94.                     || (!_otherParty || _player.partyid == _otherParty) && _player.partyflag == 2)
  95.                     {
  96.                         clickParty(_player, 2);
  97.                         delay(40);
  98.                     }
  99.                 }
  100.             }while(_player.getNext());
  101.         }
  102.  
  103.         delay(200);
  104.     }
  105. }
  106.  
  107. function NT_LifeWatch(life)
  108. {
  109.     if(life <= parseInt(me.hpmax*NTConfig_LifeThresh/100))
  110.         NTLW_DrinkPotInt(0);
  111.        
  112.     if(life <= parseInt(me.hpmax*NTConfig_LifeRejuvThresh/100))
  113.         NTLW_DrinkPotInt(2);
  114.        
  115.     if(NTConfig_LifeChicken > 0 && life < parseInt(me.hpmax*NTConfig_LifeChicken/100) && !NTC_InTown())
  116.     {
  117.         takeScreenshot();
  118.         quit();
  119.     }
  120. }
  121.  
  122. function NT_ManaWatch(mana)
  123. {
  124.     if(mana <= parseInt(me.mpmax*NTConfig_ManaThresh/100))
  125.         NTLW_DrinkPotInt(1);
  126.        
  127.     if(mana <= parseInt(me.mpmax*NTConfig_ManaRejuvThresh/100))
  128.         NTLW_DrinkPotInt(2);
  129.        
  130.     if(NTConfig_ManaChicken > 0 && mana < parseInt(me.mpmax*NTConfig_ManaChicken/100) && !NTC_InTown())
  131.     {
  132.         quit();
  133.     }
  134. }
  135.  
  136. // Internal function
  137. function NTLW_DrinkPotInt(type)
  138. {
  139.     var _pottype;
  140.     var _potion;
  141.     var _tNow = new Date();
  142.  
  143.     if(type != 2 && type != 4)
  144.     {
  145.         if(_NTLW_timerLastDrink[type] && (_tNow-_NTLW_timerLastDrink[type] < 7000))
  146.             return false;
  147.     }
  148.     /*else
  149.     {
  150.         if(_NTLW_timerLastDrink[type] && (_tNow-_NTLW_timerLastDrink[type] < 6000))
  151.             return false;
  152.     }*/
  153.    
  154.     if(me.mode == 0 || me.mode == 17)
  155.         return false;
  156.    
  157.     switch(type)
  158.     {
  159.     case 0:
  160.     case 3:
  161.         _pottype = 76;     
  162.         break;
  163.     case 1:
  164.         _pottype = 77;
  165.         break;
  166.     default:
  167.         _pottype = 78;
  168.         break;
  169.     }
  170.    
  171.     _potion = NTLW_GetPotionInt(_pottype);
  172.  
  173.     if(_potion)
  174.     {
  175.         if(me.mode == 0 || me.mode == 17)
  176.             return false;
  177.            
  178.         if(type < 3)
  179.             _potion.interact();
  180.         else
  181.             clickItem(2, _potion);
  182.    
  183.         _NTLW_timerLastDrink[type] = new Date();
  184.        
  185.         return true;
  186.     }
  187.    
  188.     return false;
  189. }
  190.  
  191. function NTLW_GetPotionInt(pottype)
  192. {
  193.     var _items = me.getItems();
  194.  
  195.     if(!_items)
  196.         return false;
  197.  
  198.     for(var i = 0 ; i < _items.length ; i++)
  199.     {
  200.         if(_items[i].mode == 2 && _items[i].itemType == pottype)
  201.             return copyUnit(_items[i]);
  202.     }
  203.  
  204.     return false;
  205. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement