gamemaste789

Untitled

May 21st, 2012
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.25 KB | None | 0 0
  1. function NTMain() {
  2. Include("libs/common/NTCommon.ntl");
  3. NTC_IncludeLibs();
  4. NTC_IncludeConfig("NTBot/char_configs");
  5. NT_LoadConfig();
  6. NTSI_LoadNIPFiles("NTBot/item_configs");
  7. NTA_Initialize();
  8. Print(COLOR_3 + "Starting Diablo Script");
  9. Say(".scroll on");
  10. if(!NTTM_CheckAct()){
  11. NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_CheckAct()");
  12. return;
  13. }
  14.  
  15. NTTMGR_TownManager();
  16. Print(COLOR_8 + "Going to River of Flame");
  17.  
  18. if(!NTTM_TownMove("waypoint")){
  19. NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_TownMove()");
  20. return;
  21. }
  22.  
  23. if(!NTM_TakeWaypoint(107)){
  24. NTC_SendMsgToScript("NTBotGame.ntj", "NTM_TakeWaypoint()");
  25. return;
  26. }
  27.  
  28. Print(COLOR_5 + "Precasting");
  29. NTP_DoPrecast(true);
  30. Print(COLOR_8 + "Going to Chaos Sanctuary");
  31.  
  32. if (!NTM_MoveTo(108, 7790, 5544)) {
  33. NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveTo()");
  34. return;
  35. }
  36.  
  37. if (!NTConfig_FastChaos) {
  38. if (NTConfig_Entrance) {
  39. NTCS_ClearPosition(30, EntranceSort);
  40. NTM_MoveTo(108, 7790, 5544);
  41. PubTP();
  42. PubSay("Entrance TP up.");
  43. BO_Party();
  44. NTCS_ClearPosition(30, EntranceSort);
  45.  
  46. var FrontToStarX = [7792,7794,7791,7777,7813,7769,7782,7802,7819,7768,7770,7791,7819, 7804];
  47. var FrontToStarY = [5564,5529,5495,5486,5486,5445,5421,5421,5446,5390,5355,5355,5376, 5340];
  48.  
  49. for (var i = 0; i < FrontToStarX.length; i += 1) {
  50. NTM_MoveTo(108, FrontToStarX[i], FrontToStarY[i]);
  51. NTCS_ClearPosition(35, EntranceSort);
  52. }
  53. }
  54.  
  55. for (i = 0; i < 2; i += 1) {
  56. NTM_MoveTo(108, 7784, 5310);
  57. NTCS_ClearPosition(30, SealSort);
  58. NTC_PingDelay(i < 1 ? 1000 : 10);
  59. NTM_MoveTo(108, 7784, 5310);
  60. }
  61.  
  62. PubTP();
  63. PubSay("Star TP up, Welcome to Team Legacy's chaos or cbaal runs, stay a sceen behind and have fun :D");
  64. BO_Party();
  65. NTCS_ClearPosition(30, SealSort);
  66. } else {
  67. NTM_MoveTo(108, 7784, 5310);
  68. NTCS_ClearPosition(20, DistanceSort);
  69. PubTP(); // for helper
  70. }
  71.  
  72. if (!NT_OpenSealsInt()) {
  73. NTC_SendMsgToScript("NTBotGame.ntj", "NT_OpenSealsInt()");
  74. return;
  75. }
  76.  
  77. PubSay("Diablo.");
  78.  
  79. if (NTConfig_LeechSupport) {
  80. NTM_MoveTo(108, 7760, 5267);
  81. PubTP();
  82. PubSay("Diablo TP up.");
  83. }
  84.  
  85. NTM_MoveTo(108, 7792, 5291);
  86. NTTMGR_CheckSafe(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe);
  87. Print(COLOR_8 + "Waiting for Diablo to spawn..");
  88.  
  89. for (i = 0; i < 200; i += 1) {
  90. if (GetUnit(NTC_UNIT_MONSTER, 243)) {
  91. break;
  92. }
  93.  
  94. NTC_Delay(500);
  95. }
  96.  
  97. if (!NTA_KillMonster(243)) {
  98. NTC_SendMsgToScript("NTBotGame.ntj", "NTA_KillMonster()");
  99. return;
  100. }
  101.  
  102. NTSI_PickItems();
  103. //PubSay("NG " + NTC_GetNextGame());
  104.  
  105. NTC_SendMsgToScript("NTBotGame.ntj", "SCRIPT_END");
  106. }
  107.  
  108. function NT_OpenSealsInt() {
  109. var _unit;
  110. var _result;
  111.  
  112. _unit = GetPresetUnits(108, NTC_UNIT_OBJECT, 396);
  113.  
  114. if (!_unit) {
  115. return false;
  116. }
  117.  
  118. if (_unit[0].roomy * 5 + _unit[0].y == 5275) {
  119. _result = NT_OpenVizierSealInt(1);
  120. } else {
  121. _result = NT_OpenVizierSealInt(2);
  122. }
  123.  
  124. if (!NTConfig_FastChaos) {
  125. NTP_DoPrecast(true);
  126. }
  127.  
  128. _unit = GetPresetUnits(108, NTC_UNIT_OBJECT, 394);
  129.  
  130. if (_unit[0].roomx * 5 + _unit[0].x == 7773) {
  131. _result = NT_OpenDeSeisSealInt(1);
  132. } else {
  133. _result = NT_OpenDeSeisSealInt(2);
  134. }
  135.  
  136. if (!_result) {
  137. return false;
  138. }
  139.  
  140. if (!NTConfig_FastChaos) {
  141. PubTP();
  142. BO_Party();
  143. NTCS_ClearPosition(40, SealSortB);
  144. }
  145.  
  146. _unit = GetPresetUnits(108, NTC_UNIT_OBJECT, 392);
  147.  
  148. if (!_unit) {
  149. return false;
  150. }
  151.  
  152. if (_unit[0].roomx * 5 + _unit[0].x == 7893) {
  153. _result = NT_OpenVenomSealInt(2);
  154. } else {
  155. _result = NT_OpenVenomSealInt(1);
  156. }
  157.  
  158. NTP_DoPrecast(true);
  159.  
  160. return _result;
  161. }
  162.  
  163. function NT_OpenVizierSealInt(type) {
  164. var i;
  165.  
  166. if (!NTConfig_FastChaos) {
  167. if (type === 1) {
  168. var vx = [7767,7756,7744,7747,7750,7741,7729,7720,7720,7721,7719,7712,7700,7687,7676, 7666];// ||| |||
  169. var vy = [5292,5284,5275,5290,5303,5310,5314,5312,5301,5288,5273,5292,5294,5294,5292, 5307];// |||
  170. } else {
  171. var vx = [7768,7755,7741,7733,7723,7714,7707,7680,7666, 7655];// |||||||||
  172. var vy = [5289,5295,5282,5291,5300,5282,5315,5310,5311, 5282];// |||
  173. }
  174.  
  175. for (i = 0; i < vx.length; i += 1) {
  176. NTM_MoveTo(108, vx[i], vy[i]);
  177. NTCS_ClearPosition(30, SealSort);
  178. }
  179. }
  180.  
  181. if (NTConfig_LeechSupport) {
  182. if (type === 1) {
  183. NTM_MoveTo(108, 7672, 5283);
  184. NTCS_ClearPosition(25, DistanceSort);
  185. NTM_MoveTo(108, 7649, 5269);
  186. NTCS_ClearPosition(25, DistanceSort);
  187. } else {
  188. NTM_MoveTo(108, 7654, 5295);
  189. NTCS_ClearPosition(25, DistanceSort);
  190. NTM_MoveTo(108, 7647, 5274);
  191. NTCS_ClearPosition(25, DistanceSort);
  192. }
  193.  
  194. PubTP();
  195. PubSay("Leech TP up.");
  196. }
  197.  
  198. if (!NT_OpenSealInt(395) || !NT_OpenSealInt(396)) {
  199. return false;
  200. }
  201.  
  202. if (type == 1) {
  203. NTM_MoveTo(108, 7691, 5292);
  204. } else {
  205. NTM_MoveTo(108, 7695, 5316);
  206. }
  207.  
  208. NTCS_Preattack(GetLocaleString(2851));
  209. NTCS_ClearPosition(40, DistanceSort, NTConfig_FastChaos && !NTConfig_LeechSupport ? 0x10 : null, NTConfig_FastChaos && !NTConfig_LeechSupport ? 306 : null);
  210. NTA_KillMonster(GetLocaleString(2851)); // Grand Vizier of Chaos
  211. NTCS_ClearPosition(40, DistanceSort, NTConfig_FastChaos && !NTConfig_LeechSupport ? 0x10 : null, NTConfig_FastChaos && !NTConfig_LeechSupport ? 306 : null);
  212. PubSay("Vizier dead.");
  213.  
  214. if(NTConfig_IdInField){
  215. NT_FieldID();
  216. }
  217.  
  218. return true;
  219. }
  220.  
  221. function NT_OpenDeSeisSealInt(type) {
  222. var i, n;
  223.  
  224. if (!NTConfig_FastChaos) {
  225. if (type === 1) {
  226. var sx = [7791,7783,7800,7809,7785,7773,7773,7776,7794,7811,7817,7815,7798]; // Shape of "2"
  227. var sy = [5265,5256,5247,5232,5230,5222,5212,5194,5194,5193,5177,5157,5155];
  228. } else {
  229. var sx = [7786,7801,7786,7787,7810,7811,7810,7790,7774,7773,7794]; // shape of an "S" or "5"
  230. var sy = [5263,5249,5245,5227,5233,5215,5198,5194,5181,5156,5154];
  231. }
  232.  
  233. for (var i = 0; i < sx.length; i += 1) {
  234. NTM_MoveTo(108, sx[i], sy[i]);
  235. NTCS_ClearPosition(30, type === 1 ? SealSort : SealSortB);
  236. }
  237. }
  238.  
  239. if (NTConfig_LeechSupport) {
  240. if (type === 1) {
  241. NTM_MoveTo(108, 7794, 5155);
  242. NTCS_ClearPosition(25, DistanceSort);
  243. NTM_MoveTo(108, 7777, 5155);
  244. NTCS_ClearPosition(25, DistanceSort);
  245. } else {
  246. NTM_MoveTo(108, 7785, 5154);
  247. NTCS_ClearPosition(25, DistanceSort);
  248. NTM_MoveTo(108, 7811, 5155);
  249. NTCS_ClearPosition(25, DistanceSort);
  250. }
  251.  
  252. PubTP();
  253. PubSay("Leech TP up.");
  254. }
  255.  
  256. if (!NT_OpenSealInt(394)) {
  257. return false;
  258. }
  259.  
  260. if (type == 1) {
  261. NTM_MoveTo(108, 7797, 5201);
  262.  
  263. for (i = 0; i < 3; i += 1) {
  264. NTM_TeleportTo(7794, 5227);
  265. }
  266. } else {
  267. NTM_MoveTo(108, 7798, 5186);
  268. }
  269.  
  270. NTCS_Preattack(GetLocaleString(2852));
  271. NTCS_ClearPosition(40, DistanceSort, NTConfig_FastChaos && !NTConfig_LeechSupport ? 0x10 : null, NTConfig_FastChaos && !NTConfig_LeechSupport ? 310 : null);
  272. NTA_KillMonster(GetLocaleString(2852)); // Lord De Seis
  273. NTCS_ClearPosition(40, DistanceSort, NTConfig_FastChaos && !NTConfig_LeechSupport ? 0x10 : null, NTConfig_FastChaos && !NTConfig_LeechSupport ? 310 : null);
  274. PubSay("De Seis dead.");
  275.  
  276. if(NTConfig_IdInField){
  277. NT_FieldID();
  278. }
  279.  
  280. return NTM_MoveTo(108, 7800, 5255);
  281. }
  282.  
  283. function NT_OpenVenomSealInt(type) {
  284. if (!NTConfig_FastChaos) {
  285. if (type === 1) {
  286. var IX = [7822,7826,7832,7850,7868,7877,7891,7907,7927,7932]; // looks like a hook
  287. var IY = [5297,5278,5307,5278,5297,5276,5276,5276,5279,5298];
  288. } else {
  289. var IX = [7825,7827,7834,7845,7855,7852,7875,7896,7917]; // shape of a "t"
  290. var IY = [5293,5276,5291,5315,5301,5278,5293,5295,5291];
  291. }
  292.  
  293. for (var i = 0; i < IX.length; i += 1) {
  294. NTM_MoveTo(108, IX[i], IY[i]);
  295. NTCS_ClearPosition(30, type === 1 ? SealSort : SealSortB);
  296. }
  297. }
  298.  
  299. if (NTConfig_LeechSupport) {
  300. if (type === 1) {
  301. NTM_MoveTo(108, 7933, 5302);
  302. NTCS_ClearPosition(25, DistanceSort);
  303. NTM_MoveTo(108, 7909, 5313);
  304. NTCS_ClearPosition(25, DistanceSort);
  305. } else {
  306. NTM_MoveTo(108, 7898, 5296);
  307. NTCS_ClearPosition(25, DistanceSort);
  308. NTM_MoveTo(108, 7892, 5321);
  309. NTCS_ClearPosition(25, DistanceSort);
  310. }
  311.  
  312. PubTP();
  313. PubSay("Leech TP up.");
  314. }
  315.  
  316. if (!NT_OpenSealInt(392) || !NT_OpenSealInt(393)) {
  317. return false;
  318. }
  319.  
  320. if (type === 1) {
  321. type = 1; // temp
  322. } else {
  323. NTM_MoveTo(108, 7933, 5299);
  324. }
  325.  
  326. NTCS_Preattack(GetLocaleString(2853));
  327. NTCS_ClearPosition(40, DistanceSort, NTConfig_FastChaos && !NTConfig_LeechSupport ? 0x10 : null, NTConfig_FastChaos && !NTConfig_LeechSupport ? 362 : null);
  328. NTA_KillMonster(GetLocaleString(2853)); // Infector of Souls
  329. NTCS_ClearPosition(40, DistanceSort, NTConfig_FastChaos && !NTConfig_LeechSupport ? 0x10 : null, NTConfig_FastChaos && !NTConfig_LeechSupport ? 362 : null);
  330. PubSay("Infector dead.");
  331.  
  332. if(NTConfig_IdInField){
  333. NT_FieldID();
  334. }
  335.  
  336. if (NTC_PutSkill(124, NTC_HAND_RIGHT)) {
  337. NTC_PingDelay(1000);
  338. }
  339.  
  340. return true;
  341. }
  342.  
  343. function NT_OpenSealInt(classid) {
  344. var warn;
  345. switch (classid) {
  346. case 396:
  347. case 394:
  348. case 392:
  349. warn = true;
  350. break;
  351. default:
  352. warn = false;
  353. break;
  354. }
  355.  
  356. var i, seal;
  357.  
  358. for (i = 0; i < 5; i += 1) {
  359. NTM_MoveToPresetUnit(108, 2, classid, classid === 394 ? 5 : 2, classid === 394 ? 5 : 0);
  360.  
  361. seal = NTC_FindUnit(NTC_UNIT_OBJECT, classid);
  362.  
  363. if (!seal) {
  364. return false;
  365. }
  366.  
  367. if (seal.mode) { // for pubbies
  368. if (warn) {
  369. PubSay("Don't hit the seals.");
  370. }
  371.  
  372. return true;
  373. }
  374.  
  375. warn = false;
  376.  
  377. NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, seal);
  378. NTC_Delay(classid === 394 ? 1000 : 500);
  379.  
  380. if (!seal.mode) {
  381. if (classid === 394 && CheckCollision(seal.x + 15, seal.y)) { // de seis optimization
  382. NTM_MoveTo(108, seal.x + 15, seal.y);
  383. } else {
  384. NTM_MoveTo(108, seal.x - 5, seal.y - 5);
  385. }
  386.  
  387. NTC_Delay(500);
  388. } else {
  389. return true;
  390. }
  391. }
  392.  
  393. return false;
  394. }
  395.  
  396. function BO_Party() {
  397. if (NTConfig_PublicMode) {
  398. NTC_Delay(1000);
  399. }
  400.  
  401. NTP_DoPrecast(true);
  402. }
  403.  
  404. function NTC_GetNextGame() { // move this to ntc
  405. function Pad(num) {
  406. if (num < 10) {
  407. num = 0 + "" + num;
  408. }
  409.  
  410. return num;
  411. }
  412.  
  413. var i, result, number,
  414. game = me.gamename;
  415.  
  416. for (i = game.length - 1; i > -1; i -= 1) {
  417. if (isNaN(game[i])) {
  418. break;
  419. }
  420. }
  421.  
  422. result = game.substring(0, i + 1);
  423. number = parseInt(game.substring(i + 1), 10) === 99 ? 0 : (parseInt(game.substring(i + 1), 10) + 1); // 99 correction
  424. result += Pad(number);
  425.  
  426. return result;
  427. }
  428.  
  429. //
  430.  
  431. function NTA_MonsterStats(unit) {
  432. this.name = unit.name;
  433. this.x = unit.x;
  434. this.y = unit.y;
  435. this.gid = unit.gid;
  436. this.classid = unit.classid;
  437. this.spectype = unit.spectype;
  438. }
  439.  
  440. function DistanceSort(unitA, unitB) {
  441. if (GetDistance(me.x, me.y, unitA.x, unitA.y) < GetDistance(me.x, me.y, unitB.x, unitB.y)) {
  442. return -1;
  443. }
  444.  
  445. return 1;
  446. }
  447.  
  448. function EntranceSort(unitA, unitB) {
  449. if (GetDistance(unitA.x, unitA.y, 7790, 5544) < GetDistance(unitB.x, unitB.y, 7790, 5544)) {
  450. return -1;
  451. }
  452.  
  453. return 1;
  454. }
  455.  
  456. function SealSort(unitA, unitB) {
  457. if (GetDistance(unitA.x, unitA.y, 7784, 5310) < GetDistance(unitB.x, unitB.y, 7784, 5310)) {
  458. return -1;
  459. }
  460.  
  461. return 1;
  462. }
  463.  
  464. function SealSortB(unitA, unitB) {
  465. if (GetDistance(unitA.x, unitA.y, 7800, 5255) < GetDistance(unitB.x, unitB.y, 7800, 5255)) {
  466. return -1;
  467. }
  468.  
  469. return 1;
  470. }
  471.  
  472. function NTCS_Preattack(name) {
  473. var i, n, target, pos, positions;
  474.  
  475. target = NTC_FindUnit(1, name, 10);
  476.  
  477. switch (me.classid) {
  478. case 0:
  479. break;
  480. case 1:
  481. break;
  482. case 2:
  483. break;
  484. case 3:
  485. if (!target) {
  486. return;
  487. }
  488.  
  489. positions = [[6, 11], [0, 8], [8, -1], [-9, 2], [0, -11], [8, -8]];
  490.  
  491. for (i = 0; i < positions.length; i += 1) {
  492. if (CheckCollision(me.areaid, target.x + positions[i][0], target.y + positions[i][1], 1)) { // check if we can move there
  493. Print("Preattack position: " + positions[i][0] + " " + positions[i][1]);
  494.  
  495. NTM_MoveTo(108, target.x + positions[i][0], target.y + positions[i][1]);
  496. NTC_PutSkill(NTConfig_AttackSkill[2], NTC_HAND_RIGHT);
  497.  
  498. for (n = 0; n < 8; n += 1) {
  499. NTC_CastSkill(NTConfig_AttackSkill[1], 2);
  500. }
  501.  
  502. break;
  503. }
  504. }
  505.  
  506. break;
  507. case 4:
  508. if (!target || NTConfig_AttackSkill[0] < 0) {
  509. return;
  510. }
  511.  
  512. pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, 20, 4);
  513.  
  514. if (pos) {
  515. NTM_MoveTo(108, pos[0], pos[1]);
  516. }
  517.  
  518. for (i = 0; i < 2; i += 1) {
  519. NTC_CastSkill(130, NTC_HAND_RIGHT);
  520. NTC_Delay(150);
  521. }
  522.  
  523. break;
  524. case 5:
  525. break;
  526. case 6:
  527. break;
  528. }
  529. }
  530.  
  531. // general functions
  532.  
  533. function PubTP() {
  534. if (NTConfig_PublicMode) {
  535. NTM_MakeTP();
  536. }
  537. }
  538.  
  539. function PubSay(string) {
  540. if (NTConfig_PublicMode) {
  541. Say(string);
  542. }
  543. }
  544.  
  545. function OpenStashes(range) {
  546. var i, unit,
  547. objects = [GetLocaleString(3274)],
  548. orgx = me.x,
  549. orgy = me.y;
  550.  
  551. for (i = 0; i < objects.length; i += 1) {
  552. unit = NTC_FindUnit(NTC_UNIT_OBJECT, objects[i]);
  553.  
  554. if (unit) {
  555. do {
  556. if (GetDistance(orgx, orgy, unit.x, unit.y) <= range) {
  557. if (NTC_OpenChest(unit)) {
  558. NTSI_PickItems();
  559. }
  560. }
  561. } while (unit.GetNext());
  562. }
  563. }
  564. }
  565.  
  566. function NTT_CheckPotionSafe() {
  567. var i, items, hpCheck, mpCheck;
  568.  
  569. items = me.GetItems();
  570.  
  571. if (NTConfig_BeltColType.indexOf("hp") > -1) {
  572. for (i = 0; i < items.length; i += 1) {
  573. if (!hpCheck && items[i].mode === 2 && items[i].code.indexOf("hp") > -1) {
  574. hpCheck = true;
  575. }
  576. }
  577. } else {
  578. hpCheck = true;
  579. }
  580.  
  581. if (NTConfig_BeltColType.indexOf("mp") > -1) {
  582. for (i = 0; i < items.length; i += 1) {
  583. if (!mpCheck && items[i].mode === 2 && items[i].code.indexOf("mp") > -1) {
  584. mpCheck = true;
  585. }
  586. }
  587. } else {
  588. mpCheck = true;
  589. }
  590.  
  591. return !(hpCheck && mpCheck);
  592. }
  593.  
  594. function NTA_Dodge(target, distance) {
  595. var i, j, coordx, coordy, monster, count,
  596. maxcount = 999,
  597. coords = [],
  598. goodCoords = [],
  599. monList = [],
  600. angles = [45, 90, 135, 180, 225, 270, 305, 360];
  601.  
  602. for (i = 0; i < angles.length; i += 1) {
  603. coordx = Math.round((Math.cos(angles[i] * Math.PI / 180)) * distance + target.x);
  604. coordy = Math.round((Math.sin(angles[i] * Math.PI / 180)) * distance + target.y);
  605.  
  606. if (CheckCollision(me.areaid, coordx, coordy, 1)) {
  607. coords.push([coordx, coordy]);
  608. }
  609. }
  610.  
  611. if (coords.length === 0) { // no valid positions - don't move
  612. return true;
  613. }
  614.  
  615. coords.sort(NTA_SortRooms);
  616.  
  617. monster = GetUnit(1);
  618.  
  619. if (monster) {
  620. do {
  621. if (monster.hp > 0) {
  622. monList.push(new NTA_MonsterStats(target));
  623. }
  624. } while (monster.GetNext());
  625. }
  626.  
  627. for (i = 0; i < coords.length; i += 1) {
  628. count = 0;
  629.  
  630. for (j = 0; j < monList.length; j += 1) {
  631. if (monList[j].hp > 0 && GetDistance(monList[j].x, monList[j].y, coords[i][0], coords[i][1]) < 10) {
  632. count += 1;
  633. }
  634. }
  635.  
  636. if (count < maxcount) {
  637. goodCoords = [coords[i][0], coords[i][1]];
  638. maxcount = count;
  639.  
  640. if (count === 0) {
  641. break;
  642. }
  643. }
  644. }
  645.  
  646. if (goodCoords.length > 0) { // just in case goodCoords is empty (shouldn't happen)
  647. if (Math.abs(me.x - goodCoords[0]) < 3 && Math.abs(me.y - goodCoords[1]) < 3) { // close enough
  648. return true;
  649. }
  650.  
  651. Say("!Dodge " + target.name);
  652. NTM_MoveTo(me.areaid, goodCoords[0], goodCoords[1]);
  653. }
  654.  
  655. return true;
  656. }
  657.  
  658. function NTCS_ClearPosition(range, sortFunc, spectype, classid) {
  659. var i, orgx, orgy, monList, ignoreList, target, result,
  660. gidAttack = [],
  661. dodgeIDs = [310, 362],
  662. attackcount = 0;
  663.  
  664. if (NTConfig_AttackSkill[1] < 0 || NTConfig_AttackSkill[3] < 0) {
  665. return false;
  666. }
  667.  
  668. switch (arguments.length) {
  669. case 0:
  670. range = 20;
  671. case 1:
  672. sortFunc = DistanceSort;
  673. case 2:
  674. spectype = false;
  675. case 3:
  676. classid = false;
  677. break;
  678. }
  679.  
  680. orgx = me.x;
  681. orgy = me.y;
  682. ignoreList = [];
  683.  
  684. MainLoop : while (attackcount < 300) {
  685. monList = [];
  686. target = NTC_FindUnit(NTC_UNIT_MONSTER);
  687.  
  688. if (target) {
  689. do {
  690. if (target.IsAttackable()) {
  691. if ((me.classid === 1 || me.classid === 2 || me.classid === 6) && NTConfig_Dodge && GetDistance(me, target) < 7 && dodgeIDs.indexOf(target.classid) > -1) {
  692. NTA_Dodge(target, 15);
  693. continue MainLoop;
  694. }
  695.  
  696. if (ignoreList.indexOf(target.gid) < 0 && GetDistance(orgx, orgy, target.x, target.y) <= range) {
  697. if (NTA_IsValidMonster(target)) {
  698. monList.push(new NTA_MonsterStats(target));
  699. } else {
  700. ignoreList.push(target.gid);
  701. }
  702. }
  703. }
  704. } while (target.GetNext());
  705. }
  706.  
  707. if (monList.length === 0) {
  708. break;
  709. }
  710.  
  711. monList.sort(sortFunc);
  712.  
  713. target = NTC_FindUnit(NTC_UNIT_MONSTER, monList[0].gid);
  714.  
  715. if (target && target.IsAttackable()) {
  716. result = NTA_Attack(target, attackcount % 30 === 0);
  717.  
  718. switch (result) {
  719. case 1:
  720. monList.shift();
  721. ignoreList.push(target.gid);
  722. break;
  723. case 2:
  724. case 3:
  725. if(!gidAttack[target.gid]) {
  726. gidAttack[target.gid] = 0;
  727. }
  728.  
  729. gidAttack[target.gid] += 1;
  730.  
  731. if (gidAttack[target.gid] > NTConfig_LowMaxAttacks) {
  732. Print(COLOR_1 + " Skipping " + target.name);
  733. monList.shift();
  734. ignoreList.push(target.gid);
  735. }
  736.  
  737. attackcount += 1;
  738.  
  739. if (target.mode === 0 || target.mode === 12) {
  740. NTSI_FastPick();
  741. }
  742.  
  743. break;
  744. default:
  745. return false;
  746. }
  747. } else {
  748. monList.shift();
  749. ignoreList.push(target.gid);
  750. }
  751. }
  752.  
  753. switch (me.classid) {
  754. case NTC_CHAR_CLASS_PALADIN:
  755. if (attackcount > 2 && (parseInt(me.hp * 100/ me.hpmax) < NTConfig_UseRedemptionHP || parseInt(me.mp * 100 / me.mpmax) < NTConfig_UseRedemptionMP)) {
  756. if (NTC_PutSkill(124, NTC_HAND_RIGHT)) {
  757. NTC_PingDelay(1000);
  758. }
  759. }
  760.  
  761. break;
  762. case NTC_CHAR_CLASS_NECROMANCER:
  763. if (typeof(NTA_SkeletonArmy) === 'function') { // old summon code
  764. NTA_SkeletonArmy(NTConfig_SkeletonArmy);
  765. NTA_MageArmy(NTConfig_MageArmy);
  766. NTA_ReviveArmy(NTConfig_ReviveArmy);
  767. } else {
  768. NTA_RaiseArmy(); // new summon code
  769. }
  770. break;
  771. case NTC_CHAR_CLASS_SORCERESS:
  772. if (me.GetState(30) === 0) {
  773. NTC_CastSkill(58, NTC_HAND_RIGHT);
  774. }
  775.  
  776. break;
  777. case NTC_CHAR_CLASS_BARBARIAN:
  778. if (attackcount > 0) {
  779. if (typeof(MWL_FindItem) === 'function') { // in case of using muddy's item find (like myself)
  780. MWL_FindItem(20);
  781. } else if (NTConfig_UseFindItem && !NTA_CheckForCloseMonsters(10)) {
  782. NTA_FindItem(NTConfig_FindItemRange);
  783. }
  784. }
  785.  
  786. break;
  787. }
  788.  
  789. if (attackcount > 0) {
  790. NTSI_PickItems();
  791. }
  792.  
  793. if (NTConfig_OpenChest) {
  794. OpenStashes(range);
  795. }
  796.  
  797. if (NTT_CheckMerc()) {
  798. Print(COLOR_1 + " Merc died, going to town.");
  799. NTTMGR_VisitTown();
  800. }
  801.  
  802. if (NTT_CheckPotionSafe()) {
  803. Print(COLOR_1 + " Out of potions, going to town.");
  804. NTTMGR_VisitTown();
  805. }
  806.  
  807. if (NTConfig_IdInField) {
  808. if (!NTT_CheckSpace(NTConfig_FreeSpaceXY[0], NTConfig_FreeSpaceXY[1])) {
  809. NT_FieldID();
  810. }
  811. }
  812.  
  813. return true;
  814. }
  815.  
  816. function NTA_SortRooms(a, b) {
  817. if (GetDistance(me.x, me.y, a[0], a[1]) < GetDistance(me.x, me.y, b[0], b[1])) {
  818. return -1;
  819. }
  820.  
  821. return 1;
  822. }
  823.  
  824. // add a better way of leechers getting bo'd when entring leaders tp. Maybe a while loop with a megetstate for bo
  825. // add an option to bo before seals. Because the leechers idle until mode change would be a very good place to do it
  826. // ^^^^ could use a settup like: 0 = disabled, 1 = bo before all, 2 = vies, 3 = de siez, 4 = ???
Advertisement
Add Comment
Please, Sign In to add comment