Guest User

Untitled

a guest
Jun 19th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.05 KB | None | 0 0
  1. var _MyDT_PreMessage = "";
  2. var leader = "Vitamins";
  3. var barb = "Lurk";
  4.  
  5. function NTMain()
  6. {
  7. Delay(1000);
  8. Include("libs/common/NTCommon.ntl");
  9. NTC_IncludeLibs();
  10. NTC_IncludeConfig("NTBot/char_configs");
  11. NT_LoadConfig();
  12. NTSI_LoadNIPFiles("NTBot/item_configs");
  13. NTA_Initialize();
  14. RegisterEvent(EVENT_GAMEMSG, quitfunc);
  15.  
  16. var XPList = [0, 0, 500, 1500, 3750, 7875, 14175, 22680, 32886, 44396, 57715, 72144, 90180, 112725, 140906,
  17. 176132, 220165, 275207, 344008, 430010, 537513, 671891, 839864, 1049830, 1312287, 1640359,
  18. 2050449, 2563061, 3203826, 3902260, 4663553, 5493363, 6397855, 7383752, 8458379, 9629723,
  19. 10906488, 12298162, 13815086, 15468534, 17270791, 19235252, 21376515, 23710491, 26254525,
  20. 29027522, 32050088, 35344686, 38935798, 42850109, 47116709, 51767302, 56836449, 62361819,
  21. 68384473, 74949165, 82104680, 89904191, 98405658, 107672256, 117772849, 128782495, 140783010,
  22. 153863570, 168121381, 183662396, 200602101, 219066380, 239192444, 261129853, 285041630, 311105466,
  23. 339515048, 370481492, 404234916, 441026148, 481128591, 524840254, 572485967, 624419793, 681027665,
  24. 742730244, 809986056, 883294891, 963201521, 1050299747, 1145236814, 1248718217, 1361512946, 1484459201,
  25. 1618470619, 1764543065, 1923762030, 2097310703, 2286478756, 2492671933, 2717422497, 2962400612, 3229426756, 3520485254, 0, 0],
  26. minXP = XPList[me.GetStat(12)] + 1;
  27.  
  28. NTC_Delay(1000);
  29. Print(NTTMGR_CheckScrolls(1));
  30. NTC_PutSkill(0, NTC_HAND_RIGHT);
  31.  
  32. Suicide(minXP);
  33.  
  34. //partyTaxiSorc();
  35. while (NTC_InMyParty(leader) || NTC_InMyParty(barb))
  36. {
  37. if (me.areaid === 103)
  38. CheckDiabloPortal();
  39.  
  40. NTC_Delay(500);
  41. }
  42.  
  43. return "NTMain()";
  44. }
  45. function quitfunc(msg, type)
  46. {
  47. if (msg.indexOf(leader) != -1 && msg.indexOf("Leech TP up") != -1)
  48. {
  49. NT_File("NTBot/bots/TeamD.txt", 1, ".filler", 50);
  50. }
  51. }
  52. function CheckDiabloPortal()
  53. {
  54. var _msg = NT_File("NTBot/bots/TeamD.txt", 0);
  55. if (_msg && _msg != _MyDT_PreMessage) {
  56. _MyDT_PreMessage = _msg;
  57.  
  58. switch (_msg.substring(_msg.indexOf("/") + 1))
  59. {
  60. case ".filler":
  61. Print("got diablo portal cmd");
  62. if (NTC_GetSkillLevel(100) < NTC_GetSkillLevel(110))
  63. NTC_PutSkill(110, NTC_HAND_RIGHT);
  64. else
  65. NTC_PutSkill(100, NTC_HAND_RIGHT);
  66. NTTM_CheckAct(4);
  67. NTTM_TownMove("portalspot");
  68. NTM_UsePortal("BluePortal", 108, leader);
  69. //while (!isMainCharIn(108))
  70. //Delay(100);
  71. if (!NTM_MoveTo(me.areaid, 7762, 5267))
  72. return "NTM_MoveTo()";
  73. break;
  74. }
  75. }
  76. }
  77.  
  78. function UseFillerPortal()
  79. {
  80. var portal = NTC_FindUnit(2, GetLocaleString(3226)),
  81. subareas = [105, 106, 105 + 256, 106 + 256, 105 + 768, 106 + 768];
  82.  
  83. if (portal)
  84. {
  85. do {
  86. if (subareas.indexOf(portal.subareaid) > -1 && portal.GetParent() !== me.name)
  87. {
  88. NTM_UsePortal(null, null, null, portal);
  89. return true;
  90. }
  91. } while (portal.GetNext());
  92. }
  93.  
  94. return false;
  95. }
  96.  
  97. function GetNearestMonster()
  98. {
  99. var gid,
  100. range = 20,
  101. monIDs = [14, 120, 140, 298, 299, 301, 302, 304, 305, 307, 308, 310, 311, 361, 362],
  102. monster = NTC_FindUnit(1);
  103.  
  104. if (monster)
  105. {
  106. do {
  107. if (monster.hp > 0 && monIDs.indexOf(monster.classid) > -1 && GetDistance(me, monster) < range)
  108. {
  109. range = GetDistance(me, monster);
  110. gid = monster.gid;
  111. }
  112. } while (monster.GetNext());
  113. }
  114.  
  115. if (gid)
  116. {
  117. return NTC_FindUnit(1, gid);
  118. }
  119.  
  120. return false;
  121. }
  122.  
  123. function Suicide(xp)
  124. {
  125. Print(NTC_InMyParty(leader) + " " + NTC_InMyParty(barb));
  126.  
  127. if (me.areaid == 103)
  128. {
  129. var i, n, path, unit, monster, made, pos;
  130.  
  131. for (i = 0; i < 20; i += 1)
  132. {
  133. //if (NTC_InMyParty(leader) || NTC_InMyParty(barb))
  134. //{
  135. if (NTTMGR_CheckScrolls(1) < 10)
  136. {
  137. //getGoldFiller();
  138. NTTMGR_TownManager();
  139. NTTM_TownMove("portalspot");
  140. }
  141.  
  142. if (!UseFillerPortal())
  143. {
  144. NTTM_TownMove("portalspot");
  145. if(!NTM_TakeWaypoint(106))
  146. return "NTM_TakeWaypoint()";
  147.  
  148. if (me.areaid == 106)
  149. {
  150. unit = GetPresetUnits(105, 1, 256);
  151.  
  152. if (unit.length)
  153. path = GetPath(me.areaid, me.x, me.y, unit[0].roomx * 5 + unit[0].x, unit[0].roomy * 5 + unit[0].y, false, 20);
  154. else
  155. return false;
  156.  
  157. if (!path)
  158. {
  159. Print("Invalid path");
  160. while (NTC_InMyParty(leader))
  161. Delay(500);
  162. CloseD2();
  163. }
  164.  
  165. for (n = 0; n < path.length; n += 1)
  166. {
  167. monster = nearestMonster();
  168.  
  169. if (monster[0])
  170. {
  171. Print("Wanna have sex with this supersexy " + monster[4] + " (Distance " + monster[3] + ").");
  172.  
  173. Print(made);
  174. pos = me.GetOptimalAttackPos(monster[2], monster[0], monster[1], made ? 3 : 15, 4);
  175.  
  176. if (pos)
  177. NTM_MoveTo2(monster[2], pos[0], pos[1]);
  178. Print("there");
  179. if (me.mode !== 17 && !made)
  180. {
  181. made = true;
  182.  
  183. pos = me.GetOptimalAttackPos(monster[2], monster[0], monster[1], 3, 4);
  184.  
  185. if (pos)
  186. NTM_WalkTo2(pos[0], pos[1]);
  187. }
  188.  
  189. break;
  190. }
  191.  
  192. NTM_WalkTo2(path[n][0], path[n][1]);
  193. }
  194. }
  195. }
  196.  
  197. if (me.mode !== 17 && !made)
  198. {
  199. made = true;
  200. Delay(100);
  201. }
  202.  
  203. monster = nearestMonster();
  204.  
  205. if (monster)
  206. {
  207. pos = me.GetOptimalAttackPos(monster[2], monster[0], monster[1], 3, 4);
  208.  
  209. if (pos)
  210. NTM_WalkTo2(pos[0], pos[1]);
  211. }
  212.  
  213. while (me.mode !== 0 && me.mode !== 17 && !NTC_InTown())
  214. NTC_Delay(50);
  215.  
  216. while (me.mode === 0 || me.mode === 17)
  217. {
  218. Print("dead");
  219. while (me.areaid != 103)
  220. {
  221. me.Cancel(0);
  222. if (me.areaid == 103)
  223. break;
  224. Delay(100);
  225. }
  226. }
  227.  
  228. Delay(150);
  229. me.Cancel(1);
  230.  
  231. if (me.GetStat(13) <= xp)
  232. {
  233. Print("Target XP reached.");
  234.  
  235. break;
  236. }
  237. //}
  238. }
  239. }
  240. }
  241.  
  242. function NTM_WalkTo2(x, y) { // kolton's updated walkto
  243. var i, distance, nTimer,
  244. nFail = 0,
  245. attemptCount = 0;
  246.  
  247. if (me.runwalk === 0) {
  248. me.runwalk = 1;
  249. }
  250.  
  251. MoveLoop : while (GetDistance(me.x, me.y, x, y) > 3 && me.mode !== 17) {
  252. if (me.classid == 3) {
  253. NTC_PutSkill(115, NTC_HAND_RIGHT);
  254. }
  255.  
  256. ClickMap(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, x, y);
  257. NTC_Delay(40);
  258. ClickMap(NTC_CLICK_LUP, NTC_SHIFT_NONE, null);
  259.  
  260. attemptCount += 1;
  261. nTimer = GetTickCount();
  262.  
  263. while (me.mode !== 2 && me.mode !== 3 && me.mode !== 6) {
  264. if (me.mode === 17) {
  265. break MoveLoop;
  266. }
  267.  
  268. if ((GetTickCount() - nTimer) > 500) {
  269. nFail++;
  270.  
  271. if (nFail === 2) {
  272. return false;
  273. }
  274.  
  275. ClickMap(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, me.x + Random(-3, 3), me.y + Random(-3, 3));
  276. NTC_Delay(40);
  277. ClickMap(NTC_CLICK_LUP, NTC_SHIFT_NONE, null);
  278.  
  279. continue MoveLoop;
  280. }
  281.  
  282. NTC_Delay(40);
  283. }
  284.  
  285. while (me.mode !== 1 && me.mode !== 5 && me.mode !== 17) {
  286. NTC_Delay(40);
  287. }
  288.  
  289. if (attemptCount >= 3) {
  290. return false;
  291. }
  292. }
  293.  
  294. return true;
  295. }
  296. function nearestMonster()
  297. {
  298. var _unit = NTC_FindUnit(NTC_UNIT_MONSTER);
  299. var uX, uY, uDistance, uName, uAreaid, uRoomsX, uRoomsY;
  300. var lastDistance = 1000;
  301. var monIDs = [14, 120, 140, 298, 299, 301, 302, 304, 305, 307, 308, 310, 311, 361, 362];
  302.  
  303. if (!_unit)
  304. return false;
  305.  
  306. do
  307. {
  308. if (GetDistance(me, _unit) < lastDistance && monIDs.indexOf(_unit.classid) > -1 && _unit.hp > 0 && _unit.mode != 0 && _unit.mode != 12 && (_unit.classid === 14 || _unit.classid === 140 || _unit.classid === 299 || _unit.classid === 302 || _unit.classid === 305 || _unit.classid === 308 || _unit.classid === 311 || _unit.classid === 361 || _unit.classid === 120 || _unit.classid === 307 || _unit.classid === 310 || _unit.classid === 304 || _unit.classid === 301 || _unit.classid === 298|| _unit.classid === 362))
  309. {
  310. lastDistance = GetDistance(me, _unit);
  311. uName = _unit.name;
  312. uDistance = GetDistance(me, _unit);
  313. uX = _unit.x;
  314. uY = _unit.y;
  315. uAreaid = _unit.areaid;
  316. uRoomsX = _unit.roomx * 5;
  317. uRoomsY = _unit.roomy * 5;
  318. }
  319.  
  320. }while (_unit.GetNext())
  321.  
  322. return [uX, uY, uAreaid, uDistance, uName, uRoomsX, uRoomsY];
  323. }
  324. function NTM_MoveTo2(areaid, x, y, retry, clearpath, canswitch)
  325. {
  326. //NT_LoadConfig();
  327. //NTSI_LoadNIPFiles("NTBot/item_configs");
  328.  
  329. var i, n;
  330. var _teleport;
  331. var _path = undefined; // houstin add
  332. var _retry = 0;
  333. var _attacked = false;
  334.  
  335. if(x == me.x && y == me.y) { return true; }
  336.  
  337. if(arguments.length < 4) { retry = 3; }
  338.  
  339. if(arguments.length < 5) { clearpath = false; }
  340.  
  341. if(arguments.length < 6) { canswitch = true; }
  342.  
  343. if(NTC_InTown() || NTC_GetSkillLevel(54) < 1) { _teleport = false; }
  344. else { _teleport = true; }
  345.  
  346. if (_teleport && GetDistance(me.x, me.y, x, y) < 30) {// houstin add
  347. return NTM_TeleportTo(x, y);
  348. }
  349.  
  350. _path = GetPath(areaid, me.x, me.y, x, y, _teleport);
  351.  
  352. if(!_path) { return (NTC_InTown() && (NTM_WalkTo2(x, y) || NTTM_TownMoveXY(x, y))); }
  353.  
  354. for(i = 0 ; i < _path.length ; i++)
  355. {
  356. for(n = 0 ; n < 2 ; n++)
  357. {
  358. if(_teleport)
  359. {
  360. if(NTM_TeleportTo(_path[i][0]+Random(-n, n), _path[i][1]+Random(-n, n))) { break; }
  361. }
  362. else
  363. {
  364. if(NTM_WalkTo2(_path[i][0], _path[i][1])) { break; }
  365. }
  366. }
  367.  
  368. if(n < 2)
  369. {
  370. if(clearpath)
  371. {
  372. if(!NTA_ClearPosition('20', true, '2')) { return false; }
  373. NTP_DoPrecast(false);
  374. NTM_MoveTo(me.areaid, _path[i][0], _path[i][1], 1);
  375. }
  376. }
  377. else if(_retry < retry)
  378. {
  379. _path = GetPath(areaid, me.x, me.y, x, y, _teleport);
  380.  
  381. if(!_path) { return false; }
  382.  
  383. i = -1;
  384. _retry++;
  385. _attacked = false;
  386. }
  387. else if((!_attacked))
  388. {
  389. //NTA_ClearPosition(10, true);
  390. //NTSI_PickItems();
  391. _attacked = true;
  392. _retry = 0;
  393. }
  394. else {
  395. return false;
  396. }
  397. }
  398.  
  399. return true;
  400. }
  401. function MyTP_CheckBeltScroll()
  402. {
  403. for (var i = 0; i < 4; i++)
  404. {
  405. if (NTConfig_BeltColType[i] == "tsc")
  406. return true;
  407. }
  408.  
  409. return false;
  410. }
  411. function NTM_MakeTP2(dest) // ??
  412. {
  413. var _usetp = true;
  414. var _portal;
  415. //var _portalname;
  416.  
  417. if(NTC_InTown())
  418. return true;
  419.  
  420. if(arguments.length < 1)
  421. _usetp = false;
  422.  
  423. if(MyTP_CheckBeltScroll())
  424. {
  425. if(!MyTP_MakeStoreTownPortal() && !MyTP_MakeStoreTownPortal())
  426. return false;
  427. }
  428. else if(!NTC_CastSkill(220, NTC_HAND_RIGHT) && !NTC_CastSkill(220, NTC_HAND_RIGHT))
  429. return false;
  430.  
  431. NTC_PingDelay(500);
  432.  
  433. //_portalname = GetLocaleString(3226);
  434.  
  435. for(var i = 0 ; i <= 2 ; i++)
  436. {
  437. _portal = NTC_FindUnit(NTC_UNIT_OBJECT, "blueportal", 103);
  438.  
  439. if(_portal)
  440. {
  441. do
  442. {
  443. if(_portal.mode == 2 && NTC_CheckOwner(_portal))
  444. {
  445. if(_usetp)
  446. return NTM_UsePortal("BluePortal", dest, me.name, _portal);
  447.  
  448. return true;
  449. }
  450. } while(_portal.GetNext());
  451. }
  452.  
  453. if(i < 2)
  454. NTC_Delay(250);
  455. }
  456.  
  457. return false;
  458. }
  459.  
  460. //////////
  461.  
  462. function partyTaxiSorc()
  463. {
  464. for(i = 0; i <= 100; i++)
  465. {
  466. if (NTC_InMyParty(leader))
  467. {
  468. break;
  469. }
  470. var _player = GetPlayerUnit();
  471. if (_player)
  472. {
  473. _mypartyid = _player.partyid;
  474. while (_player.GetNext())
  475. {
  476. if (_player.name == (leader) && _player.partyflag == 2 && (_player.partyid == 65535 || _player.partyid != _mypartyid))
  477. {
  478. me.ClickParty(_player, 2);
  479. break;
  480. }
  481. }
  482. }
  483.  
  484. NTC_Delay(200);
  485. }
  486. }
  487.  
  488. function getGoldFiller()
  489. {
  490. var _goldinventory = me.GetStat(14);
  491. if (NTC_InTown())
  492. {
  493. if (!NTTM_CheckAct(4))
  494. return "NTTM_CheckAct()";
  495. NTTM_TownMove("portalspot");
  496. var _item = NTC_FindUnit(NTC_UNIT_ITEM, GetLocaleString(2215));
  497. if (_item)
  498. {
  499. Print("seen gold");
  500. do
  501. {
  502. if (_item.classid == 523 && (GetDistance(me, _item) <= 15))
  503. {
  504. //NTM_MoveCloser(_item, 0);
  505. NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _item);
  506. }
  507. } while (_item.GetNext());
  508. }
  509. }
  510. }
Add Comment
Please, Sign In to add comment