[Release] Muddy's D2NT

05/05/2011 19:48 fischdinho#1711
Hallo,

mal ne Frage : habt ihr mit dem Chest Bot von Muddys gute erfahrungen gemacht ???
05/05/2011 20:01 ldevil#1712
Da die geänderte NTBot.ntj ja von mir ist, hier auch Mal noch die integrierte Version. Ich glaub ich habe die getestet aber keine Garantie. Ich konzentrier mich ja auf das Muddie mit AutoMule, wo das Leech dann in der nächsten Version auch eingebaut sein wird ;)

Sop aber hier nun der Code (ohne Syntaxhighlighting, damit ich nicht wieder fehler einbaue :D)
Code:
/**
*	This file was modified by [Only registered and activated users can see links. Click Here To Register...]
*	Check the programming section for updates and further scripts
*	Last Update: 02/28/2011
*/

var GameMinLength				= 120000;		// time in milliseconds, minimum game length, 180 seconds default (1 game/3 minutes)
var UnableToConnectRetry		= 5;			// time in minutes to retry connecting on connection fail (real value is +/- 1 min)
var RealmDownRetry				= 15;			// 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			= 20000;		// time in milliseconds to wait between making games
var CreateGameThresholdRandom	= 5000;			// 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					= 1000;			// wait X milliseconds before next action after a click event
var TextDelay					= 2500;			// 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 JoinChatAfterLogin			= true;			// join chat after login
var JoinRandomChannel			= false;		// if this is true, will join a random channel, otherwise it will use the channel below..
var JoinChannelInChat			= "";// leave blank not to join a private channel
var PerformChannelLogin			= false;		// type ".login" once after joining the channel
var ChannelUsers 				= new Array();	// dynamic array that holds channel users
var MaximumLocationLoops		= 5;			// The maximum number of loops for a single location; if the window is does not respond and is caught in an infinite loop it will be restarted when the number of loops exceeds the one you specify here
var JoinGameKeywords			= new Array("dia", "baal");
var JoinRandomGamesChars		= new Array("");
//---------------------------------------------------------------------------------------------------------------------------------------------------------
// Add any char/account here that is supposed to perform chat actions/game announcements or join a private channel
ChannelUsers.push("Default");
// Or
ChannelUsers.push("Default");

// The following key expressions will be replaced by their actual values:  %game --> "gamename-"  <>  %counter --> number of the next game  <>  %time --> time in seconds till game creation  <>  %password --> game password
// Note that the announcement will start after the first run, so there usually won't be any anncouncement right after login - If the gamename is undefined, the bot will try to load the backup file to announce the upcoming game properly
var GameAnnouncement			= "Creating %game%counter//%password in about %time seconds";			// Leave blank not to post a channel announcement
var GameAnnouncementDelay		= 5000;			// Wait X milliseconds before posting the announcement message (don't set this too low!)
var GameAnnouncementDelayRandom	= 500;			// Random amount of time to add to a to the announcement delay
var UseFileBackupTimeMax		= 30;			// Time in minutes that may pass since last file update - The backup File is updated at the beginning of every single game and is read everytime the name of your previous game is undefined (e.g. at restarts); Set to 0 to deactivate file backup
//----------------------------------------------------------------------------------------------------------------------------------------------------------
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

// Leech settings
var LeaderAccountName = "Default";	// leader account name here
var LeaderGamePW = "Default";			// The password used for the games you want to join
var LeecherAccounts = ["Default"];	// List ALL accounts that use leechscript

// DONT EDIT ANYTHING BELOW THIS

// Set Leecher Settings
var isLeecher = false;
for (var i = 0; i < LeecherAccounts.length; i++)
{
	if (me.account == LeecherAccounts[i])
	{
		isLeecher = true;
	}
}
var OldGame = '';
var Check = 1;

// 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 LastGameMade = GetTickCount();
var LastGameStatus = 0;
var NextGameMake = 0;
var InGameAt = 0;
var LocationLoops = new Array(2);
var ChatActionsDone = false;
var LastGameFailed = false;
var JoinedChannel = false;
var JustJoined = true;
var MadeAnnouncement = false;

Include("libs/controlInfo.ntl");
Include("libs/common/NTCommon.ntl");

var ControlData = new controlInfo();

function NTMain()
{
	var _ingame;
	
	Delay(1000);

	_ingame = false;

	ControlData.ClickDelay = ClickDelay;
	ControlData.TextDelay = TextDelay;
	ControlData.ClickDelayRandom = ClickDelayRandom;
	ControlData.TextDelayRandom = TextDelayRandom;

	while(true)
	{
		if(me.ingame)
		{
			if(!InGameAt)
				InGameAt = GetTickCount();
			
			if(!_ingame)
			{
				RunGC(); // run garbage collector between each game

				if(Load("NTBot/MWBotGame.ntj"))
				{
					_ingame = true;
					MadeAnnouncement = false;
					LocationLoops[1] = 0;
					
					MW_WriteBackupFile();
					
					if(me.playtype > 0)
						NT_SendEventToOOG(D2NT_MGR_INGAME, "In Game [IP:" + me.gameserverip.split(".")[3] + "]", 0);
					else
						NT_SendEventToOOG(D2NT_MGR_INGAME, "In Game", 0);

					LastGameStatus = 2; // in game successful
				}
			}

			Delay(1000);
		}
		else
		{
			if(_ingame)
			{
				_ingame = false;

				NT_SendEventToOOG(D2NT_MGR_READY, "", 0);
			}

			NT_LocationAction(ControlData.getLocation());

			Delay(500);
		}
	}
}

function NT_LocationAction(location)
{
	var _randomChannel, _output, _control;
	
	MW_CheckLocationLoops(location);
	
	switch(location.id)
	{
	case 3: // Lobby Chat
		if(JustJoined)
		{
			JustJoined = false;
			if(MW_IsChannelUser())
				_output = "ÿc2Chat actions enabled!";
			else
				_output = "ÿc1Chat actions disabled!";
			
			for(var i = 0; i < 3; i++)
			{
				SetStatusText(_output);
				Delay(500);
				SetStatusText("");
				Delay(500);
			}
		}
		
		if(!ChatActionsDone && MW_IsChannelUser())
		{
			ChatActionsDone = true;
			
			Delay(Random(WaitInChatBeforeActionsMin, WaitInChatBeforeActionsMax));
			
			if(!JoinedChannel && (JoinRandomChannel || JoinChannelInChat != ""))
			{
				_randomChannel = NT_GetRandomString(Random(3,10));
				SetStatusText("ÿc8Joining Channel ÿc;" + (JoinRandomChannel ? _randomChannel : JoinChannelInChat));
				
				Delay(500);
				
				Say("/join " + (JoinRandomChannel ? _randomChannel : JoinChannelInChat));
				JoinedChannel = true;
					
				if(PerformChannelLogin)
				{
					SetStatusText("ÿc8Channel Login...");
					Say(".login");
					Delay(1000);
				}
			}
		}
	case 1:  // Lobby
		var _Lines;
		var chat;
		var _Game = "";
		var _Errors = "";
		var _FoundLeader = false;
		var _LineWithName = "";

		if (location.id == 1 && JoinChatAfterLogin)
		{
			Delay(Random(WaitBeforeEnterChatMin, WaitBeforeEnterChatMax));
			ControlData.click(ControlData.controls.lobby.button.enterChat);
			break;
		}
		if (isLeecher)
		{
			Delay(1000);
			if (chat = ControlData.get(ControlData.controls.lobby.chat.textBox.channelText))
			{
				_Lines = chat.GetText();
				if (_Lines.length > 1)
				{
					for (var _Friend = 0; _Friend < _Lines.length; _Friend++)
					{
						if (_Lines[_Friend].indexOf(LeaderAccountName) > -1)
						{
							_Game = '';
							_FoundLeader = true;
							var regOfflineEnglish=/^\d\s?:\s?(\w*)\s?,\s?offline\s*$/gi;

							if (_Lines[_Friend].match(regOfflineEnglish))
							{
								_Errors += (_Errors == '' ? '' : ' ') + 'leader is offline';
								Delay(5000);
								break;
							}

							_LineWithName = _Lines[_Friend + 2];
							
							if (_LineWithName !== undefined)
								_LineWithName = _LineWithName.substring(4,_LineWithName.length);
								
							
							if (_LineWithName === undefined)
								_LineWithName = _Lines[_Friend + 1];
							else
								_LineWithName = _Lines[_Friend + 1] + _LineWithName;
								
							if (_LineWithName !== undefined)
								_LineWithName = _LineWithName.replace(/^\s+/,"");
							else
								break;
								
							if (_LineWithName.indexOf('called') > -1)
								_Game = _LineWithName.substring(_LineWithName.indexOf('called')+7,_LineWithName.indexOf('.'));
							else
								_Game = _LineWithName.substring(0,_LineWithName.indexOf('.'));
							
							_LineWithName = '';

							if (_Game != '' && _Game != OldGame)
							{
								ControlData.click(ControlData.controls.lobby.button.join);
								Delay(200);
								ControlData.setText(ControlData.controls.lobby.join.editBox.gameName, _Game);
								Delay (200);
								ControlData.setText(ControlData.controls.lobby.join.editBox.password, LeaderGamePW);
								Delay (1234);
								ControlData.click(ControlData.controls.lobby.join.button.joinGame);
								Check = 1;
							}
							else
							{
								if (!_Errors)
									_Errors = 'leader is not in game.';
							}
						}
					}
				}
				if (!_FoundLeader && JoinChannelInChat)
				{
					if (_Errors)
						Say('Errors : ' + _Errors);
					else
						Delay(15000);
				}
			}
			else
			{
				Delay(1500);
			}
			_Errors = '';
			if (_Game != '')
				OldGame = _Game;
			break;
		}
		else
		{
			if (GetTickCount() > NextGameMake)
			{
				LastGameFailed = false;

				switch(LastGameStatus)
				{
				case 0:
					if (JoinRandomGamesChars.indexOf(me.charname) > -1)
					{
						_control = ControlData.get(ControlData.controls.lobby.button.join);
						
						if (_control && _control.pressed)
						{
							ControlData.click(ControlData.controls.lobby.button.create);
							Delay(500);
						}

						ControlData.click(ControlData.controls.lobby.button.join);
					}
					else
					{
						_control = ControlData.get(ControlData.controls.lobby.button.create);
						
						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
					NT_SendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
					break;
				case 1: // game failed, rollover to reset timer
					InGameAt = GetTickCount();
					LastGameFailed = true;
					Delay(5000);
					
				case 2:
					NT_OutputGameLength();
					LastGameStatus = 0;
					NT_SetNextGameMake();
					if (LastGameFailed)
					{
						SetStatusText("ÿc1Failed to join!");
						NT_SendEventToOOG(D2NT_MGR_PRINT_LOG, "ÿBE0000Game creation failed!", 0);
						Delay(1000);
					}
					NT_SendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
					break;
				}
			}
			else
			{
				if (JoinChannelInChat && !MadeAnnouncement && MW_IsChannelUser())
				{
					if (MW_AnnounceGame())
						MadeAnnouncement = true;
				}
				
				MW_TimeoutDelay(NextGameMake - GetTickCount(), location, JoinRandomGamesChars.indexOf(me.charname) == -1);
			}
		}
		break;
	
	case 4: // Create Game
		if(JoinRandomGamesChars.indexOf(me.charname) == -1)
		{
			if(!ControlData.get(ControlData.controls.lobby.create.editBox.gameName))
			{
				ControlData.click(ControlData.controls.lobby.button.join);
				Delay (500);
				ControlData.click(ControlData.controls.lobby.button.create);
				Delay (500);
			}
			
			NT_SendEventToOOG(D2NT_MGR_CREATE_GAME, location.name, 0);

			NT_LocationTimeout(5000, location);

			LastGameMade = GetTickCount();
			LastGameStatus = 1; // pending creation
		}
		break;

	case 5: // Join Game
		if(JoinRandomGamesChars.indexOf(me.charname) > -1)
		{
			var _games, _game;

			_games = ControlData.get(ControlData.controls.lobby.join.textBox.gameList).GetText();
			_game = "";
			
			if(_games)
			{
				for(var i = 0; i < _games.length; i++)
				{
					for(var j = 0; j < JoinGameKeywords.length; j++)
					{
						if(_games[i].toLowerCase().indexOf(JoinGameKeywords[j].toLowerCase()) > -1)
						{
							_game = _games[i];
							i = _games.length;
							break;
						}
					}
				}
			}
			
			if(_game != "")
			{
				SetStatusText("ÿc8Joining Game: " + _game);
				Delay(250);
				ControlData.setText(ControlData.controls.lobby.join.editBox.gameName, _game);
				Delay(1000);
				ControlData.click(ControlData.controls.lobby.join.button.joinGame);

				NT_LocationTimeout(5000, location);
				LastGameMade = GetTickCount();
				LastGameStatus = 1; // pending creation
			}
			else
				Delay(2500);
			
			ControlData.click(ControlData.controls.lobby.button.create);
			Delay(500);
			ControlData.click(ControlData.controls.lobby.button.join);
			Delay(500);
		}
		break;

	case 6: // Ladder
		break;

	case 7: // Channel List
		break;

	case 8: // Main Menu
		if(ControlData.getCurrentRealmIndex() == me.gatewayid)
		{
			NT_OutputGameLength();
			ControlData.click(ControlData.gameTypes[me.playtype]);
		}
		else
			ControlData.click(ControlData.controls.mainMenu.button.gateway);
		break;

	case 9: // Login
		NT_SendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
		Delay(LoginDelay);

		ControlData.setText(ControlData.controls.login.editBox.accountName, me.account);

		NT_SendEventToOOG(D2NT_MGR_LOGIN, location.name, 0);

		NT_LocationTimeout(5000, location);
		break;

	case 10: // Login Error (this is a fatal error, so stop)
		NT_SendEventToOOG(D2NT_MGR_RESTART, location.name, 10);
		Delay(3500);
		break;

	case 11: // Unable To Connect
		MW_TimeoutDelay(UnableToConnectRetry*60*1000, location);
		ControlData.click(ControlData.controls.login.unableToConnect.button.ok);
		break;

	case 12: // Character Select
		var _time, _control;

		NT_SendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);

		for(_time = 0 ; _time < CharacterScreenTimeout ; _time += 500)
		{
			_control = ControlData.get(ControlData.controls.characterSelect.textBox.characterInfo[me.charloc]);
			if(_control && _control.GetText() != undefined)
				break;

			Delay(500);
		}

		if(_time < CharacterScreenTimeout)
		{
			Delay(CharacterSelectDelay);

			ControlData.click(ControlData.controls.characterSelect.textBox.characters[me.charloc], 0, 0, 1);
			ControlData.click(ControlData.controls.characterSelect.textBox.characterInfo[me.charloc], 0, 0, 1);

			// reset last game made, so it doesnt make a game immediately
			InGameAt = 0;
			NT_SetNextGameMake();
		}
		else
		{
			ControlData.click(ControlData.controls.characterSelect.button.exit);
			MW_TimeoutDelay(RealmDownRetry*60*1000, location);
		}
		break;

	case 13: // Realm Down - Character Select screen
		ControlData.click(ControlData.controls.characterSelect.button.exit);
		MW_TimeoutDelay(RealmDownRetry*60*1000, location);
		break;

	case 14: // Character Select - Disconnected
		MW_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(!NT_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
		MW_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(!NT_LocationTimeout(ConnectingToBnetTimeout, location))
			ControlData.click(ControlData.controls.mainMenu.connecting.button.cancel);
		break;

	case 22: // Login - Invalid Cdkey (classic or xpac)
		NT_SendEventToOOG(D2NT_MGR_RESTART, location.name, 3600);
		Delay(3500);
		break;

	case 23: // Character Select - Connecting
		if(!NT_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(!NT_LocationTimeout(PleaseWaitTimeout, location))
			ControlData.click(ControlData.controls.lobby.pleaseWait.button.cancel);
		break;
		
	case 26: // Lobby - Game Name Exists
		NT_SendEventToOOG(D2NT_MGR_PRINT_LOG, "ÿBE0000Game already exists", 0);
		SetStatusText("ÿc1Game already exists!");
		InGameAt = 0;
		LastGameStatus = 0;
		NT_SetNextGameMake();

		NT_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;
		NT_SetNextGameMake();

		NT_LocationTimeout(GameDoesNotExistTimeout, location);
		break;
	}
}

function NT_SendEventToOOG(locationId, statusString, pendingTime)
{
	return SendCopyData("D2NT Manager", null, (locationId<<16)|pendingTime, statusString);
}

function NT_SetNextGameMake()
{
	LastGameMade = GetTickCount();
	NextGameMake = LastGameMade + CreateGameThreshold + Random(0 - CreateGameThresholdRandom, CreateGameThresholdRandom) + InGameAt;
	InGameAt = 0;
	ChatActionsDone = false;
}

function NT_OutputGameLength()
{
	var _duration;
	
	if(InGameAt)
	{
		_duration = GetTickCount() - InGameAt;

		if(_duration < GameMinLength)
			InGameAt = GameMinLength - _duration;
		else
			InGameAt = 0;
	}
}

function NT_LocationTimeout(time, location)
{
	var _endtime = GetTickCount() + time;

	while(ControlData.getLocation().id == location.id && _endtime > GetTickCount())
	{
		if(LocationLoops[1] > 1)
			NT_SendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name + " [" + MWC_ConvertTicksToTimeString(_endtime - GetTickCount()) + "] [" + LocationLoops[1] + "]", 0);
		else
			NT_SendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name + " [" + MWC_ConvertTicksToTimeString(_endtime - GetTickCount()) + "]", 0);
		
		Delay(1000);
	}

	return (ControlData.getLocation().id != location.id);
}

