Advertisement
Guest User

AutoMulingSystem1.2

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