Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var _NTLW_timerLastDrink = new Array(5);
- var _player;
- var _checkPlayers = true;
- var _otherParty = false;
- var _playerCount = 0;
- var _partyTick = getTickCount();
- function main()
- {
- include("common/NTCommon.dbl");
- include("common/NTCubing.dbl");
- NTC_IncludeConfig();
- var _count = 0;
- var _mercHP;
- var _party, _mypartyid;
- print("ÿc3Start ToolsThread script");
- NT_LoadConfig();
- /*if(NTConfig_LifeChicken > 0)
- me.chickenhp = parseInt((me.hpmax*NTConfig_LifeChicken)/100);
- if(NTConfig_ManaChicken > 0)
- me.chickenmp = parseInt((me.mpmax*NTConfig_ManaChicken)/100);*/
- for(var i = 0 ; i < 5 ; i++)
- _NTLW_timerLastDrink[i] = 0;
- addEventListener("melife", NT_LifeWatch);
- addEventListener("memana", NT_ManaWatch);
- while(me.ingame)
- {
- if(!NTC_InTown())
- {
- _mercHP = getMercHP();
- if(_mercHP > 0)
- {
- if(_mercHP < NTConfig_MercChicken)
- {
- quit();
- break;
- }
- if(_mercHP < NTConfig_MercRejuvThresh)
- NTLW_DrinkPotInt(4);
- else if(_mercHP < NTConfig_MercLifeThresh)
- NTLW_DrinkPotInt(3);
- }
- }
- if(NTConfig_PublicMode)
- {
- if(_checkPlayers)
- {
- _player = getParty();
- do
- {
- _playerCount++;
- }while(_player.getNext());
- if(_playerCount == 1)
- print("ÿc3Send Invites.");
- else
- print("ÿc3Wait for invites.");
- _checkPlayers = false;
- }
- _player = getParty();
- _mypartyid = _player.partyid;
- do
- {
- if(_playerCount == 1)
- {
- if(_player.partyid == 65535 && _player.partyflag != 4)
- {
- clickParty(_player, 2);
- delay(40);
- }
- }
- else
- {
- if(_player.partyid != 65535 && _player.partyid != _mypartyid)
- _otherParty = _player.partyid;
- if((getTickCount() - _partyTick >= (_playerCount + 1)*1000 && !_otherParty || _mypartyid == _otherParty) && _player.partyflag != 4
- || (!_otherParty || _player.partyid == _otherParty) && _player.partyflag == 2)
- {
- clickParty(_player, 2);
- delay(40);
- }
- }
- }while(_player.getNext());
- }
- delay(200);
- }
- }
- function NT_LifeWatch(life)
- {
- if(life <= parseInt(me.hpmax*NTConfig_LifeThresh/100))
- NTLW_DrinkPotInt(0);
- if(life <= parseInt(me.hpmax*NTConfig_LifeRejuvThresh/100))
- NTLW_DrinkPotInt(2);
- if(NTConfig_LifeChicken > 0 && life < parseInt(me.hpmax*NTConfig_LifeChicken/100) && !NTC_InTown())
- {
- takeScreenshot();
- quit();
- }
- }
- function NT_ManaWatch(mana)
- {
- if(mana <= parseInt(me.mpmax*NTConfig_ManaThresh/100))
- NTLW_DrinkPotInt(1);
- if(mana <= parseInt(me.mpmax*NTConfig_ManaRejuvThresh/100))
- NTLW_DrinkPotInt(2);
- if(NTConfig_ManaChicken > 0 && mana < parseInt(me.mpmax*NTConfig_ManaChicken/100) && !NTC_InTown())
- {
- quit();
- }
- }
- // Internal function
- function NTLW_DrinkPotInt(type)
- {
- var _pottype;
- var _potion;
- var _tNow = new Date();
- if(type != 2 && type != 4)
- {
- if(_NTLW_timerLastDrink[type] && (_tNow-_NTLW_timerLastDrink[type] < 7000))
- return false;
- }
- /*else
- {
- if(_NTLW_timerLastDrink[type] && (_tNow-_NTLW_timerLastDrink[type] < 6000))
- return false;
- }*/
- if(me.mode == 0 || me.mode == 17)
- return false;
- switch(type)
- {
- case 0:
- case 3:
- _pottype = 76;
- break;
- case 1:
- _pottype = 77;
- break;
- default:
- _pottype = 78;
- break;
- }
- _potion = NTLW_GetPotionInt(_pottype);
- if(_potion)
- {
- if(me.mode == 0 || me.mode == 17)
- return false;
- if(type < 3)
- _potion.interact();
- else
- clickItem(2, _potion);
- _NTLW_timerLastDrink[type] = new Date();
- return true;
- }
- return false;
- }
- function NTLW_GetPotionInt(pottype)
- {
- var _items = me.getItems();
- if(!_items)
- return false;
- for(var i = 0 ; i < _items.length ; i++)
- {
- if(_items[i].mode == 2 && _items[i].itemType == pottype)
- return copyUnit(_items[i]);
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement