LINK:

################################################## ################
#################FINISHED FINAL (for now)#########################
#############Better leecher scripts can easily be made############
#################Please follow all directions#####################
######Will always attempt to join the game the leader is in#######
################################################## ################
****FIXES****
Always attempts to join the game the leader is in (even when full)
No longer keeps trying to join games that have not been created by the leader.
Should have perfect synchronizing with the leader even when a game is missed!
*****MORE FIXES*****
Solved the massive amounts of FTJ games from the leader, the bot will now go to character sleect screen and log back on to clear his text.
Thanks to zexxx, the bot will now read the mesage sent from the leader when he joins a game instead of spamming /f l (english only, i think)
Made the time of the leecher joining the games quicker (put all the actions into 1 part instead of using the join game case.
Will now send the message to d2nt manager to increment the game number for multiple cd key use
Increased the time to wait before checking if partied to leader to ~40 seconds (some games are slower then others)
So I finally got a baal follow bot working for D2NT 3.0, which will attempt to join the game created by the (leader) once he is inside the game. This requires the follower and the bot to be on the friends list.
Here is the script for the follow bot to use.
Code:
Code:
function NTMain()
{
Include("libs/common/NTCommon.ntl");
NTC_IncludeLibs();
NTC_IncludeConfig("NTBot/char_configs");
NT_LoadConfig();
NTSI_LoadNIPFiles("NTBot/item_configs");
NTA_Initialize(); // 10
var _leader = "iMake_Fg"; // Name of leader's character in game (exactly)
if(!NTTM_CheckAct())
{
NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_CheckAct()");
return;
}
if(me.areaid != 109)
{
if(!NTTM_TownMove("waypoint"))
{
NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_TownMove()");
return;
}
if(!NTM_TakeWaypoint(109))
{
NTC_SendMsgToScript("NTBotGame.ntj", "NTM_TakeWaypoint()");
return;
}
}
NTTMGR_TownManager();
NTTM_TownMove("portalspot");
for(i = 0; i <= 200; i++)
{
if(NTC_InMyParty(_leader))
break;
Delay(200);
}
while(me.areaid == 109 && NTC_InMyParty(_leader))
{
NTM_UsePortal("BluePortal", 131, _leader); // 50
Delay(5000);
}
NTP_DoPrecast(true);
while(NTC_InMyParty(_leader))
{
Delay(1000);
}
NTC_SendMsgToScript("NTBotGame.ntj", "SCRIPT_END");
}
Copy this code to a notepad with the extension .ntj and put it inside the bots folder.
I named my script NTBaalLeech.ntj
Go to the character config file and add in the line
NTConfig_Script.push("NTBaalLeech.ntj");
where all the other ones are (when running the follow bot only load this script.
Now copy and paste this code into a new notepad called NTBotLeech.ntj
Put this file in D2NT\D2NT\Scripts
You will see NTBot.ntj and NTMap.ntj in this folder already.
(no longer uses /f l command, english only)
(uses /f l command to find game, english, french, possibly german (german has to be added by you (see page 5?))Near the top of this code you will notice it says var leaderAccountName = "xxx";
Which ever account you are using that is the leader, put that account name exactly as it appears on the friends list in the quotes.
After you have these 2 files, the next step is to open up the file controlInfo.ntl
In this file locate the 2 lines that read this:
this.controls.lobby.chat.textBox = new Array();
this.controls.lobby.chat.textBox.channelName = [4,28,138,354,60];
Add this line under these:
this.controls.lobby.chat.textBox.channelText = [4,28,410,354,298];
This line makes the bot able to read the friends list.
I also editted the leader's baal script so the first tp it sends is fairly safe in the corner near baal (leechscript will take first tp from the leader)
There are 2 different if(ntconfig_publicmode) near the top of the baal script, what i did was i deleted the first if statement, and changed the 2nd one to look like this
Code:
if(NTConfig_PublicMode)
{
NTM_MoveTo(me.areaid, 15112, 5004, 1, true);
NTA_ClearPosition(20, true, 2);
NTM_MoveTo(me.areaid, 15116, 5004);
NTM_MakeTP();
//Say("TP is safe!");
NT_ClearThroneInt();
}
Places to edit in the NTBaalLeech.ntj file
NTA_Initialize(); // 10
var _leader = ""; // Name of leader's character in game, case sensitive
if(!NTTM_CheckAct())
Places to edit in the NTBotLeech.ntj
var joinChannelInChat = ""; // leave blank to not join a private channel
var leaderAccountName = ""; // Account name on friends list
var gamepassword = ''; // Game password if using one
in case 28: // game does not exist
Delay(160000); Edit this number accordingly, 1000 = 1 second
In the D2NT Manager on the bottom right you will see a drop down list of different .ntj files to load. Select NTBotLeech.ntj for the leech bot.
I may have missed a step in here, so any questions or if it is not working please feel free to post or PM me. I will try and help.
Last edited by Beo900 on Fri Apr 09, 2010 8:50 pm; edited 21 times in total
so jetzt mein problem ist dies
hab die aber beide add in der fl kp woran das liegen kann so bin erst mal off bis morgen
hier meine dateien
controlInfo
Code:
/*
controlInfo() Class written by njaguar
v3.1
*/
function controlInfo() {
this.controls = new Array();
this.controls.lobby = new Array();
this.controls.lobby.name = "Lobby";
this.controls.lobby.id = 1;
this.controls.lobby.textBox = new Array();
this.controls.lobby.textBox.chat = [4,28,410,354,298];
this.controls.lobby.textBox.status = [4,447,398,290,269];
this.controls.lobby.textBox.characterInfo = [4,143,588,230,87];
this.controls.lobby.button = new Array();
this.controls.lobby.button.create = [6,533,469,120,20];
this.controls.lobby.button.join = [6,652,469,120,20];
this.controls.lobby.button.channel = [6,535,490,80,20];
this.controls.lobby.button.ladder = [6,614,490,80,20];
this.controls.lobby.button.quit = [6,693,490,80,20];
this.controls.lobby.button.enterChat = [6,27,480,120,20];
this.controls.lobby.button.help = [6,146,480,120,20];
this.controls.lobby.location = [
this.controls.lobby.button.enterChat,
this.controls.lobby.button.help,
];
this.controls.lobby.inLine = new Array();
this.controls.lobby.inLine.name = "Waiting In Line";
this.controls.lobby.inLine.id = 2;
this.controls.lobby.inLine.textBox = new Array();
this.controls.lobby.inLine.textBox.inLine = [4,427,234,300,100];
this.controls.lobby.inLine.button = new Array();
this.controls.lobby.inLine.button.cancel = [6,433,433,96,32];
this.controls.lobby.inLine.location = [
this.controls.lobby.inLine.textBox.inLine,
this.controls.lobby.inLine.button.cancel,
];
this.controls.lobby.serverDown = new Array();
this.controls.lobby.serverDown.name = "Server Down";
this.controls.lobby.serverDown.id = 24;
this.controls.lobby.serverDown.textBox = new Array();
this.controls.lobby.serverDown.textBox.serverDown = [4,438,300,326,150];
this.controls.lobby.serverDown.textBox.serverDown.key = [5139];
this.controls.lobby.serverDown.location = [
this.controls.lobby.serverDown.textBox.serverDown,
]
// this is also the Please Wait dialog in the lobby, as well as Character Already Exists for creating chars
this.controls.lobby.pleaseWait = new Array();
this.controls.lobby.pleaseWait.name = "Please Wait...";//"Lost Connection";
this.controls.lobby.pleaseWait.id = 25;
this.controls.lobby.pleaseWait.textBox = new Array();
this.controls.lobby.pleaseWait.textBox.pleaseWait = [4,268,320,264,120];
this.controls.lobby.pleaseWait.button = new Array();
this.controls.lobby.pleaseWait.button.cancel = [6,351,337,96,32];
this.controls.lobby.pleaseWait.location = [
this.controls.lobby.pleaseWait.textBox.pleaseWait,
this.controls.lobby.pleaseWait.button.cancel,
];
// this is also the Please Wait dialog in the lobby
this.controls.lobby.lostConnection = new Array();
this.controls.lobby.lostConnection.name = "Lost Connection";
this.controls.lobby.lostConnection.id = 17;
this.controls.lobby.lostConnection.textBox = new Array();
this.controls.lobby.lostConnection.textBox.lostConnection = [4,268,320,264,120];
this.controls.lobby.lostConnection.textBox.lostConnection.key = [5351];
this.controls.lobby.lostConnection.button = new Array();
this.controls.lobby.lostConnection.button.ok = [6,351,337,96,32];
this.controls.lobby.lostConnection.location = [
this.controls.lobby.lostConnection.textBox.lostConnection,
this.controls.lobby.lostConnection.button.ok,
];
// Game Name Already Exists
this.controls.lobby.gameExists = new Array();
this.controls.lobby.gameExists.name = "Game Already Exists";
this.controls.lobby.gameExists.id = 26;
this.controls.lobby.gameExists.textBox = new Array();
this.controls.lobby.gameExists.textBox.gameExists = [4,438,300,326,150];
this.controls.lobby.gameExists.textBox.gameExists.key = [5138];
this.controls.lobby.gameExists.location = [
this.controls.lobby.gameExists.textBox.gameExists,
];
// Game Does Not Exist (also A Game Already Exists With That Name and Server Down w/ different key)
this.controls.lobby.gameDoesNotExist = new Array();
this.controls.lobby.gameDoesNotExist.name = "Game Does Not Exist";
this.controls.lobby.gameDoesNotExist.id = 28;
this.controls.lobby.gameDoesNotExist.textBox = new Array();
this.controls.lobby.gameDoesNotExist.textBox.text = [4,438,300,326,150];
this.controls.lobby.gameDoesNotExist.textBox.text.key = [5159];
this.controls.lobby.gameDoesNotExist.location = [
this.controls.lobby.gameDoesNotExist.textBox.text,
];
this.controls.lobby.chat = new Array();
this.controls.lobby.chat.name = "Lobby Chat";
this.controls.lobby.chat.id = 3;
this.controls.lobby.chat.button = new Array();
this.controls.lobby.chat.button.send = [6,27,470,80,20];
this.controls.lobby.chat.button.whisper = [6,107,470,80,20];
this.controls.lobby.chat.button.help = [6,187,470,80,20];
this.controls.lobby.chat.button.squelch = [6,27,490,72,20];
this.controls.lobby.chat.button.unsquelch = [6,99,490,96,20];
this.controls.lobby.chat.button.emote = [6,195,490,72,20];
this.controls.lobby.chat.textBox = new Array();
this.controls.lobby.chat.textBox.channelName = [4,28,138,354,60];
this.controls.lobby.chat.textBox.channelText = [4,28,410,354,298];
this.controls.lobby.chat.location = [
this.controls.lobby.chat.button.send,
this.controls.lobby.chat.button.whisper,
this.controls.lobby.chat.button.help,
];
this.controls.lobby.create = new Array();
this.controls.lobby.create.name = "Create Game";
this.controls.lobby.create.id = 4;
this.controls.lobby.create.textBox = new Array();
this.controls.lobby.create.textBox.createGame = [4,496,111,200,22];
this.controls.lobby.create.textBox.gameName = [4,427,134,150,12];
this.controls.lobby.create.textBox.password = [4,427,188,300,12];
this.controls.lobby.create.textBox.gameDescription = [4,427,243,300,12];
this.controls.lobby.create.textBox.maxNumberOfPlayers = [4,632,306,300,12];
this.controls.lobby.create.textBox.characterDifference = [4,632,342,300,12];
this.controls.lobby.create.textBox.levels = [4,705,342,150,12];
this.controls.lobby.create.textBox.normal = [4,723,380,150,12];
this.controls.lobby.create.textBox.nightmare = [4,579,380,150,12];
this.controls.lobby.create.textBox.hell = [4,459,380,150,12];
this.controls.lobby.create.editBox = new Array();
this.controls.lobby.create.editBox.gameName = [1,432,162,158,20];
this.controls.lobby.create.editBox.password = [1,432,217,158,20];
this.controls.lobby.create.editBox.gameDescription = [1,432,268,333,20];
this.controls.lobby.create.editBox.maxNumberOfPlayers = [1,657,308,27,20];
this.controls.lobby.create.editBox.characterDifference = [1,657,342,27,20];
this.controls.lobby.create.button = new Array();
this.controls.lobby.create.button.createGame = [6,594,433,172,32];
this.controls.lobby.create.button.cancel = [6,433,433,96,32];
this.controls.lobby.create.button.maxNumberOfPlayersUp = [0];
this.controls.lobby.create.button.maxNumberOfPlayersDown = [0];
this.controls.lobby.create.button.useCharacterDifference = [0];
this.controls.lobby.create.button.characterDifferenceUp = [0];
this.controls.lobby.create.button.characterDifferenceDown = [0];
this.controls.lobby.create.button.normal = [6,430,381,16,16];
this.controls.lobby.create.button.nightmare = [6,555,381,16,16];
this.controls.lobby.create.button.hell = [6,698,381,16,16];
this.controls.lobby.create.location = [
this.controls.lobby.create.editBox.gameName,
this.controls.lobby.create.editBox.password,
this.controls.lobby.create.editBox.gameDescription,
];
// insert all game join controls here
this.controls.lobby.join = new Array();
this.controls.lobby.join.name = "Join Game";
this.controls.lobby.join.id = 5;
this.controls.lobby.join.editBox = new Array();
this.controls.lobby.join.editBox.gameName = [1,432,148,155,20];
this.controls.lobby.join.editBox.password = [1,606,148,155,20];
this.controls.lobby.join.textBox = new Array();
this.controls.lobby.join.textBox.joinGame = [4,496,106,200,22];
this.controls.lobby.join.textBox.gameName = [4,428,121,150,12];
this.controls.lobby.join.textBox.password = [4,602,121,150,12];
this.controls.lobby.join.textBox.gameNamePlayers = [4,431,212,200,12];
this.controls.lobby.join.textBox.gameList = [4,432,393,160,173]; // list is stored in extended text
this.controls.lobby.join.textBox.gameDetails = [4,609,393,143,194]; // details is stored in extended text
this.controls.lobby.join.button = new Array();
this.controls.lobby.join.button.joinGame = [6,594,433,172,32];
this.controls.lobby.join.button.cancel = [6,433,433,96,32];
this.controls.lobby.join.location = [
this.controls.lobby.join.editBox.gameName,
this.controls.lobby.join.textBox.joinGame,
this.controls.lobby.join.textBox.gameList,
];
// insert all game ladder controls here
this.controls.lobby.ladder = new Array();
this.controls.lobby.ladder.name = "Ladder";
this.controls.lobby.ladder.id = 6;
this.controls.lobby.ladder.textBox = new Array();
this.controls.lobby.ladder.button = new Array();
this.controls.lobby.ladder.list = new Array();
// insert all game channel controls here
this.controls.lobby.channel = new Array();
this.controls.lobby.channel.name = "Channel List";
this.controls.lobby.channel.id = 7;
this.controls.lobby.channel.textBox = new Array();
this.controls.lobby.channel.editBox = new Array();
this.controls.lobby.channel.button = new Array();
this.controls.lobby.channel.list = new Array();
// insert all main menu controls here
this.controls.mainMenu = new Array();
this.controls.mainMenu.name = "Main Menu";
this.controls.mainMenu.id = 8;
this.controls.mainMenu.textBox = new Array();
this.controls.mainMenu.textBox.d2Version = [4,0,599,200,40];
this.controls.mainMenu.button = new Array();
this.controls.mainMenu.button.gateway = [6,264,391,272,25];
this.controls.mainMenu.button.battleNet = [6,264,366,272,35];
this.controls.mainMenu.button.otherMultiplayer = [6,264,433,272,35];
this.controls.mainMenu.button.singlePlayer = [6,264,324,272,35];
this.controls.mainMenu.button.credits = [6,264,528,135,25];
this.controls.mainMenu.button.cinematics = [6,402,528,135,25];
this.controls.mainMenu.button.exitDiabloII = [6,264,568,272,35];
this.controls.mainMenu.location = [
this.controls.mainMenu.button.battleNet,
this.controls.mainMenu.button.otherMultiplayer,
this.controls.mainMenu.button.singlePlayer,
];
// connecting to battle.net
this.controls.mainMenu.connecting = new Array();
this.controls.mainMenu.connecting.id = 21;
this.controls.mainMenu.connecting.name = "Connecting to Battle.net";
this.controls.mainMenu.connecting.textBox = new Array();
this.controls.mainMenu.connecting.textBox.connectingTo = [4,222,280,340,60];
this.controls.mainMenu.connecting.textBox.body = [4,222,360,340,70]; // contains connecting to battle.net/fastest server, accessing your account, or checking versions
this.controls.mainMenu.connecting.textBox.progress = [4,222,370,340,20]; // dots
this.controls.mainMenu.connecting.button = new Array();
this.controls.mainMenu.connecting.button.cancel = [6,330,416,128,35];
this.controls.mainMenu.connecting.location = [
this.controls.mainMenu.connecting.textBox.connectingTo,
this.controls.mainMenu.connecting.textBox.body,
this.controls.mainMenu.connecting.textBox.progress,
this.controls.mainMenu.connecting.button.cancel,
];
// startup screen
this.controls.d2Splash = new Array();
this.controls.d2Splash.name = "D2 Splash"
this.controls.d2Splash.id = 18;
this.controls.d2Splash.textBox = new Array();
this.controls.d2Splash.textBox.copyright = [4,100,580,600,80];
this.controls.d2Splash.location = [
this.controls.d2Splash.textBox.copyright,
];
// insert all bnet login controls here (including account settings)
// add: ACCOUNT SETTINGS, CHANGE PASSWORD, GET NEW PASSWORD, CHANGE EMAIL, CREATE NEW ACCOUNT agreement & form
this.controls.login = new Array();
this.controls.login.name = "Login";
this.controls.login.id = 9;
this.controls.login.textBox = new Array();
this.controls.login.textBox.accountName = [4,321,340,300,32];
this.controls.login.textBox.password = [4,321,394,300,32];
this.controls.login.textBox.heading = [4,200,350,400,100];
this.controls.login.editBox = new Array();
this.controls.login.editBox.accountName = [1,322,342,162,19];
this.controls.login.editBox.password = [1,322,396,162,19];
this.controls.login.button = new Array();
this.controls.login.button.createNewAccount = [6,264,572,272,35];
this.controls.login.button.accountSettings = [6,264,528,272,35];
this.controls.login.button.logIn = [6,264,484,272,35];
this.controls.login.button.exit = [6,33,572,128,35];
this.controls.login.location = [
this.controls.login.textBox.accountName,
this.controls.login.editBox.password,
this.controls.login.editBox.accountName,
this.controls.login.button.logIn,
];
// login error, permanent failure, bad account or password
this.controls.login.loginError = new Array();
this.controls.login.loginError.name = "Login Error";
this.controls.login.loginError.id = 10;
this.controls.login.loginError.textBox = new Array();
this.controls.login.loginError.textBox.loginError = [4,195,237,410,40]; // used for invalid login/password popups
this.controls.login.loginError.textBox.invalidPassword = [4,199,377,402,140];
this.controls.login.loginError.textBox.invalidAccount = [4,199,377,402,140];
this.controls.login.loginError.button = new Array();
this.controls.login.loginError.button.ok = [6,335,412,128,35]; // used for invalid login/password popups
this.controls.login.loginError.location = [
this.controls.login.loginError.textBox.loginError,
this.controls.login.loginError.button.ok,
];
// unable to connect, related to ip-bans or no internet connection
this.controls.login.unableToConnect = new Array();
this.controls.login.unableToConnect.name = "Unable To Connect";
this.controls.login.unableToConnect.id = 11;
this.controls.login.unableToConnect.textBox = new Array();
this.controls.login.unableToConnect.textBox.title = [4,158,220,485,40];
this.controls.login.unableToConnect.textBox.head = [4,162,320,477,100];
this.controls.login.unableToConnect.textBox.body = [4,162,420,477,100];
this.controls.login.unableToConnect.button = new Array();
this.controls.login.unableToConnect.button.ok = [6,335,450,128,35];
this.controls.login.unableToConnect.location = [
this.controls.login.unableToConnect.textBox.title,
this.controls.login.unableToConnect.textBox.head,
this.controls.login.unableToConnect.button.ok,
];
this.controls.login.cdkeyInUse = new Array();
this.controls.login.cdkeyInUse.name = "Cdkey In Use";
this.controls.login.cdkeyInUse.id = 19;
this.controls.login.cdkeyInUse.textBox = new Array();
this.controls.login.cdkeyInUse.textBox.unableToConnect = [4,158,220,485,40];
this.controls.login.cdkeyInUse.textBox.cdkeyInUse = [4,162,270,477,50];
this.controls.login.cdkeyInUse.textBox.byWho = [4,158,310,485,40];
this.controls.login.cdkeyInUse.textBox.onlyOneRegistered = [4,162,420,477,100];
this.controls.login.cdkeyInUse.button = new Array();
this.controls.login.cdkeyInUse.button.ok = [6,335,450,128,35];
this.controls.login.cdkeyInUse.location = [
this.controls.login.cdkeyInUse.textBox.unableToConnect,
this.controls.login.cdkeyInUse.textBox.cdkeyInUse,
this.controls.login.cdkeyInUse.textBox.byWho,
];
// login - invalid cdkey
this.controls.login.invalidCdkey = new Array();
this.controls.login.invalidCdkey.id = 22;
this.controls.login.invalidCdkey.name = "Invalid Cdkey";
this.controls.login.invalidCdkey.textBox = new Array();
this.controls.login.invalidCdkey.textBox.unableToConnect = [4,158,220,485,40];
this.controls.login.invalidCdkey.textBox.invalidCdkey = [4,162,320,477,100];
this.controls.login.invalidCdkey.textBox.invalidCdkey.key = [5202, 10912];
this.controls.login.invalidCdkey.textBox.uninstall = [4,162,420,477,100];
this.controls.login.invalidCdkey.button = new Array();
this.controls.login.invalidCdkey.button.ok = [6,335,450,128,35];
this.controls.login.invalidCdkey.location = [
this.controls.login.invalidCdkey.textBox.unableToConnect,
this.controls.login.invalidCdkey.textBox.invalidCdkey,
this.controls.login.invalidCdkey.textBox.uninstall,
this.controls.login.invalidCdkey.button.ok
];
// insert all character select screen controls here (including single player)
this.controls.characterSelect = new Array();
this.controls.characterSelect.name = "Character Select";
this.controls.characterSelect.id = 12;
this.controls.characterSelect.textBox = new Array();
this.controls.characterSelect.textBox.selectedCharName = [4,85,78,466,42];
this.controls.characterSelect.textBox.currentRealm = [4,629,44,145,21];
this.controls.characterSelect.textBox.selectedCurrentRealm = [4,626,100,151,44];
this.controls.characterSelect.textBox.characters = new Array(8);
this.controls.characterSelect.textBox.characters[0] = [4,237,178,72,93];
this.controls.characterSelect.textBox.characters[1] = [4,509,178,72,93];
this.controls.characterSelect.textBox.characters[2] = [4,237,271,72,93];
this.controls.characterSelect.textBox.characters[3] = [4,509,271,72,93];
this.controls.characterSelect.textBox.characters[4] = [4,237,364,72,93];
this.controls.characterSelect.textBox.characters[5] = [4,509,364,72,93];
this.controls.characterSelect.textBox.characters[6] = [4,237,457,72,93];
this.controls.characterSelect.textBox.characters[7] = [4,509,457,72,93];
this.controls.characterSelect.textBox.characterInfo = new Array(8);
this.controls.characterSelect.textBox.characterInfo[0] = [4,37,178,200,92];
this.controls.characterSelect.textBox.characterInfo[1] = [4,309,178,200,92];
this.controls.characterSelect.textBox.characterInfo[2] = [4,37,271,200,92];
this.controls.characterSelect.textBox.characterInfo[3] = [4,309,271,200,92];
this.controls.characterSelect.textBox.characterInfo[4] = [4,37,364,200,92];
this.controls.characterSelect.textBox.characterInfo[5] = [4,309,364,200,92];
this.controls.characterSelect.textBox.characterInfo[6] = [4,37,457,200,92];
this.controls.characterSelect.textBox.characterInfo[7] = [4,309,457,200,92];
this.controls.characterSelect.textBox.deleteConfirmation = [];
this.controls.characterSelect.button = new Array();
this.controls.characterSelect.button.ok = [6,627,572,128,35];
this.controls.characterSelect.button.exit = [6,33,572,128,35];
this.controls.characterSelect.button.createNew = [6,33,528,168,60];
this.controls.characterSelect.button.convertTo = [6,233,528,168,60];
this.controls.characterSelect.button.deleteChar = [6,433,528,168,60];
this.controls.characterSelect.button.changeRealm = [6,609,113,182,30];
this.controls.characterSelect.button.deleteYes = [];
this.controls.characterSelect.button.deleteNo = [];
this.controls.characterSelect.location = [
this.controls.characterSelect.textBox.selectedCharName,
this.controls.characterSelect.textBox.characters[0],
this.controls.characterSelect.textBox.characterInfo[7],
];
this.controls.characterCreate = new Array();
this.controls.characterCreate.name = "Character Create";
this.controls.characterCreate.id = 29;
this.controls.characterCreate.editBox = new Array();
this.controls.characterCreate.editBox.charName = [1,318,510,157,16];
this.controls.characterCreate.textBox = new Array();
this.controls.characterCreate.textBox.selectHeroClass = [4,0,80,800,50];
this.controls.characterCreate.textBox.charName = [4,321,512,200,32];
this.controls.characterCreate.textBox.bottomText = [4,210,610,430,120];
this.controls.characterCreate.textBox.expansionChar = [4,339,561,200,32];
this.controls.characterCreate.textBox.hardcore = [4,339,581,100,32];
this.controls.characterCreate.textBox.ladderChar = [4,339,601,200,32];
this.controls.characterCreate.textBox.className = [4,0,180,800,100];
this.controls.characterCreate.textBox.classDesc = [4,250,210,300,100];
this.controls.characterCreate.button = new Array();
this.controls.characterCreate.button.exit = [6,33,572,128,35];
this.controls.characterCreate.button.expansionChar = [6,319,540,15,16];
this.controls.characterCreate.button.hardcore = [6,319,560,15,16];
this.controls.characterCreate.button.ladderChar = [6,319,580,15,16];
this.controls.characterCreate.button.ok = [6,627,572,128,35];
this.controls.characterCreate.chars = new Array(9);
this.controls.characterCreate.chars[0] = [2,400,330,88,184];
this.controls.characterCreate.chars[1] = [2,626,353,88,184];
this.controls.characterCreate.chars[2] = [2,521,339,88,184];
this.controls.characterCreate.chars[3] = [2,301,333,88,184];
this.controls.characterCreate.chars[4] = [2,232,364,88,184];
this.controls.characterCreate.chars[5] = [2,100,337,88,184];
this.controls.characterCreate.chars[6] = [2,720,370,88,184];
this.controls.characterCreate.chars[7] = [2,345,470,110,127];
this.controls.characterCreate.chars[8] = [2,268,350,264,176];
this.controls.characterCreate.location = [
this.controls.characterCreate.textBox.selectHeroClass,
this.controls.characterCreate.textBox.bottomText,
];
/*
this.controls.characterCreate.alreadyExists = new Array();
this.controls.characterCreate.alreadyExists.name = "Character Create - Dupe Name";
this.controls.characterCreate.alreadyExists.id = 30;
this.controls.characterCreate.alreadyExists.textBox = new Array();
this.controls.characterCreate.alreadyExists.textBox.errorMsg = [4,268,320,264,120];
this.controls.characterCreate.alreadyExists.button = new Array();
this.controls.characterCreate.alreadyExists.button.ok = [6,351,337,96,32];
this.controls.characterCreate.alreadyExists.location = [
this.controls.characterCreate.alreadyExists.textBox.errorMsg,
this.controls.characterCreate.alreadyExists.button.ok,
];
*/
// realm down on char select screen
this.controls.characterSelect.realmDown = new Array();
this.controls.characterSelect.realmDown.name = "Realm Down";
this.controls.characterSelect.realmDown.id = 13;
this.controls.characterSelect.realmDown.textBox = new Array();
this.controls.characterSelect.realmDown.textBox.realmDown = [4,37,178,547,35];
this.controls.characterSelect.realmDown.textBox.realmDown.key = [11162];
this.controls.characterSelect.realmDown.location = [
this.controls.characterSelect.realmDown.textBox.realmDown,
];
this.controls.characterSelect.realmDown.checkNullText = true;
// Connecting on char select screen
this.controls.characterSelect.connecting = new Array();
this.controls.characterSelect.connecting.name = "Connecting...";
this.controls.characterSelect.connecting.id = 23;
this.controls.characterSelect.connecting.textBox = new Array();
this.controls.characterSelect.connecting.textBox.connecting = [4,37,178,547,35];
this.controls.characterSelect.connecting.textBox.connecting.key = [11065];
this.controls.characterSelect.connecting.location = [
this.controls.characterSelect.connecting.textBox.connecting,
];
this.controls.characterSelect.connecting.checkNullText = true;
// Popup: You were,disconnected from,battle.net. Please,reconnect.
this.controls.characterSelect.disconnected = new Array();
this.controls.characterSelect.disconnected.name = "Disconnected";
this.controls.characterSelect.disconnected.id = 14;
this.controls.characterSelect.disconnected.textBox = new Array();
this.controls.characterSelect.disconnected.textBox.disconnected = [4,268,300,264,100];
this.controls.characterSelect.disconnected.button = new Array();
this.controls.characterSelect.disconnected.button.ok = [6,351,337,96,32];
this.controls.characterSelect.disconnected.location = [
this.controls.characterSelect.disconnected.textBox.disconnected,
this.controls.characterSelect.disconnected.button.ok,
];
// Single Player - Difficulty Select
this.controls.characterSelect.difficulty = new Array();
this.controls.characterSelect.difficulty.name = "Select Difficulty";
this.controls.characterSelect.difficulty.id = 20;
this.controls.characterSelect.difficulty.textBox = new Array();
this.controls.characterSelect.difficulty.textBox.select = [4,264,260,272,35];
this.controls.characterSelect.difficulty.button = new Array();
this.controls.characterSelect.difficulty.button.normal = [6,264,297,272,35];
this.controls.characterSelect.difficulty.button.nightmare = [6,264,340,272,35];
this.controls.characterSelect.difficulty.button.hell = [6,264,383,272,35];
this.controls.characterSelect.difficulty.location = [
this.controls.characterSelect.difficulty.textBox.select,
this.controls.characterSelect.difficulty.button.normal,
this.controls.characterSelect.difficulty.button.nightmare,
this.controls.characterSelect.difficulty.button.hell,
];
// new character controls
this.controls.newCharacter = new Array();
this.controls.newCharacter.name = "New Character";
this.controls.newCharacter.id = 15;
this.controls.newCharacter.textBox = new Array();
this.controls.newCharacter.editBox = new Array();
this.controls.newCharacter.button = new Array();
// Please Wait control popup
this.controls.characterSelect.pleaseWait = new Array();
this.controls.characterSelect.pleaseWait.name = "Please Wait";
this.controls.characterSelect.pleaseWait.id = 16;
this.controls.characterSelect.pleaseWait.textBox = new Array();
this.controls.characterSelect.pleaseWait.textBox.pleaseWait = [4,268,300,264,100];
this.controls.characterSelect.pleaseWait.button = new Array();
this.controls.characterSelect.pleaseWait.button.cancel = [6,351,337,96,32];
this.controls.characterSelect.pleaseWait.location = [
this.controls.characterSelect.pleaseWait.textBox.pleaseWait,
this.controls.characterSelect.pleaseWait.button.cancel,
];
// select gateway (realm)
this.controls.gateway = new Array();
this.controls.gateway.name = "Select Gateway";
this.controls.gateway.id = 27;
this.controls.gateway.baseX = 285;
this.controls.gateway.baseY = 352;
this.controls.gateway.nextY = 24;
this.controls.gateway.textBox = new Array();
this.controls.gateway.textBox.selectGateway = [4,237,270,340,35];
this.controls.gateway.textBox.ifCurrentGateway = [4,257,345,320,84];
this.controls.gateway.textBox.realmList = [4,257,500,292,160];
this.controls.gateway.button = new Array();
this.controls.gateway.button.ok = [6,281,538,96,32];
this.controls.gateway.button.cancel = [6,436,538,96,32];
this.controls.gateway.location = [
this.controls.gateway.textBox.realmList,
this.controls.gateway.button.ok,
this.controls.gateway.button.cancel,
];
// getLocation will iterate over these, in this order, do error checkers first
this.locations = [
this.controls.characterSelect.pleaseWait,
this.controls.lobby.gameDoesNotExist,
this.controls.lobby.gameExists,
this.controls.lobby.lostConnection,
this.controls.lobby.pleaseWait,
this.controls.lobby.inLine,
this.controls.lobby.serverDown,
this.controls.characterSelect.realmDown,
this.controls.characterSelect.connecting,
this.controls.characterSelect.disconnected,
this.controls.login.loginError,
this.controls.login.invalidCdkey,
this.controls.login.unableToConnect,
this.controls.login.cdkeyInUse,
this.controls.lobby.create,
this.controls.lobby.join,
// ladder
// channel
this.controls.lobby.chat,
this.controls.lobby,
this.controls.characterSelect.difficulty,
this.controls.characterSelect,
this.controls.login,
this.controls.mainMenu.connecting,
this.controls.gateway,
this.controls.mainMenu,
this.controls.d2Splash,
this.controls.characterCreate,
];
this.gameTypes = [
this.controls.mainMenu.button.singlePlayer,
this.controls.mainMenu.button.battleNet,
this.controls.mainMenu.button.otherMultiplayer,
];
this.gameDifficulties = [
this.controls.lobby.create.button.normal,
this.controls.lobby.create.button.nightmare,
this.controls.lobby.create.button.hell,
];
this.singlePlayerDifficulties = [
this.controls.characterSelect.difficulty.button.normal,
this.controls.characterSelect.difficulty.button.nightmare,
this.controls.characterSelect.difficulty.button.hell,
];
this.clickDelay = 250;
this.textDelay = 100;
this.clickDelayRandom = 0;
this.textDelayRandom = 0;
this.realmNames = [];
this.realmNames["U.S. WEST"] = 0;
this.realmNames["U.S. EAST"] = 1;
this.realmNames["ASIA"] = 2;
this.realmNames["EUROPE"] = 3;
// returns control object if exists, else null
this.get = function( controlArray ) {
retControl = 0;
if( controlArray && controlArray.length==5 ) {
retControl = GetControl( controlArray[0], controlArray[1], controlArray[2], controlArray[3], controlArray[4] );
}
return retControl;
}
// clicks object, if it exists, return true if exists, false if not
this.click = function( controlArray, _x, _y, _skipdelay ) {
if( control = this.get( controlArray ) ) {
if( _x || _y ) {
control.Click( _x, _y );
} else {
control.Click( );
}
if(!_skipdelay) Delay( this.clickDelay + Random( 0, this.clickDelayRandom ) );
return true;
}
return false;
}
// sets text on object, returns false if not exists
this.setText = function( controlArray, str ) {
if( controlArray[0]==1 ) {
if( control = this.get( controlArray ) ) {
control.SetText( str );
Delay( this.textDelay + Random( 0, this.textDelayRandom ) );
return true;
}
}
return false;
}
// clicks a realm entry, this is 0 based! 0 = top entry (uswest)
this.clickRealmEntry = function( realmEntryIndex ) {
this.click( this.controls.gateway.textBox.realmList, 0, (realmEntryIndex*this.controls.gateway.nextY)+(this.controls.gateway.nextY/2) );
}
// returns the 0 based index of the currently selected realm
this.getCurrentRealmIndex = function( ) {
retVal = -1;
control = this.get( controlData.controls.mainMenu.button.gateway );
if(control) {
realmString = control.text.substring(control.text.indexOf(":")+2, control.text.length);
if(realmString in this.realmNames) retVal = this.realmNames[realmString];
}
return retVal;
}
this.getLocation = function( ) {
for(_i=0; _i<this.locations.length; _i++) {
found = 0;
for(_j=0; _j<this.locations[_i].location.length; _j++) {
if( (control = this.get( this.locations[_i].location[_j] )) && (!this.locations[_i].checkNullText || control.text!=null) ) {
if(this.locations[_i].location[_j].key) {
for(_k=0; _k<this.locations[_i].location[_j].key.length; _k++) {
if((_s = control.GetText()) && GetLocaleString(this.locations[_i].location[_j].key[_k]) == String(_s.join(" ")) ) {
found++;
break;
}
}
} else {
found++;
}
}
}
if(found == this.locations[_i].location.length) return this.locations[_i];
}
return 0; // no valid location found
}
// returns the current location, see locations array for listing
this.getLocationQuick = function( ) {
for(_i=0; _i<this.locations.length; _i++) {
found = true;
for(_j=0; _j<this.locations[_i].location.length; _j++) {
if( !(control = this.get( this.locations[_i].location[_j] )) ||
( this.locations[_i].checkNullText && control.text==null ) ) {
found = false;
break;
}
}
if(found) return this.locations[_i];
}
return 0; // no valid location found
}
}
Code:
const NTA_DAMAGE_NONE = 0;
const NTA_DAMAGE_PHYSICAL = 1;
const NTA_DAMAGE_MAGIC = 2;
const NTA_DAMAGE_FIRE = 3;
const NTA_DAMAGE_LIGHTNING = 4;
const NTA_DAMAGE_COLD = 5;
const NTA_DAMAGE_POISON = 6;
var _NTA_SkillHand = new Array(7);
var _NTA_SkillDamage = new Array(7);
var _NTA_SkillRange = new Array(7);
function NTA_Initialize()
{
if(NTConfig_AttackSkill[1] == 0 || NTConfig_AttackSkill[3] == 0)
NTA_DetectAttackPattern();
for(var i = 0 ; i < 7 ; i++)
{
if(NTConfig_AttackSkill[i] > 0)
{
_NTA_SkillHand[i] = GetBaseStat("skills.txt", NTConfig_AttackSkill[i], 166) ? 2 : NTC_HAND_RIGHT;
_NTA_SkillDamage[i] = NTA_GetDamageType(NTConfig_AttackSkill[i]);
switch(NTConfig_AttackSkill[i])
{
case 44: //Frost Nova
case 48: // Nova
_NTA_SkillRange[i] = 10;
break;
case 64: // Frozen Orb
_NTA_SkillRange[i] = 15;
break;
case 59:
_NTA_SkillRange[i] = 300;
break;
case 45:
_NTA_SkillRange[i] = 300;
break;
case 106: //Zeal
case 112: //Blessed Hammer
_NTA_SkillRange[i] = 3;
break;
case 151: //Whirlwind
_NTA_SkillRange[i] = 8;
break;
case 152: //Berserk
_NTA_SkillRange[i] = 3;
break;
default:
_NTA_SkillRange[i] = 25;
break;
}
}
}
}
function NTA_KillMonster(classid)
{
var _target;
if(NTConfig_AttackSkill[1] < 1)
return false;
_target = NTC_FindUnit(NTC_UNIT_MONSTER, classid, 5);
if(!_target)
return false;
if(_target.IsAttackable())
{
var _attackcount = 0;
while(_attackcount < 300 && NTA_IsValidMonster(_target))
{
if(NTA_Attack(_target, (_attackcount%30) == 0) < 2)
break;
_attackcount++;
}
}
return (_target.hp <= 0 || _target.mode == 0 || _target.mode == 12);
}
function NTA_ClearPosition(range, pickitem, safelevel)
{
var _orgx, _orgy;
var _spectype = [0x0A, 0x04, 0x02, 0x08, 0x10];
var _skiplist;
var _attackcount = 0;
var _target;
var _distance, _mingid, _mindistance;
var _result;
if(NTConfig_AttackSkill[1] < 1 || NTConfig_AttackSkill[3] < 1)
return false;
switch(arguments.length)
{
case 0:
range = 20;
case 1:
pickitem = false;
case 2:
safelevel = 0;
default:
if(NTConfig_CheckSelfSafe < 0x01 && NTConfig_CheckMercSafe < 0x01)
safelevel = 0;
break;
}
_orgx = me.x;
_orgy = me.y;
for(var i = 0 ; i < _spectype.length ; i++)
{
_skiplist = new Array();
while(_attackcount < (i+1)*100)
{
_mindistance = 100000;
_target = NTC_FindUnit(NTC_UNIT_MONSTER);
NTSI_PickItems();
if(_target)
{
do
{
if(_skiplist.indexOf(_target.gid) < 0)
{
if(_target.IsAttackable() && (_target.spectype&_spectype[i]))
{
if(GetDistance(_orgx, _orgy, _target.x, _target.y) <= range && NTA_IsValidMonster(_target))
{
_distance = GetDistance(me, _target);
if(_distance < _mindistance)
{
_mingid = _target.gid;
_mindistance = _distance;
}
}
}
else
_skiplist.push(_target.gid);
}
} while(_target.GetNext());
}
if(_mindistance < 100000)
{
_target = NTC_FindUnit(NTC_UNIT_MONSTER, _mingid);
if(_target)
{
_result = NTA_Attack(_target, (_attackcount%30) == 0);
switch(_result)
{
case 1:
_skiplist.push(_mingid);
break;
case 2:
case 3:
_attackcount++;
break;
default:
return false;
}
}
}
else
break;
}
}
if(me.classid == NTC_CHAR_CLASS_PALADIN)
{
if(_attackcount > 2 && (parseInt(me.hp*100/me.hpmax) < NTConfig_UseRedemptionHP || parseInt(me.mp*100/me.mpmax) < NTConfig_UseRedemptionMP))
{
if(NTC_PutSkill(124, NTC_HAND_RIGHT))
NTC_PingDelay(1000);
}
}
if(NTConfig_OpenChest)
{
_target = NTC_GetSpecialChest();
if(_target && GetDistance(_orgx, _orgy, _target.x, _target.y) <= range && NTC_OpenChest(_target))
_attackcount++;
}
if(pickitem && _attackcount > 0)
NTSI_PickItems();
switch(safelevel)
{
case 1:
return NTTMGR_CheckSafe(0x00, NTConfig_CheckMercSafe&0x01);
case 2:
return NTTMGR_CheckSafe(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe);
}
return true;
}
function NTA_ClearLevel(pickitem, safelevel)
{
var i;
var _room, _rooms;
var _distance, _minindex, _mindistance;
_room = GetRoom();
if(!_room)
return false;
switch(arguments.length)
{
case 0:
pickitem = true;
case 1:
safelevel = 2;
default:
if(NTConfig_CheckSelfSafe < 0x01 && NTConfig_CheckMercSafe < 0x01)
safelevel = 0;
break;
}
_rooms = new Array();
do
{
_rooms.push([parseInt(_room.x*5 + _room.xsize*5/2), parseInt(_room.y*5 + _room.ysize*5/2)]);
} while(_room.GetNext());
while(_rooms.length > 0)
{
_mindistance = 100000;
for(i = 0 ; i < _rooms.length ; i++)
{
_distance = GetDistance(me.x, me.y, _rooms[i][0], _rooms[i][1]);
if(_distance < _mindistance)
{
_minindex = i;
_mindistance = _distance;
}
}
if(NTM_MoveTo(me.areaid, _rooms[_minindex][0], _rooms[_minindex][1], 1))
{
if(!NTA_ClearRoom(pickitem, safelevel))
return false;
NTP_DoPrecast(false);
}
_rooms.splice(_minindex, 1);
}
return true;
}
function NTA_ClearRoom(pickitem, safelevel)
{
var _room;
var _spectype = [0x0A, 0x04, 0x02];
var _skiplist;
var _attackcount = 0;
var _target;
var _distance, _mingid, _mindistance;
var _result;
if(NTConfig_AttackSkill[1] < 1 || NTConfig_AttackSkill[3] < 1)
return false;
_room = me.GetRoom();
if(!_room)
return false;
switch(arguments.length)
{
case 0:
pickitem = false;
case 1:
safelevel = 0;
default:
if(NTConfig_CheckSelfSafe < 0x01 && NTConfig_CheckMercSafe < 0x01)
safelevel = 0;
break;
}
for(var i = 0 ; i < _spectype.length ; i++)
{
_skiplist = new Array();
while(_attackcount < (i+1)*100)
{
_mindistance = 100000;
_target = NTC_FindUnit(NTC_UNIT_MONSTER);
if(_target)
{
do
{
if(_skiplist.indexOf(_target.gid) < 0)
{
if(_target.IsAttackable() && (_target.spectype&_spectype[i]))
{
if(_room.UnitInRoom(_target) && NTA_IsValidMonster(_target))
{
_distance = GetDistance(me, _target);
if(_distance < _mindistance)
{
_mingid = _target.gid;
_mindistance = _distance;
}
}
}
else
_skiplist.push(_target.gid);
}
} while(_target.GetNext());
}
if(_mindistance < 100000)
{
_target = NTC_FindUnit(NTC_UNIT_MONSTER, _mingid);
if(_target)
{
_result = NTA_Attack(_target, (_attackcount%30) == 0);
switch(_result)
{
case 1:
_skiplist.push(_mingid);
break;
case 2:
case 3:
_attackcount++;
break;
default:
return false;
}
}
}
else
break;
}
}
if(me.classid == NTC_CHAR_CLASS_PALADIN)
{
if(_attackcount > 2 && (parseInt(me.hp*100/me.hpmax) < NTConfig_UseRedemptionHP || parseInt(me.mp*100/me.mpmax) < NTConfig_UseRedemptionMP))
{
if(NTC_PutSkill(124, NTC_HAND_RIGHT))
NTC_PingDelay(1000);
}
}
if(NTConfig_OpenChest)
{
_target = NTC_GetSpecialChest();
if(_target && _room.UnitInRoom(_target) && NTC_OpenChest(_target))
_attackcount++;
}
if(pickitem && _attackcount > 0)
NTSI_PickItems();
switch(safelevel)
{
case 1:
return NTTMGR_CheckSafe(0x00, NTConfig_CheckMercSafe&0x01);
case 2:
return NTTMGR_CheckSafe(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe);
}
return true;
}
function NTA_IsValidMonster(monster)
{
var _classid;
if(monster.hp <= 0 || monster.mode == 0 || monster.mode == 12)
return false;
_classid = monster.classid;
if(((_classid >= 110 && _classid <= 113) || _classid == 608) && monster.mode == 8) // ignore flying scavengers
return false;
if(_classid == 68 && monster.mode == 14) // ignore burrowing maggots
return false;
if(_classid >= 258 && _classid <= 263 && monster.mode == 14) // ignore submerged WaterWatchers
return false;
if(monster.GetState(53) || monster.GetState(96)) // Conversion, Revive
return false;
return true;
}
function NTA_GetDamageType(skillid)
{
if(skillid == 74) // Corpse Explosion
return NTA_DAMAGE_PHYSICAL;
if(skillid == 112) // Blessed Hammer
return NTA_DAMAGE_NONE;
switch(GetBaseStat("skills.txt", skillid, 233))
{
case "cold":
return NTA_DAMAGE_COLD;
case "fire":
return NTA_DAMAGE_FIRE;
case "ltng":
return NTA_DAMAGE_LIGHTNING;
case "mag":
return NTA_DAMAGE_MAGIC;
case "pois":
return NTA_DAMAGE_POISON;
case "stun":
return NTA_DAMAGE_NONE;
default:
if(GetBaseStat("skills.txt", skillid, 178) || GetBaseStat("skills.txt", skillid, 182)) // aura or passive
return NTA_DAMAGE_NONE;
}
return NTA_DAMAGE_PHYSICAL;
}
function NTA_GetResistance(enemy, type)
{
switch(type)
{
case NTA_DAMAGE_PHYSICAL:
return enemy.GetStat(36);
case NTA_DAMAGE_MAGIC:
return enemy.GetStat(37);
case NTA_DAMAGE_FIRE:
return enemy.GetStat(39);
case NTA_DAMAGE_LIGHTNING:
return enemy.GetStat(41);
case NTA_DAMAGE_COLD:
return enemy.GetStat(43);
case NTA_DAMAGE_POISON:
return enemy.GetStat(45);
}
return 0;
}
function NTA_DetectAttackPattern()
{
switch(me.classid)
{
case NTC_CHAR_CLASS_AMAZON:
return NTA_AmazonAttackPatternInt();
case NTC_CHAR_CLASS_SORCERESS:
return NTA_SorceressAttackPatternInt();
case NTC_CHAR_CLASS_NECROMANCER:
return NTA_NecromancerAttackPatternInt();
case NTC_CHAR_CLASS_PALADIN:
return NTA_PaladinAttackPatternInt();
case NTC_CHAR_CLASS_BARBARIAN:
return NTA_BarbarianAttackPatternInt();
case NTC_CHAR_CLASS_DRUID:
return NTA_DruidAttackPatternInt();
case NTC_CHAR_CLASS_ASSASSIN:
return NTA_AssassinAttackPatternInt();
}
return false;
}
// Return value : 0 = Unrecoverable process, 1 = Unavailable attack, 2 = Onetime fail, 3 = Success
function NTA_Attack(target, firstorder)
{
switch(me.classid)
{
case NTC_CHAR_CLASS_AMAZON:
return NTA_AmazonAttackInt(target, firstorder);
case NTC_CHAR_CLASS_SORCERESS:
return NTA_SorceressAttackInt(target, firstorder);
case NTC_CHAR_CLASS_NECROMANCER:
return NTA_NecromancerAttackInt(target, firstorder);
case NTC_CHAR_CLASS_PALADIN:
return NTA_PaladinAttackInt(target, firstorder);
case NTC_CHAR_CLASS_BARBARIAN:
return NTA_BarbarianAttackInt(target, firstorder);
case NTC_CHAR_CLASS_DRUID:
return NTA_DruidAttackInt(target, firstorder);
case NTC_CHAR_CLASS_ASSASSIN:
return NTA_AssassinAttackInt(target, firstorder);
}
return 0;
}
// Internal function
function NTA_AmazonAttackPatternInt()
{
return false;
}
function NTA_AmazonAttackInt(target, firstorder)
{
return 1;
}
function NTA_AmazonCastSkillInt(index, target)
{
return false;
}
function NTA_SorceressAttackPatternInt()
{
var _maxindex, _maxskill;
var _avgskilllevel = new Array();
_avgskilllevel[0] = parseInt((me.GetSkill(59, false)+me.GetSkill(39, false)+me.GetSkill(45, false)+me.GetSkill(55, false))/4);
_avgskilllevel[1] = parseInt((me.GetSkill(53, false)+me.GetSkill(38, false)+me.GetSkill(48, false)+me.GetSkill(49, false))/4);
_avgskilllevel[2] = parseInt((me.GetSkill(47, false)+me.GetSkill(36, false)+me.GetSkill(56, false)+me.GetSkill(64, false))/4);
_avgskilllevel[3] = parseInt((me.GetSkill(47, false)+me.GetSkill(36, false)+me.GetSkill(56, false))/3);
_maxindex = -1;
_maxskill = 0;
for(var i = 0 ; i < _avgskilllevel.length ; i++)
{
if(_avgskilllevel[i] > _maxskill)
{
_maxindex = i;
_maxskill = _avgskilllevel[i];
}
}
switch(_maxindex)
{
case 0: // Blizzard + Glacial Spike
NTConfig_AttackSkill[1] = 59;
NTConfig_AttackSkill[2] = 45;
NTConfig_AttackSkill[3] = 59;
NTConfig_AttackSkill[4] = 45;
break;
case 1: // Chain Lightning + Lightning
NTConfig_AttackSkill[1] = 49;
NTConfig_AttackSkill[3] = 53;
break;
case 2: // Fire Ball + Frozen Orb
NTConfig_AttackSkill[0] = 64;
NTConfig_AttackSkill[1] = 47;
NTConfig_AttackSkill[3] = 47;
NTConfig_AttackSkill[5] = 64;
NTConfig_AttackSkill[6] = 55;
break;
case 3: // Fire Ball + Meteor
NTConfig_AttackSkill[1] = 56;
NTConfig_AttackSkill[2] = 47;
NTConfig_AttackSkill[3] = 56;
NTConfig_AttackSkill[4] = 47;
break;
}
return (NTConfig_AttackSkill[1] && NTConfig_AttackSkill[3]);
}
function NTA_SorceressAttackInt(target, firstorder)
{
var _primaryindex;
if(NTTMGR_CheckCurse(NTConfig_CheckSelfSafe&0x10, NTConfig_CheckMercSafe&0x10))
{
if(!NTTMGR_VisitTown())
return 0;
}
if(firstorder && NTConfig_AttackSkill[0] > 0 && NTA_GetResistance(target, _NTA_SkillDamage[0]) < 100 && me.GetSkillStatus(NTConfig_AttackSkill[0]) != 8)
{
if(!NTC_CastSkill(NTConfig_AttackSkill[0], _NTA_SkillHand[0], target))
return 2;
return 3;
}
if(NTConfig_CastStatic < 100 && parseInt(target.hp*100/target.hpmax) > NTConfig_CastStatic && NTA_GetResistance(target, NTA_DAMAGE_LIGHTNING) <= 80)
{
var _staticlevel = NTC_GetSkillLevel(42);
if(_staticlevel > 0)
{
var _staticrange;
var _castx, _casty;
_staticrange = Math.floor((5+_staticlevel-1)*2/3);
if(GetDistance(me, target) > _staticrange || !CheckCollision(me, target, 6))
{
var _pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, _staticrange, 6);
if(_pos)
NTM_MoveTo(target.areaid, _pos[0], _pos[1], 0);
}
if(target.x < me.x)
_castx = me.x - 1;
else if(target.x > me.x)
_castx = me.x + 1;
else
_castx = me.x;
if(target.y < me.y)
_casty = me.y - 1;
else if(target.y > me.y)
_casty = me.y + 1;
else
_casty = me.y;
if(!CheckCollision(target.areaid, _castx, _casty, 1))
{
_castx = me.x;
_casty = me.y;
}
if(!NTC_CastSkill(42, NTC_HAND_RIGHT, _castx, _casty))
return 2;
return 3;
}
}
_primaryindex = (target.spectype&0x0A) ? 1 : 3;
if(NTA_GetResistance(target, _NTA_SkillDamage[_primaryindex]) <= 90)
{
if(!NTA_SorceressCastSkillInt(_primaryindex, target))
return 2;
return 3;
}
if(NTConfig_AttackSkill[5] > 0 && NTA_GetResistance(target, _NTA_SkillDamage[5]) <= 80)
{
if(!NTA_SorceressCastSkillInt(5, target))
return 2;
return 3;
}
if(NTA_GetResistance(target, _NTA_SkillDamage[_primaryindex]) < 100 || (_primaryindex == 1 && NTC_GetMerc()))
{
if(!NTA_SorceressCastSkillInt(_primaryindex, target))
return 2;
return 3;
}
return 1;
}
function NTA_SorceressCastSkillInt(index, target)
{
if(me.GetSkillStatus(NTConfig_AttackSkill[index]) != 8)
{
if(GetDistance(me, target) > _NTA_SkillRange[index])
{
var _pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, _NTA_SkillRange[index], 4);
if(_pos)
NTM_MoveTo(target.areaid, _pos[0], _pos[1], 0);
}
return NTC_CastSkill(NTConfig_AttackSkill[index], _NTA_SkillHand[index], target);
}
if(NTConfig_AttackSkill[index+1] > 0)
{
if(GetDistance(me, target) > _NTA_SkillRange[index+1] || !CheckCollision(me, target, 4))
{
var _pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, _NTA_SkillRange[index+1], 4);
if(_pos)
NTM_MoveTo(target.areaid, _pos[0], _pos[1], 0);
}
return NTC_CastSkill(NTConfig_AttackSkill[index+1], _NTA_SkillHand[index+1], target);
}
for(var i = 0 ; i < 25 ; i++)
{
NTC_Delay(NTC_DELAY_FRAME);
if(me.GetSkillStatus(NTConfig_AttackSkill[index]) != 8)
break;
}
return false;
}
function NTA_NecromancerAttackPatternInt()
{
return false;
}
function NTA_NecromancerAttackInt(target, firstorder)
{
return 1;
}
function NTA_NecromancerCastSkillInt(index, target)
{
return false;
}
function NTA_PaladinAttackPatternInt()
{
var _maxindex, _maxskill;
var _avgskilllevel = new Array();
_avgskilllevel[0] = parseInt((me.GetSkill(112, false)+me.GetSkill(108, false)+me.GetSkill(115, false))/3);
_avgskilllevel[1] = parseInt((me.GetSkill(106, false)+me.GetSkill(96, false))/2);
_avgskilllevel[2] = parseInt((me.GetSkill(121, false)+me.GetSkill(101, false)+me.GetSkill(118, false))/3);
_maxindex = -1;
_maxskill = 0;
for(var i = 0 ; i < _avgskilllevel.length ; i++)
{
if(_avgskilllevel[i] > _maxskill)
{
_maxindex = i;
_maxskill = _avgskilllevel[i];
}
}
switch(_maxindex)
{
case 0: // Blessed Hammer
NTConfig_AttackSkill[1] = 112;
NTConfig_AttackSkill[2] = 113;
NTConfig_AttackSkill[3] = 112;
NTConfig_AttackSkill[4] = 113;
break;
case 1: // Zeal
NTConfig_AttackSkill[1] = 106;
NTConfig_AttackSkill[2] = 122;
NTConfig_AttackSkill[3] = 106;
NTConfig_AttackSkill[4] = 122;
break;
case 2: // Fist of the Heavens
NTConfig_AttackSkill[1] = 121;
NTConfig_AttackSkill[2] = 123;
NTConfig_AttackSkill[3] = 121;
NTConfig_AttackSkill[4] = 123;
break;
}
return (NTConfig_AttackSkill[1] && NTConfig_AttackSkill[3]);
}
function NTA_PaladinAttackInt(target, firstorder)
{
var _primaryindex;
if(NTTMGR_CheckCurse(NTConfig_CheckSelfSafe&0x10, NTConfig_CheckMercSafe&0x10))
{
if(!NTTMGR_VisitTown())
return 0;
}
if(firstorder && NTConfig_AttackSkill[0] > 0 && NTA_GetResistance(target, _NTA_SkillDamage[0]) < 100)
{
if(GetDistance(me, target) > _NTA_SkillRange[0] || !CheckCollision(me, target, 4))
{
var _pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, _NTA_SkillRange[0], 4);
if(_pos)
NTM_MoveTo(target.areaid, _pos[0], _pos[1], 0);
}
if(!NTC_CastSkill(NTConfig_AttackSkill[0], _NTA_SkillHand[0], target))
return 2;
return 3;
}
_primaryindex = (target.spectype&0x0A) ? 1 : 3;
if(NTA_GetResistance(target, _NTA_SkillDamage[_primaryindex]) < 100)
{
if(_NTA_SkillRange[_primaryindex] < 4 && !CheckCollision(target.areaid, target.x, target.y, 1))
return 1;
if(!NTA_PaladinCastSkillInt(_primaryindex, target))
return 2;
return 3;
}
if(NTConfig_AttackSkill[5] > 0 && NTA_GetResistance(target, _NTA_SkillDamage[5]) < 100)
{
if(_NTA_SkillRange[5] < 4 && !CheckCollision(target.areaid, target.x, target.y, 1))
return 1;
if(!NTA_PaladinCastSkillInt(5, target))
return 2;
return 3;
}
return 1;
}
function NTA_PaladinCastSkillInt(index, target)
{
if(NTConfig_AttackSkill[index] == 112)
{
if(me.x-target.x < 1 || me.x-target.x > 2 || me.y-target.y < 1 || me.y-target.y > 2)
{
if(CheckCollision(target.areaid, target.x+2, target.y+2, 1))
NTM_MoveTo(target.areaid, target.x+2, target.y+2, 0);
else if(me.x-target.x < -4 || me.x-target.x > 2 || me.y-target.y < 0 || me.y-target.y > 2)
NTM_MoveTo(target.areaid, target.x-4, target.y, 0);
}
}
else
{
if(GetDistance(me, target) > _NTA_SkillRange[index] || !CheckCollision(me, target, 4))
{
var _pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, _NTA_SkillRange[index], 4);
if(_pos)
NTM_MoveTo(target.areaid, _pos[0], _pos[1], 0);
}
}
if(NTConfig_AttackSkill[index+1] > 0)
NTC_PutSkill(NTConfig_AttackSkill[index+1], NTC_HAND_RIGHT);
return NTC_CastSkill(NTConfig_AttackSkill[index], _NTA_SkillHand[index], target);
}
function NTA_BarbarianAttackPatternInt()
{
var _maxindex, _maxskill;
var _avgskilllevel = new Array();
_avgskilllevel[0] = me.GetSkill(151, false);
_maxindex = -1;
_maxskill = 0;
for(var i = 0 ; i < _avgskilllevel.length ; i++)
{
if(_avgskilllevel[i] > _maxskill)
{
_maxindex = i;
_maxskill = _avgskilllevel[i];
}
}
switch(_maxindex)
{
case 0: // Whirlwind
NTConfig_AttackSkill[1] = 151;
NTConfig_AttackSkill[3] = 151;
NTConfig_AttackSkill[5] = 152;
break;
}
return (NTConfig_AttackSkill[1] && NTConfig_AttackSkill[3]);
}
function NTA_BarbarianAttackInt(target, firstorder)
{
var _primaryindex;
if(NTTMGR_CheckCurse(NTConfig_CheckSelfSafe&0x10, NTConfig_CheckMercSafe&0x10))
{
if(!NTTMGR_VisitTown())
return 0;
}
if(firstorder && NTConfig_AttackSkill[0] > 0 && NTA_GetResistance(target, _NTA_SkillDamage[0]) < 100)
{
if(GetDistance(me, target) > _NTA_SkillRange[0] || !CheckCollision(me, target, 4))
{
var _pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, _NTA_SkillRange[0], 4);
if(_pos)
NTM_MoveTo(target.areaid, _pos[0], _pos[1], 0);
}
if(!NTC_CastSkill(NTConfig_AttackSkill[0], _NTA_SkillHand[0], target))
return 2;
return 3;
}
_primaryindex = (target.spectype&0x0A) ? 1 : 3;
if(NTA_GetResistance(target, _NTA_SkillDamage[_primaryindex]) < 100)
{
if((_NTA_SkillRange[_primaryindex] < 4 || NTConfig_AttackSkill[_primaryindex] == 151) && !CheckCollision(target.areaid, target.x, target.y, 1))
return 1;
if(!NTA_BarbarianCastSkillInt(_primaryindex, target))
return 2;
return 3;
}
if(NTConfig_AttackSkill[5] > 0 && NTA_GetResistance(target, _NTA_SkillDamage[5]) < 100)
{
if((_NTA_SkillRange[5] < 4 || NTConfig_AttackSkill[5] == 151) && !CheckCollision(target.areaid, target.x, target.y, 1))
return 1;
if(!NTA_BarbarianCastSkillInt(5, target))
return 2;
return 3;
}
return 1;
}
function NTA_BarbarianCastSkillInt(index, target)
{
if(NTConfig_AttackSkill[index] == 151)
{
var _castx, _casty;
if(GetDistance(me, target) > _NTA_SkillRange[index] || !CheckCollision(me, target, 5))
{
var _pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, _NTA_SkillRange[index], 5);
if(_pos)
NTM_MoveTo(target.areaid, _pos[0], _pos[1], 0);
}
_castx = target.x > me.x ? target.x+3 : target.x-3;
_casty = target.y > me.y ? target.y+3 : target.y-3;
return NTC_CastSkill(NTConfig_AttackSkill[index], _NTA_SkillHand[index], _castx, _casty);
}
if(GetDistance(me, target) > _NTA_SkillRange[index] || !CheckCollision(me, target, 4))
{
var _pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, _NTA_SkillRange[index], 4);
if(_pos)
NTM_MoveTo(target.areaid, _pos[0], _pos[1], 0);
}
return NTC_CastSkill(NTConfig_AttackSkill[index], _NTA_SkillHand[index], target);
}
function NTA_DruidAttackPatternInt()
{
return false;
}
function NTA_DruidAttackInt(target, firstorder)
{
return 1;
}
function NTA_DruidCastSkillInt(index, target)
{
return false;
}
function NTA_AssassinAttackPatternInt()
{
return false;
}
function NTA_AssassinAttackInt(target, firstorder)
{
return 1;
}
function NTA_AssassinCastSkillInt(index, target)
{
return false;
}
Code:
function NTMain()
{
Include("libs/common/NTCommon.ntl");
NTC_IncludeLibs();
NTC_IncludeConfig("NTBot/char_configs");
var i;
var _wave;
var _starttick;
NT_LoadConfig();
NTSI_LoadNIPFiles("NTBot/item_configs");
NTA_Initialize();
if(!NTTM_CheckAct())
{
NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_CheckAct()");
return;
}
NTTMGR_TownManager();
if(!NTTM_TownMove("waypoint"))
{
NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_TownMove()");
return;
}
if(!NTM_TakeWaypoint(129))
{
NTC_SendMsgToScript("NTBotGame.ntj", "NTM_TakeWaypoint()");
return;
}
NTP_DoPrecast(true);
for(i = 0 ; i < 2 ; i++)
{
if(!NTM_MoveToStair(me.areaid, 130+i))
{
NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveToStair()");
return;
}
if(!NTM_TakeStair(130+i))
{
NTC_SendMsgToScript("NTBotGame.ntj", "NTM_TakeStair()");
return;
}
}
if(!NTM_MoveTo(me.areaid, 15118, 5073))
{
NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveTo()");
return;
}
//NTA_ClearPosition(20, true, 2);
if(NTConfig_PublicMode)
{
NTM_MoveTo(me.areaid, 15109, 5043);
NTA_ClearPosition(20, true, 2);
NTC_PingDelay(1000);
NTM_MoveTo(me.areaid, 15109, 5043);
NTM_MakeTP();
Say("TP up, Be careful! Follow me @ 200FCR");
NTC_Delay(500)
Say("Sorc's Please Static!")
}
NT_ClearThroneInt();
if(NTConfig_PublicMode)
{
//NTM_MoveTo(me.areaid, 15094, 5070, 1, true);
}
while(1)
{
if(me.classid == NTC_CHAR_CLASS_PALADIN || me.classid == NTC_CHAR_CLASS_BARBARIAN)
NTM_MoveTo(me.areaid, 15092, 5028);
else
NTM_MoveTo(me.areaid, 15096, 5050);
if(me.GetState(2))
NTC_PutSkill(109, NTC_HAND_RIGHT);
for(i = 0 ; i < 6 ; i++)
{
_wave = NT_ThroneCheckInt();
if(_wave > 0)
break;
NTC_Delay(500);
}
_starttick = GetTickCount();
while(_wave == 0)
{
if(!NT_ThronePreAttackInt())
NTC_Delay(200);
if(GetTickCount()-_starttick > 15000)
{
NT_ClearThroneInt();
_starttick = GetTickCount();
}
_wave = NT_ThroneCheckInt();
}
switch(_wave)
{
case 1:
NTA_ClearPosition(40, true, 1);
NTP_DoPrecast(true);
break;
case 3:
NTA_ClearPosition(40, true, 2);
NT_CheckHydraInt();
break;
case 4:
NTA_ClearPosition(40, true, 2);
break;
case 5:
NTA_ClearPosition(40, true);
break;
default:
NTA_ClearPosition(40, true, 1);
break;
}
if(_wave == 5)
break;
}
if(NTConfig_KillBaal)
{
var _portal;
if(NTConfig_PublicMode)
Say("Killing Baal, Follow Me @ Op 200FCR");
if(!NTTMGR_CheckSafe(NTConfig_CheckSelfSafe|0x01, NTConfig_CheckMercSafe))
{
NTC_SendMsgToScript("NTBotGame.ntj", "NTTMGR_CheckSafe()");
return;
}
NTM_MoveTo(me.areaid, 15109, 5043);
NTC_Delay(6000);
NTP_DoPrecast(true);
while(NTC_FindUnit(NTC_UNIT_MONSTER, 543))
NTC_Delay(500);
_portal = NTC_FindUnit(NTC_UNIT_OBJECT, 563, 1);
if(!_portal)
{
NTC_SendMsgToScript("NTBotGame.ntj", "NTC_FindUnit()");
return;
}
if(!NTM_UsePortal("Portal", 132, null, _portal))
{
NTC_SendMsgToScript("NTBotGame.ntj", "NTM_UsePortal()");
return;
}
NTM_MoveTo(me.areaid, 15138, 5916);
if(!NTA_KillMonster(544))
{
NTC_SendMsgToScript("NTBotGame.ntj", "NTA_KillMonster()");
return;
}
NTSI_PickItems();
}
if(NTConfig_PublicMode)
Say("Next game");
NTC_SendMsgToScript("NTBotGame.ntj", "SCRIPT_END");
}
// Internal function
function NT_ClearThroneInt()
{
var _attackpos = [15112, 5068, 15075, 5065, 15114, 5045, 15114, 5012, 15095, 5024, 15078, 5013, 15092, 5040];
for(var i = 0 ; i < _attackpos.length ; i += 2)
{
NTM_MoveTo(me.areaid, _attackpos[i], _attackpos[i+1]);
NTA_ClearPosition(25, true, 2);
}
}
function NT_ThroneCheckInt()
{
var _monster;
if(!NTC_FindUnit(NTC_UNIT_MONSTER, 543))
return 5;
_monster = NTC_FindUnit(NTC_UNIT_MONSTER);
if(_monster)
{
do
{
if(NTA_IsValidMonster(_monster))
{
if(_monster.classid == 23 || _monster.classid == 62)
return 1;
if(_monster.classid == 105 || _monster.classid == 381)
return 2;
if(_monster.classid == 557)
return 3;
if(_monster.classid == 558)
return 4;
if(_monster.classid == 571)
return 5;
}
} while(_monster.GetNext());
}
return 0;
}
function NT_ThronePreAttackInt()
{
if(me.classid == NTC_CHAR_CLASS_SORCERESS)
{
if(NTConfig_AttackSkill[3] == 56 || NTConfig_AttackSkill[3] == 59)
return NTC_CastSkill(NTConfig_AttackSkill[3], 2, 15092, 5028);
}
else if(me.classid == NTC_CHAR_CLASS_PALADIN)
{
if(NTConfig_AttackSkill[3] == 112)
{
if(NTConfig_AttackSkill[4] > 0)
NTC_PutSkill(NTConfig_AttackSkill[4], NTC_HAND_RIGHT);
return NTC_CastSkill(NTConfig_AttackSkill[3], 2);
}
}
return false;
}
function NT_CheckHydraInt()
{
var _hydra1, _hydra2, _hydra3;
_hydra1 = NTC_FindUnit(NTC_UNIT_MONSTER, 351);
_hydra2 = NTC_FindUnit(NTC_UNIT_MONSTER, 352);
_hydra3 = NTC_FindUnit(NTC_UNIT_MONSTER, 353);
if((_hydra1 && _hydra1.GetStat(172) != 2 && _hydra1.GetState(105))
|| (_hydra2 && _hydra2.GetStat(172) != 2 && _hydra2.GetState(105))
|| (_hydra3 && _hydra3.GetStat(172) != 2 && _hydra3.GetState(105)))
{
NTM_MoveTo(me.areaid, 15112, 5004);
if(me.GetState(2))
NTC_PutSkill(109, NTC_HAND_RIGHT);
NTC_PingDelay(3000);
}
}
Code:
function NTMain()
{
Include("libs/common/NTCommon.ntl");
NTC_IncludeLibs();
NTC_IncludeConfig("NTBot/char_configs");
NT_LoadConfig();
NTSI_LoadNIPFiles("NTBot/item_configs");
NTA_Initialize();
if(!NTTM_CheckAct())
{
NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_CheckAct()");
return;
}
NTTMGR_TownManager();
if(!NTTM_TownMove("waypoint"))
{
NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_TownMove()");
return;
}
if(!NTM_TakeWaypoint(107))
{
NTC_SendMsgToScript("NTBotGame.ntj", "NTM_TakeWaypoint()");
return;
}
NTP_DoPrecast(true);
if(!NTM_MoveTo(108, 7797, 5560))
{
NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveTo()");
return;
}
if(NTConfig_PublicMode)
{
var _attackpos = [7792, 5525, 7793, 5501, 7773, 5495, 7768, 5480, 7767, 5458, 7770, 5438, 7774, 5417, 7767, 5391, 7768, 5369, 7769, 5345, 7770, 5320, 7780, 5308];
if(!NTM_MoveTo(me.areaid, 7790, 5544))
{
NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveTo()");
return;
}
//NTA_ClearPosition();
NTM_MoveTo(me.areaid, 7790, 5544);
NTC_PingDelay(1000);
//NTA_ClearPosition();
NTM_MoveTo(me.areaid, 7790, 5544);
NTM_MakeTP();
Say("TP is safe!");
for(var i = 0 ; i < _attackpos.length ; i += 2)
{
NTM_MoveTo(me.areaid, _attackpos[i], _attackpos[i+1]);
//NTA_ClearPosition();
}
NTP_DoPrecast(true);
}
if(!NT_OpenSealsInt())
{
NTC_SendMsgToScript("NTBotGame.ntj", "NT_OpenSealsInt()");
return;
}
if(NTConfig_PublicMode)
Say("Killing Diablo");
NTP_DoPrecast(true);
if(!NTM_MoveTo(me.areaid, 7792, 5292))
{
NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveTo()");
return;
}
if(!NTTMGR_CheckSafe(NTConfig_CheckSelfSafe|0x01, NTConfig_CheckMercSafe))
{
NTC_SendMsgToScript("NTBotGame.ntj", "NTTMGR_CheckSafe()");
return;
}
NTC_FindUnit(NTC_UNIT_MONSTER, 243, 100);
if(!NTA_KillMonster(243))
{
NTC_SendMsgToScript("NTBotGame.ntj", "NTA_KillMonster()");
return;
}
NTSI_PickItems();
if(NTConfig_PublicMode)
Say("Next game");
NTC_SendMsgToScript("NTBotGame.ntj", "SCRIPT_END");
}
// Internal function
function NT_OpenSealsInt()
{
var i, _unit;
var _result;
_unit = GetPresetUnits(me.areaid, NTC_UNIT_OBJECT);
if(!_unit)
return false;
_result = false;
for(i = 0 ; i < _unit.length ; i++)
{
if(_unit[i].id == 396)
{
if(_unit[i].roomy*5 + _unit[i].y == 5275)
_result = NT_OpenVizierSealInt(1);
else
_result = NT_OpenVizierSealInt(2);
break;
}
}
if(!_result)
return false;
NTP_DoPrecast(false);
_result = false;
for(i = 0 ; i < _unit.length ; i++)
{
if(_unit[i].id == 394)
{
if(_unit[i].roomx*5 + _unit[i].x == 7773)
_result = NT_OpenDeSeisSealInt(1);
else
_result = NT_OpenDeSeisSealInt(2);
break;
}
}
if(!_result)
return false;
NTP_DoPrecast(false);
_result = false;
for(i = 0 ; i < _unit.length ; i++)
{
if(_unit[i].id == 392)
{
if(_unit[i].roomx*5 + _unit[i].x == 7893)
_result = NT_OpenVenomSealInt(1);
else
_result = NT_OpenVenomSealInt(2);
break;
}
}
return _result;
}
function NT_OpenVizierSealInt(type)
{
var i, n;
var _attackpos = [7740, 5300, 7740, 5280, 7720, 5280, 7720, 5300];
var _monstername = GetLocaleString(2851);
for(i = 0 ; i < _attackpos.length ; i += 2)
{
NTM_MoveTo(me.areaid, _attackpos[i], _attackpos[i+1]);
//NTA_ClearPosition();
}
for(i = 0 ; i < 3 ; i++)
{
if(type == 1)
{
NT_OpenSealInt(395, 7654, 5310);
NT_OpenSealInt(396, 7659, 5277);
NTM_MoveTo(me.areaid, 7665, 5277);
}
else
{
NT_OpenSealInt(395, 7650, 5276);
NT_OpenSealInt(396, 7651, 5310);
}
for(n = 0 ; n < 10 ; n++)
{
NTC_Delay(200);
if(NTA_KillMonster(_monstername))
{
//NTA_ClearPosition();
NTSI_PickItems();
return NTM_MoveTo(me.areaid, 7750, 5280);
}
}
}
return false;
}
function NT_OpenDeSeisSealInt(type)
{
var i, n;
var _attackpos = [7780, 5255, 7800, 5255, 7800, 5235, 7780, 5235];
var _monstername = GetLocaleString(2852);
for(i = 0 ; i < _attackpos.length ; i += 2)
{
NTM_MoveTo(me.areaid, _attackpos[i], _attackpos[i+1]);
//NTA_ClearPosition();
}
for(i = 0 ; i < 3 ; i++)
{
if(type == 1)
{
NT_OpenSealInt(394, 7769, 5158);
NTM_MoveTo(me.areaid, 7771, 5196);
}
else
{
NT_OpenSealInt(394, 7810, 5156);
NTM_MoveTo(me.areaid, 7770, 5169);
}
for(n = 0 ; n < 10 ; n++)
{
NTC_Delay(200);
if(NTA_KillMonster(_monstername))
{
//NTA_ClearPosition();
NTSI_PickItems();
return NTM_MoveTo(me.areaid, 7800, 5255);
}
}
}
return false;
}
function NT_OpenVenomSealInt(type)
{
var i, n;
var _attackpos = [7835, 5280, 7835, 5300, 7855, 5300, 7855, 5280];
var _monstername = GetLocaleString(2853);
for(i = 0 ; i < _attackpos.length ; i += 2)
{
NTM_MoveTo(me.areaid, _attackpos[i], _attackpos[i+1]);
//NTA_ClearPosition();
}
for(i = 0 ; i < 3 ; i++)
{
if(type == 1)
{
NT_OpenSealInt(393, 7915, 5280);
NT_OpenSealInt(392, 7895, 5318);
NTM_MoveTo(me.areaid, 7892, 5298);
}
else
{
NT_OpenSealInt(393, 7905, 5277);
NT_OpenSealInt(392, 7916, 5310);
NTM_MoveTo(me.areaid, 7937, 5305);
}
for(n = 0 ; n < 10 ; n++)
{
NTC_Delay(200);
if(NTA_KillMonster(_monstername))
{
NTSI_PickItems();
if(NTC_PutSkill(124, NTC_HAND_RIGHT))
NTC_PingDelay(1000);
return true;
}
}
}
return false;
}
function NT_OpenSealInt(classid, x, y)
{
var _seal;
NTM_MoveTo(me.areaid, x, y);
//NTA_ClearPosition();
_seal = NTC_FindUnit(NTC_UNIT_OBJECT, classid, 5);
if(!_seal)
return false;
if(_seal.mode > 0)
return true;
for(var i = 0 ; i < 4 ; i++)
{
if((i % 2) == 0)
{
if(GetDistance(me, _seal) > 2)
NTM_MoveTo(_seal.areaid, _seal.x+1, _seal.y);
NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _seal);
}
NTC_Delay(500);
if(_seal.mode > 0)
return true;
}
return false;
}
Code:
Quote:
var gameMinLength = 90000; // 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 = 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 = 100; // time in milliseconds to wait between making games
var createGameThresholdRandom = 100; // time in milliseconds to randomly add +/- to the game create time
var createGameTimeout = 10; // 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 = 0; // how long to wait when a Game Does Not Exist occurs - minimum - default 10 minutes
var gameDoesNotExistDelayMax = 0; // how long to wait when a Game Does Not Exist occurs - maximum - default 15 minutes
var gameDoesNotExistTimeout = 0; // how long to wait for the dialog to disappear (default 30 seconds, don't change this)
var joinChatAfterGame = true; // join chat after leaving a game
var joinRandomChannel = false; // if this is true, will join a random channel, otherwise it will use the channel below..
var joinChannelInChat = "op imr-mule2"; // leave blank to not join a private channel
var waitBeforeEnterChatMin = 1000; // min how long to wait before entering chat
var waitBeforeEnterChatMax = 3000; // max how long to wait before entering chat
var waitInChatBeforeActionsMin = 1000; // min how long to wait before joining channel
var waitInChatBeforeActionsMax = 1000; // max how long to wait before joining channel
var JoinFromChat = true;
var leaderAccountName ="hsr1";
var check = 1;
// 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 lastGameMade = GetTickCount();
var lastGameStatus = 0;
var nextGameMake = 0;
var inGameAt = 0;
var chatActionsDone = false;
var lastGameFailed = false;
Include("libs/controlInfo.ntl");
//Include("joinBotSettings.ntl");
var controlData = new controlInfo();
var game = 'imr-baal-';
function NTMain()
{
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(!_ingame)
{
if(Load("NTBot/NTBotGame.ntj"))
{
_ingame = true;
if(me.playtype > 0)
sendEventToOOG(D2NT_MGR_INGAME, "In Game[IP:" + me.gameserverip.split(".")[3] + "]", 0);
else
sendEventToOOG(D2NT_MGR_INGAME, "In Game", 0);
lastGameStatus = 2; // in game successful
}
}
Delay(1000);
}
else
{
if(_ingame)
{
_ingame = false;
sendEventToOOG(D2NT_MGR_READY, "", 0);
}
locationAction(controlData.getLocation());
Delay(500);
}
}
}
function locationAction(location)
{
switch(location.id)
{
case 3: // Lobby Chat
if(!chatActionsDone)
{
chatActionsDone = true;
Delay(Random(waitInChatBeforeActionsMin, waitInChatBeforeActionsMax));
if(joinRandomChannel || joinChannelInChat != "")
{
Say("/join " + (joinRandomChannel ? getRandomString(Random(3,10)) : joinChannelInChat));
Delay(1000);
}
}
if(JoinFromChat){
if(check == 1)
{
sendEventToOOG(D2NT_MGR_CREATE_GAME, location.name, 0);
outputGameLength();
lastGameStatus = 0;
setNextGameMake();
sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
check = check + 1;
}
game = '';
if (joinChannelInChat)
Delay (1000);
//Say('Locating the leader : '+leaderAccountName);
Say('/f l');
Delay(1000);
if(chat = controlData.get(controlData.controls.lobby.chat.textBox.channelText))
{
var errors = '';
var found_leader = false;
lines = chat.GetText();
for (var friend = 0; friend < lines.length; friend++)
{
if (lines[friend].lastIndexOf(': '+leaderAccountName+',') > -1)
{
game = '';
found_leader = true;
var regOfflineEnglish=/^\d\s?:\s?(\w*)\s?,\s?offline\s*$/gi;
var regGameNameEnglish=/^\s*(the\s)?(game\s)?([\w\s-]*\w)\s\(private\)\.\s*$/gi;
var regGameNameFrench=/^\s*(la\s)?(partie\s)?([\w\s-]*\w)\s\(priv[^\)]*\)\.\s*$/gi;
if (lines[friend].match(regOfflineEnglish))
{
errors += (errors == '' ? '' : ' ') + 'leader is offline';
}
if (lines[friend + 1].match(regGameNameEnglish) && lines[friend+1].substr(1, 1) != ':')
{
game = lines[friend + 1].replace(regGameNameEnglish, "$3");
}
if (!game && lines[friend + 1].match(regGameNameFrench) && lines[friend+1].substr(1, 1) != ':')
{
game = lines[friend + 1].replace(regGameNameFrench, "$3");
}
if (game != '' && game != samegame && 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, gamepassword);
Delay (200);
controlData.click(controlData.controls.lobby.join.button.joinGame);
check = 1;
}
else
{
if(!errors)
{
errors = 'leader is not in game.';
}
}
}
}
if (!found_leader && joinChannelInChat)
{
if (errors)
Say('Errors : ' + errors);
else
Say('I couldn\'t find the leader in my friend list.');
Delay(1500);
}
}
else
{
if (joinChannelInChat)
Say('I can\'t read the chat!');
}
}
errors = '';
if(game != '')
samegame = game;
break;
case 1: // Lobby
if(location.id == 1 && joinChatAfterGame)
{
Delay(Random(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(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);
break;
case 2: // Waiting In Line
if(GetTickCount()-lastGameMade > waitInLineTimeout)
controlData.click(controlData.controls.lobby.inLine.button.cancel);
break;
case 4: // Create Game
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);
}
sendEventToOOG(D2NT_MGR_CREATE_GAME, location.name, 0);
RunGC(); // run garbage collector between each game
locationTimeout(5000, location);
lastGameMade = GetTickCount();
lastGameStatus = 1; // pending creation
break;
case 5: // Join Game
if(!controlData.get(controlData.controls.lobby.join.editBox.gameName))
{
controlData.click(controlData.controls.lobby.button.create);
Delay (1000);
controlData.click(controlData.controls.lobby.button.join);
Delay (1000);
}
if (game != '')
{
controlData.setText( controlData.controls.lobby.join.editBox.gameName, game);
Delay (100);
//controlData.setText( controlData.controls.lobby.join.editBox.password, gamepassword);
//Delay (100);
controlData.click(controlData.controls.lobby.join.button.joinGame);
}
check = 1;
lastGameStatus = 1; // pending creation
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, me.account);
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;
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;
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
RunGC(); // run garbage collector between each game
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, "Game already exists", 0);
//inGameAt = 0;
//lastGameStatus = 0;
//setNextGameMake();
this.controls.lobby.button.quit
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
Delay(160000); // 40 seconds longer then leader's min game time, edit yourself
controlData.click(controlData.controls.lobby.button.quit)
Delay(1000);
controlData.click(controlData.controls.characterSelect.textBox.characters[me.charloc], 0, 0, 1);
controlData.click(controlData.controls.characterSelect.textBox.characterInfo[me.charloc], 0, 0, 1)
check = 1;
oldgame = game;
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;
}
MFG
matze






