Bonjour ici.
Voilà les scripts pour faire fonctionner un bot (ou plusieurs
) avec un baba qui va bo à la demande.
Ne soyez pas surpris si vous jettez un oeil dans les scripts, ils ont été beaucoup modifiés par rapport à ceux de base.
Je vous suggère de faire une copie de vos fichiers avant d'effectuer les modifications.
Si un modo se sent de passer les balises codes en balises spoilers, ou bien autrement, aucun soucis pour moi, vu la longueur de ce post.
Nous avons inclus des parties de scripts trouvées soit ici, soit sur Eon pour ce qui concerne la sécurité, la détection des personnages dans la zone (les entêtes de scripts sont toujours en place si le script est quasiment celui d'origine.
Ce que nous avons développé, nous l'avons fait à deux, donc je remercie énormément Ammaliah qui a optimisé le code un peu bordélique et qui a codé toute la partie attaque et mouvement (non présentées pour le moment)
Le fichier NTleechStarter.ntj, un conseil, remplacez le vôtre par celui çi, sauf si vous avez des modifs très importantes dedans. Il prend en compte le français aussi, vu que les bots ont toujours tourné avec un seul didi anglais et 3 didi français.
//credit for this goes to D2od who knows way more than I do (à nous aussi, mais pour si peu ^^ )
// =============================================================================
// Leader Account settings
// =============================================================================
var leaderAccountName = "compteduBaba";
var leaderName = "NomduBaba";
// =============================================================================
// Game password (leave blank if none)
// =============================================================================
var gamepassword = "blabla";
// =============================================================================
// 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 = "Zik";
////////////////////////////////////////////////////////////////////////////////
// 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 = 420000;
// 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 = 4000;
var waitInChatBeforeActionsMax = 6000;
// 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);
Delay(5000);
Say('/f l');
Delay(1500);
}
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("yc8found 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, "yE00000Game 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;
}
Le fichier NTBot.ntj : Les timings sont étudiés pour que les bots soient synchronisés, donc je vous conseille de les adopter.
var gameMinLength = 185000; // 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 = 5000; // time in milliseconds to wait between making games
var createGameThresholdRandom = 1000; // time in milliseconds to randomly add +/- to the game create time
var createGameTimeout = 15000; // time in milliseconds to register a failed to create game
var waitInLineTimeout = 60000; // time in milliseconds to wait in lines for a create game (60 second default)
var characterSelectDelay = 1000; // time in milliseconds to wait before selecting a character on the char screen
var loginDelay = 1000; // time in milliseconds to wait before submitting login information
var clickDelay = 500; // wait X milliseconds before next action after a click event
var textDelay = 500; // wait X milliseconds before next action after inserting text into a textbox
var clickDelayRandom = 500; // random amount of time to add to a click
var textDelayRandom = 500; // random amount of time to add to a text set
var gameDoesNotExistDelayMin = 600000; // how long to wait when a Game Does Not Exist occurs - minimum - default 10 minutes
var gameDoesNotExistDelayMax = 900000; // how long to wait when a Game Does Not Exist occurs - maximum - default 15 minutes
var gameDoesNotExistTimeout = 30000; // how long to wait for the dialog to disappear (default 30 seconds, don't change this)
var 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 = "Zik"; // leave blank to not join a private channel
var waitBeforeEnterChatMin = 1000; // min how long to wait before entering chat
var waitBeforeEnterChatMax = 2000; // max how long to wait before entering chat
var waitInChatBeforeActionsMin = 2000; // min how long to wait before joining channel
var waitInChatBeforeActionsMax = 3000; // max how long to wait before joining channel
Maintenant, un des fichiers majeurs, en fait celui qui va permettre plein de choses, le fichier NTBotGame.ntj
Ici, c'est simple, copiez tout et voilà.
var CurScriptIndex = 0;
var LastScript = false;
var CloneDiabloString;
var CloneDiabloNotify = false;
function NTMain()
{
Delay(1000);
//Print("ÿc4[+] NTBot 4.2 [+]");
Include("libs/common/NTCommon.ntl");
NTC_IncludeLibs();
NTC_IncludeConfig("NTBot/char_configs");
NT_LoadConfig();
NTSI_LoadNIPFiles("NTBot/item_configs");
if(NTConfig_StartDelay > 0);
NTC_Delay(NTConfig_StartDelay);
SetUIState(0x0A, true);
NTT_GetCorpses();
if(NTConfig_Script.length > 0)
{
NTCU_InitCubing();
NTT_ClearInventory();
NTT_ClearBelt();
Load("NTBot/tools/NTToolsThread.ntj");
if(NTConfig_CheckCloneDiablo)
{
CloneDiabloString = GetLocaleString(11005);
RegisterEvent(EVENT_GAMEMSG, NT_GameMsgEvents);
}
RegisterEvent(EVENT_KEYDOWN, NT_KeyEvents);
RegisterEvent(EVENT_SCRIPTMSG, NT_ScriptMsgEvents);
Load("NTBot/bots/" + NTConfig_Script[CurScriptIndex]);
SetStatusText("Running " + NTConfig_Script[CurScriptIndex]);
while(!LastScript || CloneDiabloNotify)
{
NTC_Delay(500);
}
}
ExitGame();
}
function NT_GameMsgEvents(msg, type)
{
if(type == 4 && msg.indexOf(CloneDiabloString) != -1)
{
CloneDiabloNotify = true;
NTC_SendLogToOOG(NTC_LOG_COMMON, "ÿc4" + CloneDiabloString);
SetStatusText(CloneDiabloString);
me.maxgametime = 0;
NTC_StopScript(NTConfig_Script[CurScriptIndex]);
NTC_Delay(500);
NTTM_CheckAct();
}
else if(type == 8 && msg.indexOf(GetLocaleString(4026)) != -1)
ExitGame();
else if(msg.indexOf("quitté notre monde") != -1 || msg.indexOf("délai dépassé") != -1 || msg.indexOf("left our world") != -1 || msg.indexOf("due to timeout") != -1)
ExitGame();
// Messages whisper
else if(type == 2)
{
var reg = /^.*\(\*(\w*)\)(\swhispers)?\s*:\s\.(.*)$/gi;
if (msg.match(reg))
{
var sender = msg.replace(reg, "$1");
var command = msg.replace(reg, "$3");
Say(sender+" told me : "+command);
Delay(500);
if(command == "Arrete")
NTC_StopScript(NTConfig_Script[CurScriptIndex]);
if(command == "Town portal")
NTM_MakeTP();
if(command == "Defends toi")
{
NTA_ClearPosition(15, true);
}
if(command == "Acte 5")
{
NTC_SendLogToOOG(NTC_LOG_COMMON, "J'arrive");
// NTC_SendMsgToScript("NTBot/bots/" + NTConfig_Script[CurScriptIndex], "SCRIPT_END");
// Delay(2000);
_script = NTC_FindScript(NTConfig_Script[CurScriptIndex]);
if(_script)
{
_script.Stop();
NTC_Delay(300);
ClickMap(NTC_CLICK_LUP, NTC_SHIFT_NONE, null);
SetStatusText("Stopped " + NTConfig_Script[CurScriptIndex]);
}
NTC_Delay(1000);
Load("NTBot/bots/NTBaalleech.ntj");
SetStatusText("Running NTBaalleech.ntj");
}
// etc...
}
}
// Fin message Whisper
}
function NT_KeyEvents(keycode)
{
var _script;
switch(keycode)
{
case 19:
_script = NTC_FindScript(NTConfig_Script[CurScriptIndex]);
if(_script)
{
if(_script.running)
{
_script.Stop();
NTC_Delay(300);
ClickMap(NTC_CLICK_LUP, NTC_SHIFT_NONE, null);
SetStatusText("Stopped " + NTConfig_Script[CurScriptIndex]);
}
else
{
Load("NTBot/bots/" + NTConfig_Script[CurScriptIndex]);
SetStatusText("Running " + NTConfig_Script[CurScriptIndex]);
}
}
break;
}
}
function NT_ScriptMsgEvents(msg)
{
var _area;
switch(msg)
{
case "SCRIPT_END":
if(++CurScriptIndex < NTConfig_Script.length)
{
NTTM_CheckAct();
Load("NTBot/bots/" + NTConfig_Script[CurScriptIndex]);
SetStatusText("Running " + NTConfig_Script[CurScriptIndex]);
}
else
LastScript = true;
break;
default:
Print("ÿc1" + NTConfig_Script[CurScriptIndex] + " : " + msg + " failed");
_area = GetArea();
if(_area)
NTC_SendLogToOOG(NTC_LOG_COMMON, "ÿE00000" + NTConfig_Script[CurScriptIndex] + " : " + msg + " failed (" + _area.name + ")");
else
NTC_SendLogToOOG(NTC_LOG_COMMON, "ÿE00000" + NTConfig_Script[CurScriptIndex] + " : " + msg + " failed (unknown area)");
if(++CurScriptIndex < NTConfig_Script.length)
{
NTTM_CheckAct();
Load("NTBot/bots/" + NTConfig_Script[CurScriptIndex]);
SetStatusText("Running " + NTConfig_Script[CurScriptIndex]);
}
else
LastScript = true;
break;
}
}
Le fichier Baal.ntj, il a quelques améliorations, comme le fait de quitter si des poupées sont détectées (je ne le dirai jamais assez, nous avons tout misé sur la sécurité des runs, et donc les poupées sont un danger que nous préférons éviter, malgré le nombre de runs effectués par les bots, quelques milliers)
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(!me.GetState(32))
ExitGame();
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;
}
}
// Say("/f m .Acte 5");
if(!NTM_MoveTo(me.areaid, 15088, 5006))
{
NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveTo()");
return;
}
var _bonefetish = NTC_FindUnit(NTC_UNIT_MONSTER, GetLocaleString(2904));
if(_bonefetish)
// Modif
{
NTC_SendLogToOOG(NTC_LOG_COMMON, "ÿE00000Soul Killers found. Exiting...");
Say("Dolls !!!!!! New game");
NTC_SendMsgToScript("NTBotGame.ntj", "SCRIPT_END");
return;
}
// Fin modif
Say("/f m .Acte 5");
NTA_ClearPosition(30, true, 2);
NTC_SendLogToOOG(NTC_LOG_COMMON, "Throne");
// ******** Modif Scripts Baal **********
if(NTConfig_DollSkipBaal)
{
if(NTC_FindUnit(NTC_UNIT_MONSTER, 691))
{
Print("ÿc6 [X] Dolls detected -> skipping Baal [X]");
NTC_SendMsgToScript("NTBotGame.ntj", "SCRIPT_END");
return;
}
}
// ****** Fin modif
NT_ClearThroneInt();
// ******** Modif Public *************
if(NTConfig_PublicMode)
{
NTM_MoveTo(me.areaid, 15107, 5004, 1, true);
NTM_MakeTP();
NTM_MoveTo(me.areaid, 15092, 5040);
Say("TP is safe.");
}
// ******** Fin Modif
while(1)
{
if(_wave != 1)
NTM_MoveTo(me.areaid, 15092, 5040);
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:
NTM_MoveTo(me.areaid, me.x+1, me.y);
NTA_ClearPosition(40, true, 2);
NTM_MoveTo(me.areaid, 15092, 5040);
NTA_ClearPosition(40, true, 2);
NTP_DoPrecast(true);
break;
case 2:
NTC_SendLogToOOG(NTC_LOG_COMMON, "Wave 2");
NTA_ClearPosition(40, true);
//NTTMGR_CheckSafe(NTConfig_CheckSelfSafe|0x02, NTConfig_CheckMercSafe);
break;
case 3:
NTM_MoveTo(me.areaid, me.x+1, me.y);
NTA_ClearPosition(40, true, 2);
NT_CheckHydraInt();
break;
case 4:
NTM_MoveTo(me.areaid, me.x+1, me.y);
NTA_ClearPosition(40, true, 2);
break;
case 5:
NTM_MoveTo(me.areaid, me.x+1, me.y);
NTA_ClearPosition(40, true);
NTM_MoveTo(me.areaid, 15092, 5040);
NTA_ClearPosition(40, true, 2);
break;
// default:
// NTM_MoveTo(me.areaid, me.x+1, me.y);
// NTA_ClearPosition(40, true, 1);
// NTM_MoveTo(me.areaid, 15092, 5040);
// NTA_ClearPosition(40, true, 2);
// break;
}
if(_wave == 5)
break;
}
if(NTConfig_KillBaal)
{
var _portal;
if(NTConfig_PublicMode)
Say("Time to Kill Baal now.");
if(!NTTMGR_CheckSafe(NTConfig_CheckSelfSafe|0x01, NTConfig_CheckMercSafe))
{
NTC_SendMsgToScript("NTBotGame.ntj", "NTTMGR_CheckSafe()");
return;
}
NTM_MoveTo(me.areaid, 15092, 5010);
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");
}
function NT_ClearThroneInt()
{
var _attackpos = [15092, 5020, 15092, 5040, 15092, 5060];
for(var i = 0 ; i < _attackpos.length ; i += 2)
{
NTM_MoveTo(me.areaid, _attackpos[i], _attackpos[i+1]);
NTA_ClearPosition(30, 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, 15092, 5028);
if(me.GetState(2))
NTC_PutSkill(109, NTC_HAND_RIGHT);
NTC_PingDelay(4000);
}
}
Le fichier NTbaalleech.ntj, peu de modifications dedans, le baba etles autres bots seront en mode passifs, et iront derrière le bot tueur. Si vous souhaitez qu'ils restent en place au Tp, mettez la ligne de déplacement en remarque ( NTM_MoveTo(me.areaid, 15092, 5045); )
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 _leaderbaal = "NomduBotquivatuer"; // 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(_leaderbaal))
break;
Delay(200);
}
while(me.areaid == 109 && NTC_InMyParty(_leaderbaal))
{
NTM_UsePortal("BluePortal", 131, _leaderbaal); // 50
Delay(5000);
}
NTM_MoveTo(me.areaid, 15092, 5045);
NTP_DoPrecast(true);
while(NTC_InMyParty(_leaderbaal))
{
Delay(1000);
}
NTC_SendMsgToScript("NTBotGame.ntj", "SCRIPT_END");
}
Là, le système est plus ou moins en place, mais il faut intégrer la visite au baba qui sera tranquille au Wp des Catacombes lvl2, donc faites un truc de ce genre là, dans le fichier config de votre perso ( NTConfig_Classe_NomduPerso.ntl )
//-------------
//..::Acte 1::..
//-------------
// Aller se faire bo par le baba catacombes lvl 2
NTConfig_Script.push("NTAllerBo.ntj");
//NTConfig_Script.push("NTCow.ntj"); NTConfig_KillRakanishuCows = true;
//NTConfig_TristExtension = false;
//NTConfig_Script.push("NTBishibosh.ntj");
//NTConfig_Script.push("NTMausoleum.ntj"); NTConfig_KillBloodRaven = true;
//NTConfig_Script.push("NTTristram.ntj"); NTConfig_KillRakanishu = true;
NTConfig_Script.push("NTCountess.ntj");
//NTConfig_Script.push("NTTreehead.ntj");
//NTConfig_Script.push("NTCountessTour.ntj");
//NTConfig_Script.push("NTPit.ntj"); NTConfig_ClearPitLevel1 = 1; // 0 : don't clear, 1 : clear path only, 2 : clear all
//NTConfig_Script.push("NTHole.ntj"); NTConfig_ClearHoleLevel1 = 1; // 0 : don't clear, 1 : clear path only, 2 : clear all
NTConfig_Script.push("NTAndariel.ntj");
Maintenant, il vous faut le script NTAllerBo.ntj, que vous devez créer (dans scripts\NTBOT\bots )
function NTMain()
{
Include("libs/common/NTCommon.ntl");
NTC_IncludeLibs();
NTC_IncludeConfig("NTBot/char_configs");
NT_LoadConfig();
NTSI_LoadNIPFiles("NTBot/item_configs");
NTA_Initialize();
// On déplace le bot vers le wp des Catacombes
if(!NTTM_CheckAct())
{
NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_CheckAct()");
return;
}
Say("Gros lard, faut bosser !!!");
NTTMGR_TownManager();
if(!NTTM_TownMove("waypoint"))
{
NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_TownMove()");
return;
}
if(!NTM_TakeWaypoint(35))
{
NTC_SendMsgToScript("NTBotGame.ntj", "NTM_TakeWaypoint()");
return;
}
NTM_MoveTo(me.areaid, me.x-5, me.y);
while(!me.GetState(32))
{
NTM_MoveTo(me.areaid, me.x-5, me.y);
NTM_MoveTo(me.areaid, me.x+5, me.y);
}
NTC_Delay(6000);
NTP_DoPrecast(true);
NTC_SendMsgToScript("NTBotGame.ntj", "SCRIPT_END");
}
Le fichier config du baba, c'est tout simple ^^
Dans la section des boss, ne mettez que ça :
//------------------------------------------------------------------------------
// Boss configuration
//------------------------------------------------------------------------------
NTConfig_Script.push("NTBabaBottest.ntj");
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
Créez le fichier NTBabaBottest.ntj (J'avoue que j'ai un trou de mémoire concernant l'utilisation d'un fichier (NTBotGametest.ntj) mais ça ne géne en rien le fonctionnement du script, c'était sans doute pendant les tests que nous l'utilisions. Ne vous en faites pas, ça n'empêche pas le script de tourner.
function NTMain()
{
Include("libs/common/NTCommon.ntl");
NTC_IncludeLibs();
NTC_IncludeConfig("NTBot/char_configs");
NT_LoadConfig();
NTSI_LoadNIPFiles("NTBot/item_configs");
NTA_Initialize();
// On déplace le baba vers le wp des Catacombes, il se Bo puis fait un tp
if(!NTTM_CheckAct())
{
NTC_SendMsgToScript("NTBotGametest.ntj", "NTTM_CheckAct()");
return;
}
Say("Je suis ici pour vous booster");
NTTMGR_TownManager();
if(!NTTM_TownMove("waypoint"))
{
NTC_SendMsgToScript("NTBotGametest.ntj", "NTTM_TownMove()");
return;
}
if(!NTM_TakeWaypoint(35))
{
NTC_SendMsgToScript("NTBotGametest.ntj", "NTM_TakeWaypoint()");
return;
}
NTP_DoPrecast(true);
// Baba est en attente au Wp
do
{
if (NTC_IsQuesterOut())
{
NTC_Delay(500)
}
if (NTC_IsQuesterIn())
{
NTC_Delay(1500)
}
}
while(1)
NTC_SendMsgToScript("NTBotGametest.ntj", "SCRIPT_END");
}
function NTC_IsQuesterIn(area, name)
{
var _player;
var _myPartyId;
var _area;
_player = GetPlayerUnit();
_myPartyId = _player.partyid;
if(arguments.length < 1)
_area = me.areaid
if(arguments.length > 0)
_area = area;
do
{
if(_player.areaid == _area && _myPartyId == _player.partyid)
{
if(!name)
{
NTP_DoPrecast(true);
return true;
}
else if(_player.name == name)
{
NTP_DoPrecast(true);
return true;
}
}
NTC_Delay(100);
} while(_player.GetNext());
return false;
}
function NTC_IsGroupInAct(act)
{
var _player;
var _myPartyId;
var questeract;
_player = GetPlayerUnit();
_myPartyId = _player.partyid;
do
{
if(_player.areaid <= 39)
questeract = 1;
else if(_player.areaid >= 40 && _player.areaid <= 74)
questeract = 2;
else if(_player.areaid >= 75 && _player.areaid <= 102)
questeract = 3;
else if(_player.areaid >=103 && _player.areaid <= 108)
questeract = 4;
else
questeract = 5;
if(questeract == act && _myPartyId == _player.partyid && _player.name != me.charname)
return true;
NTC_Delay(100);
} while(_player.GetNext());
return false;
}
function NTC_IsQuesterOut(area)
{
var _player;
var _myPartyId;
_player = GetPlayerUnit();
_myPartyId = _player.partyid;
if(arguments.length < 1)
_area = me.areaid;
else
_area = area;
do
{
if(_player.areaid == _area && _myPartyId == _player.partyid)
return false;
NTC_Delay(100);
} while(_player.GetNext());
return true;
}
En théorie, ça doit fonctionner maintenant.
Comment ça tourne, tout ce bordel ?
Lancez les bots, qu'il y en ait 2 ou 8, peu importe, tout fonctionnera de façon transparente pour vous.
Quelques détails à connaître :
- le premier bot qui quitte la partie fait sortir les autres aussi, donc prévoyez large dans le timing de vos bots.
- Le baba est ce qu'on peut appeler le meneur du groupe, il crée les parties, les autres bots le suivront.
- ce système peut fonctionner pour la partie leech chez Baal pour les autres logiciels de bots, via les messages envoyés par le bot qui fait Baal.
- Il est conseillé de faire Baal en dernier, vu que tout le monde va quitter la partie quand Baal sera tué.
- Le baba en lui même est vulnérable, car pour le moment, il n'a pas encore été inclus de routines de défense, donc assurez vous que son merco soit assez puissant pour anéantir un groupe de mobs des catacombes. Ceci dit, il utilisera les potions quand même, et en dernier recours, fera un chicken.
- Les bots peuvent aller chacun de leur côté, ou bien faire en même temps la même zone (je vous recommande de regarder 2 ou 3 bots utilisant ce système faire le sanctu du chaos, c'est assez jouissif)
- Il peut bien entendu tourner avec le bot d'un ami, pour peu que les scripts soient en place sur tous les Pc faisant tourner des bots (un exemple : vous voulez vous regrouper pour faire une party complète pour maximiser le gain d'Xp et d'items, faites le, si les bots n'ont pas tous terminé leur run, ils termineront ensemble au trône)
- Nous avons recodé aussi les attaques et surtout les mouvements afin de rendre safe le sanctu du chaos pour une soso plus particulièrement, cependant il reste quelques vérifications à faire de mon côté, vu que je dois tout relire après ma longue pause)
A venir, si j'en ai le courage lol, le pilotage complet des bots pour faire les grosses zones en coopération, avec synchro pour les sceaux de didi.
Alors, bon courage, je m'attends surement à avoir oublié 1 ou 2 trucs, mais je répondrai rapidement ici pour régler les éventuels problèmes