function MW_TimeoutDelay(time, location, showNextGameStatus)
{
	var _gamename, _outputString, _timeString;
	
	if(arguments.length < 3)
		showNextGameStatus = false;
	
	_endtime = GetTickCount() + time;
	_gamename = me.gamename;
	_timeString = "";
	
	if(!_gamename)
	{
		_gamename = MW_ReadBackupFile(0);
		
		if(_gamename)
			SetStatusText("ÿc8Using File Backup...");
	}
	
	while(_endtime > GetTickCount())
	{
		_timeString = " [" + MWC_ConvertTicksToTimeString(_endtime - GetTickCount()) + "]";
		
		NT_SendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name + _timeString , 0);
		
		if(showNextGameStatus)
		{
			if(LastGameFailed && parseInt(_endtime-GetTickCount()) > CreateGameThreshold && parseInt((_endtime-GetTickCount())/1000) % 30 >= 0 && parseInt((_endtime-GetTickCount())/1000) % 30 <= 5)
			{
				_outputString = "ÿc1Last game failed!";
				_timeString = "";
			}
			else if(parseInt((_endtime-GetTickCount())/1000) >= 0)
			{
				if(_gamename && MW_GetGameCounter(_gamename, false))
					_outputString = "ÿc8Next game: " + MW_GetGameName(_gamename) + MW_GetGameCounter(_gamename, false);
				else
					_outputString = "ÿc8Game creation pending... ";
			}
			
			MWC_SetStatusText(_outputString, _timeString);
			
			if(me.ingame)
				_endtime = GetTickCount();
		}
		
		Delay(1000);
	}
	
	if(showNextGameStatus)
		SetStatusText("ÿc8Creating game...");
		
	return;
}

