Advertisement
daronmalak

universal

Nov 19th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.32 KB | None | 0 0
  1. var Diablo_PreMessage = "";
  2. var _trapsPreCasted;
  3. var _portalleech = true, trigger = false;
  4. var leechwarn = false;
  5. var SealBoss1 = false, SealBoss2 = false, SealBoss3 = false;
  6. var DiabloDead = false;
  7.  
  8. function NTMain() {
  9. Include("libs/common/NTCommon.ntl");
  10. NTC_IncludeLibs();
  11.  
  12. NTC_IncludeConfig("NTBot/char_configs");
  13. NT_LoadConfig();
  14.  
  15. NTSI_LoadNIPFiles("NTBot/item_configs");
  16.  
  17. NTA_Initialize();
  18.  
  19. RegisterEvent(EVENT_GAMEMSG, UDL_Chat);
  20.  
  21. if(!NTTM_CheckAct(4)){
  22. NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_CheckAct()");
  23. return;
  24. }
  25.  
  26. NTTMGR_TownManager();
  27. NTTM_TownMove("portalspot");
  28.  
  29. if(NTConfig_LeechChaos >= 1)
  30. {
  31. if(NTConfig_UseChatCommandPortal){
  32. while(!UDL_DiabloLeechMessageHandler() && !DiabloDead){
  33. Delay(500);
  34. }
  35. if(NTConfig_LeechChaos == 1){Delay(NTConfig_followDelay);}
  36. for(var i = 0 ; i < 10 && me.areaid == 103 ; i++){
  37. if(DiabloDead == true){break;}
  38. NTM_UsePortal("BluePortal", 108, NTConfig_Leader);
  39. }
  40. }
  41. else
  42. {
  43. myStartArea = me.areaid;
  44. while(1){
  45. NTM_UsePortal("BluePortal", 108, NTConfig_Leader);
  46. if(me.areaid == 108){
  47. break;
  48. }
  49. Delay(500);
  50. }
  51. }
  52.  
  53. }
  54.  
  55.  
  56. if(NTConfig_LeechChaos == 2 && me.areaid == 108)
  57. {
  58. //if(NTConfig_LeechBo){NTP_DoPrecast(true, NTConfig_LeechBo);}
  59. //if(!NTConfig_LeechBo){ Delay(Random(3000, 5000)); }
  60. if(!NTConfig_LeechBo){
  61. for (i = 0; i < 20; i += 1) {
  62. Delay(200);
  63. if(me.GetState(32) && me.GetState(51)){Print("Got Bo'd");break;}
  64. }
  65. }
  66.  
  67. NTP_DoPrecast(true, NTConfig_LeechBo);
  68.  
  69. if (me.y > 5353){
  70. UDL_ClearPosition(30, EntranceSort);
  71. var FrontToStarX = [7792, 7794, 7791, 7777, 7813, 7769, 7782, 7802, 7819, 7768, 7770, 7791, 7819, 7804];
  72. var FrontToStarY = [5564, 5529, 5495, 5486, 5486, 5445, 5421, 5421, 5446, 5390, 5355, 5355, 5376, 5340];
  73. for (var i = 0; i < FrontToStarX.length; i += 1) {
  74. NTM_MoveTo(108, FrontToStarX[i], FrontToStarY[i]);
  75. UDL_ClearPosition(35, EntranceSort);
  76. }
  77. }
  78.  
  79. for (i = 0; i < 2; i += 1) {
  80. NTM_MoveTo(108, 7784, 5310);
  81. UDL_ClearPosition(30, SealSort);
  82. NTC_PingDelay(i < 1 ? 1000 : 10);
  83. }
  84.  
  85. NTM_MoveTo(108, 7784, 5310);
  86. if(!NTConfig_LeechBo){Delay(2000);}
  87. NTP_DoPrecast(true, NTConfig_LeechBo);
  88. UDL_ClearPosition(30, SealSort);
  89.  
  90. if (!UDL_OpenSealsInt()) {
  91. NTC_SendMsgToScript("NTBotGame.ntj", "UDL_OpenSealsInt()");
  92. return;
  93. }
  94. if(me.classid == NTC_CHAR_CLASS_SORCERESS)
  95. NTM_MoveTo(108, 7793, 5278);
  96. else
  97. NTM_MoveTo(108, 7796, 5294);
  98.  
  99. for (i = 0; i < 80 && !DiabloDead; i += 1) {
  100. if (GetUnit(NTC_UNIT_MONSTER, 243)) {
  101. break;
  102. }
  103. UDL_DiaSpam();
  104. }
  105.  
  106. if(NTConfig_SetDiablo > 0){
  107. NTA_SetMonster(243, NTConfig_SetDiablo);
  108. }else{
  109. NTA_KillMonster(243);
  110. NTSI_PickItems();
  111. }
  112. }
  113.  
  114. if(me.areaid == 108 && NTConfig_LeechChaos == 1)
  115. UDL_LeechFollow();
  116.  
  117. if(NTConfig_LeechChaos == 0)
  118. {
  119. while(_portalleech) {NTC_Delay(250);}
  120. }
  121.  
  122. NTC_SendMsgToScript("NTBotGame.ntj", "SCRIPT_END");
  123. }
  124.  
  125. function UDL_OpenSealsInt() {
  126. var _unit;
  127. var _result;
  128.  
  129. _unit = GetPresetUnits(108, NTC_UNIT_OBJECT, 396);
  130.  
  131. if (!_unit) {
  132. return false;
  133. }
  134. if (_unit[0].roomy * 5 + _unit[0].y == 5275) {
  135. _result = UDL_OpenVizierSealInt(1);
  136. } else {
  137. _result = UDL_OpenVizierSealInt(2);
  138. }
  139.  
  140. if(!NTConfig_LeechBo){Delay(2000);}
  141. NTP_DoPrecast(true, NTConfig_LeechBo);
  142.  
  143. _unit = GetPresetUnits(108, NTC_UNIT_OBJECT, 394);
  144. if (_unit[0].roomx * 5 + _unit[0].x == 7773) {
  145. _result = UDL_OpenDeSeisSealInt(1);
  146. } else {
  147. _result = UDL_OpenDeSeisSealInt(2);
  148. }
  149. if (!_result) {
  150. return false;
  151. }
  152.  
  153. if(!NTConfig_LeechBo){Delay(2000);}
  154. NTP_DoPrecast(true, NTConfig_LeechBo);
  155. UDL_ClearPosition(40, SealSortB);
  156.  
  157. _unit = GetPresetUnits(108, NTC_UNIT_OBJECT, 392);
  158. if (!_unit) {
  159. return false;
  160. }
  161. if (_unit[0].roomx * 5 + _unit[0].x == 7893) {
  162. _result = UDL_OpenVenomSealInt(1);
  163. } else {
  164. _result = UDL_OpenVenomSealInt(2);
  165. }
  166. NTP_DoPrecast(true);
  167. return _result;
  168. }
  169.  
  170. function UDL_OpenVizierSealInt(type) {
  171. var i;
  172.  
  173.  
  174. if (type === 1) {
  175. var vx = [7767, 7756, 7744, 7747, 7750, 7741, 7729, 7720, 7720, 7721, 7719, 7712, 7700, 7687, 7676, 7666];
  176. var vy = [5292, 5284, 5275, 5290, 5303, 5310, 5314, 5312, 5301, 5288, 5273, 5292, 5294, 5294, 5292, 5307];
  177. } else {
  178. var vx = [7768, 7755, 7741, 7733, 7723, 7714, 7707, 7680, 7666, 7655];
  179. var vy = [5289, 5295, 5282, 5291, 5300, 5282, 5315, 5310, 5311, 5282];
  180. }
  181. for (i = 0; i < vx.length; i += 1) {
  182. NTM_MoveTo(108, vx[i], vy[i]);
  183. UDL_ClearPosition(30, SealSort);
  184. }
  185.  
  186.  
  187. if (!UDL_OpenSealInt(395) || !UDL_OpenSealInt(396)) {
  188. return false;
  189. }
  190. if (type == 1) {
  191. NTM_MoveTo(108, 7691, 5292);
  192. } else {
  193. NTM_MoveTo(108, 7695, 5316);
  194. }
  195.  
  196. UDL_Preattack(GetLocaleString(2851));
  197. UDL_ClearPosition(40, DistanceSort);
  198. NTA_KillMonster(GetLocaleString(2851)); // Grand Vizier of Chaos
  199. UDL_ClearPosition(40, DistanceSort);
  200.  
  201. if(NTConfig_IdInField){
  202. NT_FieldID();
  203. } return true;
  204. }
  205.  
  206. function UDL_OpenDeSeisSealInt(type) {
  207. var i, n;
  208.  
  209.  
  210. if (type === 1) {
  211. var sx = [7791, 7783, 7800, 7809, 7785, 7773, 7773, 7776, 7794, 7811, 7817, 7815, 7798]; // Shape of "2"
  212. var sy = [5265, 5256, 5247, 5232, 5230, 5222, 5212, 5194, 5194, 5193, 5177, 5157, 5155];
  213. } else {
  214. var sx = [7786, 7801, 7786, 7787, 7810, 7811, 7810, 7790, 7774, 7773, 7794]; // shape of an "S" or "5"
  215. var sy = [5263, 5249, 5245, 5227, 5233, 5215, 5198, 5194, 5181, 5156, 5154];
  216. }
  217. for (var i = 0; i < sx.length; i += 1) {
  218. NTM_MoveTo(108, sx[i], sy[i]);
  219. UDL_ClearPosition(30, type === 1 ? SealSort : SealSortB);
  220. }
  221.  
  222. if (!UDL_OpenSealInt(394)) {
  223. return false;
  224. }
  225. if (type == 1) {
  226. NTM_MoveTo(108, 7797, 5201);
  227. for (i = 0; i < 3; i += 1) {
  228. NTM_TeleportTo(7794, 5227);
  229. }
  230. } else {
  231. NTM_MoveTo(108, 7798, 5186);
  232. }
  233.  
  234. UDL_Preattack(GetLocaleString(2852));
  235. UDL_ClearPosition(40, DistanceSort);
  236. NTA_KillMonster(GetLocaleString(2852)); // Lord De Seis
  237. UDL_ClearPosition(40, DistanceSort);
  238.  
  239. if(NTConfig_IdInField){
  240. NT_FieldID();
  241. } return NTM_MoveTo(108, 7800, 5255);
  242. }
  243.  
  244. function UDL_OpenVenomSealInt(type) {
  245.  
  246. if (type === 1) {
  247. var IX = [7825, 7827, 7834, 7845, 7855, 7852, 7875, 7896, 7917]; // shape of a "t"
  248. var IY = [5293, 5276, 5291, 5315, 5301, 5278, 5293, 5295, 5291];
  249. } else {
  250. var IX = [7822, 7826, 7832, 7850, 7868, 7877, 7891, 7907, 7927, 7932]; // looks like a hook
  251. var IY = [5297, 5278, 5307, 5278, 5297, 5276, 5276, 5276, 5279, 5298];
  252. }
  253. for (var i = 0; i < IX.length; i += 1) {
  254. NTM_MoveTo(108, IX[i], IY[i]);
  255. UDL_ClearPosition(30, type === 1 ? SealSort : SealSortB);
  256. }
  257.  
  258.  
  259. if (!UDL_OpenSealInt(393) || !UDL_OpenSealInt(392)) {
  260. return false;
  261. }
  262. if (type === 1) {
  263. type = 1; // temp
  264. } else {
  265. NTM_MoveTo(108, 7933, 5299);
  266. }
  267.  
  268. UDL_Preattack(GetLocaleString(2853));
  269. UDL_ClearPosition(40, DistanceSort);
  270. NTA_KillMonster(GetLocaleString(2853)); // Infector of Souls
  271. UDL_ClearPosition(40, DistanceSort);
  272.  
  273. if(NTConfig_IdInField){
  274. NT_FieldID();
  275. }
  276. if (NTC_PutSkill(124, NTC_HAND_RIGHT)) {
  277. NTC_PingDelay(1000);
  278. } return true;
  279. }
  280.  
  281. function UDL_OpenSealInt(classid) {
  282. var warn;
  283. if(classid == 395 || classid == 393)
  284. return true;
  285. switch (classid) {
  286. case 396:
  287. case 394:
  288. case 392:
  289. warn = true;
  290. break;
  291. default:
  292. warn = false;
  293. break;
  294. }
  295. var i, seal;
  296. for (i = 0; i < 5; i += 1) {
  297. NTM_MoveToPresetUnit(108, 2, classid, 0, -7);
  298. seal = NTC_FindUnit(NTC_UNIT_OBJECT, classid);
  299. if (!seal) {
  300. return false;
  301. }
  302.  
  303. //NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, seal);
  304. NTC_Delay(classid === 394 ? 1000 : 500);
  305.  
  306. while(!seal.mode) {
  307. NTC_Delay(350);
  308. }
  309. if(seal.mode)
  310. return true;
  311. }
  312. return false;
  313. }
  314.  
  315. function UDL_MonsterStats(unit) {
  316. this.name = unit.name;
  317. this.x = unit.x;
  318. this.y = unit.y;
  319. this.gid = unit.gid;
  320. this.classid = unit.classid;
  321. this.spectype = unit.spectype;
  322. }
  323.  
  324. function DistanceSort(unitA, unitB) {
  325. if (GetDistance(me.x, me.y, unitA.x, unitA.y) < GetDistance(me.x, me.y, unitB.x, unitB.y)) {
  326. return -1;
  327. }
  328. return 1;
  329. }
  330.  
  331. function EntranceSort(unitA, unitB) {
  332. if (GetDistance(unitA.x, unitA.y, 7790, 5544) < GetDistance(unitB.x, unitB.y, 7790, 5544)) {
  333. return -1;
  334. }
  335. return 1;
  336. }
  337.  
  338. function SealSort(unitA, unitB) {
  339. if (GetDistance(unitA.x, unitA.y, 7784, 5310) < GetDistance(unitB.x, unitB.y, 7784, 5310)) {
  340. return -1;
  341. }
  342. return 1;
  343. }
  344.  
  345. function SealSortB(unitA, unitB) {
  346. if (GetDistance(unitA.x, unitA.y, 7800, 5255) < GetDistance(unitB.x, unitB.y, 7800, 5255)) {
  347. return -1;
  348. }
  349. return 1;
  350. }
  351.  
  352. function UDL_Preattack(name) {
  353. var i, n, target, pos, positions;
  354.  
  355. target = NTC_FindUnit(1, name, 10);
  356.  
  357. switch (me.classid) {
  358. case 0:
  359. break;
  360. case 1:
  361. break;
  362. case 2:
  363. break;
  364. case 3:
  365. if (!target) {
  366. return;
  367. }
  368. positions = [[6, 11], [0, 8], [8, -1], [-9, 2], [0, -11], [8, -8]];
  369. for (i = 0; i < positions.length; i += 1) {
  370. if (CheckCollision(me.areaid, target.x + positions[i][0], target.y + positions[i][1], 1)) { // check if we can move there
  371. NTM_MoveTo(108, target.x + positions[i][0], target.y + positions[i][1]);
  372. NTC_PutSkill(NTConfig_AttackSkill[2], NTC_HAND_RIGHT);
  373. for (n = 0; n < 8; n += 1) {
  374. NTC_CastSkill(NTConfig_AttackSkill[1], 2);
  375. target = NTC_FindUnit(1, name, 10);
  376. if(target){break;}
  377. }
  378. break;
  379. }
  380. }
  381. break;
  382. case 4:
  383. if (!target || NTConfig_AttackSkill[0] < 0) {
  384. return;
  385. }
  386. pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, 20, 4);
  387. if (pos) {
  388. NTM_MoveTo(108, pos[0], pos[1]);
  389. }
  390. for (i = 0; i < 2; i += 1) {
  391. NTC_CastSkill(130, NTC_HAND_RIGHT);
  392. NTC_Delay(150);
  393. }
  394. break;
  395. case 5:
  396. break;
  397. case 6:
  398. break;
  399. }
  400. }
  401.  
  402. function OpenStashes(range) {
  403. var i, unit,
  404. objects = [GetLocaleString(3274)],
  405. orgx = me.x,
  406. orgy = me.y;
  407.  
  408. for (i = 0; i < objects.length; i += 1) {
  409. unit = NTC_FindUnit(NTC_UNIT_OBJECT, objects[i]);
  410. if (unit) {
  411. do {
  412. if (GetDistance(orgx, orgy, unit.x, unit.y) <= range) {
  413. if (NTC_OpenChest(unit)) {
  414. NTSI_PickItems();
  415. }
  416. }
  417. } while (unit.GetNext());
  418. }
  419. }
  420. }
  421.  
  422. function UDL_CheckPotionSafe() {
  423. var i, items, hpCheck, mpCheck;
  424. items = me.GetItems();
  425. if (NTConfig_BeltColType.indexOf("hp") > -1) {
  426. for (i = 0; i < items.length; i += 1) {
  427. if (!hpCheck && items[i].mode === 2 && items[i].code.indexOf("hp") > -1) {
  428. hpCheck = true;
  429. }
  430. }
  431. } else {
  432. hpCheck = true;
  433. }
  434. if (NTConfig_BeltColType.indexOf("mp") > -1) {
  435. for (i = 0; i < items.length; i += 1) {
  436. if (!mpCheck && items[i].mode === 2 && items[i].code.indexOf("mp") > -1) {
  437. mpCheck = true;
  438. }
  439. }
  440. } else {
  441. mpCheck = true;
  442. }
  443. return !(hpCheck && mpCheck);
  444. }
  445.  
  446. function UDL_Dodge(target, distance) {
  447. var i, j, coordx, coordy, monster, count,
  448. maxcount = 999,
  449. coords = [],
  450. goodCoords = [],
  451. monList = [],
  452. angles = [45, 90, 135, 180, 225, 270, 305, 360];
  453. for (i = 0; i < angles.length; i += 1) {
  454. coordx = Math.round((Math.cos(angles[i] * Math.PI / 180)) * distance + target.x);
  455. coordy = Math.round((Math.sin(angles[i] * Math.PI / 180)) * distance + target.y);
  456. if (CheckCollision(me.areaid, coordx, coordy, 1)) {
  457. coords.push([coordx, coordy]);
  458. }
  459. }
  460. if (coords.length === 0) { // no valid positions - don't move
  461. return true;
  462. }
  463. coords.sort(UDL_SortRooms);
  464. monster = GetUnit(1);
  465. if (monster) {
  466. do {
  467. if (monster.hp > 0) {
  468. monList.push(new UDL_MonsterStats(target));
  469. }
  470. } while (monster.GetNext());
  471. }
  472. for (i = 0; i < coords.length; i += 1) {
  473. count = 0;
  474. for (j = 0; j < monList.length; j += 1) {
  475. if (monList[j].hp > 0 && GetDistance(monList[j].x, monList[j].y, coords[i][0], coords[i][1]) < 10) {
  476. count += 1;
  477. }
  478. }
  479. if (count < maxcount) {
  480. goodCoords = [coords[i][0], coords[i][1]];
  481. maxcount = count;
  482. if (count === 0) {
  483. break;
  484. }
  485. }
  486. }
  487. if (goodCoords.length > 0) { // just in case goodCoords is empty (shouldn't happen)
  488. if (Math.abs(me.x - goodCoords[0]) < 3 && Math.abs(me.y - goodCoords[1]) < 3) { // close enough
  489. return true;
  490. }
  491. Print(COLOR_5 + "!Dodge " + target.name);
  492. NTM_MoveTo(me.areaid, goodCoords[0], goodCoords[1]);
  493. }
  494. return true;
  495. }
  496.  
  497. function UDL_ClearPosition(range, sortFunc, spectype, classid) {
  498. var i, orgx, orgy, monList, ignoreList, target, result,
  499. gidAttack = [],
  500. dodgeIDs = [310, 362],
  501. attackcount = 0;
  502. if (NTConfig_AttackSkill[1] < 0 || NTConfig_AttackSkill[3] < 0) {
  503. return false;
  504. }
  505. switch (arguments.length) {
  506. case 0:
  507. range = 20;
  508. case 1:
  509. sortFunc = DistanceSort;
  510. case 2:
  511. spectype = false;
  512. case 3:
  513. classid = false;
  514. break;
  515. }
  516. orgx = me.x;
  517. orgy = me.y;
  518. ignoreList = [];
  519. MainLoop : while (attackcount < 300) {
  520. monList = [];
  521. target = NTC_FindUnit(NTC_UNIT_MONSTER);
  522. if (target) {
  523. do {
  524. if (target.IsAttackable()) {
  525. if ((me.classid === 1 || me.classid === 2 || me.classid === 6) && NTConfig_Dodge && GetDistance(me, target) < 7 && dodgeIDs.indexOf(target.classid) > -1) {
  526. UDL_Dodge(target, 15);
  527. continue MainLoop;
  528. }
  529. if (ignoreList.indexOf(target.gid) < 0 && GetDistance(orgx, orgy, target.x, target.y) <= range) {
  530. if (NTA_IsValidMonster(target)) {
  531. monList.push(new UDL_MonsterStats(target));
  532. } else {
  533. ignoreList.push(target.gid);
  534. }
  535. }
  536. }
  537. } while (target.GetNext());
  538. }
  539. if (monList.length === 0) {
  540. break;
  541. }
  542. monList.sort(sortFunc);
  543. target = NTC_FindUnit(NTC_UNIT_MONSTER, monList[0].gid);
  544. if (target && target.IsAttackable() && UDL_OutOfBounds(target)) {
  545. result = NTA_Attack(target, attackcount % 30 === 0);
  546. switch (result) {
  547. case 1:
  548. monList.shift();
  549. ignoreList.push(target.gid);
  550. break;
  551. case 2:
  552. case 3:
  553. if(!gidAttack[target.gid]) {
  554. gidAttack[target.gid] = 0;
  555. }
  556. gidAttack[target.gid] += 1;
  557. if (gidAttack[target.gid] > NTConfig_LowMaxAttacks) {
  558. monList.shift();
  559. ignoreList.push(target.gid);
  560. }
  561. attackcount += 1;
  562. if (target.mode === 0 || target.mode === 12) {
  563. NTSI_FastPick();
  564. }
  565. break;
  566. default:
  567. return false;
  568. }
  569. } else {
  570. monList.shift();
  571. ignoreList.push(target.gid);
  572. }
  573. }
  574. switch (me.classid) {
  575. case NTC_CHAR_CLASS_PALADIN:
  576. if (attackcount > 2 && (parseInt(me.hp * 100/ me.hpmax) < NTConfig_UseRedemptionHP || parseInt(me.mp * 100 / me.mpmax) < NTConfig_UseRedemptionMP)) {
  577. if (NTC_PutSkill(124, NTC_HAND_RIGHT)) {
  578. NTC_PingDelay(1000);
  579. }
  580. }
  581. break;
  582. case NTC_CHAR_CLASS_NECROMANCER:
  583. if (typeof(NTA_SkeletonArmy) === 'function') { // old summon code
  584. NTA_SkeletonArmy(NTConfig_SkeletonArmy);
  585. NTA_MageArmy(NTConfig_MageArmy);
  586. NTA_ReviveArmy(NTConfig_ReviveArmy);
  587. } else {
  588. NTA_RaiseArmy(); // new summon code
  589. }
  590. break;
  591. case NTC_CHAR_CLASS_SORCERESS:
  592. if (me.GetState(30) === 0) {
  593. NTC_CastSkill(58, NTC_HAND_RIGHT);
  594. }
  595. break;
  596. case NTC_CHAR_CLASS_BARBARIAN:
  597. if (attackcount > 0) {
  598. if (typeof(MWL_FindItem) === 'function') { // in case of using muddy's item find (like myself)
  599. MWL_FindItem(20);
  600. } else if (NTConfig_UseFindItem && !NTA_CheckForCloseMonsters(10)) {
  601. NTA_FindItem(NTConfig_FindItemRange);
  602. }
  603. }
  604. break;
  605. }
  606. if (attackcount > 0) {
  607. NTSI_PickItems();
  608. }
  609. if (NTConfig_OpenChest) {
  610. OpenStashes(range);
  611. }
  612. if (NTT_CheckMerc() && me.areaid == 108) {
  613. NTTMGR_VisitTown();
  614. }
  615. if (UDL_CheckPotionSafe()) {
  616. NTTMGR_VisitTown();
  617. }
  618. if (NTConfig_IdInField) {
  619. if (!NTT_CheckSpace(NTConfig_FreeSpaceXY[0], NTConfig_FreeSpaceXY[1])) {
  620. NT_FieldID();
  621. }
  622. } return true;
  623. }
  624.  
  625. function UDL_SortRooms(a, b) {
  626. if (GetDistance(me.x, me.y, a[0], a[1]) < GetDistance(me.x, me.y, b[0], b[1])) {
  627. return -1;
  628. }
  629. return 1;
  630. }
  631.  
  632. function UDL_DiabloLeechMessageHandler(){
  633. var _msg = NT_File("logs/messagecomands/"+me.charname+"-diablo.txt", 0);
  634. if (_msg && _msg != Diablo_PreMessage){
  635. Diablo_PreMessage = _msg;
  636. if(_msg.substring(_msg.indexOf("/") + 1) == "takedtp"){
  637. return true;
  638. }
  639. }
  640. return false;
  641. }
  642.  
  643. function UDL_Chat(msg, type)
  644. {
  645. if(type != 0 && msg.indexOf(NTConfig_Leader) == -1)
  646. return;
  647.  
  648. if(!trigger && (msg.indexOf(NTConfig_CS_SafeTP) != -1) && me.areaid == 108 && me.y > 5385){
  649. trigger = true;return;
  650. }
  651.  
  652. if(msg.indexOf("Vizier dead.") != -1){
  653. if(NTConfig_LeechChaos == 0 && me.areaid == 108){
  654. NTM_UsePortal("BluePortal", 103, NTConfig_Leader);
  655. if(me.areaid != 103){NTTM_CheckAct();}
  656. }
  657. SealBoss1 = true; return;
  658. }
  659.  
  660. if(msg.indexOf("De Seis dead.") != -1){
  661. if(NTConfig_LeechChaos == 0 && me.areaid == 108){
  662. NTM_UsePortal("BluePortal", 103, NTConfig_Leader);
  663. if(me.areaid != 103){NTTM_CheckAct();}
  664. }
  665. SealBoss2 = true;
  666. return;
  667. }
  668.  
  669. if(msg.indexOf("Infector dead.") != -1){
  670. if(NTConfig_LeechChaos == 0 && me.areaid == 108){
  671. NTM_UsePortal("BluePortal", 103, NTConfig_Leader);
  672. if(me.areaid != 103){NTTM_CheckAct();}
  673. }
  674. SealBoss3 = true;
  675. return;
  676. }
  677.  
  678. if(msg.indexOf("Diablo Dead.") != -1){
  679. if(NTConfig_LeechChaos < 0 && me.areaid == 108){
  680. Delay(3000);
  681. NTM_MoveTo(me.areaid, 7769, 5284);
  682. NTM_UsePortal("BluePortal", 103, NTConfig_Leader);
  683. }
  684. DiabloDead = true; _portalleech = false;
  685. return;
  686. }
  687.  
  688. if(NTConfig_LeechChaos == 0 && me.areaid == 103 && msg.indexOf("Leech TP up.") != -1){
  689. NTM_UsePortal("BluePortal", 108, NTConfig_Leader);
  690. NTP_DoPrecast(true);
  691. }
  692.  
  693. if(NTConfig_LeechChaos == 0 && me.areaid == 103 && msg.indexOf("Diablo TP up.") != -1){
  694. NTM_UsePortal("BluePortal", 108, NTConfig_Leader);
  695. NTM_MoveTo(108, NTConfig_Chaosleechpos[0], NTConfig_Chaosleechpos[1]);
  696. NTP_DoPrecast(true);
  697. }
  698. return;
  699. }
  700.  
  701. var Sealfollow = [];
  702.  
  703. function UDL_LeechFollow(){
  704. var chaosentrance = [7791, 5571, 7793, 5553, 7793, 5535, 7793, 5520, 7793, 5505, 7776, 5490,
  705. 7769, 5475, 7769, 5460, 7769, 5445, 7769, 5430, 7776, 5415, 7776,
  706. 5400, 7769, 5385, 7769, 5370, 7776, 5355, 7776, 5340, 7776, 5325]
  707.  
  708. NTConfig_SnagRange = 15;
  709. //me.showenemyonautomap = true;
  710.  
  711. if (me.y > 5353 && me.areaid == 108) {
  712. NTM_MoveTo(108, 7793, 5535);
  713. NTP_DoPrecast(true, NTConfig_LeechBo);
  714. for(var e = 4 ; e < chaosentrance.length ; e+=2){
  715. while(!UDL_Safetoadvance()){
  716. if( e == 0 || SealBoss1){UDL_FallBack(); return;}
  717. if(leechwarn && e >= 2){e=e-2;NTM_MoveTo(108, chaosentrance[e], chaosentrance[e+1]);}
  718. Delay(100);
  719. if(trigger){
  720. NTTM_CheckAct();
  721. Delay(300);
  722. while(me.areaid !=108){ NTM_UsePortal("BluePortal", 108, NTConfig_Leader);Delay(300);}
  723. return UDL_LeechFollow();
  724. }
  725. }
  726. if(!NTM_MoveTo(108, chaosentrance[e], chaosentrance[e+1]))
  727. Print("Error moving to x:" + chaosentrance[e] + " y:" + chaosentrance[e+1]);
  728. }
  729. }
  730.  
  731. var sealid = [396, 394, 392];
  732.  
  733. for(var seal = 0 ; seal < 3 ; seal++){
  734. UDL_SealPath(sealid[seal]);
  735. NTP_DoPrecast(true, NTConfig_LeechBo);
  736. for(var e = 2 ; e < Sealfollow.length ; e+=2){
  737. while(!UDL_Safetoadvance()){
  738. if(leechwarn && e == 0){UDL_FallBack(); return;}
  739. if(leechwarn && e > 0){e=e-2;NTM_MoveTo(108, Sealfollow[e], Sealfollow[e+1]);}
  740. Delay(100);
  741. }
  742. if(!NTM_MoveTo(108, Sealfollow[e], Sealfollow[e+1]))
  743. Print("Error moving to x:" + Sealfollow[e] + " y:"+Sealfollow[e+1]);
  744. }
  745. if(seal == 0){while(!SealBoss1 && !UDL_SealBossDead(GetLocaleString(2851))){Delay(200);}}
  746. if(seal == 1){while(!SealBoss2 && !UDL_SealBossDead(GetLocaleString(2852))){Delay(200);}}
  747. if(seal == 2){while(!SealBoss3 && !UDL_SealBossDead(GetLocaleString(2853))){Delay(200);}}
  748. }
  749.  
  750. NTM_MoveTo(108, 7821, 5280, 2);
  751. NTM_MoveTo(108, NTConfig_Chaosleechpos[0], NTConfig_Chaosleechpos[1]);
  752. NTP_DoPrecast(true, NTConfig_LeechBo);
  753. while(!DiabloDead && !UDL_SealBossDead(GetLocaleString(3060)))
  754. Delay(300);
  755.  
  756. return;
  757. }
  758.  
  759. function UDL_SealBossDead(classid){
  760. _target = NTC_FindUnit(NTC_UNIT_MONSTER, classid, 5);
  761. if (!_target) { return false; }
  762. return _target.mode == 12;
  763. }
  764.  
  765. function UDL_Safetoadvance()
  766. { var monstdist = 100
  767. var _enemy = NTC_FindUnit(NTC_UNIT_MONSTER);
  768. if(!_enemy){Print(COLOR_5 + "!Very Safe"); leechwarn = false; return true;}
  769. while(_enemy.GetNext())
  770. {
  771. if(_enemy.hp > 0 && _enemy.IsAttackable())
  772. {
  773.  
  774. if(_enemy.x < 7765 && _enemy.y > 5321)
  775. continue;
  776. if(_enemy.x < 7767 && _enemy.y < 5268)
  777. continue;
  778. if(_enemy.x < 7787 && _enemy.y > 5510)
  779. continue;
  780. if(_enemy.x > 7821 && me.y < 5250)
  781. continue;
  782. if(GetDistance(me, _enemy) <= 30)
  783. { Print(COLOR_5 + "!Danger!!!!");
  784. leechwarn = true;
  785. return false;
  786. }
  787. if(GetDistance(me, _enemy) <= 50)
  788. { //Print(COLOR_5 + "!Getting XP");
  789. leechwarn = false;
  790. return false;
  791. }
  792. }
  793. }
  794. //Print(COLOR_5 + "!Safe");
  795. leechwarn = false;
  796. UDL_Shrine();
  797. return true;
  798. }
  799.  
  800. function UDL_SealPath(classid){
  801. var _leechseal = GetPresetUnits(108, NTC_UNIT_OBJECT, classid);
  802. var locx = (_leechseal[0].roomx * 5 + _leechseal[0].x);
  803. var locy = (_leechseal[0].roomy * 5 + _leechseal[0].y);
  804. //Print("Seal ID = " + classid + " x:"+locx + " y:" + locy);
  805. if (locx == 7655 && locy == 5275){//seal boss 1
  806. return Sealfollow = [7776, 5325, 7768, 5314, 7752, 5314, 7730, 5314, 7709 , 5291, 7709, 5273];
  807. }
  808.  
  809. if (locx == 7655 && locy == 5315){//seal boss 1
  810. return Sealfollow = [7776, 5325, 7768, 5314, 7752, 5314, 7730, 5314, 7709, 5291];
  811. }
  812.  
  813. if (locx == 7815 && locy == 5155){//seal boss 2
  814. return Sealfollow = [7725, 5276, 7750, 5273, 7770, 5271, 7774, 5260, 7777, 5250, 7785, 5241, 7800, 5232, 7814, 5229, 7814, 5215, 7814, 5199];
  815. }
  816.  
  817. if (locx == 7773 && locy == 5155){//seal boss 2
  818. return Sealfollow = [7725, 5276, 7750, 5273, 7770, 5271, 7774, 5260, 7777, 5250, 7785, 5241, 7800, 5232, 7814, 5229];
  819. }
  820.  
  821. if (locx == 7915 && locy == 5315){//seal boss 3
  822. return Sealfollow = [7814, 5232, 7814, 5229, 7814, 5245, 7814, 5262, 7821, 5280, 7835, 5280, 7845, 5280, 7855, 5290, 7874, 5293, 7880, 5307];
  823. }
  824.  
  825. if (locx == 7893 && locy == 5313){//seal boss 3
  826. return Sealfollow = [7814, 5232, 7814, 5229, 7814, 5245, 7814, 5262, 7821, 5280, 7835, 5280, 7845, 5280, 7855, 5290, 7874, 5293, 7885, 5318];
  827. }
  828. return;
  829. }
  830.  
  831. function UDL_DiaSpam(){
  832. if(me.classid == NTC_CHAR_CLASS_AMAZON){
  833. if(NTConfig_DiaSpam > 0)
  834. return NTC_CastSkill(NTConfig_DiaSpam, 0, 7792, 5291);
  835. }
  836. else if(me.classid == NTC_CHAR_CLASS_SORCERESS){
  837. if(NTConfig_DiaSpam > 0)
  838. return NTC_CastSkill(NTConfig_DiaSpam, 0, 7792, 5291);
  839. }
  840. else if(me.classid == NTC_CHAR_CLASS_NECROMANCER){
  841. if(NTConfig_DiaSpam > 0)
  842. return NTC_CastSkill(NTConfig_DiaSpam, 0, 7792, 5291);
  843. }
  844. else if(me.classid == NTC_CHAR_CLASS_PALADIN){
  845. if(NTConfig_AttackSkill[3] == 112){
  846. NTC_PutSkill(NTConfig_AttackSkill[3], NTC_HAND_LEFT);
  847. NTC_PutSkill(NTConfig_AttackSkill[4], NTC_HAND_RIGHT);
  848. return NTC_CastSkill(NTConfig_AttackSkill[3], 2, 7792, 5291);
  849. }
  850. }
  851. else if(me.classid == NTC_CHAR_CLASS_BARBARIAN){
  852. if(NTConfig_DiaSpam > 0)
  853. return NTC_CastSkill(NTConfig_DiaSpam, 0, 7792, 5291);
  854. }
  855. else if(me.classid == NTC_CHAR_CLASS_DRUID){
  856. if(NTConfig_AttackSkill[3] == 245)
  857. return NTC_CastSkill(NTConfig_AttackSkill[3], 2, 7792, 5291);
  858. }
  859. else if(me.classid == NTC_CHAR_CLASS_ASSASSIN){
  860. var _attackPos = [7780, 5288, 7792, 5281, 7803, 5289, 7799, 5302, 7785, 5301];
  861. if(NTConfig_UseTraps && !_trapsPreCasted){
  862. for(var i=0;i<5;i++) {
  863. if(i == 0 || i == 2 || i == 3) // Added delays to prevent trap miscast
  864. NTC_Delay(25);
  865. if(NTConfig_ActBossTrapSet[i] > 0)
  866. NTC_CastSkill(NTConfig_ActBossTrapSet[i], NTC_HAND_RIGHT, _attackPos[i*2],_attackPos[(i*2)+1]);
  867. }
  868. _trapsPreCasted = true;
  869. }
  870. if(NTConfig_AttackSkill[3] == 256) {
  871. if(me.GetSkillStatus(NTConfig_AttackSkill[3]) != 8) {
  872. return NTC_CastSkill(NTConfig_AttackSkill[3], 2, 7792, 5291);
  873. }
  874. }
  875. }
  876. Delay(200);
  877. }
  878.  
  879. function UDL_FallBack()
  880. {
  881. NTTM_CheckAct();
  882. Print("Follow Failed");
  883. NTConfig_LeechChaos = 0;
  884.  
  885. return;
  886. }
  887.  
  888. function UDL_Shrine()
  889. {
  890. var xx = me.x, yy = me.y;
  891. NTSI_PickItems();
  892. NTM_MoveTo(me.areaid, xx, yy);
  893. var shrine = NTC_FindUnit(NTC_UNIT_OBJECT, "shrine");
  894. if(shrine && shrine.shrinetype == 15 && shrine.mode == 0)
  895. { if(GetDistance(me.x, me.y, shrine.x, shrine.y)<=25)
  896. NTM_MoveTo(108, shrine.x, shrine.y+3);
  897. if(GetDistance(me.x, me.y, shrine.x, shrine.y)<5)
  898. {
  899. NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, shrine);
  900. NTM_MoveTo(me.areaid, xx, yy);
  901. }
  902. }
  903. return;
  904. }
  905.  
  906. function UDL_OutOfBounds(Monst){
  907. if(NTC_GetSkillLevel(54) < 1){
  908. if(Monst.x > 7757 && Monst.x < 7774 && Monst.y > 5258 && Monst.y < 5275){
  909. return false;
  910. }
  911. }
  912.  
  913. if(Monst.x < 7787 && Monst.y > 5501)
  914. return false;
  915. if(Monst.x > 7901 && Monst.y > 5501)
  916. return false;
  917. if(Monst.x < 7767 && Monst.y > 5321)
  918. return false;
  919. if(Monst.x >7821 && Monst.y > 5321)
  920. return false;
  921. if(Monst.x < 7816 && Monst.x > 7772 && Monst.y > 5452 && Monst.y < 5477)
  922. return false;
  923. //if(Monst.x < 7792 && Monst.x > 7772 && Monst.y > 5451 && Monst.y < 5432)
  924. //return false;
  925.  
  926. //if(Monst.x < 7816 && Monst.x > 7791 && Monst.y < 5412 && Monst.y > 5387)
  927. //return false;
  928.  
  929. if(Monst.x < 7816 && Monst.x > 7772 && Monst.y < 5387 && Monst.y > 5366)
  930. return false;
  931.  
  932. if(Monst.x <7767 && Monst.y < 5267)
  933. return false;
  934. if(Monst.x >7822 && Monst.y < 5267)
  935. return false;
  936. if(Monst.y < 5147)
  937. return false;
  938. return true;
  939. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement