Guest User

Untitled

a guest
Jun 23rd, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.73 KB | None | 0 0
  1. // Multipurpose Pindle script - derived from NTPindleskin and NTNihlathak
  2.  
  3. var _NTNihlathak_Locations = new Array(8, 4);
  4.  
  5. _NTNihlathak_Locations[0] = [12519, 5203, 12522, 5227]; // Top Left
  6. _NTNihlathak_Locations[1] = [12704, 5019, 12692, 5022]; // Top Right
  7. _NTNihlathak_Locations[2] = [12705, 5391, 12723, 5413]; // Bottom Right
  8. _NTNihlathak_Locations[3] = [12889, 5206, 12898, 5228]; // Bottom Left
  9. _NTNihlathak_Locations[4] = [12519, 5203, 12522, 5196]; // Top Left
  10. _NTNihlathak_Locations[5] = [12704, 5019, 12692, 5413]; // Top Right
  11. _NTNihlathak_Locations[6] = [12705, 5391, 12727, 5022]; // Bottom Right
  12. _NTNihlathak_Locations[7] = [12889, 5206, 12898, 5192]; // Bottom Left
  13.  
  14. function NTMain()
  15. {
  16. Include("libs/common/NTCommon.ntl");
  17. NTC_IncludeLibs();
  18. NTC_IncludeConfig("NTBot/char_configs");
  19.  
  20. NT_LoadConfig();
  21. NTSI_LoadNIPFiles("NTBot/item_configs");
  22.  
  23. NTA_Initialize();
  24.  
  25. if(!NTConfig_DanceForPindle) {
  26. NTConfig_DancingSorc = false;
  27. }
  28.  
  29. if(!NTTM_CheckAct())
  30. {
  31. NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_CheckAct()");
  32. return;
  33. }
  34.  
  35. NTTMGR_TownManager();
  36.  
  37. if(NTConfig_UseTemplePortal)
  38. {
  39. if(!NTTM_CheckAct(5))
  40. {
  41. NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_CheckAct()");
  42. return;
  43. }
  44.  
  45. if(!NTTM_TownMove("portal"))
  46. {
  47. NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_TownMove()");
  48. return;
  49. }
  50.  
  51. if(!NTM_UsePortal("Portal", 121))
  52. {
  53. NTC_SendMsgToScript("NTBotGame.ntj", "NTM_UsePortal()");
  54. return;
  55. }
  56.  
  57. NTP_DoPrecast(true);
  58.  
  59. if(NTConfig_KillPindleskin)
  60. {
  61. if(!NTM_MoveTo(me.areaid, 10061, 13234))
  62. {
  63. NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveTo()");
  64. return;
  65. }
  66.  
  67. if(!NTA_KillMonster(GetLocaleString(22497)))
  68. {
  69. NTC_SendMsgToScript("NTBotGame.ntj", "NTA_KillMonster()");
  70. return;
  71. }
  72.  
  73. if(NTConfig_ClearPosition)
  74. NTA_ClearPosition();
  75.  
  76. NTSI_PickItems();
  77. }
  78.  
  79. if(NTConfig_KillNihlathak)
  80. {
  81. var _location;
  82.  
  83. for(var i = 0 ; i < 3 ; i++)
  84. {
  85. if(!NTM_MoveToStair(me.areaid, 122+i))
  86. {
  87. NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveToStair()");
  88. return;
  89. }
  90.  
  91. if(!NTM_TakeStair(122+i))
  92. {
  93. NTC_SendMsgToScript("NTBotGame.ntj", "NTM_TakeStair()");
  94. return;
  95. }
  96.  
  97. if(me.areaid == 124)
  98. break;
  99.  
  100. switch(NTConfig_ClearHalls)
  101. {
  102. case 0:
  103. break;
  104. case 1:
  105. NTConfig_SkipRegularMonsters = false;
  106. NTP_DoPrecast(true);
  107. if(!NTA_ClearLevel())
  108. {
  109. NTC_SendMsgToScript("NTBotGame.ntj", "NTA_ClearLevel()");
  110. return;
  111. }
  112. break;
  113. case 2:
  114. NTConfig_SkipRegularMonsters = true;
  115. NTP_DoPrecast(true);
  116. if(!NTA_ClearLevel())
  117. {
  118. NTC_SendMsgToScript("NTBotGame.ntj", "NTA_ClearLevel()");
  119. return;
  120. }
  121. break;
  122. }
  123.  
  124. if(NTConfig_OpenHallsSuperChests)
  125. OpenSpecialChestsInArea();
  126.  
  127. if(NTConfig_OpenChestsInArea && NTU_DontOpenAreas())
  128. OpenChestsInArea();
  129. }
  130.  
  131. NTP_DoPrecast(false);
  132.  
  133. _location = NT_FindNihlathakInt();
  134.  
  135. if(_location == -1)
  136. {
  137. NTC_SendMsgToScript("NTBotGame.ntj", "NT_FindNihlathakInt()");
  138. return;
  139. }
  140.  
  141. if(!NTM_MoveTo(me.areaid, _NTNihlathak_Locations[_location][2], _NTNihlathak_Locations[_location][3]))
  142. {
  143. NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveTo()");
  144. return;
  145. }
  146.  
  147. if(NTConfig_CheckVipers && NTC_FindUnit(NTC_UNIT_MONSTER, GetLocaleString(2956)))
  148. {
  149. NTC_SendLogToOOG(NTC_LOG_COMMON, COLOR_1 + "Tomb Vipers found.");
  150. NTC_SendMsgToScript("NTBotGame.ntj", "SCRIPT_END");
  151. return;
  152. }
  153.  
  154. if(NTTMGR_CheckSafe(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe)){
  155. NTTMGR_VisitTown();
  156. }
  157.  
  158. if(!NTA_KillMonster(526))
  159. {
  160. NTC_SendMsgToScript("NTBotGame.ntj", "NTA_KillMonster()");
  161. return;
  162. }
  163.  
  164. if(NTConfig_ClearPosition)
  165. NTA_ClearPosition();
  166.  
  167. NTSI_PickItems();
  168.  
  169. switch(NTConfig_ClearHallsOfVaught)
  170. {
  171. case 0:
  172. break;
  173. case 1:
  174. NTConfig_SkipRegularMonsters = false;
  175. NTP_DoPrecast(true);
  176. if(!NTA_ClearLevel())
  177. {
  178. NTC_SendMsgToScript("NTBotGame.ntj", "NTA_ClearLevel()");
  179. return;
  180. }
  181. break;
  182. case 2:
  183. NTConfig_SkipRegularMonsters = true;
  184. NTP_DoPrecast(true);
  185. if(!NTA_ClearLevel())
  186. {
  187. NTC_SendMsgToScript("NTBotGame.ntj", "NTA_ClearLevel()");
  188. return;
  189. }
  190. break;
  191. }
  192.  
  193. if(NTConfig_OpenChestsInArea && NTU_DontOpenAreas())
  194. OpenChestsInArea();
  195.  
  196. if(NTConfig_OpenEvilUrnNihl)
  197. {
  198. if(!NTM_MoveToPresetUnit(me.areaid, NTC_UNIT_OBJECT, 466))
  199. {
  200. NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveToPresetUnit()");
  201. return;
  202. }
  203.  
  204. var _EvilUrn = NTC_FindUnit(NTC_UNIT_OBJECT, 466);
  205.  
  206. if(_EvilUrn)
  207. {
  208. if(NTM_MoveTo(_EvilUrn.areaid, _EvilUrn.x+1, _EvilUrn.y))
  209. {
  210. if(NTC_OpenChest(_EvilUrn))
  211. NTC_Delay(1000);
  212. NTA_ClearPosition(20, true)
  213. NTC_Delay(500);
  214. NTA_ClearPosition(20, true)
  215. NTSI_PickItems();
  216. }
  217. }
  218. }
  219. }
  220. }
  221. else
  222. {
  223. if(!NTTM_TownMove("waypoint"))
  224. {
  225. NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_TownMove()");
  226. return;
  227. }
  228.  
  229. if(!NTM_TakeWaypoint(123))
  230. {
  231. NTC_SendMsgToScript("NTBotGame.ntj", "NTM_TakeWaypoint()");
  232. return;
  233. }
  234.  
  235. if(NTConfig_KillNihlathak)
  236. {
  237. var _location;
  238.  
  239. switch(NTConfig_ClearHalls)
  240. {
  241. case 0:
  242. break;
  243. case 1:
  244. NTConfig_SkipRegularMonsters = false;
  245. NTP_DoPrecast(true);
  246. if(!NTA_ClearLevel())
  247. {
  248. NTC_SendMsgToScript("NTBotGame.ntj", "NTA_ClearLevel()");
  249. return;
  250. }
  251. break;
  252. case 2:
  253. NTConfig_SkipRegularMonsters = true;
  254. NTP_DoPrecast(true);
  255. if(!NTA_ClearLevel())
  256. {
  257. NTC_SendMsgToScript("NTBotGame.ntj", "NTA_ClearLevel()");
  258. return;
  259. }
  260. break;
  261. }
  262. NTP_DoPrecast(true);
  263. if(NTConfig_OpenHallsSuperChests)
  264. OpenSpecialChestsInArea();
  265.  
  266. if(NTConfig_OpenChestsInArea && NTU_DontOpenAreas())
  267. OpenChestsInArea();
  268.  
  269. if(!NTM_MoveToStair(me.areaid, 124))
  270. {
  271. NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveToStair()");
  272. return;
  273. }
  274.  
  275. if(!NTM_TakeStair(124))
  276. {
  277. NTC_SendMsgToScript("NTBotGame.ntj", "NTM_TakeStair()");
  278. return;
  279. }
  280.  
  281. NTP_DoPrecast(false);
  282.  
  283. _location = NT_FindNihlathakInt();
  284.  
  285. if(_location == -1)
  286. {
  287. NTC_SendMsgToScript("NTBotGame.ntj", "NT_FindNihlathakInt()");
  288. return;
  289. }
  290.  
  291. if(!NTM_MoveTo(me.areaid, _NTNihlathak_Locations[_location][2], _NTNihlathak_Locations[_location][3]))
  292. {
  293. NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveTo()");
  294. return;
  295. }
  296.  
  297. if(NTTMGR_CheckSafe(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe)){
  298. NTTMGR_VisitTown();
  299. }
  300.  
  301. if(NTConfig_CheckVipers && NTC_FindUnit(NTC_UNIT_MONSTER, GetLocaleString(2956)))
  302. {
  303. NTC_SendLogToOOG(NTC_LOG_COMMON, COLOR_1 + "Tomb Vipers found.");
  304. NTC_SendMsgToScript("NTBotGame.ntj", "SCRIPT_END");
  305. return;
  306. }
  307.  
  308. if(!NTA_KillMonster(526))
  309. {
  310. NTC_SendMsgToScript("NTBotGame.ntj", "NTA_KillMonster()");
  311. return;
  312. }
  313.  
  314. if(NTConfig_ClearPosition)
  315. NTA_ClearPosition();
  316.  
  317. NTSI_PickItems();
  318.  
  319. switch(NTConfig_ClearHallsOfVaught)
  320. {
  321. case 0:
  322. break;
  323. case 1:
  324. NTConfig_SkipRegularMonsters = false;
  325. NTP_DoPrecast(true);
  326. if(!NTA_ClearLevel())
  327. {
  328. NTC_SendMsgToScript("NTBotGame.ntj", "NTA_ClearLevel()");
  329. return;
  330. }
  331. break;
  332. case 2:
  333. NTConfig_SkipRegularMonsters = true;
  334. NTP_DoPrecast(true);
  335. if(!NTA_ClearLevel())
  336. {
  337. NTC_SendMsgToScript("NTBotGame.ntj", "NTA_ClearLevel()");
  338. return;
  339. }
  340. break;
  341. }
  342.  
  343. if(NTConfig_OpenChestsInArea && NTU_DontOpenAreas())
  344. OpenChestsInArea();
  345.  
  346. if(NTConfig_OpenEvilUrnNihl)
  347. {
  348. if(!NTM_MoveToPresetUnit(me.areaid, NTC_UNIT_OBJECT, 466))
  349. {
  350. NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveToPresetUnit()");
  351. return;
  352. }
  353.  
  354. var _EvilUrn = NTC_FindUnit(NTC_UNIT_OBJECT, 466);
  355.  
  356. if(_EvilUrn)
  357. {
  358. if(NTM_MoveTo(_EvilUrn.areaid, _EvilUrn.x+1, _EvilUrn.y))
  359. {
  360. if(NTC_OpenChest(_EvilUrn))
  361. NTC_Delay(1000);
  362. NTA_ClearPosition(20, true)
  363. NTC_Delay(500);
  364. NTA_ClearPosition(20, true)
  365. NTSI_PickItems();
  366. }
  367. }
  368. }
  369. }
  370.  
  371. if(NTConfig_KillPindleskin)
  372. {
  373. switch(me.areaid)
  374. {
  375. case 124:
  376. if(!NTM_MoveToStair(me.areaid, 123))
  377. {
  378. NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveToStair()");
  379. return;
  380. }
  381.  
  382. if(!NTM_TakeStair(123))
  383. {
  384. NTC_SendMsgToScript("NTBotGame.ntj", "NTM_TakeStair()");
  385. return;
  386. }
  387. case 123:
  388. NTP_DoPrecast(false);
  389.  
  390. for(var i = 0 ; i < 2 ; i++)
  391. {
  392. if(!NTM_MoveToStair(me.areaid, 122-i))
  393. {
  394. NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveToStair()");
  395. return;
  396. }
  397.  
  398. if(!NTM_TakeStair(122-i))
  399. {
  400. NTC_SendMsgToScript("NTBotGame.ntj", "NTM_TakeStair()");
  401. return;
  402. }
  403.  
  404. if(me.areaid == 121)
  405. break;
  406.  
  407. switch(NTConfig_ClearHalls)
  408. {
  409. case 0:
  410. break;
  411. case 1:
  412. NTConfig_SkipRegularMonsters = false;
  413. NTP_DoPrecast(true);
  414. if(!NTA_ClearLevel())
  415. {
  416. NTC_SendMsgToScript("NTBotGame.ntj", "NTA_ClearLevel()");
  417. return;
  418. }
  419. break;
  420. case 2:
  421. NTConfig_SkipRegularMonsters = true;
  422. NTP_DoPrecast(true);
  423. if(!NTA_ClearLevel())
  424. {
  425. NTC_SendMsgToScript("NTBotGame.ntj", "NTA_ClearLevel()");
  426. return;
  427. }
  428. break;
  429. }
  430.  
  431. if(NTConfig_OpenHallsSuperChests)
  432. OpenSpecialChestsInArea();
  433.  
  434. if(NTConfig_OpenChestsInArea && NTU_DontOpenAreas())
  435. OpenChestsInArea();
  436. }
  437. break;
  438. }
  439.  
  440. //if(!NTM_MoveTo(me.areaid, 10061, 13234))
  441. {
  442. NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveTo()");
  443. return;
  444. }
  445.  
  446. if(!NTA_KillMonster(GetLocaleString(22497)))
  447. {
  448. NTC_SendMsgToScript("NTBotGame.ntj", "NTA_KillMonster()");
  449. return;
  450. }
  451.  
  452. if(NTConfig_ClearPosition)
  453. NTA_ClearPosition();
  454.  
  455. NTSI_PickItems();
  456. }
  457. }
  458.  
  459. NTC_SendMsgToScript("NTBotGame.ntj", "SCRIPT_END");
  460. }
  461.  
  462. // Internal function
  463. function NT_FindNihlathakInt()
  464. {
  465. var i, x, y;
  466. var _nihlathak;
  467. var _mindist = 999999;
  468. var _currdist;
  469. var _location = -1;
  470.  
  471. _nihlathak = GetPresetUnits(me.areaid, NTC_UNIT_OBJECT, 462);
  472.  
  473. if(!_nihlathak || _nihlathak.length < 1)
  474. return _location;
  475.  
  476. x = _nihlathak[0].roomx*5 + _nihlathak[0].x;
  477. y = _nihlathak[0].roomy*5 + _nihlathak[0].y;
  478.  
  479. for(i = 0 ; i < 8 ; i++)
  480. {
  481. _currdist = GetDistance(_NTNihlathak_Locations[i][0], _NTNihlathak_Locations[i][1], x, y);
  482.  
  483. if(_currdist < _mindist)
  484. {
  485. _mindist = _currdist;
  486. _location = i;
  487. }
  488. }
  489.  
  490. return _location;
  491. }
Add Comment
Please, Sign In to add comment