Guest User

Untitled

a guest
Nov 23rd, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.82 KB | None | 0 0
  1. RegisterEvent(EVENT_SCRIPTMSG, HostileHandler);
  2. var _hostilepause = false;
  3. var Diablo_PreMessage = "";
  4. var _CSSealsOnly = false;
  5. var _PublicMode = true;
  6. function NTMain(){
  7. Include("libs/common/NTCommon.ntl");
  8. NTC_IncludeLibs();
  9.  
  10. NTC_IncludeConfig("NTBot/char_configs");
  11. NT_LoadConfig();
  12.  
  13. NTSI_LoadNIPFiles("NTBot/item_configs");
  14.  
  15. NTA_Initialize();
  16.  
  17. if(!NTTM_CheckAct()){
  18. NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_CheckAct()");
  19. return;
  20. }
  21. if(me.areaid != 103){
  22. if(!NTTM_TownMove("waypoint")) {
  23. NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_TownMove()");
  24. return;
  25. }
  26. if(!NTM_TakeWaypoint(103)) {
  27. NTC_SendMsgToScript("NTBotGame.ntj", "NTM_TakeWaypoint()");
  28. return;
  29. }
  30. }
  31. NTTMGR_TownManager();
  32. NTTM_TownMove("portalspot");
  33.  
  34. if(NTConfig_UseChatCommandPortal){
  35. while(!NT_DiabloLeechMessageHandler()){
  36. Delay(500);
  37. }
  38. for(var i = 0 ; i < 100 && me.areaid == 103 ; i++){
  39. NTM_UsePortal("BluePortal", 108, NTConfig_Leader);
  40. Delay(500);
  41. }
  42. }
  43. else{
  44. myStartArea = me.areaid;
  45. while(1){
  46. NTM_UsePortal("BluePortal", 108, NTConfig_Leader);
  47. if (myStartArea != me.areaid) {
  48. break;
  49. }
  50. Delay(500);
  51. }
  52. }
  53. while(me.areaid == 0){
  54. NTC_Delay(200);
  55. }
  56. NTP_DoPrecast(true, NTConfig_LeechBo);
  57. NTCS_ClearEntrance();
  58. NTCS_OpenSealsInt();
  59. NTCS_KillDiablo();
  60. if(NTConfig_RunScriptAfterDiablo){
  61. Delay(750);
  62. NTC_SendMsgToScript("NTBotGame.ntj", "SCRIPT_END");
  63. }
  64. else{
  65. while(1) {
  66. Delay(500);
  67. }
  68. }
  69.  
  70. }
  71.  
  72. function NTCS_Say(msg){
  73. if (NTConfig_PublicMode && msg && msg.length > 0){
  74. Say (msg);
  75. NTC_Delay(50);
  76. }
  77. }
  78.  
  79. function NTCS_GetRandomText(){
  80. var s = "";
  81. var i = 0;
  82. while ((i++ < 5) || (s.length == 0))
  83. s = GetLocaleString(Random(1069, 1295));
  84. return s.length > 0 ? s : "Aww.";
  85. }
  86.  
  87. function NTCS_KillSealBoss(monsterName){
  88. for(var i = 0 ; i < 10 ; i++){
  89. NTC_Delay(100);
  90. if(NTA_KillMonster(monsterName)){
  91. if (!_CSSealsOnly) NTA_ClearPosition(20, true, 2);
  92. return true;
  93. }
  94. }
  95. return false;
  96. }
  97.  
  98. function NTCS_ClearEntrance(){
  99. var pos;
  100. if ((_CSSealsOnly == true) || (NTConfig_LeechFrom == "S")){
  101. pos = new Array();
  102. }
  103. else if (CheckCollision(me.areaid, 7784, 5447, 1)){
  104. pos = [
  105. 7794, 5540, 7794, 5515
  106. , 7770, 5499, 7794, 5480, 7803, 5499, 7818, 5499, 7818, 5480, 7818, 5447, 7818, 5428
  107. , 7803, 5421, 7794, 5403, 7784, 5421, 7770, 5428, 7770, 5447, 7770, 5480
  108. , 7770, 5480, 7770, 5447, 7784, 5421
  109. , 7770, 5414, 7770, 5392, 7770, 5363, 7770, 5341
  110. , 7794, 5341
  111. , 7818, 5341, 7818, 5392, 7818, 5363
  112. , 7794, 5363
  113. ];
  114. }
  115. else{
  116. pos = [
  117. 7794, 5540, 7794, 5515
  118. , 7818, 5499, 7794, 5480, 7784, 5499, 7770, 5499, 7770, 5480, 7770, 5447, 7770, 5428
  119. , 7784, 5421, 7794, 5403, 7803, 5421, 7818, 5428, 7818, 5447, 7818, 5480
  120. , 7818, 5447, 7803, 5421
  121. , 7818, 5414, 7818, 5392, 7818, 5363, 7818, 5341
  122. , 7794, 5341
  123. , 7770, 5341, 7770, 5392, 7770, 5363
  124. , 7794, 5363
  125. ];
  126. }
  127. if(_PublicMode)
  128. pos = pos.concat([7794, 5363, 7770, 5363, 7770, 5341, 7818, 5363, 7818, 5341]);
  129.  
  130. while (pos.length > 0){
  131. NTM_MoveTo(me.areaid, pos.shift(), pos.shift());
  132. NTA_ClearPosition(20, true, 2);
  133. }
  134. NTM_MoveTo(me.areaid, 7794, 5341);
  135. if(_PublicMode){
  136. NTM_MoveTo(me.areaid, 7794, 5341);
  137. NTA_ClearPosition(20, true, 2);
  138. }
  139. else if ((_CSSealsOnly == true) || (NTConfig_LeechFrom == "S")){
  140. NTM_MoveTo(me.areaid, 7792, 5292);
  141. NTM_MoveTo(me.areaid, 7858, 5294);
  142. }
  143. }
  144.  
  145. function NTCS_KillDiablo(){
  146. var _attackcount = 0;
  147. NTM_MoveTo(me.areaid, 7792, 5292);
  148. NTP_DoPrecast(true, NTConfig_LeechBo);
  149. if(NTConfig_IdInField){
  150. NT_FieldID();
  151. }
  152. if(me.classid == NTC_CHAR_CLASS_ASSASSIN) {
  153. if(NTConfig_UseTraps) {
  154. var _attackPos2 = [7784,5290,7793,5284,7801,5289,7797,5299,7787,5299];
  155. for(var i=0;i<5;i++) {
  156. if(i == 0 || i == 2 || i == 3) // Added delays to prevent trap miscast
  157. NTC_Delay(25);
  158. if(NTConfig_ActBossTrapSet[i] > 0)
  159. NTC_CastSkill(NTConfig_ActBossTrapSet[i], NTC_HAND_RIGHT, _attackPos2[i*2],_attackPos2[(i*2)+1]);
  160. }
  161. }
  162. }
  163. var count = 0;
  164. while(!NTA_KillMonster(243)){
  165. var _attackcount = 0;
  166. _monster = NTC_FindUnit(NTC_UNIT_MONSTER);
  167. _classid = monster.classid;
  168. _target = NTC_FindUnit(NTC_UNIT_MONSTER, classid, 5);
  169. if (NTConfig_StopAttackPercent > 0 && (parseInt(_target.hp*100/_target.hpmax) <= NTConfig_StopAttackPercent)) {
  170. while(NTA_IsValidMonster(_target)) {
  171. Delay(200);
  172. }
  173. }
  174.  
  175. if (NTA_Attack(_target, (_attackcount % 30) == 0) < 2) {
  176. break;
  177. }
  178.  
  179. _attackcount++;
  180. _sorcattack++;
  181. }
  182. NTSI_PickItems();
  183. NTM_MoveTo(me.areaid, 7792, 5292);
  184. }
  185.  
  186.  
  187. function NTCS_OpenSealError(id){
  188. NTC_SendMsgToScript("NTBotGame.ntj", "NTCS_OpenSealsInt(" + id + ")");
  189.  
  190. var msg = "Unable to find seal : ";
  191. switch (id){
  192. case 392 : msg += GetLocaleString(2853); break;
  193. case 394 : msg += GetLocaleString(2852); break;
  194. case 396 : msg += GetLocaleString(2851); break;
  195. default : break;
  196. }
  197. msg += ". Aborting ...";
  198. NTTM_CheckAct();
  199. NTC_SendMsgToScript("NTBotGame.ntj", "SCRIPT_END");
  200. }
  201.  
  202. function NTCS_OpenSealsInt(){
  203. //[0,1,2] //0=Venom(First) 1=DeSeis(Second) 2=Vizer(Third)
  204. //[1,0,2] //1=DeSeis(First) 0=Venom(Second) 2=Vizer(Third)
  205. var _order = [2,1,0]; //<-----------------------------------Change here.//2=Vizer(Fist) 1=Deseis(Second) 0=Venom(Third)
  206. var _RandomSeals = false; //Do Random Seals if your bored.
  207. var unit, count = 0, i = 0;
  208. if (_RandomSeals){
  209. rand1 = Math.floor(Math.random()*_order.length);
  210. rand2 = Math.floor(Math.random()*_order.length);
  211. rand3 = Math.floor(Math.random()*_order.length);
  212. var _n=0, _n2=0, _n3=0;
  213. for (e = 0; e < _order.length; e++){
  214. switch(e){
  215. case 0: var _n = rand1;
  216. case 1: rand2 = Math.floor(Math.random()*_order.length); if (rand2 != _n) _n2 = rand2;
  217. case 2: rand3 = Math.floor(Math.random()*_order.length); if (rand3 != _n && rand3 != _n2) _n3 = rand3;
  218. }
  219. }
  220. var _order = [_n,_n2,_n3];
  221. }
  222. for ( i = 0; i < _order.length; i++){
  223. switch(_order[i]){
  224. case 0:
  225. unit = GetPresetUnits(me.areaid, NTC_UNIT_OBJECT, 392);
  226. if(!unit) NTCS_SealsError(392);
  227. if(unit[0].roomx*5 + unit[0].x == 7893)
  228. count += NTCS_OpenSealVenomInt(1);
  229. else
  230. count += NTCS_OpenSealVenomInt(2);
  231. break;
  232. case 1:
  233. unit = GetPresetUnits(me.areaid, NTC_UNIT_OBJECT, 394);
  234. if(!unit) NTCS_SealsError(394);
  235. if(unit[0].roomx*5 + unit[0].x == 7773)
  236. count += NTCS_OpenSealDeSeisInt(1);
  237. else
  238. count += NTCS_OpenSealDeSeisInt(2);
  239. break;
  240. case 2:
  241. unit = GetPresetUnits(me.areaid, NTC_UNIT_OBJECT, 396);
  242. if(!unit) NTCS_SealsError(396);
  243. if(unit[0].roomy*5 + unit[0].y == 5275)
  244. count += NTCS_OpenSealVizierInt(1);
  245. else
  246. count += NTCS_OpenSealVizierInt(2);
  247. break;
  248. }
  249. }
  250. if(NTTMGR_CheckSafe(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe)){
  251. NTTMGR_VisitTown();
  252. }
  253. return count;
  254. }
  255.  
  256. function NTCS_OpenSealInt(classid, x, y){
  257. var retry = 0;
  258. NTM_MoveTo(me.areaid, x, y);
  259. if (!_CSSealsOnly) NTA_ClearPosition(20, true, 2);
  260. var seal = NTC_FindUnit(NTC_UNIT_OBJECT, classid);
  261. if(!seal) NTCS_OpenSealError(classid);
  262. while ((retry++ < 100) && (seal.mode == 0)){
  263. if(GetDistance(me, seal) > 2)
  264. NTM_MoveTo(seal.areaid, seal.x + 4, seal.y);
  265. //NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, seal);
  266. NTC_Delay(50);
  267. if (seal && seal.mode != 0) break;
  268. NTC_Delay(500);
  269. NTM_MoveTo(seal.areaid, seal.x -6, seal.y - 4);
  270. }
  271. return seal.mode > 0 ? 1 : 0;
  272. }
  273.  
  274. function NTCS_OpenSealVizierInt(type){
  275. var pos;
  276. var count = 0;
  277. var monsterName = GetLocaleString(2851);
  278. if (_CSSealsOnly == false){
  279. if (type == 1)
  280. pos = [
  281. 7763, 5275, 7763, 5315, 7747, 5292, 7713, 5275, 7730, 5292, 7713, 5315, 7713, 5292
  282. , 7684, 5292, 7677, 5315, 7650, 5315, 7669, 5292, 7677, 5275, 7650, 5275
  283. ];
  284. else
  285. pos = [
  286. 7763, 5275, 7763, 5315, 7747, 5295, 7713, 5275, 7730, 5295, 7713, 5315
  287. , 7694, 5315, 7675, 5315, 7656, 5315
  288. ];
  289. while (pos.length > 0){
  290. NTM_MoveTo(me.areaid, pos.shift(), pos.shift());
  291. NTA_ClearPosition(20, true, 2);
  292. }
  293. }
  294. else{
  295. NTM_MoveTo(7747, 5293);
  296. NTM_MoveTo(7713, 5293);
  297. NTM_MoveTo(7669, 5315);
  298. //NTM_MoveToPresetUnit(me.areaid, NTC_UNIT_OBJECT, 396);
  299. }
  300. if (type == 1){
  301. if(NTConfig_IdInField){
  302. NT_FieldID();
  303. }
  304. count += NTCS_OpenSealInt(396, 7659, 5277);
  305. NTM_MoveTo(me.areaid, 7669, 5292);
  306. NTCS_KillSealBoss(monsterName);
  307. NTSI_PickItems();
  308. NTM_MoveTo(me.areaid, 7684, 5292);
  309. NTM_MoveTo(me.areaid, 7654, 5310);
  310. NTM_MoveTo(me.areaid, 7654, 5310);
  311. count += NTCS_OpenSealInt(395, 7654, 5310);
  312. NTA_ClearPosition(20, true, 2);
  313. NTM_MoveTo(7684, 5293);
  314. }
  315. else{
  316. if(NTConfig_IdInField){
  317. NT_FieldID();
  318. }
  319. count += NTCS_OpenSealInt(396, 7651, 5310);
  320. NTM_MoveTo(me.areaid, 7675, 5315);
  321. NTCS_KillSealBoss(monsterName);
  322. NTSI_PickItems();
  323. NTM_MoveTo(me.areaid, 7656, 5295);
  324. NTM_MoveTo(me.areaid, 7656, 5269);
  325. NTM_MoveTo(me.areaid, 7656, 5295);
  326. count += NTCS_OpenSealInt(395, 7650, 5276);
  327. NTA_ClearPosition(20, true, 2);
  328. NTM_MoveTo(7675, 5315);
  329. }
  330. NTM_MoveTo(7730, 5293);
  331. return count;
  332. }
  333.  
  334. function NTCS_OpenSealDeSeisInt(type){
  335. var pos;
  336. var count = 0;
  337. var monsterName = GetLocaleString(2852);
  338. if (_CSSealsOnly == false){
  339. if (type == 1)
  340. pos = [
  341. 7813, 5259, 7813, 5229, 7792, 5244, 7771, 5229
  342. , 7771, 5215, 7771, 5193, 7792, 5193, 7813, 5193
  343. , 7813, 5174, 7813, 5155, 7792, 5155, 7771, 5155
  344. , 7767, 5162
  345. ];
  346. else
  347. pos = [
  348. 7813, 5259, 7792, 5244, 7771, 5229, 7771, 5244, 7813, 5229
  349. , 7813, 5215, 7813, 5193, 7792, 5193, 7771, 5193
  350. , 7771, 5174, 7771, 5155, 7792, 5155, 7813, 5155
  351. ];
  352. while (pos.length > 0){
  353. NTM_MoveTo(me.areaid, pos.shift(), pos.shift());
  354. NTA_ClearPosition(20, true, 2);
  355. }
  356. }
  357. else{
  358. NTM_MoveTo(7792, 5229);
  359. NTM_MoveTo(7792, 5193);
  360. //NTM_MoveToPresetUnit(me.areaid, NTC_UNIT_OBJECT, 394);
  361. }
  362. if (type == 1){
  363. if(NTConfig_IdInField){
  364. NT_FieldID();
  365. }
  366. count += NTCS_OpenSealInt(394, 7769, 5158);
  367. NTM_MoveTo(me.areaid, 7768, 5162);
  368. NTM_MoveTo(me.areaid, 7771, 5188);
  369. NTM_MoveTo(me.areaid, 7780, 5215);
  370. NTCS_KillSealBoss(monsterName);
  371. NTSI_PickItems();
  372. }
  373. else{
  374. if(NTConfig_IdInField){
  375. NT_FieldID();
  376. }
  377. count += NTCS_OpenSealInt(394, 7810, 5156);
  378. NTM_MoveTo(me.areaid, 7771, 5155);
  379. NTM_MoveTo(me.areaid, 7780, 5174);
  380. NTCS_KillSealBoss(monsterName);
  381. NTSI_PickItems();
  382. }
  383. if (_CSSealsOnly == false){
  384. if (type == 1)
  385. pos = [7771, 5229, 7792, 5244, 7771, 5259];
  386. else
  387. pos = [7813, 5229, 7792, 5244, 7771, 5259];
  388. while (pos.length > 0){
  389. NTM_MoveTo(me.areaid, pos.shift(), pos.shift());
  390. NTA_ClearPosition(20, true, 2);
  391. }
  392. }
  393. else{
  394. NTM_MoveTo(7792, 5229);
  395. NTM_MoveTo(7771, 5259);
  396. }
  397. return count;
  398. }
  399.  
  400. function NTCS_OpenSealVenomInt(type){
  401. var pos;
  402. var count = 0;
  403. var monsterName = GetLocaleString(2853);
  404. if (_CSSealsOnly == false){
  405. if (type == 1)
  406. pos = [
  407. 7825, 5315, 7841, 5294, 7858, 5275, 7858, 5315, 7841, 5294, 7858, 5294
  408. , 7882, 5294, 7893, 5315, 7903, 5294, 7933, 5294, 7915, 5270, 7903, 5294
  409. , 7893, 5318
  410. ];
  411. else
  412. pos = [
  413. 7825, 5315, 7841, 5294, 7858, 5294, 7874, 5315, 7874, 5275
  414. , 7885, 5275, 7905, 5275, 7933, 5275, 7933, 5294, 7993, 5315
  415. , 7909, 5315
  416. ];
  417. while (pos.length > 0){
  418. NTM_MoveTo(me.areaid, pos.shift(), pos.shift());
  419. NTA_ClearPosition(20, true, 2);
  420. }
  421. }
  422. //else
  423. //NTM_MoveToPresetUnit(me.areaid, NTC_UNIT_OBJECT, 392);
  424. if (type == 1){
  425. if(NTConfig_IdInField){
  426. NT_FieldID();
  427. }
  428. count += NTCS_OpenSealInt(392, 7895, 5318);
  429. NTM_MoveTo(me.areaid, 7900, 5294);
  430. NTCS_KillSealBoss(monsterName);
  431. NTSI_PickItems();
  432. NTM_MoveTo(me.areaid, 7903, 5294);
  433. count += NTCS_OpenSealInt(393, 7915, 5280);
  434. }
  435. else{
  436. if(NTConfig_IdInField){
  437. NT_FieldID();
  438. }
  439. count += NTCS_OpenSealInt(392, 7916, 5310);
  440. NTM_MoveTo(me.areaid, 7933, 5294);
  441. NTCS_KillSealBoss(monsterName);
  442. NTSI_PickItems();
  443. NTM_MoveTo(me.areaid, 7933, 5294);
  444. count += NTCS_OpenSealInt(393, 7905, 5277);
  445. }
  446. if (_CSSealsOnly == false){
  447. if (type == 1)
  448. pos = [7858, 5294, 7841, 5294, 7825, 5275];
  449. else
  450. pos = [7874, 5275, 7858, 5294, 7825, 5275];
  451. while (pos.length > 0){
  452. NTM_MoveTo(me.areaid, pos.shift(), pos.shift());
  453. NTA_ClearPosition(20, true, 2);
  454. }
  455. }
  456. else
  457. NTM_MoveTo(7825, 5275);
  458. return count;
  459. }
  460.  
  461. function NT_KillMonster(classid, retry){
  462. if(arguments.length < 2)
  463. retry = 0;
  464. var _target;
  465. if(NTConfig_AttackSkill[1] < 1)
  466. return false;
  467. _target = NTC_FindUnit(NTC_UNIT_MONSTER, classid, retry);
  468. if(!_target)
  469. return false;
  470. if(_target.IsAttackable()){
  471. var _attackcount = 0;
  472. while(_attackcount < 300 && NTA_IsValidMonster(_target)){
  473. if(NTA_Attack(_target, (_attackcount%30) == 0) < 2)
  474. break;
  475. _attackcount++;
  476. }
  477. }
  478. return (_target.hp <= 0 || _target.mode == 0 || _target.mode == 12);
  479. }
  480.  
  481. function HostileHandler(msg){
  482. if(msg == "pause"){
  483. if(_hostilepause){
  484. Print("yc3Resuming...");
  485. _hostilepause = false;
  486. }
  487. else {
  488. Print("yc1Pausing to kill hostiles...");
  489. _hostilepause = true;
  490.  
  491. ClickMap(NTC_CLICK_LUP, NTC_SHIFT_NONE, null);
  492. ClickMap(NTC_CLICK_RUP, NTC_SHIFT_NONE, null);
  493.  
  494. while(_hostilepause)
  495. NTC_Delay(250);
  496. }
  497. }
  498. }
  499.  
  500. function NT_DiabloLeechMessageHandler(){
  501. var _msg = NT_File("logs/messagecomands/"+me.charname+"-diablo.txt", 0);
  502. if (_msg && _msg != Diablo_PreMessage){
  503. Diablo_PreMessage = _msg;
  504. if(_msg.substring(_msg.indexOf("/") + 1) == "takedtp"){
  505. //Print(COLOR_2 + "retrieved take tp message diablo");
  506. return true;
  507. }
  508. }
  509. return false;
  510. }
Add Comment
Please, Sign In to add comment