From 50af27a52cb111f4a03913923c692d4676a63ffb Mon Sep 17 00:00:00 2001 From: Mercoory <37851307+Mercoory@users.noreply.github.com> Date: Mon, 14 Oct 2019 00:13:26 +0200 Subject: [PATCH 1/2] IPHunter improvements - More beeps when IP found - More often movement when IP found (Anti drop measure) - Overhead messages with countdown - Logs to D2BS console --- d2bs/kolbot/libs/bots/IPHunter.js | 43 +++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/d2bs/kolbot/libs/bots/IPHunter.js b/d2bs/kolbot/libs/bots/IPHunter.js index b669e0064..0a6a95f0c 100644 --- a/d2bs/kolbot/libs/bots/IPHunter.js +++ b/d2bs/kolbot/libs/bots/IPHunter.js @@ -1,26 +1,53 @@ /** * @filename IPHunter.js -* @author kolton +* @author kolton, Mercoory * @desc search for a "hot" IP and stop if the correct server is found +* @changes (2019.10.06) More beeps when IP found; More often movement when IP found (Anti drop measure); Overhead messages with countdown; Logs to D2BS console */ function IPHunter() { - var ip = Number(me.gameserverip.split(".")[3]); + var ip = Number(me.gameserverip.split(".")[3]), i, q, w; if (Config.IPHunter.IPList.indexOf(ip) > -1) { - print("IP found!"); + D2Bot.printToConsole("IPHunter: IP found! - [" + ip + "] Game is : " + me.gamename + "//" + me.gamepassword, 7); + print("IP found! - [" + ip + "] Game is : " + me.gamename + "//" + me.gamepassword); + me.overhead(":D IP found! - [" + ip + "]"); me.maxgametime = 0; - while (true) { - me.overhead("IP found!"); + for (i = 12; i != 0; i -= 1) { + me.overhead(":D IP found! - [" + ip + "]" + (i-1) + " beep left"); beep(); // works if windows sounds are enabled + delay(250); + } + + while (true) { + + /* // If you want beeping at every movement + for (i = 12; i != 0; i -= 1) { + me.overhead(":D IP found! - [" + ip + "]" + (i-1) + " beep left"); + beep(); // works if windows sounds are enabled + delay(250); + } + */ + + me.overhead(":D IP found! - [" + ip + "]"); + Town.move("waypoint"); Town.move("stash"); - delay(60e3); + + for (q = (12 * 60); q != 0; q -= 1) { + me.overhead(":D IP found! - [" + ip + "] Next movement in: " + q + " sec." ); + delay(1000); + } } } - delay(Config.IPHunter.GameLength * 60e3); + for (w = (Config.IPHunter.GameLength * 60); w != 0; w -= 1) { + me.overhead(":( IP : [" + (ip) + "] NG: " + w + " sec"); + delay(1000); + } + + D2Bot.printToConsole("IPHunter: IP was [" + ip + "]" , 10); return true; -} \ No newline at end of file +} From 71c1b252b9f6fdfb020c345f5ad37c489af3555f Mon Sep 17 00:00:00 2001 From: Mercoory <37851307+Mercoory@users.noreply.github.com> Date: Mon, 14 Oct 2019 00:20:38 +0200 Subject: [PATCH 2/2] Update IPHunter.js @jaenster improved the variable declaration. Co-Authored-By: Jan Stoots --- d2bs/kolbot/libs/bots/IPHunter.js | 93 ++++++++++++++++--------------- 1 file changed, 48 insertions(+), 45 deletions(-) diff --git a/d2bs/kolbot/libs/bots/IPHunter.js b/d2bs/kolbot/libs/bots/IPHunter.js index 0a6a95f0c..96954227a 100644 --- a/d2bs/kolbot/libs/bots/IPHunter.js +++ b/d2bs/kolbot/libs/bots/IPHunter.js @@ -6,48 +6,51 @@ */ function IPHunter() { - var ip = Number(me.gameserverip.split(".")[3]), i, q, w; - - if (Config.IPHunter.IPList.indexOf(ip) > -1) { - D2Bot.printToConsole("IPHunter: IP found! - [" + ip + "] Game is : " + me.gamename + "//" + me.gamepassword, 7); - print("IP found! - [" + ip + "] Game is : " + me.gamename + "//" + me.gamepassword); - me.overhead(":D IP found! - [" + ip + "]"); - me.maxgametime = 0; - - for (i = 12; i != 0; i -= 1) { - me.overhead(":D IP found! - [" + ip + "]" + (i-1) + " beep left"); - beep(); // works if windows sounds are enabled - delay(250); - } - - while (true) { - - /* // If you want beeping at every movement - for (i = 12; i != 0; i -= 1) { - me.overhead(":D IP found! - [" + ip + "]" + (i-1) + " beep left"); - beep(); // works if windows sounds are enabled - delay(250); - } - */ - - me.overhead(":D IP found! - [" + ip + "]"); - - Town.move("waypoint"); - Town.move("stash"); - - for (q = (12 * 60); q != 0; q -= 1) { - me.overhead(":D IP found! - [" + ip + "] Next movement in: " + q + " sec." ); - delay(1000); - } - } - } - - for (w = (Config.IPHunter.GameLength * 60); w != 0; w -= 1) { - me.overhead(":( IP : [" + (ip) + "] NG: " + w + " sec"); - delay(1000); - } - - D2Bot.printToConsole("IPHunter: IP was [" + ip + "]" , 10); - - return true; -} + let ip = Number(me.gameserverip.split(".")[3]); + + if (Config.IPHunter.IPList.indexOf(ip) > -1) { + D2Bot.printToConsole("IPHunter: IP found! - [" + ip + "] Game is : " + me.gamename + "//" + me.gamepassword, 7); + print("IP found! - [" + ip + "] Game is : " + me.gamename + "//" + me.gamepassword); + me.overhead(":D IP found! - [" + ip + "]"); + me.maxgametime = 0; + + for (let i = 12; i > 0; i -= 1) { + me.overhead(":D IP found! - [" + ip + "]" + (i - 1) + " beep left"); + beep(); // works if windows sounds are enabled + delay(250); + } + + while (true) { + + /* // If you want beeping at every movement + for (let i = 12; i != 0; i -= 1) { + me.overhead(":D IP found! - [" + ip + "]" + (i-1) + " beep left"); + beep(); // works if windows sounds are enabled + delay(250); + } + */ + + me.overhead(":D IP found! - [" + ip + "]"); + try { + Town.move("waypoint"); + Town.move("stash"); + } catch (e) { + // ensure it doesnt leave game by failing to walk due to desyncing. + } + + for (let i = (12 * 60); i > 0; i -= 1) { + me.overhead(":D IP found! - [" + ip + "] Next movement in: " + i + " sec."); + delay(1000); + } + } + } + + for (let i = (Config.IPHunter.GameLength * 60); i > 0; i -= 1) { + me.overhead(":( IP : [" + (ip) + "] NG: " + w + " sec"); + delay(1000); + } + + D2Bot.printToConsole("IPHunter: IP was [" + ip + "]", 10); + + return true; +} \ No newline at end of file