Originally Posted by mirkoregge
Hast du denn den neuen EntryPoint und das Script selber kopiert?
D2oDJoiner.ntj - EntryPoint (liegt im Ordner Scripts)
Code:
// =============================================================================
// Leader Account settings
// =============================================================================
var leaderAccountName = "kolc-1";
var leaderName = "kblizz";
// =============================================================================
// Game password (leave blank if none)
// =============================================================================
var gamepassword = "as";
// =============================================================================
// UseCDKeyChangeTrick :
// if true, the follow bot will say his gamename/gamepwd (set in the OOG) in chat before each game
// in order to increment his number of runs (to switch CDKeys after xx runs)
// if false, the follow bot will never change his CDKey
// =============================================================================
var UseCDKeyChangeTrick = false;
// =============================================================================
// Debug : set to true if you are experiencing problems with your JoinBot
// it will log in your OOG the lobby chat actions
// =============================================================================
var Debug = false;
////////////////////////////////////////////////////////////////////////////////
// Lobby chat settings :
////////////////////////////////////////////////////////////////////////////////
// Set to true to join the chat after each game (needed for JoinBot)
var joinChatAfterGame = true;
// Message said when you first enter the chat
var firstJoinMessage = "";
// Message said after each game
var chatMessageAfterGame = "";
// if this is true, will join a random channel, otherwise it will use the channel below..
var joinRandomChannel = false;
// Name of the channel you want to join (leave blank if you want to stay in the default channel)
var joinChannelInChat = "op gotv";
////////////////////////////////////////////////////////////////////////////////
// Delays:
////////////////////////////////////////////////////////////////////////////////
// Minimum game length, waits in the lobby if last game was too short
// I recommend to keep a value > 300000 (milliseconds) to avoid bnet temporary ban
var gameMinLength = 180000;
// realm delays (minutes)
var unableToConnectRetry = 5;
var realmDownRetry = 120;
var disconnectedRetry = 5;
var cdkeyInUseRetry = 5;
// interface delays (milliseconds)
var connectingToBnetTimeout = 20000;
var characterScreenTimeout = 10000;
var pleaseWaitTimeout = 10000;
var createGameThreshold = 10000;
var createGameThresholdRandom = 1000;
var createGameTimeout = 15000;
var waitInLineTimeout = 15000;
var characterSelectDelay = 1000;
var loginDelay = 1000;
var clickDelay = 500;
var textDelay = 500;
var clickDelayRandom = 500;
var textDelayRandom = 500;
var gameDoesNotExistDelayMin = 600000;
var gameDoesNotExistDelayMax = 900000;
var gameDoesNotExistTimeout = 30000;
var waitBeforeEnterChatMin = 1000;
var waitBeforeEnterChatMax = 2000;
var waitInChatBeforeActionsMin = 2000;
var waitInChatBeforeActionsMax = 3000;
// Only for JoinBot (friend list delay, milliseconds)
var LeaderOfflineDelay = 30000;
var LeaderInChatDelay = 10000;
var GameIsFullDelay = 30000;
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// DO NOT 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;
var sayChatMsgAfterGame = false;
Include("libs/controlInfo.ntl");
var controlData = new controlInfo();
var game = '';
var _gamename = "";
var _gamepassword = "";
var _leaderOfflineTick = -LeaderOfflineDelay;
var _leaderInChatTick = -LeaderInChatDelay;
var _GameIsFullTick = -GameIsFullDelay;
function NTMain()
{
Delay(1000);
var _ingame = false;
controlData.clickDelay = clickDelay;
controlData.textDelay = textDelay;
controlData.clickDelayRandom = clickDelayRandom;
controlData.textDelayRandom = textDelayRandom;
while(1)
{
if(me.ingame)
{
_gamename = me.gamename;
_gamepassword = me.gamepassword;
if(!inGameAt)
inGameAt = GetTickCount();
if(!_ingame)
{
RunGC(); // run garbage collector between each game
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
// To exit game as soon as the leader quits
//Load("NTBot/NTCheckLeader.ntj");
// to party only the leader
//Load("NTBot/tools/NTTools_AutoPartyJoinFriendGames.ntj");
}
}
Delay(1000);
}
else
{
if(_ingame)
{
_ingame = false;
sayChatMsgAfterGame = true;
sendEventToOOG(D2NT_MGR_READY, "", 0);
}
locationAction(controlData.getLocation());
Delay(500);
}
}
}
function locationAction(location)
{
switch(location.id)
{
case 3: // Lobby Chat
sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
if(!chatActionsDone)
{
Delay(Random(waitInChatBeforeActionsMin, waitInChatBeforeActionsMax));
if(joinRandomChannel || joinChannelInChat != "")
{
Say("/join " + (joinRandomChannel ? getRandomString(Random(3,10)) : joinChannelInChat));
Delay(1000);
}
if(firstJoinMessage)
{
Say(firstJoinMessage);
Delay(200);
}
chatActionsDone = true;
}
if (chatMessageAfterGame && _gamename != "" && sayChatMsgAfterGame == true)
{
Say(chatMessageAfterGame);
sayChatMsgAfterGame = false;
Delay(200);
}
game = '';
var _tick = GetTickCount();
if ((_leaderOfflineTick < 0 || (_leaderOfflineTick + LeaderOfflineDelay) < _tick)
&& (_leaderInChatTick < 0 || (_leaderInChatTick + LeaderInChatDelay) < _tick)
&& (_GameIsFullTick < 0 || (_GameIsFullTick + GameIsFullDelay) < _tick))
{
DebugInOOG('Locating the leader : '+leaderAccountName);
Say('/f l');
Delay(2500);
}
if(chat = controlData.get(controlData.controls.lobby.chat.textBox.channelText))
{
var found_leader = false;
lines = chat.GetText();
for (var line_id = lines.length - 1; line_id > -1; line_id--)
{
if (found_leader) // useless... :/
break;
if (lines[line_id].substring(0,1) == " ")
continue;
// retrieving the whole message
var msg = lines[line_id].replace(/^\s+|\s+$/, "");
var msglines = 1;
while (lines[line_id+msglines] != undefined && lines[line_id+msglines].substring(0,2) == " ")
{
msg += " " + lines[line_id+msglines].replace(/^\s+|\s+$/, "");
msglines++;
}
if (msg.lastIndexOf(leaderName) >= 0)
DebugInOOG("ÿc8found him :;"+msg);
// checking if the msg is a friendly whisper
if (msg.lastIndexOf(leaderName + ' (*' +leaderAccountName+')') > -1)
{
var regGameNameWhispered=/^.*(game|partie|spiel|partita|partida).*(nomm[^\s]*|called|chiamata)\s*([\w\s-]*\w)\s*\.\s*$/gi;
if (msg.match(regGameNameWhispered))
game = msg.replace(regGameNameWhispered, "$3");
if (game != '')
{
found_leader = true;
break;
}
}
// checking if the msg is from the friend list
if (msg.lastIndexOf(': '+leaderAccountName+',') > -1)
{
found_leader = true;
var regOffline=/^.*(offline|desconectado).*$/gi;
var regInChat=/^.*(channel|canale?)\s*([\w\s-]*\w)\.?\s*$/gi;
var regGameName=/^.*(game|partie|spiel|partita|partida)\s*([\w\s-]*\w)\s*\(priv[^\)]*\)\.\s*$/gi;
if (msg.match(regOffline)
&& (_leaderOfflineTick < 0 || (_leaderOfflineTick + LeaderOfflineDelay) < _tick))
{
DebugInOOG('Leader is offline, delay '+Math.round(LeaderOfflineDelay/1000)+' sec for next /f l.');
_leaderOfflineTick = GetTickCount();
}
else if (msg.match(regInChat)
&& (_leaderInChatTick < 0 || (_leaderInChatTick + LeaderInChatDelay) < _tick))
{
DebugInOOG('Leader is in the chat "'+msg.replace(regInChat, "$2")+'", delay '+Math.round(LeaderInChatDelay/1000)+' sec for next /f l.');
_leaderInChatTick = GetTickCount();
}
else if (msg.match(regGameName)
&& ((_leaderOfflineTick < 0 || (_leaderOfflineTick + LeaderOfflineDelay) < _tick)
&& (_leaderInChatTick < 0 || (_leaderInChatTick + LeaderInChatDelay) < _tick)))
{
game = msg.replace(regGameName, "$2");
}
else if ((_leaderInChatTick < 0 || (_leaderInChatTick + LeaderInChatDelay) < _tick)
&& (_leaderOfflineTick < 0 || (_leaderOfflineTick + LeaderOfflineDelay) < _tick))
{
// unhandled line, supposelly "In Realm"
DebugInOOG('The leader was in the the lobby but not in chat, delay '+Math.round(LeaderInChatDelay/1000)+' sec for next /f l.');
_leaderInChatTick = GetTickCount();
}
break;
}
}
if (found_leader == false)
DebugInOOG('I couldn\'t find the leader in my friend list!');
if (game!="")
{
if (UseCDKeyChangeTrick)
{
// increasing the number of runs in the OOG (for CDKey switch)
// Problem : the gamename/gamepassword set in your OOG will be typed in the lobbyChat
// this may output a red message in the lobby chat if you have a password set (not a real problem)
// I recommend to set a gamename like "Run" and no gamepassword in your OOG. -> this will output "Run-01", "Run-02", etc in lobby chat before joining games
sendEventToOOG(D2NT_MGR_CREATE_GAME, location.name, 0);
Delay(1000);
}
DebugInOOG('Leader is in the game "' + game + '"');
controlData.click(controlData.controls.lobby.button.join);
Delay(100);
}
}
else
{
DebugInOOG('I can\'t read the chat!');
//DebugInOOG('You probably haven\'t added the lobby chat controlinfo coordinates!');
Delay(30000);
}
break;
case 1: // Lobby
if(location.id == 1 && joinChatAfterGame)
{
Delay(Random(waitBeforeEnterChatMin, waitBeforeEnterChatMax));
controlData.click(controlData.controls.lobby.button.enterChat);
break;
}
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);
break;
}
sendEventToOOG(D2NT_MGR_CREATE_GAME, location.name, 0);
locationTimeout(5000, location);
lastGameMade = GetTickCount();
lastGameStatus = 1; // pending creation
break;
case 5: // Join Game
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);
RunGC(); // run garbage collector between each game
locationTimeout(5000, location);
lastGameStatus = 1; // pending join
}
else
{
DebugInOOG('No game to join : cancelling');
me.Cancel(1);
Delay(1000);
}
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
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, "ÿE00000Game already exists", 0);
inGameAt = 0;
lastGameStatus = 0;
setNextGameMake();
locationTimeout(15000, location);
break;
case 27: // Gateway Select
controlData.clickRealmEntry(me.gatewayid);
controlData.click(controlData.controls.gateway.button.ok);
break;
case 28: // Lobby - Game Does Not Exist
inGameAt = Random(gameDoesNotExistDelayMin, gameDoesNotExistDelayMax);
lastGameStatus = 0;
setNextGameMake();
locationTimeout(gameDoesNotExistTimeout, location);
break;
default:
DebugInOOG("Unhandled location : "+location.id);
break;
}
DebugInOOG("Location : "+location.id);
}
function sendEventToOOG(locationId, statusString, pendingTime)
{
return SendCopyData("D2NT Manager", null, (locationId<<16)|pendingTime, statusString);
}
function setNextGameMake()
{
lastGameMade = GetTickCount();
nextGameMake = lastGameMade + createGameThreshold + Random(0-createGameThresholdRandom, createGameThresholdRandom) + inGameAt;
inGameAt = 0;
chatActionsDone = false;
}
function outputGameLength()
{
if(inGameAt)
{
duration = GetTickCount() - inGameAt;
inGameAt = (duration < gameMinLength ? gameMinLength - duration : 0);
}
}
function locationTimeout(time, location)
{
endtime = GetTickCount() + time;
while(controlData.getLocation().id == location.id && endtime > GetTickCount())
{
sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name + " (" + parseInt((endtime-GetTickCount())/1000) + "s)", 0);
Delay(500);
}
return (controlData.getLocation().id != location.id);
}
function timeoutDelay(time, location)
{
endtime = GetTickCount() + time;
while(endtime > GetTickCount())
{
sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name + " (" + parseInt((endtime-GetTickCount())/1000) + "s)", 0);
Delay(1000);
}
}
function getRandomString(_length)
{
_retString = "";
_charSet = "0123456789abcdefghijklmnopqrstuvwxyz";
while(_length--)
{
_retString += _charSet.charAt(Random(0, _charSet.length-1));
Delay(1);
}
return _retString;
}
function DebugInOOG(logString)
{
if (Debug)
return SendCopyData("D2NT Manager", null, 9<<16, "-- Debug : " + logString);
else
return false;
}
Follower.ntj - Followscript (liegt im Ordner NTBot/bots)
Code:
var _leaderName = "charname", // ~~~~EDIT THIS~~~~CaSe SeNsItIvE~~~~
_attack = true, // ~~~~EDIT THIS~~~~true OR false~~~~
_messages = true; // white 'Say' messages
_openContainers = false; // open chests/racks/barrels/stashes/etc. Won't work in parts of some areas where collission map fails, mainly jail levels
/*
* Follower by kolton
* To initiate the follow sequence make a TP and send command "1".
*
* Commands:
* Main commands:
* 1 - take leader's tp from town / move to leader's town
* 2 - take leader's tp to town
* 3 - town manager
* c - get corpse
* p - pick items
* s - toggle stop
* <charname> s - toggle stop <charname>
* Attack:
* a - attack toggle for all
* <charname> a - attack toggle for <charname>
* aon - attack on for all
* <charname> aon - attack on for <charname>
* aoff - attack off for all
* <charname> aoff - attack off for <charname>
* Teleport: *** characters without teleport skill will ignore tele command ***
* tele - toggle teleport for all
* <charname> tele - toggle teleport for <charname>
* tele on - teleport on for all
* <charname> tele on - teleport on for <charname>
* tele off - teleport off for all
* <charname> tele off - teleport off for <charname>
* Skills: *** refer to skills.txt ***
* all skill <skillid> - change skill for all. refer to skills.txt
* <charname> skill <skillid> - change skill for <charname>
* <class> skill <skillid> - change skill for all characters of certain class *** any part of class name will do *** for example: "sorc skill 36", "zon skill 0", "din skill 106"
* Auras: *** refer to skills.txt ***
* all aura <skillid> - change aura for all paladins
* <charname> aura <skillid> - change aura for <charname>
* Town:
* a2-5 - move to appropriate act (after quest) !NOTE: Disable 'no sound' or game will crash!
* talk <npc name> - talk to a npc in town
* Misc.
* cow - enter red cow portal
* wp - all players activate a nearby wp
* <charname> wp - <charname> activates a nearby wp
* bo - barbarian precast
* <charname> tp - make a TP. Needs a TP tome if not using custom libs.
* scatter - move in a random direction (use if you're stuck by followers)
* reload - reload script. Use only in case of emergency, or after editing character config.
* quit - exit game
*/
var i, _leader, _leaderUnit, _split, _sender, _msg, _piece, _skill, _msgtick, _result, _charClass, _busy, _unit,
_stop = false;
function NTMain() {
Include("libs/common/NTCommon.ntl");
NTC_IncludeLibs();
NTC_IncludeConfig("NTBot/char_configs");
NT_LoadConfig();
NTSI_LoadNIPFiles("NTBot/item_configs");
NTA_Initialize();
RegisterEvent(EVENT_GAMEMSG,
function (msg, type) {
if (type === 0 && msg.indexOf(_leaderName) > -1) {
if (_busy) {
Say("/w " + _leaderName + " I'm busy!");
return;
}
_busy = true;
_split = msg.split(":");
if (_split.length >= 1 && _split[1] != undefined) {
_sender = _split[0].substring(3, _split[0].length - 3);
_msg = _split[1].substring(1);
if (_sender === _leaderName) {
switch (_msg) {
case "cow":
if (me.areaid === 1) {
NTTM_TownMove("portalspot");
if (NTM_UsePortal("Portal", 39)) {
Say("/w " + _leaderName + " Took cow portal.");
} else {
Say("/w " + _leaderName + " Failed to take cow portal.");
}
}
break;
case "scatter":
NTM_MoveTo(me.areaid, me.x + Random(-8, 8), me.y + Random(-8, 8));
break;
case "wp":
case (me.name + " wp"):
if (NTC_InTown()) {
break;
}
NTC_Delay(Math.floor(Math.random() * 12) * 500);
_unit = NTC_FindUnit(2, GetLocaleString(22526));
if (_unit) {
for (i = 0; i < 20; i += 1) {
if (i % 5 === 0) {
if (NTM_GetCloserInt(_unit)) {
NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _unit);
}
}
if (i % 5 === 4) {
NTM_MoveTo(_unit.areaid, _unit.x - 6, _unit.y - 6);
}
NTC_Delay(400);
if (GetUIState(0x14)) {
NTC_Delay(500);
Say("/w " + _leaderName + " Got the WP.");
break;
}
}
}
if (!GetUIState(0x14)) {
Say("/w " + _leaderName + " Failed to get the WP.");
}
me.Cancel(1);
break;
case "tele":
case (me.name + " tele"):
if (NTC_GetSkillLevel(54)) {
if (!NTConfig_Teleport) {
NTConfig_Teleport = true;
Say("/w " + _leaderName + " Teleport on");
} else {
NTConfig_Teleport = false;
Say("/w " + _leaderName + " Teleport off");
}
}
break;
case "tele off":
case (me.name + " tele off"):
if (NTC_GetSkillLevel(54)) {
NTConfig_Teleport = true;
Say("/w " + _leaderName + " Teleport on");
}
break;
case "tele on":
case (me.name + " tele on"):
if (NTC_GetSkillLevel(54)) {
NTConfig_Teleport = true;
Say("/w " + _leaderName + " Teleport off");
}
break;
case "a": // attack toggle for everyone
case (me.name + " a"): // individual attack toggle
if (_attack) {
_attack = false;
Say("/w " + _leaderName + " Attack off");
} else {
_attack = true;
Say("/w " + _leaderName + " Attack on");
}
break;
case "aoff": // attack off for everyone
case (me.name + " aoff"): // individual attack off
Delay(150);
_attack = false;
Say("/w " + _leaderName + " Attack off");
break;
case "aon": // attack on for everyone
case (me.name + " aon"): // individual attack off
Delay(150);
_attack = true;
Say("/w " + _leaderName + " Attack on");
break;
case "c": // get corpse
NTT_GetCorpses();
break;
case "p": // pick items
Say("/w " + _leaderName + " Picking items.");
NTSI_PickItems();
if (_openContainers) {
OpenContainers(20);
}
break;
case "1": // take leader's tp to outside of town / change act if leader is in another town
if (NTC_InTown() && NTC_InTown(_leader) && CheckLeaderAct(_leader) !== me.act) {
Say("/w " + _leaderName + " Going to leader's town.");
NTTM_CheckAct(CheckLeaderAct(_leader));
NTTM_TownMove("portalspot");
} else if (NTC_InTown()) {
Say("/w " + _leaderName + " Taking portal to outside.");
NTTM_CheckAct(CheckLeaderAct(_leader));
NTTM_TownMove("portalspot");
NTM_UsePortal(null, null, _leaderName);
_busy = false;
while (!GetLeaderUnit(_leaderName)) {
ClearPosition(10);
NTC_Delay(200);
}
}
break;
case "2": // take leader's tp to town
if (!NTC_InTown()) {
Delay(150);
Say("/w " + _leaderName + " Going to town.");
NTM_UsePortal(null, null, _leaderName);
}
break;
case "3": // town manager
if (NTC_InTown()) {
Say("/w " + _leaderName + " Running town manager.");
NTTMGR_TownManager();
NTTM_TownMove("portalspot");
Say("/w " + _leaderName + " Ready.");
}
break;
case "quit": // exit game
Say("/w " + _leaderName + " Good riddance.");
Delay(500);
ExitGame();
break;
case "bo": // barbarian precast
if (me.classid === 4) {
NTP_DoPrecast(true);
}
break;
case "a2": // change act
case "a3":
case "a4":
case "a5":
ChangeAct(parseInt(_msg[1], 10));
break;
case "s": // stop toggle
case (me.name + " s"): // individual stop toggle
if (_stop) {
_stop = false;
Say("/w " + _leaderName + " resuming");
} else {
_stop = true;
Say("/w " + _leaderName + " stopping");
}
break;
case (me.name + " tp"):
if (NTC_InTown()) {
FL_Say("I'm in town.");
break;
}
if (!NTM_MakeTP()) {
FL_Say("Out of scrolls!");
}
break;
}
}
if (_msg.indexOf("talk") > -1) {
Talk(_msg.split(" ")[1]);
}
if (_msg.indexOf(" skill ") > -1) {
_piece = _msg.split(" ")[0];
if (_charClass.indexOf(_piece) > -1 || _piece === me.name || _piece === "all") {
_skill = parseInt(_msg.split(" ")[2], 10);
if (NTC_GetSkillLevel(_skill)) {
Say("/w " + _leaderName + " Attack skill is " + _skill);
NTConfig_AttackSkill[1] = _skill;
NTConfig_AttackSkill[3] = _skill;
NTA_Initialize();
} else {
Say("/w " + _leaderName + " I don't have that skill.");
}
}
}
if (me.classid === 3 && _msg.indexOf(" aura ")) {
_piece = _msg.split(" ")[0];
if (_piece === me.name || _piece === "all") {
_skill = parseInt(_msg.split(" ")[2], 10);
if (NTC_GetSkillLevel(_skill)) {
Say("/w " + _leaderName + " Active aura is " + _skill);
NTC_PutSkill(_skill, 0);
NTConfig_AttackSkill[2] = _skill;
NTConfig_AttackSkill[4] = _skill;
NTA_Initialize();
} else {
Say("/w " + _leaderName + " I don't have that aura.");
}
}
}
}
_busy = false;
} else if (type === 4 && msg.indexOf(_leaderName) > -1 && (msg.indexOf("weaken") > -1 || msg.indexOf("timeout") > -1)) {
Delay(500);
ExitGame();
}
}
);
/*if (NTC_InTown()) {
NTTMGR_TownManager();
}*/
switch (me.classid) {
case 0:
_charClass = "amazon";
break;
case 1:
_charClass = "sorceress";
break;
case 2:
_charClass = "necromancer";
break;
case 3:
_charClass = "paladin";
break;
case 4:
_charClass = "barbarian";
break;
case 5:
_charClass = "druid";
break;
case 6:
_charClass = "assassin";
break;
}
for (i = 0; i < 20; i += 1) {
_leader = GetLeader(_leaderName);
if (_leader) {
break;
}
Delay(500);
}
if (!_leader) {
FL_Say("Leader not found or improperly configured file.");
NTC_Delay(1000);
ExitGame();
} else {
FL_Say("Leader found.");
}
NTC_PingDelay(200);
while (!NTC_InMyParty(_leaderName)) {
NTC_Delay(500);
}
Say("/w " + _leaderName + " Partied.");
NTTM_TownMove("portalspot");
while (NTC_InTown()) {
NTC_Delay(250);
}
Say("/w " + _leaderName + " Initiate loop.");
_leaderUnit = GetLeaderUnit(_leaderName);
_msgtick = GetTickCount();
while (NTC_InMyParty(_leaderName)) { // main loop
if (me.mode === 0 || me.mode === 17) {
Say("/w " + _leaderName + " Reviving...");
me.Cancel(0);
me.Cancel(1);
Delay(1000);
if (NTTM_TownMove("portalspot")) {
Say("/w " + _leaderName + " I'M ALIVE!!!");
}
}
while (!_leaderUnit) {
if (GetTickCount() - _msgtick > 3000) {
FL_Say("Leader unit not found!");
_msgtick = GetTickCount();
}
_leaderUnit = GetLeaderUnit(_leaderName);
Delay(500);
}
while (_stop) {
NTC_Delay(200);
}
if (GetDistance(me, _leaderUnit) <= 50) {
NTM_GetCloserInt(_leaderUnit);
}
if (_attack) {
ClearPosition(20);
}
if (!NTC_InTown() && me.classid === 3 && NTConfig_AttackSkill[2] > 0) { // paladin aura
NTC_PutSkill(NTConfig_AttackSkill[2], 0);
}
if (_leader.areaid !== me.areaid && !NTC_InTown()) {
while (_leader.areaid === 0) {
Delay(100);
}
_result = CheckExit(_leader, _leader.areaid);
if (_result) {
switch (_result) {
case 1:
FL_Say("Taking stairs.");
Delay(500);
NTM_TakeStair(_leader.areaid);
break;
case 2:
FL_Say("Using portal.");
Delay(500);
NTM_UsePortal(null, _leader.areaid, null);
break;
case 3:
FL_Say("Taking waypoint.");
Delay(500);
NTM_TakeWaypoint(_leader.areaid);
break;
case 4:
FL_Say("Special transit.");
break;
}
while (me.areaid === 0) {
Delay(100);
}
_leaderUnit = GetLeaderUnit(_leaderName);
}
}
if (NTC_InTown()) {
NTTM_TownMove("portalspot");
while (NTC_InTown()) {
NTC_Delay(250);
}
}
NTC_Delay(25);
}
NTC_SendMsgToScript("NTBotGame.ntj", "SCRIPT_END");
}
//===============================================================================================================
function GetLeaderUnit(name) {
var _unit = NTC_FindUnit(NTC_UNIT_PLAYER);
if (_unit) {
do {
if (_unit.name === name) {
return _unit;
}
} while (_unit.GetNext());
}
return false;
}
function GetLeader(name) {
_party = GetPlayerUnit();
if (_party) {
do {
if (_party.name === name) {
return _party;
}
} while (_party.GetNext());
}
return false;
}
function CheckLeaderAct(leader) {
if (leader.areaid <= 39) {
return 1;
} else if(leader.areaid >= 40 && leader.areaid <= 74) {
return 2;
} else if(leader.areaid >= 75 && leader.areaid <= 102) {
return 3;
} else if(leader.areaid >= 103 && leader.areaid <= 108) {
return 4;
}
return 5;
}
function CheckExit(leader, area) {
var _unit = GetPresetUnits(me.areaid, NTC_UNIT_TILE);
if (_unit) {
for (var i = 0; i < _unit.length; i += 1) {
if (_unit[i].subareaid === area) {
return 1;
}
}
}
_unit = NTC_FindUnit(NTC_UNIT_OBJECT, GetLocaleString(3226));
if (_unit) {
do {
if (_unit.subareaid === area || _unit.subareaid === area + 256 || _unit.subareaid === area + 768) {
return 2;
}
} while (_unit.GetNext());
}
if (NTC_InTown(leader)) {
_unit = NTM_GetWaypointInt();
if (_unit) {
return 3;
}
}
if((me.areaid === 74 && area === 54 || me.areaid === 54 && area === 74)) { // arcane portal
NTM_TakeUnit(NTC_UNIT_OBJECT, 298);
return 4;
}
if (me.areaid >= 66 && me.areaid <= 72 && area === 73) { // duriel's wall
NTM_TakeUnit(NTC_UNIT_OBJECT, 100);
return 4;
}
/*if (me.areaid === 92 && area === 93) { // kurast sewers
???
}*/
if (me.areaid === 131 && area === 132) { // throne of destruction
NTM_TakeUnit(NTC_UNIT_OBJECT, 563);
return 4;
}
return 0;
}
function FL_Say(msg) {
if (_messages) {
Say(msg);
}
return true;
}
function QuestInteract(npc) {
var i;
NTM_GetCloserInt(npc);
for (i = 0; i < 20; i += 1) {
if (i % 10 === 0) {
NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, npc);
}
if (i % 10 === 9) {
while (!GetUIState(0x09)) {
me.Cancel(0);
NTC_Delay(100);
}
me.Cancel(1);
break;
}
NTC_Delay(200);
}
}
function Talk(name) {
if (!NTC_InTown()) {
Say("/w " + _leaderName + " I'm not in town!");
return false;
}
if (name) {
name = name.toLowerCase();
} else {
Say("/w " + _leaderName + " No NPC name given.");
return false;
}
var npc, names;
switch (me.act) {
case 1:
names = ["gheed", "charsi", "akara", "kashya", "cain", "warriv"];
break;
case 2:
names = ["fara", "lysander", "greiz", "elzix", "jerhyn", "meshif", "drognan", "atma", "cain"];
break;
case 3:
names = ["alkor", "asheara", "ormus", "hratli", "cain"];
break;
case 4:
names = ["halbu", "tyrael", "jamella", "cain"];
break;
case 5:
names = ["larzuk", "malah", "qual-kehk", "anya", "nihlathak", "cain"];
break;
}
if (names.indexOf(name) < 0) {
Say("/w " + _leaderName + " Invalid NPC.");
return false;
}
if (!NTTM_TownMove(name === "jerhyn" ? "palace" : name)) {
NTTM_TownMove("portalspot");
Say("/w " + _leaderName + " Failed to move to town spot.");
return false;
}
npc = NTC_FindUnit(1);
if (npc) {
do {
if (npc.name.replace(/ /g, "").toLowerCase().indexOf(name) > -1) {
QuestInteract(npc);
NTTM_TownMove("portalspot");
Say("/w " + _leaderName + " Done talking.");
return true;
}
} while (npc.GetNext());
}
Say("/w " + _leaderName + " NPC not found.");
NTTM_TownMove("portalspot");
return false;
}
function ChangeAct(act) {
var npc, portal, preArea;
preArea = me.areaid;
switch (act) {
case 2:
if (me.areaid >= 40) {
break;
}
NTTM_TownMove("warriv");
npc = NTC_FindUnit(1, 155);
if (npc) {
QuestInteract(npc);
if (NTT_DoInteract(npc)) {
me.SelectNPCMenu(0x0D36);
}
}
break;
case 3:
if (me.areaid >= 75) {
break;
}
NTTM_TownMove("palace");
npc = NTC_FindUnit(1, 201);
if (npc) {
QuestInteract(npc);
}
NTTM_TownMove("meshif");
npc = NTC_FindUnit(1, 210);
if (npc) {
QuestInteract(npc);
if (NTT_DoInteract(npc)) {
me.SelectNPCMenu(0x0D38);
}
}
break;
case 4:
if (me.areaid >= 103) {
break;
}
if (NTC_InTown()) {
NTTM_TownMove("cain");
npc = NTC_FindUnit(1, 245);
if (npc) {
QuestInteract(npc);
}
NTTM_TownMove("portalspot");
NTM_UsePortal(null, 102, null);
}
target = NTC_FindUnit(2, 342, 20);
NTM_MoveTo(target.areaid, target.x - 3, target.y - 1);
NTM_TakeUnit(NTC_UNIT_OBJECT, 342);
break;
case 5:
if (me.areaid >= 109) {
break;
}
NTTM_TownMove("tyrael");
npc = NTC_FindUnit(1, NTC_NPC_ID_TYREAL_ACT_4);
if(npc) {
QuestInteract(npc);
NTM_TakeUnit(2, 566);
}
}
NTC_PingDelay(2000);
while (!me.areaid) {
NTC_Delay(500);
}
if (me.areaid === preArea) {
me.Cancel(1);
NTTM_TownMove("portalspot");
FL_Say("Act change failed.");
return;
}
NTTM_TownMove("portalspot");
FL_Say("Act change successful.");
if (act === 2) {
Say("Don't forget to talk to Drognan after getting the Viper Amulet!");
}
}
function ClearPosition(range) {
var i, orgx, orgy, monList, skipList, target, result,
tele = NTC_GetSkillLevel(54),
attackcount = 0;
if (NTConfig_AttackSkill[1] < 0 || NTConfig_AttackSkill[3] < 0) {
Print("�c1Set your attacks, noob!");
return false;
}
if (!arguments.length) {
range = 20;
}
orgx = me.x;
orgy = me.y;
skipList = [];
MainLoop : while (_attack && attackcount < 300) {
if (me.mode === 0 || me.mode === 17) {
return false;
}
monList = [];
target = NTC_FindUnit(NTC_UNIT_MONSTER);
if (target) {
do {
if (skipList.indexOf(target.gid) < 0) {
if (target.IsAttackable()) {
if (NTA_IsValidMonster(target)) {
if (GetDistance(orgx, orgy, target.x, target.y) <= range && (CheckCollision(me, target, 1) || tele)) {
monList.push(new NTA_MonsterStats(target));
}
}
} else {
skipList.push(target.gid);
}
}
} while (target.GetNext());
}
if (monList.length === 0) {
break;
}
monList.sort(SortMonsters);
target = NTC_FindUnit(NTC_UNIT_MONSTER, monList[0].gid);
if (target && target.IsAttackable()) {
result = NTA_Attack(target, attackcount % 30 === 0);
//Say("!Attacking " + target.name + " " + target.classid);
switch (result) {
case 1:
skipList.push(target.gid);
monList.shift();
break;
case 2:
case 3:
attackcount += 1;
break;
default:
return false;
}
} else {
monList.shift();
}
}
if (attackcount > 0) {
switch (me.classid) {
case 2:
NTA_RaiseArmy();
break;
}
NTT_ClearBelt();
PickPotions(range);
NTP_DoPrecast(false);
}
return true;
}
function SortMonsters(unitA, unitB) {
var monID = [58, 59, 60, 61, 62, 101, 102, 103, 104, 105, 229, 278, 279, 280, 281, 282, 312, 645, 646, 647, 667, 668, 669, 670];
if (monID.indexOf(unitA.classid) > -1) {
return -1;
} else if (GetDistance(me.x, me.y, unitA.x, unitA.y) < GetDistance(me.x, me.y, unitB.x, unitB.y)) {
return -1;
}
return 1;
}
function NTA_MonsterStats(unit) {
this.name = unit.name;
this.x = unit.x;
this.y = unit.y;
this.gid = unit.gid;
this.hp = unit.hp;
this.classid = unit.classid;
this.spectype = unit.spectype;
}
function PickPotions(range) {
var i, item, itemList, checkedItem;
item = NTC_FindUnit(4);
if (!item) {
return false;
}
itemList = [];
do {
if ((item.mode === 3 || item.mode === 5) && item.itemtype >= 76 && item.itemtype <= 78 && GetDistance(me.x, me.y, item.x, item.y) <= range) {
if (NTSI_CheckItem(item)) {
itemList.push(new NTSI_ItemInt(item, 1));
}
}
} while (item.GetNext());
while (itemList.length > 0) {
itemList.sort(NTSI_SortItems);
checkedItem = itemList.shift();
item = NTC_FindUnit(NTC_UNIT_ITEM, checkedItem.GID);
if (item && !NTSI_IsLimitedItemInt(item) && NTSI_PickUpItemInt(item)) {
switch(checkedItem.ClassID) {
case 515: // Rejuvenation Potion
case 516: // Full Rejuvenation Potion
Print("Picked up "+ NTC_ItemQualityToD2Color[9] + GetLocaleString(2209 + checkedItem.ClassID - 515));
break;
case 587: // Minor Healing Potion
case 588: // Light Healing Potion
case 589: // Healing Potion
case 590: // Greater Healing Potion
case 591: // Super Healing Potion
Print("Picked up "+ NTC_ItemQualityToD2Color[10] + GetLocaleString(2266 + checkedItem.ClassID - 587));
break;
case 592: // Minor Mana Potion
case 593: // Light Mana Potion
case 594: // Mana Potion
case 595: // Greater Mana Potion
case 596: // Super Mana Potion
Print("Picked up "+ NTC_ItemQualityToD2Color[4] + GetLocaleString(2266 + checkedItem.ClassID - 587));
break;
}
}
}
return true;
}
function OpenContainers(range) {
var i, strings, unit, orgX, orgY;
orgX = me.x;
orgY = me.y;
strings = [
3222, // = Barrel
3224, // = an Exploding Barrel
3236, // = Crate
3237, // = Casket
3241, // = Corpse
3242, // = Dead Rogue
3243, // = Dead Rogue
3246, // = Mummy Sarcophagus
3247, // = Armor Stand
3248, // = Weapon Rack
3249, // = Sarcophagus
3251, // = Large Urn
3252, // = Canopic Jar
3254, // = Undefiled Grave
3256, // = Urn
3260, // = Chest
3262, // = Locked Chest
3268, // = Loose Boulder
3269, // = Loose Rock
3270, // = Hollow Log
3275, // = Guard Corpse
3279, // = Rat's Nest
3283, // = Skeleton
3284, // = Skullpile
3285, // = Cocoon
3293, // = Goo Pile
3297, // = Skull Pile
3302, // = Basket
3303, // = Rock Pile
3307, // = Dead Guard
3309, // = Sarcophagus
3310, // = Dead Villager
3321, // = Bone Chest
3323, // = Hung Skeleton
3271, // = Hiding Spot
3274, // = Hidden Stash
3315 // = Stash
];
for (i = 0; i < strings.length; i += 1) {
unit = NTC_FindUnit(2, GetLocaleString(strings[i]));
if (unit) {
do {
if (CheckCollision(me, unit, 1) && GetDistance(orgX, orgY, unit.x, unit.y) <= range && NTC_OpenChest(unit)) {
NTSI_PickItems();
}
} while (unit.GetNext());
}
}
}
|