function NT_GetRandomString(length)
{
	_retString = "";
	_charSet = "0123456789abcdefghijklmnopqrstuvwxyz";

	while(length--)
	{
		_retString += _charSet.charAt(Random(0, _charSet.length - 1));
		Delay(1);
	}

	return _retString;
}

function MW_GetGameName(lastGameString)
{
	if(!lastGameString)
		return "";
	else
		return lastGameString.substr(0, lastGameString.lastIndexOf('-') + 1);
}

function MW_GetGameCounter(lastGameString, simple)
{
	var _count, _countString;

	if(!lastGameString)
		return "-1";
	else
	{
		_countString = lastGameString.slice(lastGameString.lastIndexOf('-') + 1);
			
		if(_countString[0] == '0')
			_countString = _countString.substr(1);

		_count = parseInt(_countString) + 1;

		if(_count == 100)
			_count = 0;

		if(!simple)
		{
			if(_count <= 9)
				return '0' + _count;
		}

		return _count;
	}
}

function MW_IsChannelUser()
{
	for(var i = 0; i < ChannelUsers.length; i++)
	{
		if(me.account.toLowerCase() == ChannelUsers[i].toLowerCase() || me.charname.toLowerCase() == ChannelUsers[i].toLowerCase())
			return true;
	}
	return false;
}

function MW_ReadBackupFile(type)
{
	var _fhandle, _buffer, _time, _now, _retValue;
	
	_fhandle = FileOpen("/Logs/Temporary Data/" + me.charname + ".channel", 2);
	_retValue = "";
	_now = new Date();
	
	if(_fhandle && _now)
	{
		_buffer = _fhandle.ReadLine();
		
		if(_buffer)
		{
			_time = parseInt(_buffer);
			if(_now.getTime() - _time < UseFileBackupTimeMax*6E4)
			{
				_retValue = _fhandle.ReadLine();
				
				if(type > 0)
					_retValue = _fhandle.ReadLine();
			}
		}
		_fhandle.Close();
	}
	else if(_fhandle)
		_fhandle.Close();
	
	return _retValue;
}

function MW_WriteBackupFile()
{
	var _fhandle, _now;
	
	if(UseFileBackupTimeMax == 0)
		return false;
		
	_fhandle = FileOpen("/Logs/Temporary Data/" + me.charname + ".channel", 1);
	_now = new Date();

	if(_fhandle && _now)
	{
		_fhandle.WriteLine(_now.getTime());
		_fhandle.WriteLine(me.gamename);
		_fhandle.WriteLine(me.gamepassword);
		
		_fhandle.Close();
		
		return true;
	}
	else if(_fhandle)
		_fhandle.Close();
	
	return false;
}

function MW_CheckLocationLoops(location)
{
	if(!location)
		return false;
	
	if(isLeecher)
		MaximumLocationLoops = 900;
		
	if(!LocationLoops[0] || location.id != LocationLoops[0].id)
	{
		LocationLoops[0] = location;
		LocationLoops[1] = 0;
	}
	else if(LocationLoops[0].id != 5)
	{
		LocationLoops[1]++;
		
		if(LocationLoops[1] >= MaximumLocationLoops)
		{
			if(LocationLoops[1] < 1000)
				NT_SendEventToOOG(D2NT_MGR_PRINT_LOG, "ÿBE0000Location Loop Restart!;ÿc1Location Loops: " + LocationLoops[1] + "\nÿBE0000Location: " + LocationLoops[0].name + "\nÿBE0000Location ID: " + LocationLoops[0].id, 0);
			
			LocationLoops[1] = 1000; // Make sure the location loop notification is only shown once
			
			NT_SendEventToOOG(D2NT_MGR_RESTART, location.name, 0);
		}
	}
	
	return true;
}

function MW_AnnounceGame()
{
	var _gamePass, _gameName, _gameText, _delay;

	_gameName = me.gamename;
	
	if(!_gameName)
		_gameName = MW_ReadBackupFile(0);
		
	_gamePass = me.gamepassword;
	
	if(!_gamePass)
		_gamePass = MW_ReadBackupFile(1);
		
	if(_gameName && !me.ingame)
	{
		_delay = (GameAnnouncementDelay > 5000) ? GameAnnouncementDelay : 5000;
		_delay += (GameAnnouncementDelayRandom > 500) ? Random(0, GameAnnouncementDelayRandom) : 500;
		
		_gameText = GameAnnouncement.replace("%password", ((_gamePass) ? _gamePass : "N/A"));
		_gameText = _gameText.replace("%game", MW_GetGameName(_gameName));
		_gameText = _gameText.replace("%counter", MW_GetGameCounter(_gameName, false));
		_gameText = _gameText.replace("%time", parseInt((NextGameMake - GetTickCount() - _delay + ClickDelay + TextDelay) / 1000 + 5));
	
		if(_gameText.indexOf("NaN") > -1)
			return false;
		
		if(parseInt((NextGameMake - GetTickCount() - _delay + ClickDelay + TextDelay) / 1000) > 3)
		{
			Delay(_delay);
			
			return Say(_gameText);
		}
	}
	
	return false;
}
edit: Das ist übrigens schon die neue Version wie ich grad sehe, die eigentlich auch mit Gamenamen die einen Abstand enthalten klar kommen sollte. Das hat bei der letzten leider nicht geklappt.

edit2: Sop der Punkte-Bug ist nun auch hier behoben
05/05/2011 20:02 DeathFromHeaven#1713
ich hab ma noch ne Frage:

Kann ich irgendow abstellen, dass aufgehobenes Gold in den xml-Stashlogs auftaucht?

Oder einfach nen Tipp in welche Funktion ich mal einen Blick werfen sollte?^^

LG
05/05/2011 20:14 seltn#1714
Moinsen!

Hab ein kleines Problem!
Mein Goldbarb hebt ziemlich viele items auf, die wenig gold beim verkauf bringen.
< 10k gold.
Dadurch geht er pro run ein paar mal in die stadt und verkauft sie,
Das zieht die runs natürlich in die länge.

Gibt es eine möglichkeit eine minimum olgd-verkaufsgrenze zu setzen oder sowas ähnliches?

Lg Seltn
05/05/2011 20:21 Derbeth#1715
Quote:
Originally Posted by ldevil View Post
Da die geänderte NTBot.ntj ja von mir ist, hier auch Mal noch die integrierte Version. Ich glaub ich habe die getestet aber keine Garantie. Ich konzentrier mich ja auf das Muddie mit AutoMule, wo das Leech dann in der nächsten Version auch eingebaut sein wird ;)


edit: Das ist übrigens schon die neue Version wie ich grad sehe, die eigentlich auch mit Gamenamen die einen Abstand enthalten klar kommen sollte. Das hat bei der letzten leider nicht geklappt.
Habe damit meine NTBot.ntj ersetzt...

Aber ich verstehe das richtig:

Ich habe den ganz normalen Muddys D2NT 1.2.
Ich ersetze die NtBot.ntj mit deiner.
Ich setze einen Leader und einen Leecher Account fest.
Ich joine mit beiden Accounts
leader öffnet spiel
Leecher connectet und leeched....

Falls ja:
Bis zum leader funktionierts
der Leecher bekommt ne fehlermeldung (die ich nicht sehe da sofort restart von D2... Sobal er in den Chat joint...

Gruss derb

Und noch ne ferhlermeldung von meinem Gold Barb, bringt er alle X games... unregelmässig habs bis jetzt aber nur nach Threshsocket gesehen.
pickits wurden alle mit NipChecker kontrolliert, ohne fehler...

Diese hier:
NTItemparser.ntl (96) : SyntaxError: missing ) in parenthetical
05/05/2011 20:35 ldevil#1716
Quote:
Originally Posted by Derbeth View Post
Habe damit meine NTBot.ntj ersetzt...

Aber ich verstehe das richtig:

Ich habe den ganz normalen Muddys D2NT 1.2.
Ich ersetze die NtBot.ntj mit meiner.
Ich setze einen Leader und einen Leecher Account fest.
Ich joine mit beiden Accounts
leader öffnet spiel
Leecher connectet und leeched....

Falls ja:
Bis zum leader funktionierts
der Leecher bekommt ne fehlermeldung (die ich nicht sehe da sofort restart von D2... Sobal er in den Chat joint...

Gruss derb
Ich nehm an du meinst du verwendest meine (also die ich oben gepostet habe) und nicht deine ;)

Aber ja, einfach Leader und Leecher Account eintragen, PW eintragen und gut ist. Wenn du kein PW verwendest einfach "" eintragen...

Aber ja, das ich hab ein Original Muddy V1.2 genommen und nur die NTBot.ntj angepasst und bei mir läuft alles perfekt. Wenn du selber schon dran rumgefummelt hast, dann kanns sein dass es nicht klappt :p

Ausserdem brauchst du natürlich noch ein LeechScript wie BaalLeech oder BaalCoFight oder so, der Leecher macht ganz normal die Scripts die du ihm in der Config zugeordnet hast.

Quote:
Originally Posted by Derbeth View Post
Und noch ne ferhlermeldung von meinem Gold Barb, bringt er alle X games... unregelmässig habs bis jetzt aber nur nach Threshsocket gesehen.
pickits wurden alle mit NipChecker kontrolliert, ohne fehler...

Diese hier:
NTItemparser.ntl (96) : SyntaxError: missing ) in parenthetical
Das deutet auf Fehler in der Pickit hin. Nip Checker laufen lassen. Der ist irgendwo in dem Thread auch verlinkt, wenn ich mich nicht irre.
05/05/2011 21:08 Derbeth#1717
Und welche Leech/coleechfight scripte verwendest du da?
NipChecker hats abgeklappert aber keinen fehler gefunden...
05/05/2011 22:01 19Miami#1718
habe 2 bots am laufen und momentan

99 runs 64 restarts

76 runs 54 restarts

da kann irgendwas auch nicht richtig sein oder?

kanns mit dem Itemlogerror zu tun haben?
05/05/2011 22:26 Shrimps in Bierteig#1719
kannst mal versuchen in deiner global config, die zeile für xml log auf false stellen. Falls du soso verwendest, villeicht auf mal das interagieren mit telekinese ausmachen. Habe damit die erfahrung gemacht, das es teilweise zu probleme führen kann. Wen das nicht hilft, post mal deine configs.

Was für Chars sind es, und welche gebiete farmst du?
05/06/2011 00:19 19Miami#1720
die fehlermeldungen verschwinden jetzt, hätte aber auch gerne nen log :)
05/06/2011 00:31 luio1#1721
Hab ne kurze Frage:

Was bedeutet MWConfig_KillFullInfectorMob im Dia Script?
Und besteht die Möglichkeit, dass der Bot nur die Siegelbosse killt und nicht das CS säubert?

mfg
05/06/2011 00:40 BigFatMonster#1722
die option bedeutet dass er beimletzten siegel erst das öffnet, wo die monster spawnenund das letzt dann wenn die tot sind.
wenn die option nicht an is öffnet er erst das ander und dann das mit den mobs, so dass die alle sterben sobald der boss down is.

du musst das script nen bissel abändern, bzw nen neues einbaun.
wurd hier aber schon irgendwo ma beschrieben, such ma nach fastdia oder so
da müsstest du was in diesem topic finden.
05/06/2011 07:35 Derbeth#1723
Ist es möglich dass ich im Toolsentry auch den Horadric Cube loggen kann, um z.B das Ilvl festzustellen oder eine schöne itemausgabe für d2jsp habe?
05/06/2011 10:53 seltn#1724
Moinsen!

Hab ein kleines Problem!
Mein Goldbarb hebt ziemlich viele items auf, die wenig gold beim verkauf bringen.
< 10k gold.
Dadurch geht er pro run ein paar mal in die stadt und verkauft sie,
Das zieht die runs natürlich in die länge.

Gibt es eine möglichkeit eine minimum olgd-verkaufsgrenze zu setzen oder sowas ähnliches?

Lg Seltn
05/06/2011 11:14 Shrimps in Bierteig#1725
Soweit ich weiss kannst du nur einstellen wieviel gold er mind. aufhebt. Aber du könntest mal versuchen in der global config: MWConfig_PickUpMoneymakers = true; auf false zu setzen. So hebt er vor er in die stadt geht, keine items auf um die einfach zu verkaufen.

@19miami Zu dem problem mit dem Logfiles, könntest mal versuchen den bot neu zu downloaden und ein zu stellen. Kann sein das sich irgendwo bei dir mal n fehler oder sowas eingeschlichen hat. Ich hatte mal restartprobleme, und das neu runterladen und installieren, hat die probleme wieder behoben.