Advertisement
gtoilet

d2classic pubjoin.dbj

Feb 19th, 2017
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.83 KB | None | 0 0
  1. var StarterConfig = {
  2. MinGameTime: 0, // Minimum game length in seconds. If a game is ended too soon, the rest of the time is waited in the lobby
  3. PingQuitDelay: 30, // Time in seconds to wait in lobby after quitting due to high ping
  4. CreateGameDelay: 5, // Seconds to wait before creating a new game
  5. ResetCount: 0, // Reset game count back to 1 every X games.
  6. CharacterDifference: 99, // Character level difference. Set to false to disable character difference.
  7. ChatActionsDelay: 2, // Seconds to wait in lobby before entering a channel
  8.  
  9. JoinChannel: "", // Default channel. Can be an array of channels - ["channel 1", "channel 2"]
  10. FirstJoinMessage: "", // Default join message. Can be an array of messages
  11. AnnounceGames: false, // Default value
  12. AfterGameMessage: "", // Default message after a finished game. Can be an array of messages
  13.  
  14. SwitchKeyDelay: 5, // Seconds to wait before switching a used/banned key or after realm down
  15. CrashDelay: 5, // Seconds to wait after a d2 window crash
  16. FTJDelay: 10, // Seconds to wait after failing to create a game
  17. RealmDownDelay: 2, // Minutes to wait after getting Realm Down message
  18. UnableToConnectDelay: 5, // Minutes to wait after Unable To Connect message
  19. CDKeyInUseDelay: 5, // Minutes to wait before connecting again if CD-Key is in use.
  20. ConnectingTimeout: 20, // Seconds to wait before cancelling the 'Connecting...' screen
  21. PleaseWaitTimeout: 10, // Seconds to wait before cancelling the 'Please Wait...' screen
  22. WaitInLineTimeout: 60, // Seconds to wait before cancelling the 'Waiting in Line...' screen
  23. GameDoesNotExistTimeout: 30 // Seconds to wait before cancelling the 'Game does not exist.' screen
  24. };
  25.  
  26. /**
  27. IncludeFilter config:
  28.  
  29. Multiple entries in the same array mean AND:
  30. ["baal", "-"] = game has to contain "baal" and "-"
  31.  
  32. Different entries mean OR:
  33. ["baal"],
  34. ["diablo"]
  35. will join games with either "baal" or "diablo" in their name
  36.  
  37. Similar rules apply to ExcludeFilter:
  38.  
  39. ["somebaal", "-"] ignores games with "somebaal" and "-" in the game name
  40.  
  41. ["somebaal"],
  42. ["somediablo"]
  43. this will ignore all games with "somebaal" or "somediablo" in their names
  44. */
  45.  
  46. var IncludeFilter = [
  47. [""]
  48. ];
  49.  
  50. var ExcludeFilter = [
  51. [""]
  52. ];
  53.  
  54. // ###############################################################################
  55.  
  56. function includeCheck(game) {
  57. // No filters
  58. if (!IncludeFilter.length) {
  59. return true;
  60. }
  61.  
  62. var i, j;
  63.  
  64. for (i = 0; i < IncludeFilter.length; i += 1) {
  65. for (j = 0; j < IncludeFilter[i].length; j += 1) {
  66. // Break the inner loop if an element didn't match or if an element is invalid
  67. if (!IncludeFilter[i][j] || !game.match(IncludeFilter[i][j], "gi")) {
  68. break;
  69. }
  70. }
  71.  
  72. // All elements matched
  73. if (j === IncludeFilter[i].length) {
  74. return true;
  75. }
  76. }
  77.  
  78. return false;
  79. }
  80.  
  81. function excludeCheck(game) {
  82. // No filters
  83. if (!ExcludeFilter.length) {
  84. return true;
  85. }
  86.  
  87. var i, j;
  88.  
  89. for (i = 0; i < ExcludeFilter.length; i += 1) {
  90. for (j = 0; j < ExcludeFilter[i].length; j += 1) {
  91. // Break the inner loop if an element didn't match or if an element is invalid
  92. if (!ExcludeFilter[i][j] || !game.match(ExcludeFilter[i][j], "gi")) {
  93. break;
  94. }
  95. }
  96.  
  97. // All elements matched
  98. if (j === ExcludeFilter[i].length) {
  99. return false;
  100. }
  101. }
  102.  
  103. return true;
  104. }
  105.  
  106. // No touchy!
  107. include("json2.js");
  108. include("OOG.js");
  109. include("automule.js");
  110. include("gambling.js");
  111. include("craftingsystem.js");
  112. include("torchsystem.js");
  113. include("common/misc.js");
  114.  
  115. if (!FileTools.exists("data/" + me.profile + ".json")) {
  116. DataFile.create();
  117. }
  118.  
  119. var gameInfo, gameStart, ingame, chatActionsDone, pingQuit,
  120. handle, useChat, firstLogin, connectFail, lastGameTick,
  121. gameCount = DataFile.getStats().runs + 1,
  122. lastGameStatus = "ready",
  123. loginFail = 0,
  124. isUp = "no",
  125. chanInfo = {
  126. joinChannel: "",
  127. firstMsg: "",
  128. afterMsg: "",
  129. announce: false
  130. };
  131.  
  132. function sayMsg(string) {
  133. if (!useChat) {
  134. return;
  135. }
  136.  
  137. say(string);
  138. }
  139.  
  140. function ReceiveCopyData(mode, msg) {
  141. var obj;
  142.  
  143. switch (msg) {
  144. case "Handle":
  145. handle = mode;
  146.  
  147. break;
  148. }
  149.  
  150. switch (mode) {
  151. case 2: // Game info
  152. print("Recieved Game Info");
  153.  
  154. gameInfo = JSON.parse(msg);
  155.  
  156. break;
  157. case 3: // Game request
  158. // Don't let others join mule/torch/key/gold drop game
  159. if (AutoMule.inGame || Gambling.inGame || TorchSystem.inGame || CraftingSystem.inGame) {
  160. break;
  161. }
  162.  
  163. if (gameInfo) {
  164. obj = JSON.parse(msg);
  165.  
  166. if (me.gameReady) {
  167. D2Bot.joinMe(obj.profile, me.gamename.toLowerCase(), "", me.gamepassword.toLowerCase(), isUp);
  168. } else {
  169. D2Bot.joinMe(obj.profile, gameInfo.gameName.toLowerCase(), gameCount, gameInfo.gamePass.toLowerCase(), isUp);
  170. }
  171. }
  172.  
  173. break;
  174. case 4: // Heartbeat ping
  175. if (msg === "pingreq") {
  176. sendCopyData(null, me.windowtitle, 4, "pingrep");
  177. }
  178.  
  179. break;
  180. case 0xf124: // Cached info retreival
  181. if (msg !== "null") {
  182. gameInfo.crashInfo = JSON.parse(msg);
  183. }
  184.  
  185. break;
  186. }
  187. }
  188.  
  189. function setNextGame() {
  190. var nextGame = gameInfo.gameName;
  191.  
  192. if (StarterConfig.ResetCount && gameCount + 1 >= StarterConfig.ResetCount) {
  193. nextGame += 1;
  194. } else {
  195. nextGame += (gameCount + 1);
  196. }
  197.  
  198. DataFile.updateStats("nextGame", nextGame);
  199. }
  200.  
  201. function locationTimeout(time, location) {
  202. var endtime = getTickCount() + time;
  203.  
  204. while (getLocation() === location && endtime > getTickCount()) {
  205. delay(500);
  206. }
  207.  
  208. return (getLocation() !== location);
  209. }
  210.  
  211. function updateCount() {
  212. D2Bot.updateCount();
  213. delay(1000);
  214. ControlAction.click(6, 264, 366, 272, 35);
  215.  
  216. try {
  217. login(me.profile);
  218. } catch (e) {
  219.  
  220. }
  221.  
  222. delay(1000);
  223. ControlAction.click(6, 33, 572, 128, 35);
  224. }
  225.  
  226. function ScriptMsgEvent(msg) {
  227. switch (msg) {
  228. case "mule":
  229. AutoMule.check = true;
  230.  
  231. break;
  232. case "muleTorch":
  233. AutoMule.torchCheck = true;
  234.  
  235. break;
  236. case "torch":
  237. TorchSystem.check = true;
  238.  
  239. break;
  240. case "crafting":
  241. CraftingSystem.check = true;
  242.  
  243. break;
  244. case "getMuleMode":
  245. if (AutoMule.torchAnniCheck === 2) {
  246. scriptBroadcast("2");
  247. } else if (AutoMule.torchAnniCheck === 1) {
  248. scriptBroadcast("1");
  249. } else if (AutoMule.check) {
  250. scriptBroadcast("0");
  251. }
  252.  
  253. break;
  254. case "pingquit":
  255. pingQuit = true;
  256.  
  257. break;
  258. }
  259. }
  260.  
  261. function timer(tick) {
  262. if (!tick) {
  263. return "";
  264. }
  265.  
  266. var min, sec;
  267.  
  268. min = Math.floor((getTickCount() - tick) / 60000).toString();
  269.  
  270. if (min <= 9) {
  271. min = "0" + min;
  272. }
  273.  
  274. sec = (Math.floor((getTickCount() - tick) / 1000) % 60).toString();
  275.  
  276. if (sec <= 9) {
  277. sec = "0" + sec;
  278. }
  279.  
  280. return " (" + min + ":" + sec + ")";
  281. }
  282.  
  283. function randomString(len) {
  284. var i,
  285. rval = "",
  286. letters = "abcdefghijklmnopqrstuvwxyz";
  287.  
  288. for (i = 0; i < len; i += 1) {
  289. rval += letters[Math.floor(Math.random() * 26)];
  290. }
  291.  
  292. return rval;
  293. }
  294.  
  295. function main() {
  296. debugLog(me.profile);
  297. addEventListener('copydata', ReceiveCopyData);
  298. addEventListener('scriptmsg', ScriptMsgEvent);
  299.  
  300. while (!handle) {
  301. delay(100);
  302. }
  303.  
  304. DataFile.updateStats("handle", handle);
  305. delay(500);
  306. D2Bot.init();
  307. load("tools/heartbeat.js");
  308.  
  309. while (!gameInfo) {
  310. D2Bot.requestGameInfo();
  311. delay(500);
  312. }
  313.  
  314. if (gameInfo.error) {
  315. D2Bot.retrieve();
  316. delay(200);
  317.  
  318. if (gameInfo.crashInfo) {
  319. D2Bot.printToConsole("Crash Info: Script: " + gameInfo.crashInfo.currScript + " Area: " + gameInfo.crashInfo.area, 10);
  320. }
  321.  
  322. ControlAction.timeoutDelay("Crash Delay", StarterConfig.CrashDelay * 1e3);
  323. D2Bot.updateRuns();
  324. }
  325.  
  326. D2Bot.store(JSON.stringify({currScript: "none", area: "out of game"}));
  327.  
  328. while (true) {
  329. while (me.ingame) { // returns true before actually in game so we can't only use this check
  330. if (me.gameReady) { // returns false when switching acts so we can't use while
  331. isUp = "yes";
  332.  
  333. if (!ingame) {
  334. gameStart = getTickCount();
  335.  
  336. print("Updating Status");
  337. //D2Bot.updateStatus("Game: " + me.gamename);
  338.  
  339. lastGameStatus = "ingame";
  340. ingame = true;
  341.  
  342. DataFile.updateStats("runs", gameCount);
  343. DataFile.updateStats("ingameTick");
  344. }
  345.  
  346. D2Bot.updateStatus("Game: " + me.gamename + timer(gameStart));
  347. }
  348.  
  349. delay(1000);
  350. }
  351.  
  352. isUp = "no";
  353.  
  354. locationAction(getLocation());
  355. delay(1000);
  356. }
  357. }
  358.  
  359. function locationAction(location) {
  360. var i, string, text, gameToJoin, doneGames, gameList;
  361.  
  362. MainSwitch:
  363. switch (location) {
  364. case 0:
  365. ControlAction.click(6, 264, 266, 272, 35);
  366. break;
  367. case 1: // Lobby
  368. D2Bot.updateStatus("Lobby");
  369.  
  370. if (!firstLogin) {
  371. firstLogin = true;
  372. }
  373.  
  374. if (lastGameStatus === "pending") {
  375. gameCount += 1;
  376. }
  377.  
  378. loginFail = 0;
  379.  
  380. if (StarterConfig.PingQuitDelay && pingQuit) {
  381. ControlAction.timeoutDelay("Ping Delay", StarterConfig.PingQuitDelay * 1e3);
  382.  
  383. pingQuit = false;
  384. }
  385.  
  386. if (ingame || gameInfo.error) {
  387. if (!gameStart) {
  388. gameStart = DataFile.getStats().ingameTick;
  389. }
  390.  
  391. if (getTickCount() - gameStart < StarterConfig.MinGameTime * 1e3) {
  392. ControlAction.timeoutDelay("Min game time wait", StarterConfig.MinGameTime * 1e3 + gameStart - getTickCount());
  393. }
  394. }
  395.  
  396. if (ingame) {
  397. D2Bot.store(JSON.stringify({currScript: "none", area: "out of game"}));
  398.  
  399. if (AutoMule.outOfGameCheck() || TorchSystem.outOfGameCheck() || Gambling.outOfGameCheck() || CraftingSystem.outOfGameCheck()) {
  400. break;
  401. }
  402.  
  403. print("updating runs");
  404. D2Bot.updateRuns();
  405.  
  406. lastGameTick = getTickCount();
  407. gameCount += 1;
  408. lastGameStatus = "ready";
  409. ingame = false;
  410.  
  411. if (StarterConfig.ResetCount && gameCount >= StarterConfig.ResetCount) {
  412. gameCount = 1;
  413.  
  414. DataFile.updateStats("runs", gameCount);
  415. }
  416. }
  417.  
  418. if (!ControlAction.click(6, 652, 469, 120, 20)) { // Join
  419. break;
  420. }
  421.  
  422. if (!locationTimeout(5000, location)) { // in case create button gets bugged
  423. if (!ControlAction.click(6, 533, 469, 120, 20)) { // Create
  424. break;
  425. }
  426.  
  427. if (!ControlAction.click(6, 652, 469, 120, 20)) { // Join
  428. break;
  429. }
  430. }
  431.  
  432. break;
  433. case 2: // Waiting In Line
  434. D2Bot.updateStatus("Waiting...");
  435. locationTimeout(StarterConfig.WaitInLineTimeout * 1e3, location);
  436. ControlAction.click(6, 433, 433, 96, 32);
  437.  
  438. break;
  439. case 3: // Lobby Chat
  440. break;
  441. case 4: // Create Game
  442. break;
  443. case 5: // Join Game
  444. // Don't join immediately after previous game to avoid FTJ
  445. if (getTickCount() - lastGameTick < 5000) {
  446. ControlAction.timeoutDelay("Game Delay", (lastGameTick - getTickCount() + 5000));
  447. }
  448.  
  449. for (i = 0; i < 5; i += 1) {
  450. gameList = ControlAction.getGameList();
  451.  
  452. if (gameList && gameList.length > 0) {
  453. break;
  454. }
  455.  
  456. delay(1000);
  457. }
  458.  
  459. if (gameList) {
  460. doneGames = [];
  461. gameToJoin = false;
  462.  
  463. if (FileTools.exists("logs/doneGames.json")) {
  464. doneGames = JSON.parse(Misc.fileAction("logs/doneGames.json", 0));
  465. }
  466.  
  467. gameList.sort(function (a, b) {
  468. return b.players - a.players;
  469. });
  470.  
  471. for (i = 0; i < gameList.length; i += 1) {
  472. if (doneGames.indexOf(gameList[i].gameName) === -1 && includeCheck(gameList[i].gameName) && excludeCheck(gameList[i].gameName)) {
  473. print("�c7Game: " + gameList[i].gameName + ", Players: " + gameList[i].players);
  474.  
  475. gameToJoin = gameList[i].gameName;
  476.  
  477. break;
  478. }
  479. }
  480.  
  481. if (gameToJoin) {
  482. if (doneGames.length >= 20) {
  483. doneGames.shift();
  484. }
  485.  
  486. doneGames.push(gameToJoin);
  487. Misc.fileAction("logs/doneGames.json", 1, JSON.stringify(doneGames));
  488.  
  489. me.blockMouse = true;
  490.  
  491. try {
  492. joinGame(gameToJoin, "");
  493. } catch (joinErr) {
  494.  
  495. }
  496.  
  497. me.blockMouse = false;
  498.  
  499. locationTimeout(5000, location);
  500. }
  501. }
  502.  
  503. break;
  504. case 6: // Ladder
  505. break;
  506. case 7: // Channel List
  507. break;
  508. case 8: // Main Menu
  509. case 9: // Login
  510. case 15: // Character Select
  511. case 18: // D2 Splash
  512. // Single Player screen fix
  513. if (getLocation() === 15 && !getControl(4, 634, 555, 29, 20)) {
  514. delay(100);
  515. ControlAction.click(4, 514, 339, 200, 92);
  516. delay(100);
  517. ControlAction.click(6, 353, 572, 128, 35);
  518. break;
  519. }
  520.  
  521. if (firstLogin && getLocation() === 9) { // multiple realm botting fix in case of R/D or disconnect
  522. ControlAction.click(6, 33, 572, 128, 35);
  523. }
  524.  
  525. D2Bot.updateStatus("Logging In");
  526.  
  527. try {
  528. login(me.profile);
  529. } catch (e) {
  530. print(e + " " + getLocation());
  531. }
  532.  
  533. break;
  534. case 10: // Login Error
  535. string = "";
  536. text = ControlAction.getText(4, 199, 377, 402, 140);
  537.  
  538. if (text) {
  539. for (i = 0; i < text.length; i += 1) {
  540. string += text[i];
  541.  
  542. if (i !== text.length - 1) {
  543. string += " ";
  544. }
  545. }
  546.  
  547. switch (string) {
  548. case getLocaleString(5207):
  549. D2Bot.updateStatus("Invalid Password");
  550. D2Bot.printToConsole("Invalid Password");
  551.  
  552. break;
  553. case getLocaleString(5208):
  554. loginFail += 1;
  555.  
  556. if (loginFail < 2) {
  557. ControlAction.timeoutDelay("Login retry", 3000);
  558. ControlAction.click(6, 335, 412, 128, 35);
  559.  
  560. break MainSwitch;
  561. }
  562.  
  563. D2Bot.updateStatus("Invalid Account");
  564. D2Bot.printToConsole("Invalid Account");
  565.  
  566. break;
  567. case getLocaleString(5199):
  568. D2Bot.updateStatus("Disabled CDKey");
  569. D2Bot.printToConsole("Disabled CDKey: " + gameInfo.mpq, 6);
  570. D2Bot.CDKeyDisabled();
  571.  
  572. if (gameInfo.switchKeys) {
  573. ControlAction.timeoutDelay("Key switch delay", StarterConfig.SwitchKeyDelay * 1000);
  574. D2Bot.restart(true);
  575. } else {
  576. D2Bot.stop();
  577. }
  578.  
  579. break;
  580. case getLocaleString(10913):
  581. D2Bot.updateStatus("Disabled LoD CDKey");
  582. D2Bot.printToConsole("Disabled LoD CDKey: " + gameInfo.mpq, 6);
  583. D2Bot.CDKeyDisabled();
  584.  
  585. if (gameInfo.switchKeys) {
  586. ControlAction.timeoutDelay("Key switch delay", StarterConfig.SwitchKeyDelay * 1000);
  587. D2Bot.restart(true);
  588. } else {
  589. D2Bot.stop();
  590. }
  591.  
  592. break;
  593. case getLocaleString(5347):
  594. D2Bot.updateStatus("Disconnected");
  595. D2Bot.printToConsole("Disconnected");
  596. ControlAction.click(6, 335, 412, 128, 35);
  597.  
  598. break MainSwitch;
  599. default:
  600. D2Bot.updateStatus("Login Error");
  601. D2Bot.printToConsole("Login Error - " + string);
  602.  
  603. break;
  604. }
  605. }
  606.  
  607. ControlAction.click(6, 335, 412, 128, 35);
  608.  
  609. while (true) {
  610. delay(1000);
  611. }
  612.  
  613. break;
  614. case 11: // Unable To Connect
  615. D2Bot.updateStatus("Unable To Connect");
  616.  
  617. if (connectFail) {
  618. ControlAction.timeoutDelay("Unable to Connect", StarterConfig.UnableToConnectDelay * 6e4);
  619.  
  620. connectFail = false;
  621. }
  622.  
  623. if (!ControlAction.click(6, 335, 450, 128, 35)) {
  624. break;
  625. }
  626.  
  627. connectFail = true;
  628.  
  629. break;
  630. case 13: // Realm Down - Character Select screen
  631. D2Bot.updateStatus("Realm Down");
  632. delay(1000);
  633.  
  634. if (!ControlAction.click(6, 33, 572, 128, 35)) {
  635. break;
  636. }
  637.  
  638. updateCount();
  639. ControlAction.timeoutDelay("Realm Down", StarterConfig.RealmDownDelay * 6e4);
  640. D2Bot.CDKeyRD();
  641.  
  642. if (gameInfo.switchKeys && !gameInfo.rdBlocker) {
  643. D2Bot.printToConsole("Realm Down - Changing CD-Key");
  644. ControlAction.timeoutDelay("Key switch delay", StarterConfig.SwitchKeyDelay * 1000);
  645. D2Bot.restart(true);
  646. } else {
  647. D2Bot.printToConsole("Realm Down - Restart");
  648. D2Bot.restart();
  649. }
  650.  
  651. break;
  652. case 14: // Character Select / Main Menu - Disconnected
  653. D2Bot.updateStatus("Disconnected");
  654. delay(500);
  655. ControlAction.click(6, 351, 337, 96, 32);
  656.  
  657. break;
  658. case 16: // Character Select - Please Wait popup
  659. if (!locationTimeout(StarterConfig.PleaseWaitTimeout * 1e3, location)) {
  660. ControlAction.click(6, 351, 337, 96, 32);
  661. }
  662.  
  663. break;
  664. case 17: // Lobby - Lost Connection - just click okay, since we're toast anyway
  665. delay(1000);
  666. ControlAction.click(6, 351, 337, 96, 32);
  667.  
  668. break;
  669. case 19: // Login - Cdkey In Use
  670. D2Bot.printToConsole(gameInfo.mpq + " is in use by " + ControlAction.getText(4, 158, 310, 485, 40), 6);
  671. D2Bot.CDKeyInUse();
  672.  
  673. if (gameInfo.switchKeys) {
  674. ControlAction.timeoutDelay("Key switch delay", StarterConfig.SwitchKeyDelay * 1000);
  675. D2Bot.restart(true);
  676. } else {
  677. ControlAction.click(6, 335, 450, 128, 35);
  678. ControlAction.timeoutDelay("CD-Key in use", StarterConfig.CDKeyInUseDelay * 6e4);
  679. }
  680.  
  681. break;
  682. case 20: // Single Player - Select Difficulty
  683. break;
  684. case 21: // Main Menu - Connecting
  685. if (!locationTimeout(StarterConfig.ConnectingTimeout * 1e3, location)) {
  686. ControlAction.click(6, 330, 416, 128, 35);
  687. }
  688.  
  689. break;
  690. case 22: // Login - Invalid Cdkey (classic or xpac)
  691. text = ControlAction.getText(4, 162, 270, 477, 50);
  692. string = "";
  693.  
  694. if (text) {
  695. for (i = 0; i < text.length; i += 1) {
  696. string += text[i];
  697.  
  698. if (i !== text.length - 1) {
  699. string += " ";
  700. }
  701. }
  702. }
  703.  
  704. switch (string) {
  705. case getLocaleString(10914):
  706. D2Bot.printToConsole(gameInfo.mpq + " LoD key in use by " + ControlAction.getText(4, 158, 310, 485, 40), 6);
  707. D2Bot.CDKeyInUse();
  708.  
  709. if (gameInfo.switchKeys) {
  710. ControlAction.timeoutDelay("Key switch delay", StarterConfig.SwitchKeyDelay * 1000);
  711. D2Bot.restart(true);
  712. } else {
  713. ControlAction.click(6, 335, 450, 128, 35);
  714. ControlAction.timeoutDelay("LoD key in use", StarterConfig.CDKeyInUseDelay * 6e4);
  715. }
  716.  
  717. break;
  718. default:
  719. if (gameInfo.switchKeys) {
  720. D2Bot.printToConsole("Invalid CD-Key");
  721. ControlAction.timeoutDelay("Key switch delay", StarterConfig.SwitchKeyDelay * 1000);
  722. D2Bot.restart(true);
  723. } else {
  724. ControlAction.click(6, 335, 450, 128, 35);
  725. ControlAction.timeoutDelay("Invalid CD-Key", StarterConfig.CDKeyInUseDelay * 6e4);
  726. }
  727.  
  728. break;
  729. }
  730.  
  731. break;
  732. case 23: // Character Select - Connecting
  733. case 42: // Empty character screen
  734. if (!locationTimeout(StarterConfig.ConnectingTimeout * 1e3, location)) {
  735. ControlAction.click(6, 33, 572, 128, 35);
  736. }
  737.  
  738. if (gameInfo.rdBlocker) {
  739. D2Bot.restart();
  740. }
  741.  
  742. break;
  743. case 24: // Server Down - not much to do but wait..
  744. break;
  745. case 25: // Lobby - Please Wait
  746. if (!locationTimeout(StarterConfig.PleaseWaitTimeout * 1e3, location)) {
  747. ControlAction.click(6, 351, 337, 96, 32);
  748. }
  749.  
  750. break;
  751. case 26: // Lobby - Game Name Exists
  752. ControlAction.click(6, 533, 469, 120, 20);
  753.  
  754. gameCount += 1;
  755. lastGameStatus = "ready";
  756.  
  757. break;
  758. case 27: // Gateway Select
  759. ControlAction.click(6, 436, 538, 96, 32);
  760.  
  761. break;
  762. case 28: // Lobby - Game Does Not Exist
  763. D2Bot.printToConsole("Game doesn't exist");
  764.  
  765. if (gameInfo.rdBlocker) {
  766. D2Bot.printToConsole(gameInfo.mpq + " is probably flagged.", 6);
  767.  
  768. if (gameInfo.switchKeys) {
  769. ControlAction.timeoutDelay("Key switch delay", StarterConfig.SwitchKeyDelay * 1000);
  770. D2Bot.restart(true);
  771. }
  772. } else {
  773. locationTimeout(StarterConfig.GameDoesNotExistTimeout * 1e3, location);
  774. }
  775.  
  776. lastGameStatus = "ready";
  777.  
  778. break;
  779. case 38: // Game is full
  780. // doesn't happen when making
  781. break;
  782. default:
  783. if (location !== undefined) {
  784. D2Bot.printToConsole("Unhandled location " + location);
  785. //takeScreenshot();
  786. delay(500);
  787. D2Bot.restart();
  788. }
  789.  
  790. break;
  791. }
  792. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement