var gameMinLength = 185000; // time in milliseconds, minimum game length, 185 seconds default (1 game/3 minutes) var gameMaxLength = 300000; // time in milliseconds, maximum game length, 600 seconds default var unableToConnectRetry = 5; // time in minutes to retry connecting on connection fail (real value is +/- 1 min) var realmDownRetry = 30; // time in minutes to retry connecting on a realm down (default is 120 minutes) var disconnectedRetry = 5; // time in minutes to retry on a disconnection (usually ip ban related) var cdkeyInUseRetry = 5; // time in minutes to retry on a cdkey in use error message (set to 0 to stop) var connectingToBnetTimeout = 20000; // time in milliseconds to wait for a login to time out and click cancel and retry var characterScreenTimeout = 10000; // time in milliseconds to wait for character screen to appear var pleaseWaitTimeout = 10000; // time in milliseconds to wait for a please wait popup var createGameThreshold = 5000; // time in milliseconds to wait between making games var createGameThresholdRandom = 1000; // time in milliseconds to randomly add +/- to the game create time var createGameTimeout = 15000; // time in milliseconds to register a failed to create game var waitInLineTimeout = 60000; // time in milliseconds to wait in lines for a create game (60 second default) var characterSelectDelay = 1000; // time in milliseconds to wait before selecting a character on the char screen var loginDelay = 1000; // time in milliseconds to wait before submitting login information var clickDelay = 500; // wait X milliseconds before next action after a click event var textDelay = 500; // wait X milliseconds before next action after inserting text into a textbox var clickDelayRandom = 321; // random amount of time to add to a click var textDelayRandom = 543; // random amount of time to add to a text set var gameDoesNotExistDelayMin = 600000; // how long to wait when a Game Does Not Exist occurs - minimum - default 10 minutes var gameDoesNotExistDelayMax = 900000; // how long to wait when a Game Does Not Exist occurs - maximum - default 15 minutes var gameDoesNotExistTimeout = 30000; // how long to wait for the dialog to disappear (default 30 seconds, don't change this) var joinChatAfterGame = false; // join chat after leaving a game var joinRandomChannel = true; // if this is true, will join a random channel, otherwise it will use the channel below.. var joinChannelInChat = ""; // leave blank to not join a private channel var waitBeforeEnterChatMin = 1000; // min how long to wait before entering chat var waitBeforeEnterChatMax = 2000; // max how long to wait before entering chat var waitInChatBeforeActionsMin = 2000; // min how long to wait before joining channel var waitInChatBeforeActionsMax = 3000; // max how long to wait before joining channel // DONT EDIT ANYTHING BELOW THIS var lastGameMade = getTickCount(); var lastGameStatus = 0; var nextGameMake = 0; var inGameAt = 0; var chatActionsDone = false; var lastGameFailed = false; include("controlInfo.dbl"); var controlData = new controlInfo(); function main() { delay(1000); var _ingame = false; controlData.clickDelay = clickDelay; controlData.textDelay = textDelay; controlData.clickDelayRandom = clickDelayRandom; controlData.textDelayRandom = textDelayRandom; while(1) { if(me.ingame) { if(!inGameAt) inGameAt = getTickCount(); if(getTickCount()-lastGameMade < gameMaxLength) { if(!_ingame) { _ingame = true; sendEventToOOG(126, "In Game", parseInt(gameMinLength/1000)); lastGameStatus = 2; // in game successful } delay(1000); } else { sendEventToOOG(65535, "Maximum game length reached!", 65535); quit(); var x; for (x = 0; x < 40 && me.ingame; x++) { delay(500); } if (me.ingame) quitGame(); } } else { if(_ingame) { _ingame = false; sendEventToOOG(65535, "Exited game!", 65535); } delay(500); locationAction(controlData.getLocation()); } } } function locationAction(location) { switch(location.id) { case 3: // Lobby Chat if(!chatActionsDone) { chatActionsDone = true; delay(rnd(waitInChatBeforeActionsMin, waitInChatBeforeActionsMax)); if(joinRandomChannel || joinChannelInChat != "") { say("/join " + (joinRandomChannel ? getRandomString(rnd(3,10)) : joinChannelInChat)); delay(1000); } } case 1: // Lobby if(location.id == 1 && joinChatAfterGame) { delay(rnd(waitBeforeEnterChatMin, waitBeforeEnterChatMax)); controlData.click(controlData.controls.lobby.button.enterChat); break; } if(getTickCount() > nextGameMake) { lastGameFailed = false; switch(lastGameStatus) { case 0: controlData.click(controlData.controls.lobby.button.create); nextGameMake = getTickCount() + createGameTimeout; // set our timeout sendEventToOOG(127, location.name, 0); break; case 1: // game failed, rollover to reset timer inGameAt = getTickCount(); // reset inGameAt, to wait how long we should have waited.. lastGameFailed = true; case 2: outputGameLength(); lastGameStatus = 0; setNextGameMake(); sendEventToOOG(127, location.name, 0); break; } } else locationTimeout(nextGameMake-getTickCount(), location); break; case 2: // Waiting In Line if(getTickCount()-lastGameMade > waitInLineTimeout) controlData.click(controlData.controls.lobby.inLine.button.cancel); break; case 4: // Create Game sendEventToOOG(4, location.name, 0); delay(500); runGC(); // run garbage collector between each game while(controlData.getLocation().id == 4) delay(500); lastGameMade = getTickCount(); lastGameStatus = 1; // pending creation break; case 5: // Join Game break; case 6: // Ladder break; case 7: // Channel List break; case 8: // Main Menu outputGameLength(); break; case 9: // Login sendEventToOOG(127, location.name, 0); delay(loginDelay); sendEventToOOG(9, location.name, 0); while(controlData.getLocation().id == 9) delay(500); break; case 10: // Login Error (this is a fatal error, so stop) sendEventToOOG(10, location.name, 10); delay(3500); break; case 11: // Unable To Connect sendEventToOOG(11, location.name, unableToConnectRetry*60); delay(3500); break; case 12: // Character Select var i; sendEventToOOG(127, location.name, 0); delay(characterSelectDelay); if(controlData.getLocation().id != 12) break; sendEventToOOG(12, location.name, 0); for(i = 0 ; i < 10 ; i++) { delay(500); if(controlData.getLocation().id != 12) break; } if(i >= 10) { sendEventToOOG(13, location.name, realmDownRetry*60); delay(3500); break; } // reset last game made, so it doesnt make a game immediately inGameAt = 0; setNextGameMake(); break; case 13: // Realm Down - Character Select screen sendEventToOOG(13, location.name, realmDownRetry*60); delay(3500); break; case 14: // Character Select - Disconnected sendEventToOOG(14, location.name, disconnectedRetry*60); delay(3500); break; case 15: // New Character break; case 16: // Character Select - Please Wait popup if(!locationTimeout(pleaseWaitTimeout, location)) { sendEventToOOG(16, location.name, 60); delay(3500); } break; case 17: // Lobby - Lost Connection - just click okay, since we're toast anyway sendEventToOOG(17, location.name, 60); delay(3500); break; case 18: // D2 Splash break; case 19: // Login - Cdkey In Use sendEventToOOG(19, location.name, cdkeyInUseRetry*60); delay(3500); break; case 20: // Single Player - Select Difficulty break; case 21: // Main Menu - Connecting if(!locationTimeout(connectingToBnetTimeout, location)) { sendEventToOOG(21, location.name, 10); delay(3500); } break; case 22: // Login - Invalid Cdkey (classic or xpac) sendEventToOOG(22, location.name, 3600); delay(3500); break; case 23: // Character Select - Connecting if(!locationTimeout(characterScreenTimeout, location)) { sendEventToOOG(23, location.name, 60); delay(3500); } break; case 24: // Server Down - not much to do but wait.. break; case 25: // Lobby - Please Wait if(!locationTimeout(pleaseWaitTimeout, location)) controlData.click(controlData.controls.lobby.pleaseWait.button.cancel); break; case 26: // Lobby - Game Name Exists sendEventToOOG(65535, "Game name already exists", 65535); while(controlData.getLocation().id == 26) delay(500); inGameAt = 0; lastGameStatus = 0; setNextGameMake(); break; case 27: // Gateway Select break; case 28: // Lobby - Game Does Not Exist inGameAt = rnd(gameDoesNotExistDelayMin, gameDoesNotExistDelayMax); lastGameStatus = 0; setNextGameMake(); locationTimeout(gameDoesNotExistTimeout, location); break; } } function sendEventToOOG(locationId, statusString, pendingTime) { return sendCopyData(null, "D2Manager 2.5", (locationId<<16)|pendingTime, me.windowtitle+";"+statusString); } function setNextGameMake() { lastGameMade = getTickCount(); nextGameMake = lastGameMade + createGameThreshold + rnd(0-createGameThresholdRandom, createGameThresholdRandom) + inGameAt; inGameAt = 0; chatActionsDone = false; } function outputGameLength() { if(inGameAt) { duration = getTickCount() - inGameAt; inGameAt = (duration < gameMinLength ? gameMinLength - duration : 0); } } function locationTimeout(time, location) { endtime = getTickCount() + time; while(controlData.getLocation().id == location.id && endtime > getTickCount()) { sendEventToOOG(127, location.name + " (" + parseInt((endtime-getTickCount())/1000) + "s)", 0); delay(500); } return (controlData.getLocation().id != location.id); } function getRandomString(_length) { _retString = ""; _charSet = "0123456789abcdefghijklmnopqrstuvwxyz"; while(_length--) _retString += _charSet.charAt(rnd(0, _charSet.length-1)); return _retString; }