Guest User

Untitled

a guest
Jul 20th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.33 KB | None | 0 0
  1. // settings for game run
  2. var NTConfig_CubingDelays = 1000;
  3. var grabFade = true;
  4. var endGameWhenDone = true;
  5.  
  6. //ingame vars dont touch
  7. var tKey = me.GetItems("pk1");
  8. var hKey = me.GetItems("pk2");
  9. var dKey = me.GetItems("pk3");
  10. var existingPortal = [];
  11.  
  12. function NTMain()
  13. {
  14. Include("libs/common/NTCommon.ntl");
  15. NTC_IncludeLibs();
  16. NTC_IncludeConfig("NTBot/char_configs");
  17.  
  18. NT_LoadConfig();
  19.  
  20. NTConfig_TPChicken = 0;
  21.  
  22. NTSI_LoadNIPFiles("NTBot/item_configs");
  23.  
  24. NTA_Initialize();
  25.  
  26. NTTMGR_TownManager();
  27.  
  28. NTTM_CheckAct(5);
  29.  
  30. if(tKey.length >= 3 && hKey.length >= 3 && dKey.length >= 3) {
  31. if(NT_OpenMiniPortals()) {
  32. if(grabFade) {
  33. NT_PreBuffFade();
  34. }
  35. NT_FindExistingPortals();
  36.  
  37. for(var n = 0; n < existingPortal.length; n++) {
  38. NT_TakeMiniPortal(existingPortal[n]);
  39. NT_CheckKeyBossAreaid();
  40. }
  41. if(!endGameWhenDone) {
  42. NTC_SendMsgToScript("NTBotGame.ntj", "SCRIPT_END");
  43. }
  44. else {
  45. Say("Got the organs!");
  46. NTC_Delay(10001);
  47. }
  48. }
  49. }
  50. }
  51.  
  52. function NT_CheckKeyBossAreaid(){
  53. switch(me.areaid)
  54. {
  55. case 133:
  56. Print(NTC_PrintRandomColor() + "Killing Lillith");
  57. NT_KillLilith();
  58. break;
  59.  
  60. case 134:
  61. Print(NTC_PrintRandomColor() + "Killing Duriel");
  62. NT_KillUberDuriel();
  63. break;
  64.  
  65. case 135:
  66. Print(NTC_PrintRandomColor() + "Killing Izzy");
  67. NT_KillIzual();
  68. break;
  69. }
  70. return;
  71. }
  72.  
  73. function NT_IsPossiblePortal(possiblePortal) { // this checks for portals that we actually interested in.
  74. if((possiblePortal.subareaid == 133 || possiblePortal.subareaid == 134 || possiblePortal.subareaid == 135
  75. || possiblePortal.subareaid == 389 || possiblePortal.subareaid == 390 || possiblePortal.subareaid == 391
  76. || possiblePortal.subareaid == 136 || possiblePortal.subareaid == 392)
  77. && !NTC_CheckOwner(possiblePortal, me.name)) {
  78. return true;
  79. }
  80. else { return false; }
  81. }
  82.  
  83. function NT_TakeMiniPortal(takePortal){
  84. var rightPortal;
  85. if(!takePortal) {
  86. return false;
  87. }
  88. var _portal = NTC_FindUnit(NTC_UNIT_OBJECT, GetLocaleString(3226));
  89. var _gid;
  90. if(_portal){
  91. do
  92. {
  93. _gid = _portal.gid;
  94. if(_gid == takePortal){
  95. rightPortal = _portal;
  96. break;
  97. }
  98. } while(_portal.GetNext());
  99. Delay(250)
  100. }
  101.  
  102. while(rightPortal.mode != 2){
  103. Delay(500);
  104. }
  105. Delay(200)
  106.  
  107. for(var i = 0 ; i <25 ; i++){
  108. if(NTM_GetCloserInt(rightPortal)) {
  109. NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, rightPortal);
  110. }
  111. NTC_Delay(250);
  112. if(me.areaid != 109){
  113. break;
  114. }
  115. }
  116. while(me.areaid == 0){
  117. NTC_Delay(200);
  118. }
  119. NTC_PingDelay(NTConfig_AreaDelay);
  120. if(me.areaid == 109){
  121. me.maxgametime = 0;
  122. }
  123. return me.areaid != 109;
  124. }
  125.  
  126. function NT_KillLilith(){
  127. entryX = me.x
  128. entryY = me.y
  129. NTP_DoPrecast(true);
  130. if(!NTM_MoveToPresetUnit(me.areaid, NTC_UNIT_OBJECT, 397, 2, 2)){
  131. return false;
  132. }
  133. if(!NT_KillMonster(707)){
  134. return false;
  135. }
  136. NTC_PingDelay(100);
  137. NTC_PickSpecialItem(650);
  138. NTC_PingDelay(100);
  139. NTSI_PickItems();
  140.  
  141. NTM_MoveTo(me.areaid, entryX, entryY)
  142. var _portal = NTC_FindUnit(NTC_UNIT_OBJECT, GetLocaleString(3226))
  143. for(var i = 0 ; i <25 ; i++){
  144. if(NTM_GetCloserInt(_portal)){
  145. NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _portal);
  146. }
  147. NTC_Delay(250);
  148. if(me.areaid != 133){
  149. break;
  150. }
  151. }
  152. NTC_PingDelay(NTConfig_AreaDelay);
  153. NTTMGR_VisitStash(); // force stash organs between mini's
  154. return true;
  155. }
  156.  
  157. function NT_FindExistingPortals(){ // this function is called before cubing keys. Checks for already opened portals so we can find the one we will open next
  158. var _portal = NTC_FindUnit(NTC_UNIT_OBJECT, GetLocaleString(3226));
  159. var _gid;
  160. if(_portal){
  161. do{
  162. if(!NT_IsPossiblePortal(_portal)){
  163. continue;
  164. }
  165. _gid = _portal.gid;
  166. if( existingPortal.indexOf(_gid) == -1){ // if the portal has not already been pushed into the existingPortal array
  167. existingPortal.push(_gid); // push it into the array now
  168. }
  169. } while(_portal.GetNext());
  170. }
  171. return;
  172. }
  173.  
  174. function NT_FindNewPortal(){ // now we have opened a new portal lets find it
  175. var _portal = NTC_FindUnit(NTC_UNIT_OBJECT, GetLocaleString(3226));
  176. var _gid;
  177. if(_portal){
  178. do
  179. {
  180. if(!NT_IsPossiblePortal(_portal)){
  181. continue;
  182. }
  183. _gid = _portal.gid;
  184. if( existingPortal.indexOf(_gid) == -1){
  185. return _gid; // return this portal. which will be the one taken
  186. }
  187. } while(_portal.GetNext());
  188. Delay(250)
  189. }
  190. return false;
  191. }
  192.  
  193. function NT_KillIzual(){
  194. NTP_DoPrecast(true);
  195. if(!NTM_MoveToPresetUnit(me.areaid, NTC_UNIT_OBJECT, 397, 2, 2)){
  196. return false;
  197. }
  198. if(!NT_KillMonster(706)){
  199. return false;
  200. }
  201. NTC_PingDelay(100);
  202. NTC_PickSpecialItem(652);
  203. NTC_PingDelay(100);
  204. NTSI_PickItems();
  205. NTM_MakeTP(true);
  206. NTTMGR_VisitStash(); // force stash organs between mini's
  207. return true;
  208. }
  209.  
  210. function NT_KillUberDuriel(){
  211. NTP_DoPrecast(true);
  212. NT_FindUberDuriel();
  213. var UberDuriel = NTC_FindMonster(708);
  214. if(UberDuriel){
  215. NTM_MoveTo(me.areaid, UberDuriel.x, UberDuriel.y);
  216.  
  217. }
  218. if(!NT_KillMonster(708)){
  219. return false;
  220. }
  221. NTC_PingDelay(100);
  222. NTC_PickSpecialItem(651);
  223. NTC_PingDelay(100);
  224. NTSI_PickItems();
  225. NTM_MakeTP(true);
  226. NTTMGR_VisitStash(); // force stash organs between mini's
  227. return true;
  228. }
  229.  
  230. function NT_FindUberDuriel(){
  231. var _findLoc = [20196, 8694, 20308, 8588, 20187, 8639, 20100, 8550, 20103, 8688, 20144, 8709, 20263, 8811, 20247, 8665];
  232. for(var i = 0 ; i < _findLoc.length; i += 2){
  233. NTM_MoveTo(me.areaid, _findLoc[i], _findLoc[i+1]);
  234. if(NTC_FindUnit(NTC_UNIT_MONSTER, 708)){
  235. break;
  236. }
  237. }
  238. }
  239.  
  240. function NT_KillMonster(classid) { // purpose of this is to increase max attacks for lilith
  241. var _target;
  242. if(NTConfig_AttackSkill[1] < 1){
  243. return false;
  244. }
  245. _target = NTC_FindUnit(NTC_UNIT_MONSTER, classid, 5);
  246. if(!_target){
  247. return false;
  248. }
  249. if(_target.IsAttackable()){
  250. var _attackcount = 0;
  251. while(_attackcount < 800 && NTA_IsValidMonster(_target)){
  252. if(NTA_Attack(_target, (_attackcount%30) == 0) < 2){
  253. break;
  254. }
  255. _attackcount++;
  256. }
  257. }
  258. return (_target.hp <= 0 || _target.mode == 0 || _target.mode == 12);
  259. }
  260.  
  261. function TakeLilllithPortal()
  262. {
  263. _portal = NTC_FindUnit(NTC_UNIT_OBJECT, GetLocaleString(3226));
  264. var Lportal;
  265.  
  266. if(_portal ) {
  267. for(var n = 0; n < _portal.length; n++) {
  268. if(_portal.subareaid == 133) {
  269. Lportal = _portal;
  270. break;
  271. }
  272. }
  273. for(var i = 0 ; i <25 ; i++){
  274. if(NTM_GetCloserInt(Lportal)) {
  275. NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, Lportal);
  276. }
  277. NTC_Delay(250);
  278. if(me.areaid != 109){
  279. break;
  280. }
  281. }
  282. while(me.areaid == 0){
  283. NTC_Delay(200);
  284. }
  285. NTC_PingDelay(NTConfig_AreaDelay);
  286. if(me.areaid == 133) {
  287. return true;
  288. }
  289. return false;
  290. }
  291. }
  292.  
  293. function TakeIzzyPortal()
  294. {
  295. _portal = NTC_FindUnit(NTC_UNIT_OBJECT, GetLocaleString(3226));
  296. var Iportal;
  297.  
  298. if(_portal ) {
  299. for(var n = 0; n < _portal.length; n++) {
  300. if(_portal.subareaid == 135) {
  301. Iportal = _portal;
  302. break;
  303. }
  304. }
  305. for(var i = 0 ; i <25 ; i++){
  306. if(NTM_GetCloserInt(Iportal)) {
  307. NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, Iportal);
  308. }
  309. NTC_Delay(250);
  310. if(me.areaid != 109){
  311. break;
  312. }
  313. }
  314. while(me.areaid == 0){
  315. NTC_Delay(200);
  316. }
  317. NTC_PingDelay(NTConfig_AreaDelay);
  318. if(me.areaid == 135) {
  319. return true;
  320. }
  321. return false;
  322. }
  323. }
  324.  
  325. function TakeDuryPortal()
  326. {
  327. _portal = NTC_FindUnit(NTC_UNIT_OBJECT, GetLocaleString(3226));
  328. var Iportal;
  329.  
  330. if(_portal ) {
  331. for(var n = 0; n < _portal.length; n++) {
  332. if(_portal.subareaid == 134) {
  333. Dportal = _portal;
  334. break;
  335. }
  336. }
  337. for(var i = 0 ; i <25 ; i++){
  338. if(NTM_GetCloserInt(Dportal)) {
  339. NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, Dportal);
  340. }
  341. NTC_Delay(250);
  342. if(me.areaid != 109){
  343. break;
  344. }
  345. }
  346. while(me.areaid == 0){
  347. NTC_Delay(200);
  348. }
  349. NTC_PingDelay(NTConfig_AreaDelay);
  350. if(me.areaid == 134) {
  351. return true;
  352. }
  353. return false;
  354. }
  355. }
  356.  
  357. function NT_OpenMiniPortals() {
  358. var miniSpots = []; // I know could have used parallel arrays, but was playing
  359. miniSpots[0] = [5134, 5056];
  360. miniSpots[1] = [5132, 5063];
  361. miniSpots[2] = [5130, 5070];
  362. for(var i = 0; i < 3; i++){
  363. Print(NTC_PrintRandomColor() + "opening portal");
  364. if(!NT_CubeKeys(miniSpots[i][0], miniSpots[i][1], i)){
  365. return false;
  366. }
  367. }
  368. NTC_PingDelay(NTConfig_CubingDelays);
  369. return true;
  370. }
  371.  
  372. function NT_CubeKeys(spotx, spoty, keys) {
  373. var _stash;
  374. NTTM_TownMove("stash");
  375. _stash = NTC_FindUnit(NTC_UNIT_OBJECT, NTC_UNIT_STASH);
  376. if(_stash){
  377. if(NTT_DoInteract(_stash)){
  378. var cube;
  379. cube = me.GetItems(NTC_UNIT_CUBE);
  380. if(!cube || cube.length < 1){
  381. return false;
  382. }
  383. if(NTCU_CheckCubeInventoryInt() > 0){
  384. if(!NTCU_OpenCubeInt(cube[0])){
  385. return false;
  386. }
  387. if(NTCU_ClearCubeInt() < 1){
  388. return false;
  389. }
  390. NTCU_CloseCubeInt();
  391. }
  392. }
  393. NTCU_MoveItemToCubeInt(cube[0], tKey[keys])
  394. NTCU_MoveItemToCubeInt(cube[0], hKey[keys])
  395. NTCU_MoveItemToCubeInt(cube[0], dKey[keys])
  396. NTTM_TownMoveXY(spotx, spoty);
  397. Delay(250)
  398. if(!NTCU_OpenCubeInt(cube[0])){
  399. return false;
  400. }
  401. Delay(250);
  402. if(Transmute()){
  403. NTC_PingDelay(NTConfig_CubingDelays);
  404. NTCU_CloseCubeInt();
  405. NTC_PingDelay(NTConfig_CubingDelays);
  406. NTC_CancelMenus();
  407. NTC_PingDelay(parseInt((NTConfig_CubingDelays / 2), 10));
  408. NTC_PingDelay(100);
  409. return true;
  410. }
  411. else{
  412. NTC_PingDelay(NTConfig_CubingDelays);
  413. Print(COLOR_1 + "didn't open portal");
  414. NTCU_CloseCubeInt();
  415. return false;
  416. }
  417. }
  418. else{
  419. return false;
  420. }
  421. }
  422.  
  423. function NT_PreBuffFade() {
  424. var specialCheckSelf = ['01'];
  425. var specialMercCheck = [];
  426. if(NTTM_TownMove("waypoint")){
  427. if(NTM_TakeWaypoint(107)){
  428. NTP_DoPrecast(true);
  429. NTM_MoveTo(me.areaid, 7811, 5872);
  430. Print(NTC_PrintRandomColor() + "Activating fade");
  431. while(1){
  432. if(me.GetStat(181) > 0) {
  433. break;
  434. }
  435. if(NTTMGR_CheckSafe(specialCheckSelf, specialMercCheck)){
  436. NTM_MoveTo(me.areaid, 7811, 5872);
  437. }
  438. NTC_Delay(200);
  439. }
  440. }
  441. }
  442. Print(NTC_PrintRandomColor() + "There's Our Fade");
  443. return;
  444. }
Add Comment
Please, Sign In to add comment