Advertisement
Guest User

Untitled

a guest
Feb 5th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.09 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.  
  9. NTConfig_DancingSorc = true;
  10.  
  11. if(!NTTM_CheckAct(1)){
  12. NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_CheckAct()");
  13. return;
  14. }
  15.  
  16. NTTMGR_TownManager();
  17. if(!me.GetQuest(4, 10)){
  18. if(!NT_CheckCowPortal()){
  19. var _wirtbody, _cube, _leg, _portal, _stash, _items, i, _npc, prearea;
  20. for (i = 0; i < 10; i++){
  21. _cube = NTC_FindUnit(NTC_UNIT_ITEM, 549);
  22. if (_cube)
  23. break;
  24. }
  25. _items = me.GetItems();
  26. for (i = 0; i < _items.length;i++){
  27. if (_items[i].classid == 549) {
  28. Print ("Already Got CUbe");
  29. _cube = _items[i];
  30. break;
  31. }
  32. }
  33. if (!_cube){
  34. GetCube();
  35. }
  36. for (i = 0; i < 10; i++){
  37. _leg = NTC_FindUnit(NTC_UNIT_ITEM, 88);
  38. if(_leg)
  39. break;
  40. }
  41. _items = me.GetItems();
  42. for (i = 0; i < _items.length;i++){
  43. if (_items[i].classid == 88) {
  44. Print ("Already Got Leg");
  45. _leg = _items[i];
  46. }
  47. }
  48.  
  49. if (!_leg){
  50. if(!NTTM_TownMove("waypoint")){
  51. NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_TownMove()");
  52. return;
  53. }
  54. if(!NTM_TakeWaypoint(4)){
  55. NTC_SendMsgToScript("NTBotGame.ntj", "NTM_TakeWaypoint()");
  56. return;
  57. }
  58. NTP_DoPrecast();
  59. if(!NTM_MoveToPresetUnit(me.areaid, NTC_UNIT_MONSTER, 737, 10, 10)){
  60. NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveToPresetUnit()");
  61. return;
  62. }
  63. if(!NTM_UsePortal("Portal", 38)){
  64. NTC_SendMsgToScript("NTBotGame.ntj", "NTM_UsePortal()");
  65. return;
  66. }
  67. NTM_MoveTo(me.areaid, 25047, 5178);
  68. if(NTA_ClearPosition(10)){
  69. if(NTConfig_IdInField){
  70. if (!NTT_CheckSpace(NTConfig_FreeSpaceXY[0], NTConfig_FreeSpaceXY[1])) {
  71. NT_FieldID();
  72. }
  73. }
  74. NTSI_PickItems();
  75. if(NTConfig_IdInField){
  76. if (!NTT_CheckSpace(NTConfig_FreeSpaceXY[0], NTConfig_FreeSpaceXY[1])) {
  77. NT_FieldID();
  78. }
  79. }
  80. }
  81. _wirtbody = NTC_FindUnit(NTC_UNIT_OBJECT, 268);
  82. if(!_wirtbody){
  83. NTC_SendMsgToScript("NTBotGame.ntj", "Wirt's body not found.");
  84. return;
  85. }
  86. if(NTM_MoveTo(_wirtbody.areaid, _wirtbody.x+3, _wirtbody.y)){
  87. if(NTC_OpenChest(_wirtbody)){
  88. NTC_PingDelay(500);
  89. for (i = 0; i < 10; i++){
  90. _leg = NTC_FindUnit(NTC_UNIT_ITEM, 88);
  91. if (_leg)
  92. break;
  93. }
  94. if(!NTT_CheckSpace(_leg.xsize, _leg.ysize)){
  95. _prearea = me.areaid
  96. if(NTTM_CheckAct()){
  97. NTTMGR_TownManager(true);
  98. NTTM_TownMove("portalspot")
  99. NTM_UsePortal("BluePortal", _prearea)
  100. }
  101. }
  102. for (i = 0; i < 20; i++){
  103. if ((i % 5) == 0){
  104. if (_leg.mode == 3 || _leg.mode == 5){
  105. if (NTC_ClearCursor())
  106. NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _leg);
  107. }
  108. }
  109. NTC_PingDelay(100);
  110. if (_leg.mode != 3 && _leg.mode != 5){
  111. Print(COLOR_4 + "Got Leg");
  112. NTC_PingDelay(200);
  113. break;
  114. }
  115. }
  116. }
  117. }
  118. if(!_leg){
  119. NTC_SendMsgToScript("NTBotGame.ntj", "No leg found.");
  120. return;
  121. }
  122. NTM_MakeTP(1);
  123. }
  124. else{
  125. if(!NTT_CheckSpace(_leg.xsize, _leg.ysize)){
  126. _prearea = me.areaid;
  127. if(NTTM_CheckAct()){
  128. NTTMGR_TownManager(true);
  129. NTTM_TownMove("portalspot")
  130. NTM_UsePortal("BluePortal", _prearea)
  131. }
  132. }
  133. for (i = 0; i < 20; i++){
  134. if ((i % 5) == 0){
  135. if (_leg.mode == 3 || _leg.mode == 5){
  136. if (NTC_ClearCursor())
  137. NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _leg);
  138. }
  139. }
  140. NTC_PingDelay(100);
  141. if (_leg.mode != 3 && _leg.mode != 5){
  142. Print(COLOR_4 + "Who carries a leg around?");
  143. NTC_PingDelay(200);
  144. Print(COLOR_4 + "Dude, thats sick.");
  145. break;
  146. }
  147. }
  148. }
  149. if(NTCW_AlreadyTombs()){
  150. if(!NTTM_CheckAct()){
  151. NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_CheckAct()");
  152. return;
  153. }
  154. NTTM_TownMove("akara");
  155. for(var i = 0 ; i < 10 ; i++){
  156. _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_AKARA);
  157. if(_npc)
  158. break;
  159. }
  160. if(_npc){
  161. if(NTT_DoInteract(_npc)){
  162. if(NTT_DoTrade(_npc)){
  163. _NTR_DoID = NTT_CheckUnids();
  164. if(_NTR_DoID)
  165. NTTMGR_IDItems(_npc);
  166. NTT_FillTome(_npc, 1);
  167. NTT_FillTome(_npc, 0);
  168. NTT_SecondTomeTP(_npc, "tbk", 1);
  169. _portal = NTR_GetTP();
  170. if(!_portal){
  171. NTC_SendMsgToScript("NTBotGame.ntj", "No extra tome of townportal found.");
  172. return;
  173. }
  174. }
  175. }
  176. me.Cancel(1);
  177. }
  178. }
  179. else
  180. _portal = NTR_GetTP();
  181. NTTM_TownMove("stash");
  182. for(var i = 0 ; i < 10 ; i++){
  183. _stash = NTC_FindUnit(NTC_UNIT_OBJECT, NTC_UNIT_STASH);
  184. if(_stash)
  185. break;
  186. }
  187. if(_stash){
  188. if(NTM_GetCloserInt(_stash)){
  189. if(NTT_DoInteract(_stash)){
  190. _items = me.GetItems(NTC_UNIT_CUBE);
  191. _cube = _items[0];
  192. if(!_cube){
  193. NTC_SendMsgToScript("NTBotGame.ntj", "No cube found.");
  194. return;
  195. }
  196. if(NTCU_CheckCubeInventoryInt() > 0){
  197. NTCU_OpenCubeInt(_cube)
  198. if(NTCU_ClearCubeInt() < 1){
  199. NTC_SendMsgToScript("NTBotGame.ntj", "Cube cannot be emptied.");
  200. return;
  201. }
  202. NTCU_CloseCubeInt();
  203. }
  204. NTCU_MoveItemToCubeInt(_cube,_leg)
  205. NTCU_MoveItemToCubeInt(_cube,_portal)
  206. NTCU_OpenCubeInt(_cube);
  207. if(Transmute()){
  208. NTC_PingDelay(1000);
  209. NTCU_CloseCubeInt();
  210. NTC_PingDelay(1000);
  211. NTC_CancelMenus();// added this for testing
  212. NTC_PingDelay(parseInt((1000 / 2), 10));
  213. }
  214. else{
  215. NTC_PingDelay(1000);
  216. NTCU_CloseCubeInt();
  217. NTC_PingDelay(1000);
  218. NTC_CancelMenus();// added this for testing
  219. NTC_PingDelay(parseInt((1000 / 2), 10));
  220. }
  221. }
  222. }
  223. }
  224. NTC_PingDelay(1000);
  225. }
  226. if(NT_CheckCowPortal()){
  227. Delay(Random(1000,2000));
  228. Print(COLOR_4 + "Cow portal is up, guess it's time to go in!");
  229. Delay(Random(1000,2000));
  230. }
  231. if(!NT_TakeCowPortal()){
  232. NTC_SendMsgToScript("NTBotGame.ntj", "Failed to take Cow Portal.");
  233. return;
  234. }
  235. if(NTConfig_CowKingChicken > 0) {
  236. Load("NTBot/tools/NTKingLifeWatch-v2.ntj");
  237. }
  238. NTP_DoPrecast();
  239. NTR_ClearRooms();
  240. NTC_SendMsgToScript("NTBotGame.ntj", "SCRIPT_END");
  241. }
  242. else{
  243. me.maxgametime = 0;
  244. var AntiIdleMoo = ["waypoint", "portalspot", "exit", "stash", "gheed", "charsi", "akara", "kashya", "cain", "warriv"];
  245. Print(COLOR_4 + "Cow quest has been completed, why are trying to do it?");
  246. SetStatusText(COLOR_8 + "Cow King Dead ~ Anti-Idle ON");
  247. while(1){
  248. t = Random(0,9);
  249. Say("!I'm going to go ahead and move to " + AntiIdleMoo[t] + "!");
  250. Delay(Random(1000,2000));
  251. if(!NTTM_TownMove(AntiIdleMoo[t])) {
  252. NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_TownMove()");
  253. return;
  254. }
  255. Delay(Random(3000,8000));
  256. }
  257. }
  258. }
  259.  
  260. // Internal functions
  261. function NT_CheckCowPortal()
  262. {
  263. var _portal = NTC_GetUnit(NTC_UNIT_OBJECT, GetLocaleString(3226));
  264. if(_portal){
  265. if(_portal.subareaid == 295 || _portal.subareaid == 39){
  266. return true;
  267. }
  268. }
  269. else
  270. return false;
  271. }
  272.  
  273.  
  274. function NTR_GetTP(){
  275. var _portals = me.GetItems("tbk");
  276. if (_portals){
  277. for (var i = 0; i < _portals.length; i++){
  278. if (_portals[i].mode == 0 && (_portals[i].itemloc != 0 || NTConfig_Columns[_portals[i].y][_portals[i].x] > 0)){
  279. return _portals[i];
  280. }
  281. }
  282. }
  283. return false;
  284. }
  285.  
  286. function abs(integer){
  287. if(integer < 0){
  288. integer = -integer;
  289. }
  290. return integer;
  291. }
  292. function NTR_TakeCowPortal(range){
  293. var _portal = NTC_FindUnit(NTC_UNIT_OBJECT, GetLocaleString(3226));
  294. if (_portal){
  295. var _isClick;
  296. var _preAreaId = me.areaid;
  297. do{
  298. if (GetDistance(me, _portal) < range && _portal.mode == 2){
  299. for (var i = 0; i < 40; i++){
  300. if ((i % 10) == 0){
  301. if(NTM_GetCloserInt(_portal))
  302. _isClick = NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _portal);
  303. }
  304. if (_isClick){
  305. NTC_Delay(200);
  306. break;
  307. }
  308. }
  309. NTC_PingDelay(1000);
  310. var j = 0;
  311. var check = true;
  312. do{
  313. if (me.areaid != _preAreaId){
  314. NTC_PingDelay(500);
  315. return true;
  316. check = false;
  317. }
  318. j++;
  319. } while(j < 40 && check == true);
  320. }
  321. } while (_portal.GetNext());
  322. }
  323. return false;
  324. }
  325.  
  326. function NTA_MonsterStats(unit) {
  327. this.name = unit.name;
  328. this.x = unit.x;
  329. this.y = unit.y;
  330. this.gid = unit.gid;
  331. this.classid = unit.classid;
  332. this.spectype = unit.spectype;
  333. }
  334.  
  335. function NTT_SecondTomeTP(npc, type, amount){
  336. var _items;
  337. var _counter = 0;
  338. if(arguments.length < 1)
  339. return false;
  340. if(arguments.length < 2)
  341. type = 0;
  342. if(arguments.length < 0)
  343. amount = 1;
  344. if(amount == 0)
  345. return false;
  346. if(type)
  347. _items = npc.GetItems("tbk");
  348. if(_items){
  349. if(_items.length > 0){
  350. for(var i = 0 ; i < amount ; i++){
  351. if(NTT_ShopItem(_items[0], npc, 2))
  352. _counter++;
  353. }
  354. }
  355. }
  356. return (_counter > 0);
  357. }
  358.  
  359. function NTCW_AlreadyTombs()
  360. {
  361. var portalbook = me.GetItems("tbk");
  362. if(portalbook && portalbook.length <= 1)
  363. return true;
  364. else
  365. return false;
  366. }
  367.  
  368. function NT_TakeCowPortal()
  369. {
  370. var _prearea = me.areaid
  371. var _portal = NTC_GetUnit(NTC_UNIT_OBJECT, GetLocaleString(3226));
  372.  
  373. if(_portal){
  374. do{
  375. if(_portal.subareaid == 295 || _portal.subareaid == 39){
  376. while(_portal.mode != 2){
  377. Delay(500)
  378. }
  379. break;
  380. }
  381. } while(_portal.GetNext());
  382. for(var i = 0 ; i < 40 ; i++){
  383. if(NTM_GetCloserIntS(_portal)){
  384. NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _portal);
  385. }
  386. if(me.areaid != _prearea){
  387. break;
  388. }
  389. }
  390. }
  391. return (me.areaid == 39);
  392. }
  393.  
  394.  
  395. function NTCS_Preattack(name) {
  396. var i, n, target, pos, positions;
  397.  
  398. target = NTC_FindUnit(1, name, 10);
  399.  
  400. switch (me.classid) {
  401. case 0:
  402. break;
  403. case 1:
  404. break;
  405. case 2:
  406. break;
  407. case 3:
  408. if (!target) {
  409. return;
  410. }
  411. positions = [[6, 11], [0, 8], [8, -1], [-9, 2], [0, -11], [8, -8]];
  412. for (i = 0; i < positions.length; i += 1) {
  413. if (CheckCollision(me.areaid, target.x + positions[i][0], target.y + positions[i][1], 1)) { // check if we can move there
  414. Print("Preattack position: " + positions[i][0] + " " + positions[i][1]);
  415. NTM_MoveTo(108, target.x + positions[i][0], target.y + positions[i][1]);
  416. NTC_PutSkill(NTConfig_AttackSkill[2], NTC_HAND_RIGHT);
  417. for (n = 0; n < 8; n += 1) {
  418. NTC_CastSkill(NTConfig_AttackSkill[1], 2);
  419. }
  420. break;
  421. }
  422. }
  423. break;
  424. case 4:
  425. if (!target || NTConfig_AttackSkill[0] < 0) {
  426. return;
  427. }
  428. pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, 20, 4);
  429. if (pos) {
  430. NTM_MoveTo(108, pos[0], pos[1]);
  431. }
  432. for (i = 0; i < 2; i += 1) {
  433. NTC_CastSkill(130, NTC_HAND_RIGHT);
  434. NTC_Delay(150);
  435. }
  436. break;
  437. case 5:
  438. break;
  439. case 6:
  440. break;
  441. }
  442. }
  443.  
  444. function NTT_CheckPotionSafe() {
  445. var i, items, hpCheck, mpCheck;
  446.  
  447. items = me.GetItems();
  448.  
  449. if (NTConfig_BeltColType.indexOf("hp") > -1) {
  450. for (i = 0; i < items.length; i += 1) {
  451. if (!hpCheck && items[i].mode === 2 && items[i].code.indexOf("hp") > -1) {
  452. hpCheck = true;
  453. }
  454. }
  455. } else {
  456. hpCheck = true;
  457. }
  458. if (NTConfig_BeltColType.indexOf("mp") > -1) {
  459. for (i = 0; i < items.length; i += 1) {
  460. if (!mpCheck && items[i].mode === 2 && items[i].code.indexOf("mp") > -1) {
  461. mpCheck = true;
  462. }
  463. }
  464. } else {
  465. mpCheck = true;
  466. }
  467. return !(hpCheck && mpCheck);
  468. }
  469.  
  470. function NTA_Dodge(target, distance) {
  471. var i, j, coordx, coordy, monster, count,
  472. maxcount = 999,
  473. coords = [],
  474. goodCoords = [],
  475. monList = [],
  476. angles = [45, 90, 135, 180, 225, 270, 305, 360];
  477. for (i = 0; i < angles.length; i += 1) {
  478. coordx = Math.round((Math.cos(angles[i] * Math.PI / 180)) * distance + target.x);
  479. coordy = Math.round((Math.sin(angles[i] * Math.PI / 180)) * distance + target.y);
  480. if (CheckCollision(me.areaid, coordx, coordy, 1)) {
  481. coords.push([coordx, coordy]);
  482. }
  483. }
  484. if (coords.length === 0) { // no valid positions - don't move
  485. return true;
  486. }
  487.  
  488. coords.sort(NTA_SortRooms);
  489.  
  490. monster = GetUnit(1);
  491.  
  492. if (monster) {
  493. do {
  494. if (monster.hp > 0) {
  495. monList.push(new NTA_MonsterStats(target));
  496. }
  497. } while (monster.GetNext());
  498. }
  499. for (i = 0; i < coords.length; i += 1) {
  500. count = 0;
  501. for (j = 0; j < monList.length; j += 1) {
  502. if (monList[j].hp > 0 && GetDistance(monList[j].x, monList[j].y, coords[i][0], coords[i][1]) < 10) {
  503. count += 1;
  504. }
  505. }
  506. if (count < maxcount) {
  507. goodCoords = [coords[i][0], coords[i][1]];
  508. maxcount = count;
  509. if (count === 0) {
  510. break;
  511. }
  512. }
  513. }
  514. if (goodCoords.length > 0) { // just in case goodCoords is empty (shouldn't happen)
  515. if (Math.abs(me.x - goodCoords[0]) < 3 && Math.abs(me.y - goodCoords[1]) < 3) { // close enough
  516. return true;
  517. }
  518. Say("!Dodge " + target.name);
  519. NTM_MoveTo(me.areaid, goodCoords[0], goodCoords[1]);
  520. }
  521. return true;
  522. }
  523.  
  524. function NTCS_ClearPosition(range, sortFunc, spectype, classid) {
  525. var _orgx, _orgy;
  526. var _spectype = [0x0A, 0x01, 0x01];
  527. //var _spectype = [0x0A, 0x01];
  528. var _skiplist;
  529. var _attackcount = 0;
  530. var _target;
  531. var _distance, _mingid, _mindistance;
  532. var _result;
  533. var _cowKing;
  534. var _test;
  535.  
  536. if (NTConfig_PrioritizeWeakerFoes && NTConfig_PrioritizeWeakerFoesAreaDisable.indexOf(me.areaid) < 0) {
  537. _spectype = [0x10, 0x01, 0x04, 0x0A];
  538. }
  539.  
  540. if(NTConfig_AttackSkill[1] < 0 || NTConfig_AttackSkill[3] < 0)
  541. return false;
  542.  
  543. switch(arguments.length){
  544. case 0:
  545. range = 20;
  546. case 1:
  547. pickitem = false;
  548. case 2:
  549. safelevel = 0;
  550. default:
  551. if ((NTConfig_CheckSelfSafe.length < 1) && (NTConfig_CheckMercSafe.length < 1)) { safelevel = 0; }
  552. break;
  553. }
  554.  
  555. _orgx = me.x;
  556. _orgy = me.y;
  557.  
  558. for(var i = 0 ; i < _spectype.length ; i++){
  559. _skiplist = new Array();
  560.  
  561. MainLoop : while(_attackcount < (i+1)*100){
  562. _mindistance = 100000;
  563.  
  564. _target = NTC_FindUnit(NTC_UNIT_MONSTER);
  565.  
  566. if(_target){
  567. do{
  568. if(_skiplist.indexOf(_target.gid) < 0){
  569. if(_target.IsAttackable() && (_target.spectype&_spectype[i])){
  570. if ((me.classid === 1 || me.classid === 2 || me.classid === 6) && NTConfig_Dodge_Cows && GetDistance(me, _target) < 7) {
  571. NTA_Dodge(_target, 15);
  572. continue MainLoop;
  573. }
  574. if(GetDistance(_orgx, _orgy, _target.x, _target.y) <= range && NTA_IsValidMonster(_target)){
  575. _distance = GetDistance(me, _target);
  576. if(_distance < _mindistance){
  577. _mingid = _target.gid;
  578. _mindistance = _distance;
  579. }
  580. if ((MonstersToAttackFirst.indexOf(_target.classid) > -1) && _distance < _minshamandistance) {
  581. _minshamangid = _target.gid;
  582. _minshamandistance = _distance;
  583. }
  584. }
  585. } else { _skiplist.push(_target.gid); }
  586. }
  587. } while(_target.GetNext());
  588. }
  589.  
  590. if(_mindistance < 100000){
  591. _target = NTC_FindUnit(NTC_UNIT_MONSTER, _mingid);
  592. if(_target){
  593. _cowKing = GetUnit(NTC_UNIT_MONSTER, GetLocaleString(2850));
  594. if(_cowKing){
  595. return true;
  596. }
  597.  
  598. _result = NTA_Attack(_target, (_attackcount % 30) === 0);
  599.  
  600. switch(_result){
  601. case 1: _skiplist.push(_mingid); break;
  602. case 2:
  603. case 3:
  604. if (_target.mode === 0 || _target.mode === 12) {
  605. NTSI_FastPick();
  606. }
  607. _attackcount++;
  608. _sorcattack++;
  609. break;
  610. default: return false;
  611. }
  612. }
  613. }
  614. else { break; }
  615. }
  616. }
  617. if (me.classid == NTC_CHAR_CLASS_PALADIN) {
  618. if (_attackcount > 2 && ((parseFloat(me.hp * 100 / me.hpmax) < NTConfig_UseRedemptionHP) || (parseInt(me.mp * 100 / me.mpmax, 10) < NTConfig_UseRedemptionMP))) {
  619. if (NTC_PutSkill(124, NTC_HAND_RIGHT)) { NTC_PingDelay(1000); }
  620. }
  621. } else if (me.classid == NTC_CHAR_CLASS_NECROMANCER) {
  622. NTA_SkeletonArmy(NTConfig_SkeletonArmy);
  623. NTA_MageArmy(NTConfig_MageArmy);
  624. NTA_ReviveArmy(NTConfig_ReviveArmy);
  625. } else if (me.classid == NTC_CHAR_CLASS_BARBARIAN) {
  626. if (NTConfig_UseFindItem && _attackcount > 2) {
  627. if (!NTA_CheckForCloseMonsters(10)) {
  628. //Print(COLOR_25 + "No Monsters close - looting");
  629. NTA_FindItem(NTConfig_FindItemRange);
  630. }
  631. }
  632. }
  633. _cowKing = GetUnit(NTC_UNIT_MONSTER, GetLocaleString(2850));
  634. if(_cowKing){
  635. return true;
  636. }
  637. //if(failed == false){
  638. //if (NTConfig_OpenChest) {
  639. //_target = NTC_GetSpecialChest();
  640. //if (_target && GetDistance(_orgx, _orgy, _target.x, _target.y) <= range && NTC_OpenChest(_target)) { _attackcount++; _sorcattack++; }
  641. //}
  642. //if (NTConfig_OpenChestsInAreaClearing && NTConfig_AreasToOpenChestClearing.indexOf(me.areaid) != -1) {
  643. //NTC_OpenChestsInAreaNear(_orgx, _orgy, range);
  644. //}
  645.  
  646. if(NTConfig_IdInField){
  647. if (!NTT_CheckSpace(NTConfig_FreeSpaceXY[0], NTConfig_FreeSpaceXY[1])) {
  648. NT_FieldID();
  649. } // id in field add
  650. }
  651. //if (pickitem && _attackcount > 0) { NTSI_PickItems(); }
  652. if (_attackcount > 0) {
  653. NTSI_PickItems();
  654. }
  655. if(NTConfig_IdInField){
  656. if (!NTT_CheckSpace(NTConfig_FreeSpaceXY[0], NTConfig_FreeSpaceXY[1])) {
  657. NT_FieldID();
  658. } // id in field add
  659. }
  660. //}
  661. return true;
  662. }
  663.  
  664. function NTR_ClearRooms(){
  665. var failcount = 0, precount = 0, x, y, offx = 0, offy = 0, goalx = 0, goaly = 0, cowoffx = 0, cowoffy = 0;
  666. var toggle = true;
  667. var _cowKing;
  668. var _faillast;
  669. x = me.x;
  670. y = me.y;
  671. //NTC_PingDelay(5000);
  672. while (failcount <= 25){
  673. if(toggle == true && offx == goalx){
  674. if(goaly < 0){
  675. goaly=(0-(goaly-20));
  676. }else{
  677. goaly=(0-(goaly+20));
  678. }
  679. toggle = false;
  680. }
  681. if(toggle == false && offy == goaly){
  682. if(goaly < 0){
  683. goalx=(0-(goalx-20));
  684. }else{
  685. goalx=(0-(goalx+20));
  686. }
  687. toggle = true;
  688. }
  689. if(offy > goaly){
  690. offy-=20;
  691. y-=20;
  692. }
  693. if(offy < goaly){
  694. offy+=20;
  695. y+=20;
  696. }
  697. if(offx < goalx){
  698. offx+=20;
  699. x+=20;
  700. }
  701. if(offx > goalx){
  702. offx-=20;
  703. x-=20;
  704. }
  705. _cowKing = GetUnit(NTC_UNIT_MONSTER, GetLocaleString(2850));
  706. if(!_cowKing){
  707. //NTR_ClearPosition(20, true, 0, _faillast);
  708. NTCS_ClearPosition(20, true, 0, _faillast);
  709. if(((GetTickCount()-precount)/1000) >= 30 && 30 >= 0){
  710. NTP_DoPrecast();
  711. precount = GetTickCount();
  712. }
  713. }
  714. if(!NTM_MoveTo(me.areaid, x, y)){
  715. failcount++;
  716. _faillast = true;
  717. }else{
  718. _faillast = false;
  719. }
  720. }
  721. return true;
  722. }
  723. function NTA_SortRooms(a, b) {
  724. if (GetDistance(me.x, me.y, a[0], a[1]) < GetDistance(me.x, me.y, b[0], b[1])) {
  725. return -1;
  726. }
  727. return 1;
  728. }
  729.  
  730. //Cube start
  731.  
  732. function GetCube(){
  733. if(me.diff == 0){
  734.  
  735. if(!NTTM_TownMove("waypoint")) {
  736. NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_TownMove()");
  737. return;
  738. }
  739.  
  740. if(!NTM_TakeWaypoint(57)) {
  741. NTC_SendMsgToScript("NTBotGame.ntj", "NTM_TakeWaypoint()");
  742. return;
  743. }
  744.  
  745. NTP_DoPrecast(true);
  746.  
  747. if(!NTM_MoveToStair(me.areaid, 60)) {
  748. NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveToStair()");
  749. return;
  750. }
  751.  
  752. if(!NTM_TakeStair(60)) {
  753. NTC_SendMsgToScript("NTBotGame.ntj", "NTM_TakeStair()");
  754. return;
  755. }
  756.  
  757. NTP_DoPrecast(true);
  758.  
  759. if(!NTM_MoveToPresetUnit(me.areaid, NTC_UNIT_OBJECT, 354, -5, -5)) {
  760. NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveToPresetUnit()");
  761. return;
  762. }
  763.  
  764. NTA_ClearPosition(30, false);
  765.  
  766. //NTSI_PickItems();
  767.  
  768. _Cube = NTC_FindUnit(NTC_UNIT_OBJECT, 354);
  769.  
  770. if(_Cube) {
  771. if(NTM_MoveTo(_Cube.areaid, _Cube.x+3, _Cube.y)) {
  772. NTA_ClearPosition(30, false);
  773. //NTSI_PickItems();
  774. }
  775.  
  776. if(NTC_OpenChest(_Cube)) {
  777. NTC_PingDelay(100);
  778. //NTSI_PickItems();
  779. }
  780.  
  781. NTA_ClearPosition(30, false);
  782.  
  783. //NTSI_PickItems();
  784.  
  785. //if(NTConfig_IdInField){
  786. //NT_FieldID();
  787. }
  788. }
  789.  
  790.  
  791.  
  792. NTM_MakeTP();
  793.  
  794. Say("Cube tp up come grabe cube and get back to town!");
  795.  
  796. Movetocube();
  797.  
  798. NTA_ClearPosition(30, false);
  799. StashCube();
  800. return;
  801.  
  802. }
  803. //}
  804.  
  805.  
  806. function Movetocube(){
  807. var _cube = NTC_FindUnit(NTC_UNIT_ITEM, 549);
  808. if(!_cube){Say("You have the cube man");return false;}
  809. if (_cube.mode == 3 || _cube.mode == 5){
  810. NTM_MoveTo(me.areaid, _cube.x, _cube.y);
  811. NTC_Delay(1000)
  812. Say("Picking up Cube");
  813. NTC_PingDelay(100);
  814. NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _cube);
  815. NTC_Delay(1000)
  816. }
  817. NTC_PingDelay(100);
  818. return true;
  819. }
  820.  
  821.  
  822. function StashCube(){
  823. NTM_UsePortal("BluePortal", 40, me.charname);
  824. NTTM_TownMove("stash");
  825. NTC_PingDelay(100);
  826. for(var i = 0 ; i < 10 ; i++){
  827. _stash = NTC_FindUnit(NTC_UNIT_OBJECT, NTC_UNIT_STASH);
  828. if(_stash)
  829. break;
  830. }
  831.  
  832. if(NTT_DoInteract(_stash)){
  833. _cube = me.GetItems(NTC_UNIT_CUBE);
  834. _Items = _cube[0];
  835. if(_cube){
  836. for(var i = 0 ; i < _cube.length ; i++){
  837. if(_cube[i].classid == 549){
  838. Say("Stashing Cube");
  839. NTC_PingDelay(100);
  840. NTC_ItemToCursor(_cube[i]);
  841. NTC_PingDelay(200);
  842. me.ClickItem(0, 0, 0, 4);
  843. NTC_PingDelay(200)
  844. NTC_CancelMenus();
  845. NTC_Delay(250)
  846. //if (NTC_ClearCursor())
  847. Say("Cube in Stash");
  848. //NTC_Delay(250)
  849. //NTTM_TownMove("portalspot");
  850. //NTC_Delay(250)
  851. //NTM_UsePortal("BluePortal", 60, me.charname);
  852. //NTC_Delay(250)
  853. //NTSI_PickItems();
  854. Say("Done");
  855. //NTM_MakeTP();
  856. //NTM_UsePortal("BluePortal", 40, me.charname);
  857. //NTTMGR_TownManager();
  858. //return true;
  859. if(!NTTM_CheckAct(1)){
  860. NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_CheckAct()");
  861. return true;
  862. }
  863.  
  864.  
  865. }
  866. //NTC_SendMsgToScript("NTBotGame.ntj", "SCRIPT_END");
  867. }
  868. }
  869. }
  870. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement