Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //////////////////////////////////////
- // Mule Account Info: //
- //////////////////////////////////////
- // Mule account information format: [["accountname1","charactername1",characterposition1],["accountname2","charactername2",characterposition2]];
- // note that character position is zero based (0,1,2,3,4,5,6 and 7 are valid entries)
- // also note that any number of account/toon name/toon position attribute trios can be listed out
- // Password information for all mule accounts specified here must be the same
- // If you wish to log accounts with different passwords, copy this file to a new name and create a separate profile in the manager
- // Format for var logTheseMules: [["accountname1","charactername1",characterposition1],["accountname2","charactername2",characterposition2]];
- // where characterposition1, characterposition2 are numeric values.
- // Example:
- // var logTheseMules = [["mule3303","Gems",0], ["mule3303","Pgems",1], ["mule3303","Runes",2], ["mule3303","Crafting Runes",3], ["mule3303","Junk Jewels",4], ["mule3303","A2 1",5], ["mule3303","A2 2",6], ["mule3303","A2 3",7]];
- var logTheseMules = [];
- //////////////////////////////////////
- // Minimum Game Length: //
- //////////////////////////////////////
- var gameMinLength = 180000; // time in milliseconds, minimum game length, 180 seconds default (1 game/3 minutes)
- ////////////////////////////////////////
- // Connection Settings: //
- ////////////////////////////////////////
- var unableToConnectRetry = 5; // time in minutes to retry connecting on connection fail (real value is +/- 1 min)
- var realmDownRetry = 300; // time in minutes to retry connecting on a realm down (default is 300 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 = 45000; // 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 = 500; // random amount of time to add to a click
- var textDelayRandom = 500; // 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 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
- var waitBeforeNextLineChatMin = 500; // Minimum ammount of time to add after each text line
- var waitBeforeNextLineChatMax = 1500; // Maximum ammount of time to add after each text line
- // DONT EDIT ANYTHING BELOW THIS
- // D2NT Manager Command
- const D2NT_MGR_LOADING = 1;
- const D2NT_MGR_READY = 2;
- const D2NT_MGR_LOGIN = 3;
- const D2NT_MGR_CREATE_GAME = 4;
- const D2NT_MGR_INGAME = 5;
- const D2NT_MGR_RESTART = 6;
- const D2NT_MGR_CHICKEN = 7;
- const D2NT_MGR_PRINT_STATUS = 8;
- const D2NT_MGR_PRINT_LOG = 9;
- var alreadyLoggedIn = false; // will only send the login command once leave as unless you want to login everytime you join a channel
- var lastGameMade = GetTickCount();
- var lastGameStatus = 0;
- var nextGameMake = 0;
- var inGameAt = 0;
- var chatActionsDone = false;
- var lastGameFailed = false;
- var tempDelay = Random(waitBeforeNextLineChatMin, waitBeforeNextLineChatMax);
- var gameInfo = "";
- var bugignor = true;
- Include("libs/controlInfo.ntl");
- Include("libs/common/NTColorConverter.ntl");
- var controlData = new controlInfo();
- var muleIndex = 0;
- var relog = false;
- var retoon = false;
- var done = false;
- function NTMain()
- {
- Delay(1000);
- var _ingame = false;
- controlData.clickDelay = clickDelay;
- controlData.textDelay = textDelay;
- controlData.clickDelayRandom = clickDelayRandom;
- controlData.textDelayRandom = textDelayRandom;
- if (logTheseMules.length < 1) {
- sendEventToOOG(D2NT_MGR_PRINT_LOG, COLOR_1 + "Error: configure var logTheseMules in NTMuleLog", 0);
- done=true;
- }
- while(!done)
- {
- if(me.ingame)
- {
- if(!inGameAt)
- inGameAt = GetTickCount();
- if(!_ingame)
- {
- RunGC(); // run garbage collector between each game
- if(Load("NTBot/bots/NTMuleLogging.ntj"))
- {
- _ingame = true;
- sendEventToOOG(D2NT_MGR_INGAME, "In Game", 0);
- Delay(500);
- sendEventToOOG(D2NT_MGR_PRINT_LOG, COLOR_8 + "Successfully logged: "+logTheseMules[muleIndex][0]+"/"+me.charname, 0);
- lastGameStatus = 2; // in game successful
- muleIndex++;
- if (muleIndex >= logTheseMules.length) {
- done=true;
- Delay(500);
- sendEventToOOG(D2NT_MGR_PRINT_LOG, COLOR_2 + "NTMuleLog Complete.", 0);
- Print(COLOR_2 + "NTMuleLog Complete.");
- break;
- }
- if (logTheseMules[muleIndex] && logTheseMules[muleIndex-1][0].toLowerCase() != logTheseMules[muleIndex][0].toLowerCase()) {relog=true;}
- retoon=true;
- Delay(gameMinLength);
- ExitGame();
- }
- }
- Delay(500);
- }
- else
- {
- if(_ingame)
- {
- _ingame = false;
- sendEventToOOG(D2NT_MGR_READY, "", 0);
- }
- if (muleIndex >= logTheseMules.length) {
- done=true;
- Delay(500);
- sendEventToOOG(D2NT_MGR_PRINT_STATUS, "Done.", 0);
- sendEventToOOG(D2NT_MGR_PRINT_LOG, COLOR_2 + "NTMuleLog Complete.", 0);
- break;
- }
- locationAction(controlData.getLocation());
- Delay(500);
- }
- }
- }
- function locationAction(location)
- {
- switch(location.id)
- {
- case 3: // Lobby Chat
- if(!chatActionsDone)
- {
- chatActionsDone = true;
- Delay(Random(waitInChatBeforeActionsMin, waitInChatBeforeActionsMax));
- }
- case 1: // Lobby
- if (retoon) {controlData.click(controlData.controls.lobby.button.quit);retoon=false; break;}
- if(GetTickCount() > nextGameMake)
- {
- lastGameFailed = false;
- switch(lastGameStatus)
- {
- case 0:
- password = (me.gamepassword);
- game = (getGameName(me.gamename));
- counter = (getGameCounter(me.gamename, false));
- time = (parseInt((nextGameMake - GetTickCount() - tempDelay)/1000+3.0));
- _control = controlData.get(controlData.controls.lobby.button.create); // fixes creation stuck button bug out of unmodded d2nt
- if(_control && _control.pressed)
- {
- controlData.click(controlData.controls.lobby.button.join);
- Delay(500);
- }
- controlData.click(controlData.controls.lobby.button.create);
- nextGameMake = GetTickCount() + createGameTimeout; // set our timeout
- sendEventToOOG(D2NT_MGR_PRINT_STATUS, 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(D2NT_MGR_PRINT_STATUS, location.name, 0);
- break;
- }
- }
- else
- timeoutDelay(nextGameMake-GetTickCount(), location, true);
- break;
- case 2: // Waiting In Line
- if(GetTickCount()-lastGameMade > waitInLineTimeout)
- controlData.click(controlData.controls.lobby.inLine.button.cancel);
- break;
- case 4: // Create Game
- sendEventToOOG(D2NT_MGR_CREATE_GAME, location.name, 0);
- locationTimeout(5000, location);
- 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
- if(controlData.getCurrentRealmIndex() == me.gatewayid)
- {
- outputGameLength();
- controlData.click(controlData.gameTypes[me.playtype]);
- }
- else
- controlData.click(controlData.controls.mainMenu.button.gateway);
- break;
- case 9: // Login
- sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
- Delay(loginDelay);
- controlData.setText(controlData.controls.login.editBox.accountName, logTheseMules[muleIndex][0]);
- sendEventToOOG(D2NT_MGR_LOGIN, location.name, 0);
- locationTimeout(5000, location);
- break;
- case 10: // Login Error (this is a fatal error, so stop)
- sendEventToOOG(D2NT_MGR_RESTART, location.name, 10);
- Delay(3500);
- break;
- case 11: // Unable To Connect
- timeoutDelay(unableToConnectRetry*60*1000, location)
- controlData.click(controlData.controls.login.unableToConnect.button.ok);
- break;
- case 12: // Character Select
- var _time, _control, _position, _name, _info, _nameTry;
- var foundName = false;
- if (relog) {controlData.click([6,33,572,128,35]);relog=false; break;}
- _position = logTheseMules[muleIndex][2];
- for(_time = 0 ; _time < characterScreenTimeout ; _time += 500)
- {
- _control = controlData.get(controlData.controls.characterSelect.textBox.characterInfo[_position]);
- if(_control && _control.GetText() != undefined)
- break;
- Delay(500);
- }
- _info = controlData.get(controlData.controls.characterSelect.textBox.characterInfo[_position]).GetText();
- if (me.playtype != 0 && _info == null) {
- sendEventToOOG(D2NT_MGR_PRINT_LOG, COLOR_1 + "Error: character at position "+_position+" in "+logTheseMules[muleIndex][0]+" does not exist, skipping", 0);
- muleIndex++;
- relog=true;
- break;
- }
- if (me.playtype == 0) {
- _name = logTheseMules[muleIndex][1].toLowerCase();
- for(var ct = 0 ; ct < 8 ; ct++)
- {
- _info = controlData.get(controlData.controls.characterSelect.textBox.characterInfo[ct]).GetText();
- if (_info != null) {
- _nameTry = _info[1].toLowerCase();
- if (_nameTry == _name) {
- _position = ct;
- foundName=true;
- break;
- }
- }
- }
- }
- if (!foundName && me.playtype == 0) {
- // error, single player character name not found
- sendEventToOOG(D2NT_MGR_PRINT_LOG, COLOR_1 + _name+" not found by name, using position", 0);
- }
- sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
- if(_time < characterScreenTimeout)
- {
- Delay(characterSelectDelay);
- controlData.click(controlData.controls.characterSelect.textBox.characters[_position], 0, 0, 1);
- controlData.click(controlData.controls.characterSelect.textBox.characterInfo[_position], 0, 0, 1);
- // reset last game made, so it doesnt make a game immediately
- inGameAt = 0;
- setNextGameMake();
- }
- else
- {
- controlData.click(controlData.controls.characterSelect.button.exit);
- timeoutDelay(realmDownRetry*60*1000, location);
- }
- break;
- case 13: // Realm Down - Character Select screen
- controlData.click(controlData.controls.characterSelect.button.exit);
- timeoutDelay(realmDownRetry*60*1000, location);
- break;
- case 14: // Character Select - Disconnected
- timeoutDelay(disconnectedRetry*60*1000, location);
- controlData.click(controlData.controls.characterSelect.disconnected.button.ok);
- break;
- case 15: // New Character
- break;
- case 16: // Character Select - Please Wait popup
- if(!locationTimeout(pleaseWaitTimeout, location))
- controlData.click(controlData.controls.characterSelect.pleaseWait.button.cancel);
- break;
- case 17: // Lobby - Lost Connection - just click okay, since we're toast anyway
- controlData.click(controlData.controls.lobby.lostConnection.button.ok);
- break;
- case 18: // D2 Splash
- controlData.click(controlData.controls.d2Splash.textBox.copyright);
- break;
- case 19: // Login - Cdkey In Use
- timeoutDelay(cdkeyInUseRetry*60*1000, location);
- controlData.click(controlData.controls.login.cdkeyInUse.button.ok);
- break;
- case 20: // Single Player - Select Difficulty
- controlData.click(controlData.singlePlayerDifficulties[me.diff]);
- break;
- case 21: // Main Menu - Connecting
- if(!locationTimeout(connectingToBnetTimeout, location))
- controlData.click(controlData.controls.mainMenu.connecting.button.cancel);
- break;
- case 22: // Login - Invalid Cdkey (classic or xpac)
- sendEventToOOG(D2NT_MGR_RESTART, location.name, 3600);
- Delay(3500);
- break;
- case 23: // Character Select - Connecting
- if(!locationTimeout(characterScreenTimeout, location))
- controlData.click(controlData.controls.characterSelect.button.exit);
- 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(D2NT_MGR_PRINT_LOG, COLOR_1 + "Game already exists", 0);
- inGameAt = 0;
- lastGameStatus = 0;
- setNextGameMake();
- locationTimeout(15000, location);
- break;
- case 27: // Gateway Select
- controlData.clickRealmEntry(me.gatewayid);
- controlData.click(controlData.controls.gateway.button.ok);
- break;
- case 28: // Lobby - Game Does Not Exist
- inGameAt = Random(gameDoesNotExistDelayMin, gameDoesNotExistDelayMax);
- lastGameStatus = 0;
- setNextGameMake();
- locationTimeout(gameDoesNotExistTimeout, location);
- break;
- }
- }
- function sendEventToOOG(locationId, statusString, pendingTime)
- {
- return SendCopyData("D2NT Manager", null, (locationId<<16)|pendingTime, statusString);
- }
- function setNextGameMake()
- {
- lastGameMade = GetTickCount();
- nextGameMake = lastGameMade + createGameThreshold + Random(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(D2NT_MGR_PRINT_STATUS, location.name + " (" + parseInt((endtime-GetTickCount())/1000) + "s)", 0);
- Delay(500);
- }
- return (controlData.getLocation().id != location.id);
- }
- function timeoutDelay(time, location)
- {
- endtime = GetTickCount() + time;
- while(endtime > GetTickCount())
- {
- sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name + " (" + parseInt((endtime-GetTickCount())/1000) + "s)", 0);
- Delay(1000);
- }
- }
- function getRandomString(_length)
- {
- _retString = "";
- _charSet = "0123456789abcdefghijklmnopqrstuvwxyz";
- while(_length--)
- {
- _retString += _charSet.charAt(Random(0, _charSet.length-1));
- Delay(1);
- }
- return _retString;
- }
- function getGameName(lastGameString)
- {
- if(!lastGameString)
- return "";
- else
- return (lastGameString.split("-")[0] + "-");
- }
- function getGameCounter(lastGameString, simple)
- {
- var myCount;
- if(!lastGameString)
- return "-1";
- else
- {
- switch(lastGameString.split("-")[1])
- {
- case "08":
- myCount = 9;
- break;
- case "09":
- myCount = 10;
- break;
- case "99":
- myCount = 00;
- break;
- default:
- myCount = parseInt(lastGameString.split("-")[1]) + 1;
- break;
- }
- if(!simple)
- {
- if(myCount <= 9)
- return ('0' + myCount);
- }
- return myCount;
- }
- }
Add Comment
Please, Sign In to add comment