Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.31 KB | None | 0 0
  1. var Realm = "U.S. EAST"; //Logs onto specified realm. this is useful for redvex users.
  2. //Realms are: U.S. EAST, U.S. WEST, EUROPE, ASIA, CLASSIC BETA, REDVEX
  3. var checkRealm = false;
  4.  
  5.  
  6.  
  7. /////////////////////////////////////////////////////////////////
  8. // characters in your game setting: //
  9. ////////////////////////////////////////////////////////////////
  10. var characterdiff = "99"; //use this to keep those pesky spam bots out of the f'ing game
  11. var maxNumberOfPlayersss = "8"; //use this to set the maximum number of players allowed in your game
  12.  
  13. ///////////////////////////////////////////////////
  14. // Mule Notify
  15. ///////////////////////////////////////////////////
  16. var MuleNotification = false; // Set to true to send status to manager
  17.  
  18. ///////////////////////////////////////////////////
  19. // Mule Specific vars
  20. ///////////////////////////////////////////////////
  21. var MuleGamePassword = "hesony"; // Consistant through all games
  22. var muleAccountPassword = "puhmecho"; // for all mule accounts
  23. var CharPrefix = "PzbA";
  24. var AccountPrefix = "kozyi";
  25. var CreateCharacterClass = 0; // 0:Amazon, 1:Sorceress, 2:Necromancer, 3:Paladin, 4:Barbarian, 5:Druid, 6:Assassin
  26. var Hardcore = true;
  27. var Ladder = true;
  28. var Classic = false;
  29.  
  30. ///////////////////////////////////////
  31. // Channel Settings // / /These controll what if any channel you join
  32. ///////////////////////////////////////
  33. var joinChatAfterGame = true; // join chat after leaving a game
  34. var joinRandomChannel = false; // if this is true, will join a random channel, otherwise it will use the channel below..
  35. var joinChannelInChat = ""; // Channel you want your bot to join, leave blank to not join a private channel
  36.  
  37. ///////////////////////////////////////
  38. // Message Settings: // // These controll what your bot sais to the leechers will also send a log incommand to a channel bot
  39. ///////////////////////////////////////
  40. var chatMessageOnJoin = ""; // Chat Message to say Login command for channel bot will only be sent once
  41. var chatMessageAfterGame1 = ""; // Optional chat message Line #1 to say after each game on Channel
  42. var chatMessageAfterGame2 = ""; // Optional chat message Line #2 to say after each game on Channel
  43. var chatMessageAfterGame3 = ""; // Optional chat message Line #3 to say after each game on Channel
  44. var chatMessageAfterGame4 = ""; // Optional chat message Line #4 to say after each game on Channel
  45. var chatMessageAfterGame5 = ""; // Optional chat message Line #5 to say after each game on Channel
  46.  
  47. /////////////////////////////////////// // These will let you send a message with a game name password and time to your leechers
  48. // Game Message Settings: // // var saygamename must be true for any of these to work
  49. /////////////////////////////////////// // You cant NOT have a - in you game name it will bug it out
  50. var saygamename = false; // Must be true for any of the game message settings to work
  51. var nextgamemessage = ""; // This will come befor your next game name eg "New game is"
  52. var saypassword = false; // This will togle if the bot says your game pw
  53. var saytime = false; // This will togle if the bot says how much time till creation
  54. var timemessage = ""; // This will come after your pw and befor the time eg. "in about" xx seconds say time MUST be true for this to be used
  55.  
  56. //////////////////////////////////////
  57. // Minimum Game Length: //
  58. //////////////////////////////////////
  59.  
  60. var gameMinLength = 250000; // time in milliseconds, minimum game length, 180 seconds default (1 game/3 minutes)
  61.  
  62. ////////////////////////////////////////
  63. // Connection Settings: //
  64. ////////////////////////////////////////
  65.  
  66.  
  67. var unableToConnectRetry = 5; // time in minutes to retry connecting on connection fail (real value is +/- 1 min)
  68. var realmDownRetry = 1; // 7 is default , changing to short just to checktime in minutes to retry connecting on a realm down (default is 300 minutes)
  69. var disconnectedRetry = 5; // time in minutes to retry on a disconnection (usually ip ban related)
  70. var cdkeyInUseRetry = 3; // 5 is default - 3 is now time in minutes to retry on a cdkey in use error message (set to 0 to stop)
  71. var connectingToBnetTimeout = 20000; // time in milliseconds to wait for a login to time out and click cancel and retry
  72. var characterScreenTimeout = 10000; // time in milliseconds to wait for character screen to appear
  73. var pleaseWaitTimeout = 10000; // time in milliseconds to wait for a please wait popup
  74. var createGameThreshold = 40000; // -- 40000 is default , changed it to shortet to see what is going to happentime in milliseconds to wait between making games
  75. var createGameThresholdRandom = 2; // time in milliseconds to randomly add +/- to the game create time
  76. var createGameTimeout = 18000; // time in milliseconds to register a failed to create game
  77. var waitInLineTimeout = 60000; // time in milliseconds to wait in lines for a create game (60 second default)
  78. var characterSelectDelay = 2000; // time in milliseconds to wait before selecting a character on the char screen
  79. var loginDelay = 2000; // time in milliseconds to wait before submitting login information
  80. var clickDelay = 1000; // wait X milliseconds before next action after a click event
  81. var textDelay = 1000; // wait X milliseconds before next action after inserting text into a textbox
  82. var clickDelayRandom = 2000; // random amount of time to add to a click
  83. var textDelayRandom = 2000; // random amount of time to add to a text set
  84. var gameDoesNotExistDelayMin = 300000; // how long to wait when a Game Does Not Exist occurs - minimum - default 10 minutes
  85. var gameDoesNotExistDelayMax = 600000; // how long to wait when a Game Does Not Exist occurs - maximum - default 15 minutes
  86. var gameDoesNotExistTimeout = 30000; // how long to wait for the dialog to disappear (default 30 seconds, don't change this)
  87. var waitBeforeEnterChatMin = 2000; // min how long to wait before entering chat
  88. var waitBeforeEnterChatMax = 4000; // max how long to wait before entering chat
  89. var waitInChatBeforeActionsMin = 1000; // min how long to wait before joining channel
  90. var waitInChatBeforeActionsMax = 2000; // max how long to wait before joining channel
  91. var waitBeforeNextLineChatMin = 5000; // Minimum ammount of time to add after each text line
  92. var waitBeforeNextLineChatMax = 6000; // Maximum ammount of time to add after each text line
  93. var ftjDelay = 600; // time to idle before trying if leecher failed to join. In seconds.
  94. // DONT EDIT ANYTHING BELOW THIS
  95.  
  96. // D2NT Manager Command
  97. const D2NT_MGR_LOADING = 1;
  98. const D2NT_MGR_READY = 2;
  99. const D2NT_MGR_LOGIN = 3;
  100. const D2NT_MGR_CREATE_GAME = 4;
  101. const D2NT_MGR_INGAME = 5;
  102. const D2NT_MGR_RESTART = 6;
  103. const D2NT_MGR_CHICKEN = 7;
  104. const D2NT_MGR_PRINT_STATUS = 8;
  105. const D2NT_MGR_PRINT_LOG = 9;
  106. var alreadyLoggedIn = false; // will only send the login command once leave as unless you want to login everytime you join a channel
  107. var lastGameMade = GetTickCount();
  108. var lastGameStatus = 0;
  109. var nextGameMake = 0;
  110. var inGameAt = 0;
  111. var chatActionsDone = false;
  112. var lastGameFailed = false;
  113. var tempDelay = Random(waitBeforeNextLineChatMin, waitBeforeNextLineChatMax);
  114. var gameInfo = "";
  115. var bugignor = true;
  116. var muleGame = "";
  117. var Muling;
  118. var ingameScript;
  119. var MuleAccount;
  120. var onMule = false;
  121. var GrabMule;
  122. var mulepos;
  123. var myGame = getRandomString(12);
  124. var ftjcount = 0;
  125.  
  126. Include("libs/controlInfo.ntl");
  127. Include("libs/common/NTColorConverter.ntl");
  128. Include("libs/mulingInfo.ntl");
  129.  
  130. var controlData = new controlInfo();
  131.  
  132. function NTMain()
  133. {
  134. Delay(1000);
  135.  
  136. writeInitialSettings();
  137.  
  138. var _ingame = false;
  139.  
  140. controlData.clickDelay = clickDelay;
  141. controlData.textDelay = textDelay;
  142. controlData.clickDelayRandom = clickDelayRandom;
  143. controlData.textDelayRandom = textDelayRandom;
  144. while(1)
  145. {
  146. if(me.ingame)
  147. {
  148. if(!inGameAt)
  149. inGameAt = GetTickCount();
  150.  
  151. if(!_ingame)
  152. {
  153. RunGC(); // run garbage collector between each game
  154.  
  155. if(Load(ingameScript))
  156. {
  157. _ingame = true;
  158. if(ingameScript == "NTBot/NTBotGame.ntj") {
  159. NT_File("logs/messagecomands/"+me.charname+"-nextgame.txt", 1, me.gamename + "/" + me.gamepassword); // for leader to print game/pw to txt
  160. }
  161.  
  162. if(me.playtype > 0)
  163. sendEventToOOG(D2NT_MGR_INGAME, "In Game[IP:" + me.gameserverip.split(".")[3] + "]", 0);
  164.  
  165. else
  166. sendEventToOOG(D2NT_MGR_INGAME, "In Game", 0);
  167. if(ingameScript == "NTBot/NTBotGame.ntj") {
  168. Delay(3000);
  169. //Say("/f m come " + me.gamename); // this is for leechers to join only after leader is in game
  170.  
  171. }
  172. lastGameStatus = 2; // in game successful
  173. }
  174. }
  175.  
  176. Delay(1000);
  177. }
  178. else
  179. {
  180.  
  181. if(_ingame)
  182. {
  183. My_ExitGame_Check(); // out of korean modded d2nt fixes white screen of death
  184.  
  185. _ingame = false;
  186.  
  187. sendEventToOOG(D2NT_MGR_READY, "", 0);
  188. }
  189.  
  190. muleGame = NT_File("AMS/MuleStatus/" + me.account + "_mulegame.txt", 0);
  191. GrabMule = NT_File("AMS/MuleStatus/" + me.account + "_charstatus.txt", 0);
  192. Muling = NT_File("AMS/MuleStatus/" + me.account + "_mulingstatus.txt", 0);
  193.  
  194. switch(Muling)
  195. {
  196. case "true":
  197. {
  198. locationActionMule(controlData.getLocation());
  199. break;
  200. }
  201. case "false":
  202. {
  203. locationAction(controlData.getLocation());
  204. break;
  205. }
  206. }
  207. Delay(500);
  208. }
  209. }
  210. }
  211.  
  212. function locationAction(location)
  213. {
  214. switch(location.id)
  215. {
  216. case 3: // Lobby Chat
  217. //ftjcheck
  218. if (ftjcount >= 10 && lastGameStatus == 1) {
  219. sendEventToOOG(D2NT_MGR_PRINT_LOG, COLOR_1 + "FTJ detected...........Idling", 0);
  220. ftjcount = 0;
  221. inGameAt = 0;
  222. lastGameStatus = 0;
  223. setNextGameMake();
  224. locationTimeout(ftjDelay*1000, location);
  225. }
  226. if(onMule) {
  227. if(MuleNotification) {
  228. SendCopyData("D2NT Manager", null, 9<<16, "Swapping to Main character!");
  229. }
  230. controlData.click(controlData.controls.lobby.button.quit);
  231. break;
  232. }
  233.  
  234. if(!chatActionsDone)
  235. {
  236. chatActionsDone = true;
  237. Delay(Random(waitInChatBeforeActionsMin, waitInChatBeforeActionsMax));
  238.  
  239. if(joinRandomChannel || joinChannelInChat != "")
  240. {
  241. {
  242. Say("");
  243. Delay(12000);
  244. Say("");
  245. Say("")
  246. }
  247. }
  248. }
  249. case 1: // Lobby
  250. //ftjcheck
  251. if (ftjcount >= 10 && lastGameStatus == 1) {
  252. sendEventToOOG(D2NT_MGR_PRINT_LOG, COLOR_1 + "FTJ detected...........Idling", 0);
  253. ftjcount = 0;
  254. inGameAt = 0;
  255. lastGameStatus = 0;
  256. setNextGameMake();
  257. locationTimeout(ftjDelay*1000, location);
  258. }
  259. sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
  260.  
  261. if(location.id == 1 && joinChatAfterGame)
  262. {
  263. Delay(Random(waitBeforeEnterChatMin, waitBeforeEnterChatMax));
  264. controlData.click(controlData.controls.lobby.button.enterChat);
  265. break;
  266. }
  267.  
  268. if(GetTickCount() > nextGameMake)
  269. {
  270. lastGameFailed = false;
  271.  
  272. switch(lastGameStatus)
  273. {
  274. case 0:
  275. password = (me.gamepassword);
  276. game = (getGameName(me.gamename));
  277. counter = (getGameCounter(me.gamename, false));
  278. time = (parseInt((nextGameMake - GetTickCount() - tempDelay)/1000+3.0));
  279. if (saygamename){{
  280. gameInfo += nextgamemessage + " " + game + counter;
  281. }
  282. if (saypassword){
  283. gameInfo += "//" + password
  284. }
  285. if (saytime){
  286. gameInfo += " " + timemessage + " " + time + " seconds"
  287. }
  288. }
  289. if(joinChatAfterGame){
  290. if(chatMessageAfterGame1.length > 0){
  291. Say(chatMessageAfterGame1);
  292. if(chatMessageAfterGame1.length > 0){
  293. Delay(tempDelay);
  294. }
  295. }
  296. if(chatMessageAfterGame2.length > 0){
  297. Say(chatMessageAfterGame2);
  298. if(chatMessageAfterGame2.length > 0){
  299. Delay(tempDelay);
  300. }
  301. }
  302. if(chatMessageAfterGame3.length > 0){
  303. Say(chatMessageAfterGame3);
  304. if(chatMessageAfterGame3.length > 0){
  305. Delay(tempDelay);
  306. }
  307. }
  308. if(chatMessageAfterGame4.length > 0){
  309. Say(chatMessageAfterGame4);
  310. if(chatMessageAfterGame4.length > 0){
  311. Delay(tempDelay);
  312. }
  313. }
  314. if(chatMessageAfterGame5.length > 0){
  315. Say(chatMessageAfterGame5);
  316. if(chatMessageAfterGame5.length > 0){
  317. Delay(tempDelay);
  318. }
  319. }
  320. if(saygamename) {
  321. if(bugignor){
  322. bugignor = false;
  323. gameInfo = "";
  324. } else{
  325. Say(gameInfo)
  326. Delay(tempDelay)
  327. gameInfo = "";
  328. }
  329. }
  330. }
  331. _control = controlData.get(controlData.controls.lobby.button.create); // fixes creation stuck button bug out of unmodded d2nt
  332. if(_control && _control.pressed)
  333. {
  334. controlData.click(controlData.controls.lobby.button.join);
  335. Delay(500);
  336. }
  337.  
  338. controlData.click(controlData.controls.lobby.button.create);
  339. _control = controlData.get(controlData.controls.lobby.create.button.useCharacterDifference);
  340. if(_control && !_control.pressed)
  341. {
  342. controlData.click(controlData.controls.lobby.create.button.useCharacterDifference);//checks the use character diff box...does this every time so no go
  343. }
  344. controlData.setText(controlData.controls.lobby.create.editBox.characterDifference,(characterdiff)); //level restriction
  345. controlData.setText(controlData.controls.lobby.create.editBox.maxNumberOfPlayers, (maxNumberOfPlayersss)); //max players
  346. controlData.setText(controlData.controls.lobby.create.editBox.password, "hesony");
  347. nextGameMake = GetTickCount() + createGameTimeout; // set our timeout
  348. sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
  349. case 1: // game failed, rollover to reset timer
  350. inGameAt = GetTickCount(); // reset inGameAt, to wait how long we should have waited..
  351. lastGameFailed = true;
  352. case 2:
  353. outputGameLength();
  354. lastGameStatus = 0;
  355. setNextGameMake();
  356. sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
  357. break;
  358. }
  359. } else
  360. timeoutDelay(nextGameMake-GetTickCount(), location, true);
  361. break;
  362.  
  363. case 2: // Waiting In Line
  364. if(GetTickCount()-lastGameMade > waitInLineTimeout)
  365. controlData.click(controlData.controls.lobby.inLine.button.cancel);
  366. break;
  367.  
  368. case 4: // Create Game
  369. ingameScript = "NTBot/NTBotGame.ntj";
  370. controlData.setText(controlData.controls.lobby.create.editBox.characterDifference,(characterdiff));
  371. controlData.setText(controlData.controls.lobby.create.editBox.maxNumberOfPlayers, (maxNumberOfPlayersss));
  372.  
  373. sendEventToOOG(D2NT_MGR_CREATE_GAME, location.name, 0);
  374.  
  375. locationTimeout(15000, location);
  376.  
  377. lastGameMade = GetTickCount();
  378. lastGameStatus = 1;
  379. Delay(500);
  380. break;
  381.  
  382. case 5: // Join Game
  383. break;
  384.  
  385. case 6: // Ladder
  386. break;
  387.  
  388. case 7: // Channel List
  389. break;
  390.  
  391. case 8: // Main Menu
  392. {
  393. if(!checkRealm)
  394. {
  395. controlData.click(controlData.controls.mainMenu.button.gateway);
  396. checkRealm = true;
  397. }
  398. else
  399. controlData.click(controlData.gameTypes[me.playtype]);
  400. }
  401. break;
  402.  
  403. case 9: // Login
  404. sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
  405. Delay(loginDelay);
  406.  
  407. controlData.setText(controlData.controls.login.editBox.accountName, me.account);
  408.  
  409. sendEventToOOG(D2NT_MGR_LOGIN, location.name, 0);
  410.  
  411. locationTimeout(5000, location);
  412. onMule = false;
  413. break;
  414.  
  415. case 10: // Login Error (this is a fatal error, so stop)
  416. sendEventToOOG(D2NT_MGR_RESTART, location.name, 10);
  417. Delay(3500);
  418. break;
  419.  
  420. case 11: // Unable To Connect
  421. timeoutDelay(unableToConnectRetry*60*1000, location)
  422. controlData.click(controlData.controls.login.unableToConnect.button.ok);
  423. break;
  424.  
  425. case 12: // Character Select
  426. var _time, _control, _info;
  427.  
  428. sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
  429.  
  430. for(_time = 0 ; _time < characterScreenTimeout ; _time += 500)
  431. {
  432. _control = controlData.get(controlData.controls.characterSelect.textBox.characterInfo[me.charloc]);
  433. if(_control && _control.GetText() != undefined)
  434. break;
  435.  
  436. Delay(500);
  437. }
  438.  
  439. _info = controlData.get(controlData.controls.characterSelect.textBox.characterInfo[me.charloc]).GetText();
  440. if(_info ){ SendCopyData(d2monitor, null, 900, _info[1]);}
  441.  
  442. if(_time < characterScreenTimeout)
  443. {
  444. Delay(characterSelectDelay);
  445.  
  446. controlData.click(controlData.controls.characterSelect.textBox.characters[me.charloc], 0, 0, 1);
  447. controlData.click(controlData.controls.characterSelect.textBox.characterInfo[me.charloc], 0, 0, 1);
  448.  
  449. // reset last game made, so it doesnt make a game immediately
  450. inGameAt = 0;
  451. setNextGameMake();
  452. }
  453. else
  454. {
  455. controlData.click(controlData.controls.characterSelect.button.exit);
  456. timeoutDelay(realmDownRetry*60*1000, location);
  457. }
  458. break;
  459.  
  460. case 13: // Realm Down - Character Select screen
  461. controlData.click(controlData.controls.characterSelect.button.exit);
  462. timeoutDelay(realmDownRetry*60*1000, location);
  463. break;
  464.  
  465. case 14: // Character Select - Disconnected
  466. timeoutDelay(disconnectedRetry*60*1000, location);
  467. controlData.click(controlData.controls.characterSelect.disconnected.button.ok);
  468. break;
  469.  
  470. case 15: // New Character
  471. break;
  472.  
  473. case 16: // Character Select - Please Wait popup
  474. if(!locationTimeout(pleaseWaitTimeout, location))
  475. controlData.click(controlData.controls.characterSelect.pleaseWait.button.cancel);
  476. break;
  477.  
  478. case 17: // Lobby - Lost Connection - just click okay, since we're toast anyway
  479. controlData.click(controlData.controls.lobby.lostConnection.button.ok);
  480. break;
  481.  
  482. case 18: // D2 Splash
  483. controlData.click(controlData.controls.d2Splash.textBox.copyright);
  484. break;
  485.  
  486. case 19: // Login - Cdkey In Use
  487. timeoutDelay(cdkeyInUseRetry*60*1000, location);
  488. controlData.click(controlData.controls.login.cdkeyInUse.button.ok);
  489. break;
  490.  
  491. case 20: // Single Player - Select Difficulty
  492. controlData.click(controlData.singlePlayerDifficulties[me.diff]);
  493. break;
  494.  
  495. case 21: // Main Menu - Connecting
  496. if(!locationTimeout(connectingToBnetTimeout, location))
  497. controlData.click(controlData.controls.mainMenu.connecting.button.cancel);
  498. break;
  499.  
  500. case 22: // Login - Invalid Cdkey (classic or xpac)
  501. sendEventToOOG(D2NT_MGR_PRINT_LOG, COLOR_1 + "Bad CD Key...........Idling", 0);
  502. while(1) { Delay(500); }
  503. sendEventToOOG(D2NT_MGR_RESTART, location.name, 3600);
  504. Delay(3500);
  505. break;
  506.  
  507. case 23: // Character Select - Connecting
  508. if(!locationTimeout(characterScreenTimeout, location))
  509. controlData.click(controlData.controls.characterSelect.button.exit);
  510. break;
  511.  
  512. case 24: // Server Down - not much to do but wait..
  513. break;
  514.  
  515. case 25: // Lobby - Please Wait
  516. if(!locationTimeout(pleaseWaitTimeout, location))
  517. controlData.click(controlData.controls.lobby.pleaseWait.button.cancel);
  518. break;
  519.  
  520. case 26: // Lobby - Game Name Exists
  521. sendEventToOOG(D2NT_MGR_PRINT_LOG, COLOR_1 + "Game already exists", 0);
  522.  
  523. inGameAt = 0;
  524. lastGameStatus = 0;
  525. setNextGameMake();
  526.  
  527. locationTimeout(15000, location);
  528. break;
  529.  
  530. case 27: // Gateway Select
  531. {
  532. controlData.clickRealmEntry(RealmIndex());
  533. controlData.click(controlData.controls.gateway.button.ok);
  534. }
  535. break;
  536.  
  537. case 28: // Lobby - Game Does Not Exist
  538. inGameAt = Random(gameDoesNotExistDelayMin, gameDoesNotExistDelayMax);
  539. lastGameStatus = 0;
  540. setNextGameMake();
  541.  
  542. locationTimeout(gameDoesNotExistTimeout, location);
  543. break;
  544. default:
  545. if (lastGameStatus == 1) {
  546. sendEventToOOG(D2NT_MGR_PRINT_STATUS, "Please Wait...", 0);
  547. for (ftjcount=0; ftjcount<=10 && !me.ingame; ftjcount++) {
  548. Delay(1000)
  549. }
  550. }
  551. break;
  552.  
  553. case 29: // Popup: You were,disconnected from,battle.net. Please,reconnect.
  554. timeoutDelay(disconnectedRetry*60*1000, location)
  555. controlData.click(controlData.controls.unableToConnect.button.ok);
  556. break;
  557.  
  558. }
  559. }
  560.  
  561. function sendEventToOOG(locationId, statusString, pendingTime)
  562. {
  563. return SendCopyData("D2NT Manager", null, (locationId<<16)|pendingTime, statusString);
  564. }
  565.  
  566. function setNextGameMake()
  567. {
  568. lastGameMade = GetTickCount();
  569. nextGameMake = lastGameMade + createGameThreshold + Random(0-createGameThresholdRandom, createGameThresholdRandom) + inGameAt;
  570. inGameAt = 0;
  571. chatActionsDone = false;
  572. }
  573.  
  574. function outputGameLength()
  575. {
  576. if(inGameAt)
  577. {
  578. duration = GetTickCount() - inGameAt;
  579.  
  580. inGameAt = (duration < gameMinLength ? gameMinLength - duration : 0);
  581. }
  582. }
  583.  
  584. function locationTimeout(time, location)
  585. {
  586. endtime = GetTickCount() + time;
  587.  
  588. while(controlData.getLocation().id == location.id && endtime > GetTickCount())
  589. {
  590. sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name + " (" + parseInt((endtime-GetTickCount())/1000) + "s)", 0);
  591. Delay(500);
  592. }
  593.  
  594. return (controlData.getLocation().id != location.id);
  595. }
  596.  
  597. function timeoutDelay(time, location)
  598. {
  599. endtime = GetTickCount() + time;
  600.  
  601. while(endtime > GetTickCount())
  602. {
  603. sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name + " (" + parseInt((endtime-GetTickCount())/1000) + "s)", 0);
  604. Delay(1000);
  605. }
  606. }
  607.  
  608. function getRandomString(_length)
  609. {
  610. _retString = "";
  611. _charSet = "0123456789abcdefghijklmnopqrstuvwxyz";
  612. _cRo = -1;
  613. _cR = -1;
  614. while(_length--)
  615. {
  616. while(_cRo == _cR)
  617. _cR = Random(0, _charSet.length-1)
  618. _retString += _charSet.charAt(_cR);
  619. Delay(1);
  620. _cRo = _cR
  621. }
  622.  
  623. return _retString;
  624. }
  625.  
  626. function getGameName(lastGameString)
  627. {
  628. if(!lastGameString)
  629. return "";
  630. else
  631. return (lastGameString.split("-")[0] + "-");
  632. }
  633.  
  634. function getGameCounter(lastGameString, simple)
  635. {
  636. var myCount;
  637. if(!lastGameString)
  638. return "-1";
  639. else
  640. {
  641. switch(lastGameString.split("-")[1])
  642. {
  643. case "08":
  644. myCount = 9;
  645. break;
  646. case "09":
  647. myCount = 10;
  648. break;
  649. case "99":
  650. myCount = 00;
  651. break;
  652. default:
  653. myCount = parseInt(lastGameString.split("-")[1]) + 1;
  654. break;
  655. }
  656. if(!simple)
  657. {
  658. if(myCount <= 9)
  659. return ('0' + myCount);
  660. }
  661. return myCount;
  662. }
  663. }
  664.  
  665. function My_ExitGame_Check()
  666. {
  667. for (var i = 0; i < 40; i++)
  668. {
  669. if (controlData.getLocation().id != undefined)
  670. break;
  671.  
  672. if (i > 38)
  673. {
  674. LogPrintSimple(me.account + " StarterTest.txt", "White Screen of Death: Restarting")
  675. sendEventToOOG(D2NT_MGR_PRINT_LOG, COLOR_1 + "White Screen of Death: Restarting", 0);
  676. sendEventToOOG(D2NT_MGR_RESTART, "", 5);
  677. My_Delay(); // make sure and add this also
  678. }
  679.  
  680. Delay(500);
  681. }
  682. }
  683.  
  684. function My_Delay(retry)
  685. {
  686. if (arguments.length < 1)
  687. retry = 20;
  688.  
  689. while (retry-- > 0)
  690. Delay(1000);
  691. }
  692.  
  693. function LogPrintSimple(filepath, mesg){
  694.  
  695. var _filepath = filepath;
  696. var _mesg = mesg;
  697.  
  698. var date = new Date().toLocaleFormat("<%a, %b %d, %H:%M>");
  699. var logfile = FileOpen(_filepath, 2); // opens file
  700. if(!logfile)
  701. var logfile = FileOpen(_filepath, 1); // if file not there then creates it
  702.  
  703. logfile.WriteLine(date + " " + _mesg );
  704. logfile.Close();
  705. }
  706.  
  707. function writeInitialSettings()
  708. {
  709. _char = FileOpen("AMS/MuleStatus/" + me.account + "_charstatus.txt", 0);
  710.  
  711. if(!_char)
  712. NT_File("AMS/MuleStatus/" + me.account + "_charstatus.txt", 1, "Main");
  713. else
  714. _char.Close();
  715. Delay(500);
  716.  
  717. _stat = FileOpen("AMS/MuleStatus/" + me.account + "_mulingstatus.txt", 0);
  718.  
  719. if(!_stat)
  720. NT_File("AMS/MuleStatus/" + me.account + "_mulingstatus.txt", 1, "false");
  721. else
  722. _stat.Close();
  723. Delay(500);
  724.  
  725. _pos = FileOpen("AMS/MuleStatus/" + me.account + "_locstatus.txt", 0);
  726.  
  727. if(!_pos)
  728. NT_File("AMS/MuleStatus/" + me.account + "_locstatus.txt", 1, "0");
  729. else
  730. _pos.Close();
  731. }
  732.  
  733. function NT_File(path, mode, msg, delay) {
  734. var _msg = "";
  735. var _line = "";
  736. var _fileHandle;
  737. var _isFileCheck = false;
  738.  
  739. if (arguments.length < 3) { msg = ""; }
  740. if (arguments.length < 4) { delay = (mode > 0) ? 5 : 2; }
  741.  
  742. while (delay--) {
  743. if (mode == 2 && !_isFileCheck) {
  744. _fileHandle = FileOpen(path, 0);
  745. if (!_fileHandle)
  746. _fileHandle = FileOpen(path, 1);
  747.  
  748. if (_fileHandle)
  749. _fileHandle.Close();
  750.  
  751. _isFileCheck = true;
  752. }
  753.  
  754. _fileHandle = FileOpen(path, mode);
  755. if (_fileHandle)
  756. break;
  757.  
  758. if (delay)
  759. Delay(200);
  760. }
  761.  
  762. if (_fileHandle) {
  763. if (mode == 0) {
  764. while (!_fileHandle.eof) {
  765. _line = _fileHandle.ReadLine();
  766. if (_line || !_fileHandle.eof)
  767. _msg += _line + msg;
  768. }
  769. }
  770. else if (msg)
  771. _fileHandle.WriteLine(msg);
  772.  
  773. _fileHandle.Close();
  774. }
  775.  
  776. return _msg;
  777. }
  778.  
  779. function SetForNextGame()
  780. {
  781. var gametime = GetTickCount() + 1000 * 60 * 3 + 1000 * 15;
  782. var timeTilStart = gametime - GetTickCount();
  783. locationTimeout(timeTilStart, location);
  784. chatActionsDone = false;
  785. inGameAt = 0;
  786. }
  787.  
  788. function NT_CheckNameLength(prefix, totallength)
  789. {
  790. var _howManyChars = totallength - prefix.length
  791. return _howManyChars;
  792. }
  793.  
  794. function NT_LogMuleAccount(newaccount)
  795. {
  796. var _newAccount = newaccount;
  797. var muleaccountlist = FileOpen("AMS/MuleLogs/" + me.account + "_muleaccount.txt", 2);
  798. if(!muleaccountlist)
  799. var muleaccountlist = FileOpen("AMS/MuleLogs/" + me.account + "_muleaccount.txt", 1);
  800.  
  801. muleaccountlist.WriteLine(_newAccount + "/" + muleAccountPassword);
  802. muleaccountlist.Close();
  803. return;
  804. }
  805.  
  806. function LogMuleAccountStatus(newaccount)
  807. {
  808. var _newAccount = newaccount;
  809. var muleaccountlist = FileOpen("AMS/MuleStatus/" + me.account + "_muleaccount.txt", 2);
  810. if(!muleaccountlist)
  811. var muleaccountlist = FileOpen("AMS/MuleStatus/" + me.account + "_muleaccount.txt", 1);
  812.  
  813. muleaccountlist.WriteLine(_newAccount);
  814. muleaccountlist.Close();
  815. return;
  816. }
  817.  
  818. function getRandomStringNames(_length)
  819. {
  820. _retString = "";
  821. _charSet = "abcdefghijklmnopqrstuvwxyz";
  822.  
  823. while(_length--)
  824. {
  825. _retString += _charSet.charAt(Random(0, _charSet.length-1));
  826. Delay(50);
  827. }
  828. return _retString;
  829. }
  830.  
  831. function RealmIndex()
  832. {
  833. switch(Realm)
  834. {
  835. case "U.S. WEST":
  836. return 0;
  837. case "U.S. EAST":
  838. return 1;
  839. case "ASIA":
  840. return 2;
  841. case "EUROPE":
  842. return 3;
  843. case "REDVEX":
  844. return 4;
  845. }
  846. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement