gtoilet

channelrush

May 19th, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.73 KB | None | 0 0
  1. var StarterConfig = {
  2. JoinChannel: "", // Name of the channel to join
  3. FirstJoinMessage: "", // Message to say when first joining a channel, usually ".login"
  4. ChatActionsDelay: 2, // Seconds to wait in lobby before entering a channel
  5.  
  6. // D2BotChannel settings
  7. Games: [""], // List of games to look for. Example: Games: ["some baal-", "chaos run-"],
  8. Passwords: [""], // List of game passwords. Each array in Games array should have a matching element in Passwords. Use "" for blank pw.
  9. JoinDelay: 5, // Seconds to wait between announcement and clicking join - Also applies to RushMode
  10. FriendListQuery: 0, // Seconds between "/f l" retries. 0 = disable
  11.  
  12. // D2botChannel rush mode settings
  13. RushMode: true, // Used for afk channel rushers, sits in channel until it recieves a game signal. Joins user specified gamename and password.
  14. GameSignal: "!rushme", // Signal that there's about to be a game coming. I.e "!rushme gamename//password"
  15. GamePasswordSplitter: "", // Splits the gamename and password. I.e "aa1//gg", aa1 is the gamename and gg is the password, // is the splitter. Use "" for blank pw
  16. RusherAntiIdle: true, // Clicks join game to avoid getting disconnected in the lobby - Useful if you keep the bot afk in channel for long periods of time
  17. RusherAntiIdleTime: 300, // Time in seconds between join game clicks
  18.  
  19. SwitchKeyDelay: 0, // Seconds to wait before switching a used/banned key or after realm down
  20.  
  21. SkipMutedKey: true,
  22. MutedKeyTrigger: "Your account has had all chat privileges suspended.",
  23. CrashDelay: 60, // Seconds to wait after a d2 window crash
  24. RealmDownDelay: 10, // Minutes to wait after getting Realm Down message
  25. UnableToConnectDelay: 5, // Minutes to wait after Unable To Connect message
  26. CDKeyInUseDelay: 5, // Minutes to wait before connecting again if CD-Key is in use. SwitchKeys overrides this!
  27. ConnectingTimeout: 20, // Seconds to wait before cancelling the 'Connecting...' screen
  28. PleaseWaitTimeout: 10, // Seconds to wait before cancelling the 'Please Wait...' screen
  29. WaitInLineTimeout: 60, // Seconds to wait before cancelling the 'Waiting in Line...' screen
  30. GameDoesNotExistTimeout: 5 // Seconds to wait before cancelling the 'Game does not exist.' screen
  31. };
  32.  
  33. // Advanced config - you don't have to edit this unless you need some of the features provided
  34. var AdvancedConfig = {
  35. /* Features: Override channel for each profile, Override join delay for each profile
  36.  
  37. * Format *:
  38. "Profile Name": {JoinDelay: number_of_seconds}
  39. or
  40. "Profile Name": {JoinChannel: "channel name"}
  41. or
  42. "Profile Name": {JoinChannel: "channel name", JoinDelay: number_of_seconds}
  43.  
  44. * Example * (don't edit this - it's just an example):
  45.  
  46. "MyProfile1": {JoinDelay: 3},
  47. "MyProfile2": {JoinChannel: "some channel"},
  48. "MyProfile3": {JoinChannel: "some other channel", JoinDelay: 11}
  49. "MyProfile4": {AnnounceGames: true, AnnounceMessage: "Joining game"} // announce game you are joining
  50. */
  51.  
  52. // Put your lines under this one. Multiple entries are separated by commas. No comma after the last one.
  53.  
  54. "Test": {
  55. JoinChannel: "op nnqry",
  56. JoinDelay: 3,
  57. AnnounceGames: true,
  58. AnnounceMessage: "Joining game" // output: Joining game Baals-23
  59. }
  60. };
  61.  
  62.  
  63. // No touchy!
  64. include("json2.js");
  65. include("OOG.js");
  66. include("automule.js");
  67. include("gambling.js");
  68. include("torchsystem.js");
  69. include("common/misc.js");
  70.  
  71. var gameStart, handle, ingame, firstLogin, useChat,
  72. connectFail, chatActionsDone, gameInfo,
  73. gameCount = DataFile.getStats().runs + 1,
  74. channelTick = getTickCount(),
  75. lastGameStatus = "ready",
  76. joinAntiIdle = false,
  77. fListTick = 0,
  78. idleTick = 0,
  79. loginFail = 0,
  80. retry = 0,
  81. joinInfo = {
  82. gameName: "",
  83. gamePass: "",
  84. oldGame: "",
  85. inGame: false
  86. };
  87.  
  88. if (!FileTools.exists("data/" + me.profile + ".json")) {
  89. DataFile.create();
  90. }
  91.  
  92. function sayMsg(string) {
  93. if (!useChat) {
  94. return;
  95. }
  96.  
  97. say(string);
  98. }
  99.  
  100. function ReceiveCopyData(mode, msg) {
  101. var obj;
  102.  
  103. switch (msg) {
  104. case "Handle":
  105. handle = mode;
  106.  
  107. break;
  108. }
  109.  
  110. switch (mode) {
  111. case 2: // game info
  112. print("Recieved Game Info");
  113.  
  114. gameInfo = JSON.parse(msg);
  115.  
  116. break;
  117. case 3: // Game request
  118. // Don't let others join mule/torch/key/gold drop game
  119. if (AutoMule.inGame || Gambling.inGame || TorchSystem.inGame) {
  120. break;
  121. }
  122.  
  123. if (gameInfo) {
  124. obj = JSON.parse(msg);
  125.  
  126. D2Bot.joinMe(obj.profile, me.gamename || "", "", me.gamepassword || "", me.gameReady ? "yes" : "no");
  127. }
  128.  
  129. break;
  130. case 4:
  131. // Heartbeat ping
  132. if (msg === "pingreq") {
  133. sendCopyData(null, me.windowtitle, 4, "pingrep");
  134. }
  135.  
  136. break;
  137. }
  138. }
  139.  
  140. function timeoutDelay(text, time) {
  141. var endTime = getTickCount() + time;
  142.  
  143. while (getTickCount() < endTime) {
  144. D2Bot.updateStatus(text + " (" + Math.floor((endTime - getTickCount()) / 1000) + "s)");
  145. delay(500);
  146. }
  147. }
  148.  
  149. function locationTimeout(time, location) {
  150. var endtime = getTickCount() + time;
  151.  
  152. while (getLocation() === location && endtime > getTickCount()) {
  153. delay(500);
  154. }
  155.  
  156. return (getLocation() !== location);
  157. }
  158.  
  159. function updateCount() {
  160. D2Bot.updateCount();
  161. delay(1000);
  162. ControlAction.click(6, 264, 366, 272, 35);
  163.  
  164. try {
  165. login(me.profile);
  166. } catch (e) {
  167.  
  168. }
  169.  
  170. delay(1000);
  171. ControlAction.click(6, 33, 572, 128, 35);
  172. }
  173.  
  174. function ScriptMsgEvent(msg) {
  175. switch (msg) {
  176. case "mule":
  177. AutoMule.check = true;
  178.  
  179. break;
  180. case "muleTorch":
  181. AutoMule.torchCheck = true;
  182.  
  183. break;
  184. case "torch":
  185. TorchSystem.check = true;
  186.  
  187. break;
  188. case "getMuleMode":
  189. if (AutoMule.torchCheck) {
  190. scriptBroadcast("1");
  191. } else if (AutoMule.check) {
  192. scriptBroadcast("0");
  193. }
  194.  
  195. break;
  196. }
  197. }
  198.  
  199. function timer(tick) {
  200. if (!tick) {
  201. return "";
  202. }
  203.  
  204. var min, sec;
  205.  
  206. min = Math.floor((getTickCount() - tick) / 60000).toString();
  207.  
  208. if (min <= 9) {
  209. min = "0" + min;
  210. }
  211.  
  212. sec = (Math.floor((getTickCount() - tick) / 1000) % 60).toString();
  213.  
  214. if (sec <= 9) {
  215. sec = "0" + sec;
  216. }
  217.  
  218. return " (" + min + ":" + sec + ")";
  219. }
  220.  
  221. function main() {
  222. addEventListener('copydata', ReceiveCopyData);
  223. addEventListener('scriptmsg', ScriptMsgEvent);
  224.  
  225. while (!handle) {
  226. delay(100);
  227. }
  228.  
  229. DataFile.updateStats("handle", handle);
  230. D2Bot.init();
  231. load("tools/heartbeat.js");
  232.  
  233. while (!gameInfo) {
  234. D2Bot.requestGameInfo();
  235. delay(500);
  236. }
  237.  
  238. if (gameInfo.error === "@error") {
  239. timeoutDelay("Crash Delay", StarterConfig.CrashDelay * 1e3);
  240. D2Bot.updateRuns();
  241. }
  242.  
  243. while (true) {
  244. while (me.ingame) { // returns true before actually in game so we can't only use this check
  245. if (me.gameReady) { // returns false when switching acts so we can't use while
  246. joinInfo.inGame = true;
  247.  
  248. if (!ingame) {
  249. print("Updating Status");
  250. //D2Bot.updateStatus("Game: " + me.gamename);
  251.  
  252. joinInfo.oldGame = me.gamename;
  253. lastGameStatus = "ingame";
  254. ingame = true;
  255. gameStart = getTickCount();
  256.  
  257. DataFile.updateStats("runs", gameCount);
  258. }
  259.  
  260. D2Bot.updateStatus("Game: " + me.gamename + timer(gameStart));
  261. }
  262.  
  263. delay(1000);
  264. }
  265.  
  266. joinInfo.inGame = false;
  267.  
  268. locationAction(getLocation());
  269. delay(1000);
  270. }
  271. }
  272.  
  273. function locationAction(location) {
  274. var i, n, string, text, regex, fullText, lines, rushGameInfo, rushGameName, rushGameAndPsw;
  275.  
  276. MainSwitch:
  277. switch (location) {
  278. case 0:
  279. ControlAction.click();
  280. break;
  281. case 1: // Lobby
  282. D2Bot.updateStatus("Lobby");
  283.  
  284. loginFail = 0;
  285.  
  286. ControlAction.click(6, 27, 480, 120, 20);
  287.  
  288. break;
  289. case 2: // Waiting In Line
  290. D2Bot.updateStatus("Waiting...");
  291. locationTimeout(StarterConfig.WaitInLineTimeout * 1e3, location);
  292. ControlAction.click(6, 433, 433, 96, 32);
  293.  
  294. break;
  295. case 3: // Lobby Chat
  296. D2Bot.updateStatus("Lobby Chat");
  297.  
  298. if (ingame) {
  299. AutoMule.outOfGameCheck();
  300. TorchSystem.outOfGameCheck();
  301. Gambling.outOfGameCheck();
  302. print("updating runs");
  303. D2Bot.updateRuns();
  304.  
  305. gameCount += 1;
  306. lastGameStatus = "ready";
  307. ingame = false;
  308. retry = 0;
  309. }
  310.  
  311. // Muted key handler
  312. fullText = "";
  313. lines = ControlAction.getText(4, 28, 410, 354, 298);
  314.  
  315. if (!lines) {
  316. break;
  317. }
  318.  
  319. fullText = lines.join(" ").replace(/\s+/g, " ");
  320.  
  321. if (fullText.match(StarterConfig.MutedKeyTrigger.replace(/\s+/g, " "), "gi")) {
  322. D2Bot.printToConsole(gameInfo.mpq + " is muted.", 6);
  323.  
  324. ControlAction.mutedKey = true;
  325.  
  326. if (StarterConfig.SkipMutedKey) {
  327. if (gameInfo.switchKeys) {
  328. timeoutDelay("Key switch delay", StarterConfig.SwitchKeyDelay * 1000);
  329. D2Bot.restart(true);
  330. } else {
  331. D2Bot.stop();
  332. }
  333. }
  334. }
  335.  
  336. if (!ControlAction.mutedKey && (!chatActionsDone || getTickCount() - channelTick >= 120e3)) {
  337. if (StarterConfig.JoinChannel !== "") {
  338. if (typeof AdvancedConfig[me.profile] === "object" && typeof AdvancedConfig[me.profile].JoinChannel === "string") {
  339. joinInfo.joinChannel = AdvancedConfig[me.profile].JoinChannel;
  340. } else {
  341. joinInfo.joinChannel = StarterConfig.JoinChannel;
  342. }
  343.  
  344. if (joinInfo.joinChannel) {
  345. if (ControlAction.joinChannel(joinInfo.joinChannel)) {
  346. useChat = true;
  347. } else {
  348. print("Unable to join channel, chat messages disabled.");
  349.  
  350. useChat = false;
  351. }
  352. }
  353. }
  354.  
  355. if (StarterConfig.FirstJoinMessage !== "" && !chatActionsDone) { // Added !chatActionsDone condition to prevent spam
  356. timeoutDelay("Chat delay", StarterConfig.ChatActionsDelay * 1e3);
  357. sayMsg(StarterConfig.FirstJoinMessage);
  358. delay(500);
  359. }
  360.  
  361. chatActionsDone = true;
  362. channelTick = getTickCount();
  363. }
  364.  
  365. if (StarterConfig.RushMode && StarterConfig.RusherAntiIdle && getTickCount() - idleTick >= StarterConfig.RusherAntiIdleTime * 1000) {
  366. joinAntiIdle = true;
  367. idleTick = getTickCount();
  368.  
  369. ControlAction.click(6, 652, 469, 120, 20);
  370. }
  371.  
  372. if (StarterConfig.FriendListQuery > 0 && getTickCount() - fListTick >= StarterConfig.FriendListQuery * 1000) {
  373. say("/f l");
  374.  
  375. fListTick = getTickCount();
  376. }
  377.  
  378. switch (lastGameStatus) {
  379. case "pending": // Most likely FTJ (can't detect it directly)
  380. retry += 1;
  381.  
  382. D2Bot.updateRuns();
  383.  
  384. if (retry < 3) {
  385. ControlAction.click(6, 652, 469, 120, 20);
  386.  
  387. break MainSwitch;
  388. }
  389.  
  390. break;
  391. case "DNE": // Game didn't exist
  392. retry += 1;
  393.  
  394. break;
  395. case "FULL": // Game is full
  396. retry = 3;
  397.  
  398. break;
  399. }
  400.  
  401. if (retry >= 3) {
  402. //print("reset game");
  403. D2Bot.printToConsole("Failed to join 3 times. Aborting.");
  404.  
  405. lastGameStatus = "ready";
  406. joinInfo.oldGame = joinInfo.gameName;
  407. retry = 0;
  408. }
  409.  
  410. fullText = "";
  411. lines = ControlAction.getText(4, 28, 410, 354, 298);
  412.  
  413. if (!lines) {
  414. break;
  415. }
  416.  
  417. fullText = lines.join(" ").replace(/\s+/g, " ");
  418.  
  419. if (StarterConfig.RushMode) {
  420. regex = new RegExp(StarterConfig.GameSignal + " \.+", "gi");
  421. rushGameInfo = fullText.match(regex);
  422.  
  423. if (rushGameInfo) {
  424. rushGameName = rushGameInfo.toString().split(" ", 2); // split the game signal message and the game info
  425.  
  426. if (StarterConfig.GamePasswordSplitter === "") {
  427. joinInfo.gameName = rushGameName[1];
  428. joinInfo.gamePass = "";
  429.  
  430. ControlAction.click(6, 652, 469, 120, 20);
  431. } else {
  432. rushGameAndPsw = rushGameName[1].toString().split(StarterConfig.GamePasswordSplitter);
  433.  
  434. joinInfo.gameName = rushGameAndPsw[0];
  435. joinInfo.gamePass = rushGameAndPsw[1];
  436.  
  437. if (joinInfo.gameName !== joinInfo.oldGame) {
  438. ControlAction.click(6, 652, 469, 120, 20);
  439. }
  440. }
  441. }
  442. } else {
  443. MainLoop:
  444. for (n = 0; n < StarterConfig.Games.length; n += 1) {
  445. regex = new RegExp("\\W+" + StarterConfig.Games[n].toLowerCase() + "\\d+", "gi");
  446. joinInfo.gameName = fullText.match(regex);
  447.  
  448. if (joinInfo.gameName) {
  449. joinInfo.gameName = joinInfo.gameName[joinInfo.gameName.length - 1].toString().replace(/^\W*/, ""); // use last match and trim it
  450. joinInfo.gamePass = StarterConfig.Passwords[n] || "";
  451.  
  452. if (joinInfo.gameName !== joinInfo.oldGame) {
  453. ControlAction.click(6, 652, 469, 120, 20);
  454.  
  455. break MainLoop;
  456. }
  457. }
  458. }
  459. }
  460.  
  461. break;
  462. case 4: // Create Game
  463. break;
  464. case 5: // Join Game
  465. if (joinAntiIdle) {
  466. joinAntiIdle = false;
  467.  
  468. ControlAction.click(6, 433, 433, 96, 32);
  469. }
  470.  
  471. D2Bot.updateStatus("Join Game");
  472.  
  473. if (joinInfo.gameName !== "") {
  474. print("ÿc2Joining ÿc0" + joinInfo.gameName);
  475.  
  476. if (typeof AdvancedConfig[me.profile] === "object" && typeof AdvancedConfig[me.profile].AnnounceGame === "boolean" && typeof AdvancedConfig[me.profile].AnnounceMessage === "string") {
  477. sayMsg(AdvancedConfig[me.profile].AnnounceMessage + " " + joinInfo.gameName);
  478. }
  479.  
  480. if (retry === 0 || lastGameStatus === "pending") { // Only delay on first join - the rest is handled by GameDoesNotExistTimeout. Any other case is instant fail (ie. full game).
  481. if (typeof AdvancedConfig[me.profile] === "object" && typeof AdvancedConfig[me.profile].JoinDelay === "number") {
  482. timeoutDelay("Custom Join Delay", AdvancedConfig[me.profile].JoinDelay * 1e3);
  483. } else if (StarterConfig.JoinDelay) {
  484. timeoutDelay("Join Game Delay", StarterConfig.JoinDelay * 1e3);
  485. }
  486. }
  487.  
  488. me.blockmouse = true;
  489.  
  490. try {
  491. joinGame(joinInfo.gameName, joinInfo.gamePass);
  492. } catch (joinErr) {
  493.  
  494. }
  495.  
  496. me.blockmouse = false;
  497. lastGameStatus = "pending";
  498.  
  499. locationTimeout(5000, location);
  500. }
  501.  
  502. break;
  503. case 6: // Ladder
  504. break;
  505. case 7: // Channel List
  506. break;
  507. case 8: // Main Menu
  508. case 9: // Login
  509. case 12: // Character Select
  510. case 18: // D2 Splash
  511. // Single Player screen fix
  512. if (getLocation() === 12 && !getControl(4, 626, 100, 151, 44)) {
  513. ControlAction.click(6, 33, 572, 128, 35);
  514.  
  515. break;
  516. }
  517.  
  518. if (firstLogin && getLocation() === 9) { // multiple realm botting fix in case of R/D or disconnect
  519. ControlAction.click(6, 33, 572, 128, 35);
  520. }
  521.  
  522. if (!firstLogin) {
  523. firstLogin = true;
  524. }
  525.  
  526. D2Bot.updateStatus("Logging In");
  527.  
  528. try {
  529. login(me.profile);
  530. } catch (e) {
  531. print(e);
  532. }
  533.  
  534. break;
  535. case 10: // Login Error
  536. string = "";
  537. text = ControlAction.getText(4, 199, 377, 402, 140);
  538.  
  539. if (text) {
  540. for (i = 0; i < text.length; i += 1) {
  541. string += text[i];
  542.  
  543. if (i !== text.length - 1) {
  544. string += " ";
  545. }
  546. }
  547.  
  548. switch (string) {
  549. case getLocaleString(5207):
  550. D2Bot.updateStatus("Invalid Password");
  551. D2Bot.printToConsole("Invalid Password");
  552.  
  553. break;
  554. case getLocaleString(5208):
  555. loginFail += 1;
  556.  
  557. if (loginFail < 2) {
  558. timeoutDelay("Login retry", 3000);
  559. ControlAction.click(6, 335, 412, 128, 35);
  560.  
  561. break MainSwitch;
  562. }
  563.  
  564. D2Bot.updateStatus("Invalid Account");
  565. D2Bot.printToConsole("Invalid Account");
  566.  
  567. break;
  568. case getLocaleString(5199):
  569. D2Bot.updateStatus("Disabled CDKey");
  570. D2Bot.printToConsole("Disabled CDKey");
  571. D2Bot.CDKeyDisabled();
  572.  
  573. if (gameInfo.switchKeys) {
  574. timeoutDelay("Key switch delay", StarterConfig.SwitchKeyDelay * 1000);
  575. D2Bot.restart(true);
  576. } else {
  577. D2Bot.stop();
  578. }
  579.  
  580. break;
  581. case getLocaleString(5347):
  582. D2Bot.updateStatus("Disconnected");
  583. D2Bot.printToConsole("Disconnected");
  584. ControlAction.click(6, 335, 412, 128, 35);
  585.  
  586. break MainSwitch;
  587. default:
  588. D2Bot.updateStatus("Login Error");
  589. D2Bot.printToConsole("Login Error - " + string);
  590.  
  591. break;
  592. }
  593. }
  594.  
  595. ControlAction.click(6, 335, 412, 128, 35);
  596.  
  597. while (true) {
  598. delay(1000);
  599. }
  600.  
  601. break;
  602. case 11: // Unable To Connect
  603. D2Bot.updateStatus("Unable To Connect");
  604.  
  605. if (connectFail) {
  606. timeoutDelay("Unable to Connect", StarterConfig.UnableToConnectDelay * 6e4);
  607.  
  608. connectFail = false;
  609. }
  610.  
  611. if (!ControlAction.click(6, 335, 450, 128, 35)) {
  612. break;
  613. }
  614.  
  615. connectFail = true;
  616.  
  617. break;
  618. case 13: // Realm Down - Character Select screen
  619. D2Bot.updateStatus("Realm Down");
  620. delay(1000);
  621.  
  622. if (!ControlAction.click(6, 33, 572, 128, 35)) {
  623. break;
  624. }
  625.  
  626. updateCount();
  627. timeoutDelay("Realm Down", StarterConfig.RealmDownDelay * 6e4);
  628. D2Bot.CDKeyRD();
  629.  
  630. if (gameInfo.switchKeys) {
  631. D2Bot.printToConsole("Realm Down - Changing CD-Key");
  632. timeoutDelay("Key switch delay", StarterConfig.SwitchKeyDelay * 1000);
  633. D2Bot.restart(true);
  634. }
  635.  
  636. break;
  637. case 14: // Character Select / Main Menu - Disconnected
  638. D2Bot.updateStatus("Disconnected");
  639. delay(500);
  640. ControlAction.click(6, 351, 337, 96, 32);
  641. break;
  642. case 16: // Character Select - Please Wait popup
  643. if (!locationTimeout(StarterConfig.PleaseWaitTimeout * 1e3, location)) {
  644. ControlAction.click(6, 351, 337, 96, 32);
  645. }
  646.  
  647. break;
  648. case 17: // Lobby - Lost Connection - just click okay, since we're toast anyway
  649. delay(1000);
  650. ControlAction.click(6, 351, 337, 96, 32);
  651. break;
  652. case 19: // Login - Cdkey In Use
  653. D2Bot.printToConsole("CD-Key in use by " + ControlAction.getText(4, 158, 310, 485, 40));
  654. D2Bot.CDKeyInUse();
  655.  
  656. if (gameInfo.switchKeys) {
  657. timeoutDelay("Key switch delay", StarterConfig.SwitchKeyDelay * 1000);
  658. D2Bot.restart(true);
  659. } else {
  660. timeoutDelay("CD-Key in use", StarterConfig.CDKeyInUseDelay * 6e4);
  661. ControlAction.click(6, 335, 450, 128, 35);
  662. }
  663.  
  664. break;
  665. case 20: // Single Player - Select Difficulty
  666. break;
  667. case 21: // Main Menu - Connecting
  668. if (!locationTimeout(StarterConfig.ConnectingTimeout * 1e3, location)) {
  669. ControlAction.click(6, 330, 416, 128, 35);
  670. }
  671.  
  672. break;
  673. case 22: // Login - Invalid Cdkey (classic or xpac)
  674. text = ControlAction.getText(4, 162, 270, 477, 50);
  675. string = "";
  676.  
  677. if (text) {
  678. for (i = 0; i < text.length; i += 1) {
  679. string += text[i];
  680.  
  681. if (i !== text.length - 1) {
  682. string += " ";
  683. }
  684. }
  685. }
  686.  
  687. switch (string) {
  688. case getLocaleString(10914):
  689. D2Bot.printToConsole("LoD key in use by " + ControlAction.getText(4, 158, 310, 485, 40));
  690. D2Bot.CDKeyInUse();
  691.  
  692. if (gameInfo.switchKeys) {
  693. timeoutDelay("Key switch delay", StarterConfig.SwitchKeyDelay * 1000);
  694. D2Bot.restart(true);
  695. } else {
  696. ControlAction.click(6, 335, 450, 128, 35);
  697. timeoutDelay("LoD key in use", StarterConfig.CDKeyInUseDelay * 6e4);
  698. }
  699.  
  700. break;
  701. default:
  702. if (gameInfo.switchKeys) {
  703. D2Bot.printToConsole("Invalid CD-Key");
  704. timeoutDelay("Key switch delay", StarterConfig.SwitchKeyDelay * 1000);
  705. D2Bot.restart(true);
  706. } else {
  707. ControlAction.click(6, 335, 450, 128, 35);
  708. timeoutDelay("Invalid CD-Key", StarterConfig.CDKeyInUseDelay * 6e4);
  709. }
  710.  
  711. break;
  712. }
  713.  
  714. break;
  715. case 23: // Character Select - Connecting
  716. case 42: // Empty character screen
  717. if (!locationTimeout(StarterConfig.ConnectingTimeout * 1e3, location)) {
  718. //print("QQQ");
  719. ControlAction.click(6, 33, 572, 128, 35);
  720. }
  721.  
  722. if (gameInfo.rdBlocker) {
  723. D2Bot.restart();
  724. }
  725.  
  726. break;
  727. case 24: // Server Down - not much to do but wait..
  728. break;
  729. case 25: // Lobby - Please Wait
  730. if (!locationTimeout(StarterConfig.PleaseWaitTimeout * 1e3, location)) {
  731. ControlAction.click(6, 351, 337, 96, 32);
  732. }
  733.  
  734. break;
  735. case 26: // Lobby - Game Name Exists
  736. break;
  737. case 27: // Gateway Select
  738. ControlAction.click(6, 436, 538, 96, 32);
  739.  
  740. break;
  741. case 28: // Lobby - Game Does Not Exist
  742. //D2Bot.printToConsole("Game doesn't exist");
  743. ControlAction.click(6, 652, 469, 120, 20);
  744. ControlAction.click(6, 433, 433, 96, 32);
  745. timeoutDelay("Game doesn't exist", StarterConfig.GameDoesNotExistTimeout * 1e3);
  746.  
  747. lastGameStatus = "DNE";
  748.  
  749. break;
  750. case 38: // Game is full
  751. //D2Bot.printToConsole("Game is full");
  752. ControlAction.click(6, 652, 469, 120, 20);
  753. ControlAction.click(6, 433, 433, 96, 32);
  754.  
  755. lastGameStatus = "FULL";
  756.  
  757. break;
  758. default:
  759. if (location !== undefined) {
  760. D2Bot.printToConsole("Unhandled location " + location);
  761. delay(500);
  762. D2Bot.restart();
  763. }
  764.  
  765. break;
  766. }
  767. }
Add Comment
Please, Sign In to add comment