Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 41.33 KB | None | 0 0
  1. const NTA_DAMAGE_NONE = 0;
  2. const NTA_DAMAGE_PHYSICAL = 1;
  3. const NTA_DAMAGE_MAGIC = 2;
  4. const NTA_DAMAGE_FIRE = 3;
  5. const NTA_DAMAGE_LIGHTNING = 4;
  6. const NTA_DAMAGE_COLD = 5;
  7. const NTA_DAMAGE_POISON = 6;
  8. var _NTA_SkillDamage=[];
  9. var _NTA_SkillDelay =[];
  10. var _NTA_SkillHand =[];
  11. var ignoreKorpse =[];
  12. const DEAD_MODE = (1<<29)|(1<<12);
  13. function NTA_KillBoss(classid)
  14. {
  15. var _target;
  16.  
  17. if(NTConfig_AttackBoss < 1)
  18. return false;
  19.  
  20. _target = NTC_FindMonster(classid);
  21.  
  22. if(_target)
  23. {
  24. if(NTConfig_AttackFirst > 0 && NTA_GetResistance(_target, NTA_GetDamageType(NTConfig_AttackFirst)) < 100)
  25. {
  26. if(NTC_IsLeftSkill(NTConfig_AttackFirst))
  27. NTC_DoCast(NTConfig_AttackFirst, 2, _target);
  28. else
  29. NTC_DoCast(NTConfig_AttackFirst, NTC_HAND_RIGHT, _target);
  30. }
  31.  
  32. return NTA_Attack(_target, true, 100);
  33. }
  34.  
  35. return false;
  36. }
  37.  
  38. function killChaosBoss() {
  39. var _target=getUnit(1),target;
  40. if(_target) {
  41. do {
  42. if(NTA_IsValidTarget(_target)&&chaosBoss(_target)) {
  43. target=copyUnit(_target);
  44. }if(target) {
  45. if(me.classid==1&&NTA_GetResistance(target,_NTA_SkillDamage[1])>=100)
  46. clearSection(40,40,0x08);
  47. NTA_Attack(target,false,200);
  48. }
  49. }while(_target.getNext());
  50. }function chaosBoss(_target) {
  51. if(_target.name==getLocaleString(2851)||_target.name==getLocaleString(2852)||_target.name==getLocaleString(2853))
  52. return true;
  53. return false;
  54. }NTP_UpdatePrecast();
  55. return false;
  56. }
  57.  
  58. function throneboss() {
  59. var _target=getUnit(1),target;
  60. if(_target) {
  61. do {
  62. if(throneBoss(_target)&&_target.x>15070&&_target.x<15121&&_target.y<5074&&_target.y>5001) {
  63. target=copyUnit(_target);
  64. }if(target) {
  65. if(me.classid==1&&NTA_GetResistance(target,_NTA_SkillDamage[1])>=100)
  66. clearSection(40,40,0x08);
  67. NTA_Attack(target,false,200);
  68. }
  69. }while(_target.getNext());
  70. }function throneBoss(_target) {
  71. if (_target.name==getLocaleString(21851)||_target.name==getLocaleString(21852)||_target.name==getLocaleString(21853)||_target.name==getLocaleString(21854)||_target.name==getLocaleString(21855))
  72. return true;
  73. return false;
  74. }NTP_UpdatePrecast();
  75. return false;
  76. }
  77.  
  78. function clearTP(range) {
  79. var _target=getUnit(1),target,townPortal=getUnit(2,59);
  80. if(arguments.length<1)range=20;
  81. if(_target) {
  82. do {
  83. if(NTA_IsValidTarget(_target)&&getDistance(_target,townPortal)<range) {
  84. target=copyUnit(_target);
  85. }if(target) {
  86. if(me.classid==1&&NTA_GetResistance(target,_NTA_SkillDamage[2])<100)
  87. NTA_SorceressAttackInt(target,false,100);
  88. else
  89. NTA_Attack(target,false,100);
  90. }
  91. }while(_target.getNext());
  92. }NTP_UpdatePrecast();
  93. return false;
  94. }
  95.  
  96. function first() {
  97. var _target=getUnit(1),target;
  98. if(_target) {
  99. do {
  100. if(attackFirst(_target)&&_target.x>15070&&_target.x<15121&&_target.y<5088&&_target.y>5001) {
  101. target=copyUnit(_target);
  102. }if(target) {
  103. if(me.classid==1&&NTA_GetResistance(target,_NTA_SkillDamage[2])<100)
  104. NTA_SorceressAttackInt(target,false,100);
  105. else
  106. NTA_Attack(target,false,100);
  107. }
  108. }while(_target.getNext());
  109. }function attackFirst(_target) {
  110. var Classes=[670,105];
  111. for(AClass in Classes) { if(_target.classid==Classes[AClass]) { return true; } }
  112. return false;
  113. }return false;
  114. }
  115.  
  116. function clearSection(xrange,yrange,spectype) {
  117. var _target=getUnit(1),target,x=me.x,y=me.y;
  118. if(arguments.length<1)
  119. xrange=20;
  120. if(arguments.length<2)
  121. yrange=20;
  122. if(arguments.length<3)
  123. spectype=0;
  124. if(_target) {
  125. do {
  126. if(NTA_IsValidTarget(_target)&&(spectype==0||(_target.spectype&spectype))&&Math.sqrt((x-_target.x)*(x-_target.x))<xrange&&Math.sqrt((y-_target.y)*(y-_target.y))<yrange) {
  127. target=copyUnit(_target);
  128. }if(target) {
  129. if(me.classid==1&&NTA_GetResistance(target,_NTA_SkillDamage[2])<100)
  130. NTA_SorceressAttackInt(target,false,100);
  131. else
  132. NTA_Attack(target,false,100);
  133. }
  134. }while(_target.getNext());
  135. }NTP_UpdatePrecast();
  136. return false;
  137. }
  138.  
  139. function clearThrone() {
  140. var _target=getUnit(1),target;
  141. if(_target) {
  142. do {
  143. if(NTA_IsValidTarget(_target)&&_target.x>15070&&_target.x<15121&&_target.y<5074&&_target.y>5001) {
  144. target=copyUnit(_target);
  145. }if(target) {
  146. throneboss();
  147. first();
  148. if(me.classid==1&&NTA_GetResistance(target,_NTA_SkillDamage[2])<100)
  149. NTA_SorceressAttackInt(target,false,100);
  150. else
  151. NTA_Attack(target,false,100);
  152. }
  153. }while(targets.getNext());
  154. }NTP_UpdatePrecast();
  155. return false;
  156. }
  157.  
  158. function clearchaosarea() {
  159. var _target=getUnit(1),target;
  160. if(_target) {
  161. do {
  162. if(NTA_IsValidTarget(_target)&&(_target.x<7823)&&(_target.x>7766)&&(_target.y<5368)&&(_target.y>5321)) {
  163. target=copyUnit(_target);
  164. if(me.classid==1&&NTA_GetResistance(target,_NTA_SkillDamage[2])<100)
  165. NTA_SorceressAttackInt(target,false,100);
  166. else
  167. NTA_Attack(target,false,100);
  168. }
  169. }while(_target.getNext());
  170. }NTP_UpdatePrecast();
  171. return false;
  172. }
  173.  
  174. function NTA_ClearPosition(range, spectype)
  175. {
  176. var _orgx, _orgy;
  177. var _target;
  178. var _killnum = 0;
  179. var _units = 0;
  180.  
  181. //if(NTConfig_AttackOthers < 1)
  182. // return false;
  183.  
  184. if(arguments.length < 1)
  185. range = 20;
  186.  
  187. if(arguments.length < 2)
  188. spectype = 0;
  189.  
  190. _orgx = me.x;
  191. _orgy = me.y;
  192.  
  193. var mobs = NTC_GetUnit(NTC_UNIT_MONSTER);
  194. var MobList = [];
  195. if(mobs){
  196. do {
  197. if(NTA_IsValidTarget(mobs))
  198. MobList.push(copyUnit(mobs));
  199. } while(mobs.getNext());
  200. }
  201. _units = 0;
  202.  
  203. if(MobList.length >0)
  204. {
  205. // print("Start Unit Loop.");
  206. MobList.sort(SortMonsters)
  207. while (MobList.length >= 1) {
  208. MobList.sort(SortMonsters)
  209. _target = copyUnit(MobList[MobList.length-1]); // not sure if this is right
  210. MobList.pop();
  211.  
  212.  
  213. if(NTA_IsValidTarget(_target) && (spectype == 0 || (_target.spectype & spectype)) && //getDistance(_orgx, _orgy, _target.x, _target.y) < range)
  214. (_orgx - range <_target.x) && (_orgx + range >_target.x) && //square vs circle calc
  215. (_orgy - range <_target.y) && (_orgy + range >_target.y))
  216. {
  217. //PreCasting
  218. if(_killnum == 0 && _target.hp > 0)
  219. {
  220.  
  221. if(NTConfig_AttackFirst > 0 && NTA_GetResistance(_target, NTA_GetDamageType(NTConfig_AttackFirst)) < 100 && checkCollision(me, _target, 3) == 0)
  222. {
  223.  
  224. if(NTC_IsLeftSkill(NTConfig_AttackFirst))
  225. {
  226. NTC_DoCast(NTConfig_AttackFirst, 2, _target);
  227. }
  228. else
  229. {
  230. NTC_DoCast(NTConfig_AttackFirst, NTC_HAND_RIGHT, _target);
  231. }
  232.  
  233. // PickIt (FastSnag)
  234. NTSI_FastSnag();
  235. }
  236. }
  237. if(NTA_Attack(_target, false, 20))
  238. {
  239. _killnum++;
  240. }
  241.  
  242. }
  243.  
  244. }
  245. }
  246.  
  247. //Post casting
  248. if (me.classid == NTC_CHAR_CLASS_NECROMANCER){ //build army
  249. if (XP_useSkel) {
  250. var success = XP_CheckRevives(70,363);
  251. }
  252. // Check Skeleton Mages
  253. if (XP_useSkelMage && success) {
  254. success = XP_CheckRevives(80,364);
  255. }
  256. // Check Revives
  257. if (XP_useRevive && success) {
  258. success = XP_CheckRevives(95);
  259. }
  260. }
  261. if(me.classid == NTC_CHAR_CLASS_PALADIN)
  262. {
  263. if(NTConfig_UseRedemption && _killnum > 1 && NTC_PutSkill(124, NTC_HAND_RIGHT))
  264. {
  265. NTC_PingDelay(750);
  266. }
  267. }
  268.  
  269. return (_killnum > 0);
  270. }
  271.  
  272. function isRoomReachable(room){
  273. var col = room.getCollision();
  274. //print("x size"+ room.xsize+" y size"+ room.ysize);
  275. /*
  276. for (var x =1; x < room.xsize; x++){
  277. if (col[0][x] ==0)
  278. return [room.x*5+x,room.y*5]
  279. if (col[room.ysize-1][x] ==0)
  280. return [room.x*5+x,room.y*5+room.ysize]
  281. }
  282. for (var y =1; y < room.ysize; y++){
  283. if (col[y][0] ==0)
  284. return [room.x*5,room.y*5+y]
  285. if (col[y][room.xsize-1] ==0)
  286. return [room.x*5+room.xsize,room.y*5+y]
  287. }
  288. */
  289. var size = (room.ysize > room.xsize ? room.ysize : room.xsize)
  290. for (var y =1; y < room.xsize -1; y++){
  291. for (var x =1; x < room.ysize-1; x++){
  292. if (col[x][y] == 0)
  293. //if(col[x-1][y] == && col[x-1][y-1] == 0 && col[x+1][y] == 0 && col[x+1][y+1] == 0 )
  294. return [room.x*5+y,room.y*5+x,size]; // this is probly wrong fixed x/y swap
  295.  
  296. }
  297. }
  298. // dumpRoom(room)
  299. return false;
  300. }
  301. function dumpRoom(room){
  302. var col = room.getCollision();
  303. var output ="";
  304. sendCopyData(null, "OOG", 0,room.x+" "+room.y);
  305. for (var x =0; x < room.xsize ; x++){
  306. output=" ";
  307.  
  308. for (var y =0; y < room.ysize; y++){
  309. output= output + col[x][y];
  310. }
  311. sendCopyData(null, "OOG", 0,output+" ");
  312. }
  313. return false;
  314. }
  315. function NTA_ClearRooms(AttackRoutine,minX,minY,maxX,maxY)
  316. {
  317.  
  318. if (minX > maxX){
  319. var tempx = maxX;
  320. maxX = minX;
  321. minX = tempx;
  322. }
  323. if (minX > maxX){
  324. var tempy = maxY;
  325. maxY = minY;
  326. minY = tempy;
  327. }
  328. var _room;
  329. var _rooms;
  330. var rx,ry,path,reachable;
  331. _room = getRoom();
  332.  
  333. if(!_room)
  334. return false;
  335.  
  336. _rooms = new Array();
  337. var size = (_room.xsize > _room.ysize) ? _room.xsize : _room.ysize ;
  338. do
  339. {
  340. rx = parseInt(_room.x*5 + _room.xsize/2);
  341. ry = parseInt(_room.y*5 + _room.ysize/2)
  342. //path= getPath(me.area, me.x, me.y, rx, ry,false);
  343.  
  344. reachable =isRoomReachable(_room);
  345. if (reachable){
  346. //if (reachable[0]==7741)
  347. // dumpRoom(_room);
  348. //
  349. if (maxX && maxY){
  350. if (rx <maxX && ry <maxY && rx > minX && ry > minY){
  351. _rooms.push([reachable[0],reachable[1]])//([parseInt(_room.x*5 + _room.xsize/2), parseInt(_room.y*5 + _room.ysize/2)]);
  352. }
  353. }else{
  354. _rooms.push([reachable[0],reachable[1]])//[parseInt(_room.x*5 + _room.xsize/2), parseInt(_room.y*5 + _room.ysize/2)]);
  355. }
  356. }
  357.  
  358. } while(_room.getNext());
  359.  
  360. while(_rooms.length > 0)
  361. {
  362. _rooms.sort(NTA_SortRoomInt);
  363. _room = _rooms.shift();
  364. print(_rooms.toSource());
  365. NTM_MoveTo(_room[0], _room[1]);
  366. if(typeof(AttackRoutine) == 'function'){
  367. if(!AttackRoutine(size))
  368. return false;
  369. }else{
  370. NTA_ClearPosition(size+10); //clear as big as the room are some are up to 60
  371. NTSI_PickItems();
  372. NTP_UpdatePrecast();
  373. }
  374. }
  375. return true;
  376. }
  377.  
  378.  
  379.  
  380.  
  381. function NTA_IsValidTarget(monster, simple)
  382. {
  383. if (monster && monster.type == 0 && NT_HostileAction ==2){
  384. return true;
  385. }
  386. if(!monster || (monster.type != NTC_UNIT_MONSTER) )// added for pking
  387. return false;
  388.  
  389. if(monster.mode == 0 || monster.mode == 12 || monster.hp <= 0)
  390. return false;
  391.  
  392. if(arguments.length < 2)
  393. simple = false;
  394.  
  395. if(!simple)
  396. {
  397. if(!monster.name)
  398. return false;
  399.  
  400. switch(monster.name.toLowerCase())
  401. {
  402. case "dummy":
  403. case "an evil force":
  404. return false;
  405. }
  406.  
  407. switch(monster.classid)
  408. {
  409. case 271: // Merc
  410. case 338:
  411. case 359:
  412. case 561:
  413.  
  414. case 356: // Decoy
  415. case 357: // Valkyrie
  416. case 418: // Shadow Warrior
  417. case 419: // Shadow Master
  418.  
  419. case 363: // Necro Skeleton
  420. case 364: // Necro Mage
  421.  
  422. case 366: // Compelling Orb
  423. case 406: // Izual's Spirit
  424.  
  425. case 266: // Act1: Flavie (Navi) -> Between BloodMoor & ColdPlains
  426. case 408: // Act4: Hadriel (Malachai) -> Entrance of River of Flames
  427.  
  428. case 516: // Act5: Impact point for Catapults (Invisible) -> Frigid Highlands
  429. case 517: // Act5: Impact point for Catapults (Invisible)
  430. case 518: // Act5: Impact point for Catapults (Invisible) -> Bloodyfoot Hill
  431. case 519: // Act5: Impact point for Catapults (Invisible)
  432. case 522: // Act5: Combatant Barbarian
  433. case 523: // Act5: Combatant Barbarian
  434.  
  435. case 543: // Baal on stairs outside Worldstone Chamber
  436. case 545: // Baal taunts
  437. return false;
  438. }
  439.  
  440. if(monster.classid >= 289 && monster.classid <= 292) // Necro's Golem
  441. return false;
  442.  
  443. if((monster.classid >= 326 && monster.classid <= 330) || (monster.classid >= 410 && monster.classid <= 417)) // Traps
  444. return false;
  445.  
  446. if(monster.classid >= 351 && monster.classid <= 353) // Hydra
  447. return false;
  448.  
  449. if(monster.classid >= 420 && monster.classid <= 432) // Druid's friend
  450. return false;
  451. }
  452.  
  453. if(((monster.classid >= 110 && monster.classid <= 113) || monster.classid == 608) && monster.mode == 8)
  454. return false;
  455.  
  456. if(monster.classid == 68 && monster.mode == 14)
  457. return false;
  458.  
  459. if((monster.classid == 258 || monster.classid == 261) && monster.mode == 14)
  460. return false;
  461.  
  462. if(monster.getStat(172) == 2 || monster.getState(105) == 0)
  463. return false;
  464.  
  465. if(monster.getState(53) || monster.getState(96)) // Conversion, Revive
  466. return false;
  467.  
  468. //if(getBaseStat(1, monster.classid, 23))
  469. // return false;
  470. //if(checkCollision(monster, monster, 3)){
  471. //print("mob off wall")
  472.  
  473. //}
  474.  
  475. if(monster.classid==306&&checkCollision(me,monster,1)||monster.classid==693&&checkCollision(me,monster,3))
  476. return false;
  477.  
  478. return true;
  479. }
  480.  
  481. // cwkim - Check later
  482. function NTA_GetDamageType(skillid)
  483. {
  484. switch(skillid)
  485. {
  486. case 74: // Corpse Explosion
  487. case 106: // Zeal
  488. case 107: // Charge
  489. case 151: // Whirlwind
  490. return NTA_DAMAGE_PHYSICAL;
  491.  
  492. case 112: // Blessed Hammer
  493. return NTA_DAMAGE_MAGIC;
  494.  
  495. case 47: // Fire Ball
  496. case 56: // Meteor
  497. return NTA_DAMAGE_FIRE;
  498.  
  499. case 48: // Nova
  500. case 49: // Lightning
  501. case 53: // Chain Lightning
  502. return NTA_DAMAGE_LIGHTNING;
  503.  
  504. case 59: // Blizzard
  505. case 64: // Frozen Orb
  506. return NTA_DAMAGE_COLD;
  507.  
  508. case 92: // Poison Nova
  509. return NTA_DAMAGE_POISON;
  510. }
  511.  
  512. var _etype;
  513.  
  514. if(skillid == 74)
  515. return NTA_DAMAGE_PHYSICAL;
  516. if(skillid == 101)
  517. return NTA_DAMAGE_NONE;
  518. _etype = getBaseStat(3, parseInt(skillid, 10), 211);
  519.  
  520. switch(_etype)
  521. {
  522. case 0: return NTA_DAMAGE_PHYSICAL;
  523. case 1: return NTA_DAMAGE_FIRE;
  524. case 2: return NTA_DAMAGE_LIGHTNING;
  525. case 3: return NTA_DAMAGE_MAGIC;
  526. case 4: return NTA_DAMAGE_COLD;
  527. case 5: return NTA_DAMAGE_POISON;
  528. }
  529.  
  530. return NTA_DAMAGE_NONE;
  531. }
  532.  
  533. function NTA_GetResistance(enemy, type)
  534. {
  535. if(!enemy)
  536. return false;
  537.  
  538. if(arguments.length == 2)
  539. {
  540. switch(type)
  541. {
  542. case NTA_DAMAGE_PHYSICAL:
  543. return enemy.getStat(36);
  544.  
  545. case NTA_DAMAGE_MAGIC:
  546. return enemy.getStat(37);
  547.  
  548. case NTA_DAMAGE_FIRE:
  549. return enemy.getStat(39);
  550.  
  551. case NTA_DAMAGE_LIGHTNING:
  552. return enemy.getStat(41);
  553.  
  554. case NTA_DAMAGE_COLD:
  555. return enemy.getStat(43);
  556.  
  557. case NTA_DAMAGE_POISON:
  558. return enemy.getStat(45);
  559. }
  560. }
  561.  
  562. return 0;
  563. }
  564.  
  565. function NTA_Attack(target, boss, maxattacks)
  566. {
  567. switch(me.classid)
  568. {
  569. case NTC_CHAR_CLASS_AMAZON:
  570. return NTA_AmazonAttackInt(target, boss, maxattacks);
  571.  
  572. case NTC_CHAR_CLASS_SORCERESS:
  573. return NTA_SorceressAttackInt(target, boss, maxattacks);
  574.  
  575. case NTC_CHAR_CLASS_NECROMANCER:
  576. return NTA_NecromancerAttackInt(target, boss, maxattacks);
  577.  
  578. case NTC_CHAR_CLASS_PALADIN:
  579. return NTA_PaladinAttackInt(target, boss, maxattacks);
  580.  
  581. case NTC_CHAR_CLASS_BARBARIAN:
  582. return NTA_BarbarianAttackInt(target, boss, maxattacks);
  583.  
  584. case NTC_CHAR_CLASS_DRUID:
  585. return NTA_DruidAttackInt(target, boss, maxattacks);
  586.  
  587. case NTC_CHAR_CLASS_ASSASSIN:
  588. return NTA_AssassinAttackInt(target, boss, maxattacks);
  589. }
  590.  
  591. return false;
  592. }
  593.  
  594. // Internal function
  595. function NTA_AmazonAttackInt(target,boss,maxattacks) {
  596. var attack=0,prehp=target.hp,hits=0,misses=0;
  597. while(attack++<maxattacks&&!target.hp>0) {
  598. if(target.classid==243||target.classid==544) {
  599. if(attack==1||attack%3==0&&miss||getDistance(me,target)>3)
  600. NTM_MoveTo(target.x+1,target.y+2);
  601. }else {
  602. if(attack==1||getDistance(me,target)>35)
  603. NTA_MoveCloseInt(target,20);
  604. if(attack%6==0&&miss&&getDistance(me,target)>3)
  605. NTA_MoveCloseInt(target,Math.round(getDistance(me,target)-6));
  606. }if(getDistance(me,target)>3)
  607. me.setSkill(2,0);
  608. me.setSkill(24,0);
  609. if(target.hp>0&&clickMap(3,1,target))if(delay(100))if(clickMap(2))delay(100);
  610. var hit=target.hp<prehp,miss=target.hp>=prehp; if(hit)hits++; if(miss)misses++;
  611. }NTSI_FastSnag();
  612. if(NTConfig_CheckSafe)
  613. NTTMGR_CheckSafe(1);
  614. return true;
  615. }
  616.  
  617. function NTA_SorceressAttackInt(target,boss,maxattacks) {
  618. var _primaryindex=boss?1:2,attack=0,range1,range2,prehp=target.hp,hits=0,misses=0;
  619. if(NTConfig_AttackSkill[1]==48||NTConfig_AttackSkill[2]==48)
  620. range1=10;
  621. else
  622. range1=20;
  623. if(NTConfig_AttackSkill[3]==48||NTConfig_AttackSkill[4]==48||NTConfig_AttackSkill[5]==48)
  624. range2=10;
  625. else
  626. range2=20;
  627. if(NTConfig_CastStatic<100) {
  628. var _staticlevel=NTC_CheckSkill(42);
  629. if(boss&&_staticlevel>0&&target.getStat(41)<100&&(boss||checkCollision(me,target,3)==0)) {
  630. var _cast=0,_staticrange=Math.floor(1.0+0.668*_staticlevel);
  631. if(parseInt(target.hp*100/128)>NTConfig_CastStatic)
  632. NTA_MoveCloseInt(target,20);
  633. while(_cast++<10&&parseInt(target.hp*100/128)>NTConfig_CastStatic) {
  634. if(me.setSkill(42,0))
  635. if(clickMap(3,1,target))if(delay(100))if(clickMap(5))delay(100);
  636. }
  637. }
  638. }if(NTConfig_AttackSkill[0]>0) {
  639. NTA_MoveCloseInt(target,range1);
  640. if(me.setSkill(NTConfig_AttackSkill[0],0))
  641. if(clickMap(3,1,target))if(delay(100))if(clickMap(5))delay(100);
  642. }while(attack++<maxattacks&&target.hp>0) {
  643. if(NTA_GetResistance(target,_NTA_SkillDamage[_primaryindex])<100) {
  644. if((target.classid==243||target.classid==544)&&getDistance(me,target)>6)
  645. NTM_MoveTo(target.x+2,target.y+5);
  646. else if(attack==1||attack%3==0&&miss&&attack<13&&getDistance(me,target)>range1)
  647. NTA_MoveCloseInt(target,range1);
  648. if(!(target.classid==243||target.classid==544)&&getDistance(me,target)<3&&hits>3)
  649. NTM_MoveTo(target.x+2,me.y+3);
  650. if(!boss&&attack%3==0&&miss)
  651. NTA_MoveCloseInt(target,Math.round(getDistance(me,target)-3));
  652. doCastInt(_primaryindex, target);
  653. }else if(NTConfig_AttackSkill[4]>0&&NTA_GetResistance(target,_NTA_SkillDamage[4])<100) {
  654. if(attack==1||attack%3==0&&miss&&getDistance(me,target)>range2)
  655. NTA_MoveCloseInt(target,range2);
  656. if(getDistance(me,target)<3&&hits>3)
  657. NTM_MoveTo(target.x+2,me.y+3);
  658. if(attack%3==1&&miss)
  659. NTA_MoveCloseInt(target,Math.round(getDistance(me,target)-3));
  660. doCastInt(4, target);
  661. }else if(NTConfig_UseMerc&&me.getMerc()) {
  662. if(getDistance(me,target)<3&&hits>3)
  663. NTM_MoveTo(target.x+2,me.y+3);
  664. if(getDistance(me, target)>6)
  665. if(NTA_MoveCloseInt(target,3))delay(1000);
  666. me.setSkill(NTConfig_AttackSkill[2],0);
  667. if(clickMap(3,1,target))if(delay(100))if(clickMap(5))delay(100);
  668. }var hit=target.hp<prehp,miss=target.hp>=prehp; if(hit)hits++; if(miss)misses++;
  669. }NTSI_FastSnag();
  670. if(NTConfig_CheckSafe)
  671. NTTMGR_CheckSafe(1);
  672. return true;
  673. }
  674.  
  675. function getCurseState(curse){
  676. if (curse == 66) // Amplify Damage
  677. return 9;
  678. if (curse == 76) //iron maden
  679. return 55;
  680. if (curse == 82) //life tap
  681. return 58;
  682. if (curse == 87)//Decrepify
  683. return 60;
  684. if (curse == 91) //lower resist
  685. return 61;
  686. return 1;
  687. }
  688. function getIntoLOS(target){
  689. //for (var j = 0 ; j <15 ; j++){
  690. // sendCopyData(null, "OOG", 0,"col "+j +" " +checkCollision(me, target,j)+ "x: "+target.x);
  691. //}
  692.  
  693. if(checkCollision(me, target,10)){
  694. print("moving closer collision 10")
  695. NTA_MoveCloseInt(target, Math.round(getDistance(me, target)/2));
  696. }
  697. if(checkCollision(me, target,2)){
  698. print("moving closer collision 2")
  699. NTA_MoveCloseInt(target, Math.round(getDistance(me, target)/2));
  700. }
  701. if(checkCollision(me, target,1)){
  702. print("moving closer collision 1")
  703. NTA_MoveCloseInt(target, Math.round(getDistance(me, target)/2));
  704. }
  705. }
  706. function NTA_NecromancerAttackInt(target, boss, maxattacks)
  707. {
  708. var _maxattacks = 0
  709. //move these to global
  710. var armySize = 0;
  711. var success;
  712.  
  713.  
  714. while(_maxattacks++ < maxattacks && NTA_IsValidTarget(target, true) && target.hp > 0){
  715. armySize =me.getMinionCount(4)+me.getMinionCount(5)+me.getMinionCount(6);
  716. if (armySize > XP_BuildArmyThresh){
  717. if(target && (!target.getState(getCurseState(XP_Curse)) ) && target.classid != 371)
  718. NTC_DoCast(XP_Curse,0,target);
  719. }else{
  720. if(target && (!target.getState(getCurseState(XP_BuildArmyCurse)) ) && target.classid != 371)
  721. NTC_DoCast(XP_BuildArmyCurse,0,target);
  722. }
  723.  
  724.  
  725.  
  726. getIntoLOS(target);
  727. if (boss)
  728. NTC_DoCast(NTConfig_AttackBoss,0,target);
  729. else
  730. NTC_DoCast(NTConfig_AttackOthers,0,target);
  731.  
  732. if (armySize > XP_BuildArmyThresh && getDistance(me.x,me.y,target.x,target.y)>5){
  733. //sendCopyData(null, "OOG", 0,"going closer");
  734. NTM_MoveTo(target.x+1, target.y, 0) //stay on mob if we got army going
  735. clickMap(0,0,me.x,me.y+1);
  736. }
  737. if (XP_CorpseExplosion) {
  738. XP_UseNecroCE(target);
  739. }
  740. if (XP_useSkel) {
  741. var success = XP_CheckRevives(70,363);
  742. }
  743. // Check Skeleton Mages
  744. if (XP_useSkelMage && success) {
  745. success = XP_CheckRevives(80,364);
  746. }
  747. // Check Revives
  748. if (XP_useRevive && success) {
  749. success = XP_CheckRevives(95);
  750. }
  751. }
  752.  
  753.  
  754. }
  755. function XP_CheckRevives(reviveSkill,reviveID) {
  756. if (reviveSkill != 70 && reviveSkill != 80 && reviveSkill != 95){
  757. //DC_DPrint("XP_CheckRevives() -> Invalid skill passed!");
  758. return false;
  759. }
  760. var success = false;
  761. var haveRevive = 0;
  762. var maxRevives = XP_MaxRevives(reviveSkill);
  763. var needMana = 0;
  764. var skeltype = 0;
  765. var XP_ToRevive = 3;
  766. var i = 0;
  767. // get the right skeltype id (4 = skeleton, 5 = skeletonmage, 6 = revive)
  768. switch(reviveSkill){
  769. case 70:
  770. needMana = 5 + NTC_CheckSkill(reviveSkill);
  771. skeltype = 4;
  772. break;
  773. case 80:
  774. needMana = 7 + NTC_CheckSkill(reviveSkill);
  775. skeltype = 5;
  776. break;
  777. case 95:
  778. needMana = 45;
  779. skeltype = 6;
  780. break;
  781. }
  782. // Count my revives
  783. haveRevive = me.getMinionCount(skeltype);//0;
  784. success = (haveRevive >= maxRevives || me.mp <= needMana);
  785. //XP_ToRevive controls how many corpses to proccess per function call
  786. while (haveRevive < maxRevives && me.mp > needMana && i++ < XP_ToRevive) {
  787. var korpse = getBodyTarget(25);
  788. if (reviveSkill == 95) {
  789. if (korpse && ((korpse.spectype & 0x07) == 0) && korpse.classid != 571
  790. && korpse.classid != 572 && korpse.classid != 573
  791. && korpse.classid != 312 && korpse.classid != 702
  792. && getBaseStat(6, korpse.classid, 8) && getBaseStat(6, korpse.classid, 9)) {
  793. //DC_DPrint("Reviving " + korpse.name + " from range " + DA_GetRange(korpse));
  794. // print("Reviving " + korpse.name + " from range " + DA_GetRange(korpse));
  795. getIntoLOS(korpse);
  796. //print("Raising " + (reviveSkill == 70 ? "Skel": "Mage") + " from " + korpse.name + " from range " + getDistance(me,korpse));
  797. NTC_DoCast(reviveSkill,0,korpse.x,korpse.y,1); // casting revive fails some times so im just going to try once
  798. //delay(500);
  799. success = true;
  800. }
  801. else if (!korpse){
  802. break;
  803. }
  804. }
  805. else { // Skel or SkelMage
  806. if(korpse){
  807. var iLoop = 0;
  808. //DC_DPrint("Raising " + (reviveSkill == 70 ? "Skel": "Mage") + " from " + korpse.name + " from range " + DA_GetRange(korpse));
  809.  
  810. while(korpse && haveRevive == me.getMinionCount(skeltype) && iLoop++ < XP_ToRevive){
  811. //print("in loop: "+iLoop+" haveRevive = " + haveRevive + " minionCount = " + me.getMinionCount(skeltype));
  812. getIntoLOS(korpse);
  813. if(getDistance(me.x,me.y,korpse.x,korpse.y) <40){
  814. //print("Raising " + (reviveSkill == 70 ? "Skel": "Mage") + " from " + korpse.name + " from range " + getDistance(me,korpse));
  815. NTC_DoCast(reviveSkill,0,korpse.x,korpse.y,1);
  816. //delay(500);
  817. //delay(((typeof me.serverip !== "undefined") ? me.ping : 50));
  818. }
  819. }
  820. success = true;
  821. }
  822. else{
  823. break;
  824. }
  825. }
  826. delay(300);
  827. haveRevive = me.getMinionCount(skeltype);
  828. }
  829. return success;
  830. }
  831. function XP_MaxRevives(revSkill) {
  832. switch(revSkill){
  833. case 70:
  834. return((me.getSkill(70,1) < 4) ? me.getSkill(70,1) : 2 + Math.floor(me.getSkill(70,1) / 3));
  835. case 80:
  836. return((me.getSkill(80,1) < 4) ? me.getSkill(80,1) : 2 + Math.floor(me.getSkill(80,1) / 3));
  837. case 95:
  838. return(me.getSkill(95,1));
  839. }
  840. return false;
  841. }
  842. function XP_UseNecroCE(target) {
  843. if (!target || target.hp < 1 || (target.getStat(36) > 99 && target.getStat(39) > 99)) return;
  844. var CE_level = NTC_CheckSkill(74);
  845. var CEa = (CE_level - 1) / 3;
  846. var CE_rad = 2.6 + CEa;
  847. var bomb = getBodyTarget(25,target.x,target.y,CE_rad);
  848. //if (bomb && target && target.hp > 0 && me.mp > 20 && DA_GetRangeXY(target,bomb.x,bomb.y) <= CE_rad) {
  849. if (bomb && target && target.hp > 0 && me.mp > 20 && getDistance(target.x,target.y,bomb.x,bomb.y) <= CE_rad) {
  850. //DC_DoCast(74,0,bomb);
  851. NTC_DoCast(74,0, bomb);
  852. delay(100);
  853. }
  854. }
  855. function getBodyTarget(range,tagX,tagY,dist) {
  856. var body_target = false;
  857.  
  858. var BodyTarget = getUnit(1, null, DEAD_MODE);
  859. if(BodyTarget) do {
  860. if (BodyTarget.getStat(172) == 2 || BodyTarget.getState(105) == 0) {
  861. continue;
  862. }
  863. if (BodyTarget.getState(99) || BodyTarget.getState(104) || BodyTarget.getState(118)) {
  864. continue;
  865. }
  866. // Use NeverCount base monstat for traps, hydra, etc.
  867. if (getBaseStat(1,BodyTarget.classid,23)) {
  868. continue;
  869. }
  870. if(getDistance(me, BodyTarget) < (!range ? 25 : range) && !BodyTarget.getParent() &&
  871. /*BodyTarget.classid != 271 && BodyTarget.classid != 289 &&
  872. BodyTarget.classid != 290 && BodyTarget.classid != 291 &&
  873. BodyTarget.classid != 292 && BodyTarget.classid != 338 &&
  874. BodyTarget.classid != 351 && BodyTarget.classid != 352 &&
  875. BodyTarget.classid != 353 && BodyTarget.classid != 359 &&
  876. BodyTarget.classid != 363 && BodyTarget.classid != 364 &&
  877. BodyTarget.classid != 371 && BodyTarget.classid != 543 &&
  878. BodyTarget.classid != 561 && */
  879. getBaseStat(6, BodyTarget.classid, 8) &&
  880. (((me.area == 132 || me.area == 131) && ((me.x < 15099) && (me.x > 15088)) && ((me.y < 5022) && (me.y > 5006))) ||
  881. !checkCollision(me.area,me.x,me.y,3,BodyTarget.x,BodyTarget.y,3,7))) {
  882. var skipTarget=false;
  883. for(var tk = 0; tk<ignoreKorpse.length; tk++) {
  884. if(ignoreKorpse[tk] == BodyTarget.gid) {
  885. skipTarget=true;
  886. break;
  887. }
  888. }
  889. if (tagX && getDistance (tagX,tagY, BodyTarget.x,BodyTarget.y) > dist)
  890. skipTarget = true;
  891. if(!skipTarget) {
  892. ignoreKorpse.push(BodyTarget.gid);
  893. return BodyTarget;
  894. }
  895. }
  896. }while(BodyTarget.getNext(null,DEAD_MODE));
  897. return false;
  898. }
  899.  
  900. function NTA_PaladinAttackInt(target,boss,maxattacks) {
  901. var attack=0,prehp=target.hp,hits=0,misses=0,castfirst,checkmajic,checklight,checkphysical,hammers,secondary,holybolt,foh,foh4immune,dolls,achmel;
  902. if(NTConfig_AttackFirst>0)castfirst=true;
  903. if(NTConfig_AttackOthers==112||NTConfig_AttackBoss==112)hammers=true;
  904. if(NTConfig_AttackOthers==121||NTConfig_AttackBoss==121)foh=true;
  905. if(NTConfig_AttackSecondary>0)secondary=true;
  906. if(NTConfig_AttackSecondary==121)foh4immune=true;
  907. if(hammers) {
  908. if(NTA_GetResistance(target,2)<100)checkmajic=true;
  909. }else if(foh||foh4immune) {
  910. if(NTA_GetResistance(target,4)<100)checklight=true;
  911. }else {
  912. if(NTA_GetResistance(target,1)<100)checkphysical=true;
  913. }if(NTConfig_AttackSecondary==101)holybolt=true;
  914. if(target.classid==691)dolls=true;
  915. if(target.name==getLocaleString(21852))achmel=true;
  916. while(attack++<maxattacks&&target.hp>0) {
  917. if(attack==1) {
  918. if(hammers) {
  919. if(dolls&&!foh4immune)
  920. NTA_MoveCloseInt(target,6);
  921. if(boss&&!foh4immune)
  922. NTM_MoveTo(target.x+1,target.y+2);
  923. }if(castfirst&&me.setSkill(NTConfig_AttackFirst, 0))
  924. if(clickMap(3,1,target))if(delay(100))if(clickMap(5))delay(100);
  925. }if(hammers) {
  926. if(checkmajic) {
  927. if(dolls) {
  928. if(getDistance(me,target)>6)NTA_MoveCloseInt(target,6);
  929. if(attack>1&&miss)NTM_MoveTo(target.x-5,target.y+1);
  930. if(getDistance(me,target)<6) {
  931. if(me.x<target.x)NTM_MoveTo(target.x-5,target.y);
  932. if(me.x>target.x)NTM_MoveTo(target.x+5,target.y);
  933. if(me.y<target.y)NTM_MoveTo(target.x,target.y-5);
  934. if(me.y>target.y)NTM_MoveTo(target.x,target.y+5);
  935. }me.setSkill(NTConfig_PutAura,0);
  936. me.setSkill(112,1);
  937. if(clickMap(0,1,target))if(delay(100))if(clickMap(2))delay(100);
  938. }else {
  939. if(boss) {
  940. if(attack%3==0&&miss||getDistance(me,target)>3) {
  941. NTM_MoveTo(target.x+1, target.y+2);
  942. }
  943. }else {
  944. if(!boss&&attack==1&&getDistance(me,target)<20||getDistance(me,target)>3&&getDistance(me,target)<20)
  945. if(me.setSkill(54,0))clickMap(3,0,target);
  946. if(getDistance(me,target)<20&&attack%3==0&&miss) {
  947. me.setSkill(54,0);
  948. if(attack%2==1)
  949. clickMap(3,0,target.x+rnd(-1,1),target.y+rnd(-1,1));
  950. else
  951. clickMap(3,0,target);
  952. }if(getDistance(me,target)>20)NTM_MoveTo(target.x+1,target.y);
  953. }me.setSkill(NTConfig_PutAura,0);
  954. me.setSkill(112,1);
  955. if(target.hp<=0) break;
  956. if(clickMap(0,1,target))if(delay(100))if(clickMap(2))delay(100);
  957. }
  958. }else if(secondary) {
  959. if(holybolt) {
  960. if(getDistance(me,target)>3)NTA_MoveCloseInt(target,3);
  961. if(attack%3==1&& miss)NTA_MoveCloseInt(target,1);
  962. if(me.x>target.x)if(clickMap(0,0,target.x-1,me.y-1))delay(100);if(clickMap(2))delay(100);
  963. if(me.x<target.x)if(clickMap(0,0,target.x+1,me.y+1))delay(100);if(clickMap(2))delay(100);
  964. if(achmel) me.setSkill(124,0);else me.setSkill(NTConfig_PutAura,0);
  965. me.setSkill(101,1);
  966. if(clickMap(0,1,target))if(delay(100))if(clickMap(2))delay(100);
  967. }else if(foh4immune) {
  968. if(getDistance(me, target)>20)NTA_MoveCloseInt(target,20);
  969. if(achmel)me.setSkill(124,0);else me.setSkill(NTConfig_PutAura,0);
  970. me.setSkill(121,1);
  971. if(clickMap(0,1,target))if(delay(100))if(clickMap(2))delay(100);
  972. }else {
  973. if(getDistance(me,target)>3)NTA_MoveCloseInt(target,1);
  974. me.setSkill(NTConfig_PutAura,0);
  975. me.setSkill(NTConfig_AttackSecondary,1);
  976. if(clickMap(0,0,target))if(delay(100))if(clickMap(2))delay(100);
  977. }
  978. }
  979. }else if(foh) {
  980. if(checklight) {
  981. if((target.classid==243||target.classid==544)&&getDistance(me,target)>6)NTA_MoveCloseInt(target,3);
  982. else if(getDistance(me,target)>20)NTA_MoveCloseInt(target,20);
  983. me.setSkill(NTConfig_PutAura,0);
  984. me.setSkill(121,1);
  985. if(clickMap(0,1,target))if(delay(100))if(clickMap(2))delay(100);
  986. }else if(secondary) {
  987. if(getDistance(me,target)>3)NTA_MoveCloseInt(target,1);
  988. me.setSkill(NTConfig_PutAura,0);
  989. me.setSkill(NTConfig_AttackSecondary,1);
  990. if(clickMap(0,0,target))if(delay(100))if(clickMap(2))delay(100);
  991. }
  992. }else {
  993. if(checkphysical) {
  994. if(getDistance(me,target)>6)NTA_MoveCloseInt(target,3);
  995. me.setSkill(NTConfig_PutAura,0);
  996. if(boss)me.setSkill(NTConfig_AttackBoss,1);else me.setSkill(NTConfig_AttackOthers,1);
  997. if(clickMap(0,0,target))if(delay(100))if(clickMap(2))delay(100);
  998. }else if(secondary) {
  999. if(getDistance(me,target)>6)NTA_MoveCloseInt(target,3);
  1000. me.setSkill(NTConfig_PutAura,0);
  1001. me.setSkill(NTConfig_AttackSecondary,1);
  1002. if(clickMap(0,0,target))if(delay(100))if(clickMap(2))delay(100);
  1003. }
  1004. }var hit=target.hp<prehp,miss=target.hp>=prehp; if(hit)hits++; if(miss)misses++;
  1005. }NTSI_FastSnag();
  1006. if(NTConfig_CheckSafe)
  1007. NTTMGR_CheckSafe(1);
  1008. return true;
  1009. }
  1010.  
  1011. function NTA_BarbarianAttackInt(target, boss, maxattacks) { //Whirl Wind only!
  1012. var _maxattacks = 0;
  1013. while(_maxattacks++ < maxattacks && target.hp>0) {
  1014. if(getDistance(me, target) > 20) NTA_MoveCloseInt(target, 3);
  1015. me.setSkill(151, 1);
  1016. if(me.y < target.y || me.y == target.y)
  1017. if(clickMap(0, 1, target.x + rnd(-1, 2), target.y + 3))
  1018. if(delay(100)) if(clickMap(2)) delay(100);
  1019. if(me.y > target.y || me.y == target.y)
  1020. if(clickMap(0, 1, target.x + rnd(-2, 1), target.y - 3))
  1021. if(delay(100)) if(clickMap(2)) delay(100);
  1022. if(me.x < target.x || me.x == target.x)
  1023. if(clickMap(0, 1, target.x + 3, target.y + rnd(-1, 2)))
  1024. if(delay(100)) if(clickMap(2)) delay(100);
  1025. if(me.x > target.x || me.x == target.x)
  1026. if(clickMap(0, 1, target.x - 3, target.y + rnd(-2, 1)))
  1027. if(delay(100)) if(clickMap(2)) delay(100);
  1028. }
  1029. }
  1030.  
  1031. function NTA_DruidAttackInt(target, boss, maxattacks) {
  1032. var _maxattacks=0,_range=13,_prehp=target.hp,_nohit,castfirst;
  1033. if(NTConfig_AttackSkill[0] > 0) castfirst = true;
  1034. while(_maxattacks++ < maxattacks && target.hp>0) {
  1035. NTSI_FastSnag();
  1036. if(!me.getState(149))NTC_DoCast(226,0);
  1037. if(!me.getState(144))NTC_DoCast(250,0);
  1038. if(_maxattacks==1) {
  1039. if(target.classid==243||target.classid==544)
  1040. NTM_MoveTo(target.x+1, target.y+2);
  1041. else
  1042. NTA_MoveCloseInt(target, _range);
  1043. if(castfirst&&me.setSkill(NTConfig_AttackSkill[0], 0))
  1044. if(clickMap(3, 1, target))if(delay(100))if(clickMap(5))delay(100);
  1045. }if(boss) {
  1046. if(_maxattacks % 3 == 0 && _nohit || getDistance(me, target) > 3)
  1047. NTM_MoveTo(target.x+1, target.y+2);
  1048. }else {
  1049. if(_maxattacks<13&&_maxattacks%6==0&&getDistance(me, target)>3&&_nohit)
  1050. NTA_MoveCloseInt(target, Math.round(getDistance(me, target)-6));
  1051. if(_maxattacks>13 && _maxattacks%2==1 && _nohit)
  1052. NTM_MoveTo(target.x+1, target.y+2);
  1053. }if(boss)me.setSkill(NTConfig_AttackSkill[1],0);
  1054. else me.setSkill(NTConfig_AttackSkill[2],0);
  1055. if(clickMap(3,1,target))if(delay(100))if(clickMap(5))delay(100);
  1056. if(target.hp >= _prehp) _nohit = true; else _nohit = false;
  1057. }NTSI_FastSnag();
  1058. if(NTConfig_CheckSafe)
  1059. NTTMGR_CheckSafe(1);
  1060. return true;
  1061. }
  1062.  
  1063. function NTA_AssassinAttackInt(target, boss, maxattacks) {
  1064. var _maxattacks=0,_range1=20,_range2=10,castfirst,checklight,secondary,checktraps;
  1065. if(NTConfig_AttackSkill[0] > 0) castfirst = true;
  1066. if(NTA_GetResistance(target,4)<100)checklight=true;
  1067. if(NTConfig_AttackSkill[4] > 0) secondary = true;
  1068. if(checkTraps(412)+checkTraps(416)<5) checktraps = true;
  1069. while(_maxattacks++ < maxattacks && target.hp>0) {
  1070. if(_maxattacks==1) {
  1071. if(boss)
  1072. NTA_MoveCloseInt(target,_range2);
  1073. else
  1074. NTA_MoveCloseInt(target,_range1);
  1075. if(castfirst&&me.setSkill(NTConfig_AttackSkill[0], 0))
  1076. if(clickMap(3, 1, target))if(delay(100))if(clickMap(5))delay(100);
  1077. if(NTConfig_CastCloakOfShadows)
  1078. if(!target.getState(153)&&(target.classid==571||target.classid==670||target.classid==105||target.classid==312||target.classid==641||target.classid==691||target.classid==693))
  1079. if(me.setSkill(264,0))
  1080. if(clickMap(3,0,target))if(delay(100))if(clickMap(5))delay(100);
  1081. if(target.name==getLocaleString(21852))
  1082. NTC_DoCast(276, 0);
  1083. }if(NTConfig_UseTraps) {
  1084. if(checklight) {
  1085. if(boss&&_maxattacks==1||getDistance(me, target)>_range2)
  1086. NTA_MoveCloseInt(target,_range2);
  1087. else if(_maxattacks==1||getDistance(me, target)>_range1)
  1088. NTA_MoveCloseInt(target,_range1);
  1089. if(target.classid==573) //if last wave use mindblast
  1090. NTC_DoCast(273, 0, target);
  1091. if(_maxattacks==1&&checktraps)
  1092. NTC_DoCast(271, 0, me.x, me.y+2);
  1093. if(_maxattacks==2&&checktraps)
  1094. NTC_DoCast(271, 0, me.x+2, me.y);
  1095. if(_maxattacks==3&&checktraps)
  1096. NTC_DoCast(271, 0, me.x, me.y-2);
  1097. if(_maxattacks==4&&checktraps)
  1098. NTC_DoCast(271, 0, me.x-2, me.y);
  1099. if(_maxattacks==5&&checktraps)
  1100. NTC_DoCast(271, 0, me.x-2, me.y-2);
  1101. if(boss&&_maxattacks>5&&checkTraps(412)+checkTraps(416)<5)
  1102. NTC_DoCast(271, 0);
  1103. if(_maxattacks>4&&_maxattacks%2==1&&target.hp>0&&me.setSkill(256, 1))
  1104. if(clickMap(0, 1, target))delay(1000);
  1105. while(me.getState(10))delay(100);
  1106. if(clickMap(2))delay(100);
  1107. if(_maxattacks>5&&_maxattacks%2==0&&target.hp>0&&me.setSkill(251, 1))
  1108. if(clickMap(0, 1, target))delay(1000);
  1109. while(me.getState(10))delay(100);
  1110. if(clickMap(2))delay(100);
  1111. }else {
  1112. if(_maxattacks==1||getDistance(me, target)>_range1)
  1113. NTA_MoveCloseInt(target,_range1);
  1114. if(target.classid==573) //if last wave use mindblast
  1115. NTC_DoCast(273, 0, target);
  1116. if(_maxattacks==1&&checktraps)
  1117. NTC_DoCast(276, 0, me.x, me.y+2);
  1118. if(_maxattacks==2&&checktraps)
  1119. NTC_DoCast(271, 0, me.x+2, me.y);
  1120. if(_maxattacks==3&&checktraps)
  1121. NTC_DoCast(271, 0, me.x, me.y-2);
  1122. if(_maxattacks==4&&checktraps)
  1123. NTC_DoCast(271, 0, me.x-2, me.y);
  1124. if(_maxattacks==5&&checktraps)
  1125. NTC_DoCast(271, 0, me.x-2, me.y-2);
  1126. if(boss&&_maxattacks>5&&checkTraps(412)+checkTraps(416)<5)
  1127. NTC_DoCast(271, 0);
  1128. if(_maxattacks>4&&_maxattacks%2==1&&target.hp>0&&me.setSkill(256, 1))
  1129. if(clickMap(0, 1, target))delay(1000);
  1130. while(me.getState(10))delay(100);
  1131. if(clickMap(2))delay(100);
  1132. if(_maxattacks>5&&_maxattacks%2==0&&target.hp>0&&me.setSkill(251, 1))
  1133. if(clickMap(0, 1, target))delay(1000);
  1134. while(me.getState(10))delay(100);
  1135. if(clickMap(2))delay(100);
  1136. if(secondary&&target.hp > 0&&_maxattacks>5&&target.hp>0&&!(target.name==getLocaleString(3162)||target.name==getLocaleString(2851))&&me.setSkill(NTConfig_AttackSkill[4], 0))
  1137. if(clickMap(3, 1, target))delay(1000);
  1138. while(me.getState(10))delay(100);
  1139. if(clickMap(5))delay(100);
  1140. }
  1141. }
  1142. }NTSI_FastSnag();
  1143. if(NTConfig_CheckSafe)
  1144. NTTMGR_CheckSafe(1);
  1145. function checkTraps(classid){
  1146. var traps = getUnit(1, classid), _traps = 0;
  1147. if(traps)
  1148. do
  1149. if(traps&&traps.mode!=12&&traps.getParent()==me&&getDistance(me,traps)<13)
  1150. _traps++;
  1151. while(traps.getNext(classid));
  1152. return _traps;
  1153. }return true;
  1154. }
  1155.  
  1156. function NTA_MoveCloseInt(target, maxrange)
  1157. {
  1158. var _dist = getDistance(me, target);
  1159.  
  1160. if(_dist > maxrange)
  1161. {
  1162. var _destx, _desty;
  1163.  
  1164. _destx = me.x + Math.round((_dist-maxrange)*(target.x-me.x) / _dist);
  1165. _desty = me.y + Math.round((_dist-maxrange)*(target.y-me.y) / _dist);
  1166.  
  1167. NTM_MoveTo(_destx, _desty, 0);
  1168.  
  1169. if (getDistance(me, target)>maxrange)
  1170. NTM_MoveTo(target.x,target.y);
  1171.  
  1172. }
  1173.  
  1174. return true;
  1175. }
  1176.  
  1177. function NTA_SortRoomInt(a, b)
  1178. {
  1179. if(getDistance(me.x, me.y, a[0], a[1]) < getDistance(me.x, me.y, b[0], b[1]))
  1180. return -1;
  1181.  
  1182. return 1;
  1183. }
  1184.  
  1185. function NTA_Initialize()
  1186. {
  1187. if(typeof(NTConfig_PutAura) == 'string') NTConfig_PutAura = getSkillByName(NTConfig_PutAura);
  1188. if(typeof(NTConfig_AttackFirst) == 'string') NTConfig_AttackFirst = getSkillByName(NTConfig_AttackFirst);
  1189. if(typeof(NTConfig_AttackBoss) == 'string') NTConfig_AttackBoss = getSkillByName(NTConfig_AttackBoss);
  1190. if(typeof(NTConfig_AttackOthers) == 'string') NTConfig_AttackOthers = getSkillByName(NTConfig_AttackOthers);
  1191. if(typeof(NTConfig_AttackSecondary) == 'string') NTConfig_AttackSecondary = getSkillByName(NTConfig_AttackSecondary);
  1192. if(typeof(NTConfig_AttackSkill[0]) == 'string') NTConfig_AttackSkill[0] = getSkillByName(NTConfig_AttackSkill[0]);
  1193. if(typeof(NTConfig_AttackSkill[1]) == 'string') NTConfig_AttackSkill[1] = getSkillByName(NTConfig_AttackSkill[1]);
  1194. if(typeof(NTConfig_AttackSkill[2]) == 'string') NTConfig_AttackSkill[2] = getSkillByName(NTConfig_AttackSkill[2]);
  1195. if(typeof(NTConfig_AttackSkill[3]) == 'string') NTConfig_AttackSkill[3] = getSkillByName(NTConfig_AttackSkill[3]);
  1196. if(typeof(NTConfig_AttackSkill[4]) == 'string') NTConfig_AttackSkill[4] = getSkillByName(NTConfig_AttackSkill[4]);
  1197. if(typeof(NTConfig_AttackSkill[5]) == 'string') NTConfig_AttackSkill[5] = getSkillByName(NTConfig_AttackSkill[5]);
  1198. if(typeof(XP_Curse) == 'string') XP_Curse = getSkillByName(XP_Curse);
  1199. if(typeof(XP_BuildArmyCurse) == 'string') XP_BuildArmyCurse = getSkillByName(XP_BuildArmyCurse);
  1200.  
  1201.  
  1202. if (me.classid == 1){
  1203. //NTConfig_AttackFirst=NTConfig_AttackSkill[0];
  1204. //NTConfig_AttackBoss=NTConfig_AttackSkill[1];
  1205. //NTConfig_AttackOthers=NTConfig_AttackSkill[2];
  1206. //NTConfig_AttackSecondary=NTConfig_AttackSkill[4];
  1207. //if (NTConfig_AttackSecondary == 0)
  1208. // NTConfig_AttackSecondary = NTConfig_AttackSkill[4];
  1209.  
  1210. if (NTConfig_AttackSkill[0] == 0 && NTConfig_AttackSkill[1] == 0 && NTConfig_AttackSkill[2] == 0 && NTConfig_AttackSkill[3] == 0 && NTConfig_AttackSkill[4] == 0 ){
  1211. // old config file
  1212. NTConfig_AttackSkill[0] = NTConfig_AttackFirst;
  1213. NTConfig_AttackSkill[1] = NTConfig_AttackBoss;
  1214. NTConfig_AttackSkill[2] = NTConfig_AttackOthers;
  1215. NTConfig_AttackSkill[4] = NTConfig_AttackSecondary;
  1216. }
  1217. }
  1218. for(var i = 0 ; i < 6 ; i++)
  1219. {
  1220. if(NTConfig_AttackSkill[i] > 0)
  1221. {
  1222. _NTA_SkillHand[i] = getBaseStat("skills.txt", NTConfig_AttackSkill[i], 166) ? 2 : NTC_HAND_RIGHT;
  1223. _NTA_SkillDamage[i] = NTA_GetDamageType(NTConfig_AttackSkill[i]);
  1224. _NTA_SkillDelay[i] = NTC_GetCastDelay(NTConfig_AttackSkill[i]);
  1225. }
  1226. }
  1227. }
  1228. function doCastInt(index, target)
  1229. {
  1230. var _untimedindex = index < 4 ? 3 : 5;
  1231. if (NTConfig_AttackSkill[index] == 0)
  1232. return false;
  1233. if(!NTC_DoCast(NTConfig_AttackSkill[index], _NTA_SkillHand[index], target))
  1234. return false;
  1235.  
  1236. if(_NTA_SkillDelay[index] > 0)
  1237. {
  1238. if(NTConfig_AttackSkill[_untimedindex] > 0)
  1239. {
  1240. var _starttick = getTickCount();
  1241.  
  1242. while(target.hp>0)
  1243. {
  1244. NTC_DoCast(NTConfig_AttackSkill[_untimedindex], _NTA_SkillHand[_untimedindex], target);
  1245.  
  1246. if(getTickCount()-_starttick >= _NTA_SkillDelay[index])
  1247. break;
  1248. }
  1249. }
  1250. else
  1251. NTC_Delay(_NTA_SkillDelay[index]);
  1252. }
  1253.  
  1254. return true;
  1255. }
  1256. function NTA_DoCastInt(index, target)
  1257. {
  1258. var _untimedindex = index < 4 ? 3 : 5;
  1259. if (NTConfig_AttackSkill[index] == 0)
  1260. return false;
  1261. if(!NTC_DoCast(NTConfig_AttackSkill[index], _NTA_SkillHand[index], target))
  1262. return false;
  1263.  
  1264. if (me.area != 102)
  1265. getIntoLOS(target)
  1266.  
  1267. if(_NTA_SkillDelay[index] > 0)
  1268. {
  1269. if(NTConfig_AttackSkill[_untimedindex] > 0)
  1270. {
  1271. var _starttick = getTickCount();
  1272.  
  1273. while(NTA_IsValidTarget(target, true))
  1274. {
  1275. NTC_DoCast(NTConfig_AttackSkill[_untimedindex], _NTA_SkillHand[_untimedindex], target);
  1276.  
  1277. if(getTickCount()-_starttick >= _NTA_SkillDelay[index])
  1278. break;
  1279. }
  1280. }
  1281. else
  1282. NTC_Delay(_NTA_SkillDelay[index]);
  1283. }
  1284.  
  1285. return true;
  1286. }
  1287. function SortMonsters(nUnit1, nUnit2) { // taken from Mbot cred goes to McGod
  1288. if (nUnit1.spectype & 0x01 || nUnit1.spectype & 0x02 || nUnit1.spectype & 0x04)
  1289. return 1;
  1290. if (nUnit2.spectype & 0x01 || nUnit2.spectype & 0x02 || nUnit2.spectype & 0x04)
  1291. return -1;
  1292. var nResIDs = [58,59,60,61,62,101,102,103,104,105,229,278,279,280,281,282,645,646,647,667,668,669,670];
  1293. for (var n in nResIDs) {
  1294. if (nResIDs[n] == nUnit1.classid)
  1295. return 1;
  1296. if (nResIDs[n] == nUnit2.classid)
  1297. return -1;
  1298. }
  1299. if (getDistance(me, nUnit1) < getDistance(me, nUnit2))
  1300. return 1;
  1301. return -1;
  1302. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement