diff --git a/d2bs/kolbot/libs/bots/Diablo.js b/d2bs/kolbot/libs/bots/Diablo.js index 5f16fe823..8ad2f54b7 100644 --- a/d2bs/kolbot/libs/bots/Diablo.js +++ b/d2bs/kolbot/libs/bots/Diablo.js @@ -2,6 +2,7 @@ * @filename Diablo.js * @author kolton * @desc clear Chaos Sanctuary and kill Diablo +* @return {boolean} */ function Diablo() { @@ -235,6 +236,7 @@ function Diablo() { }; this.infectorSeal = function () { + Precast.doPrecast(true); print("Inf layout " + this.infLayout); this.followPath(this.infLayout === 1 ? this.starToInfA : this.starToInfB); @@ -259,10 +261,34 @@ function Diablo() { return true; }; + const openSeals = (sealOrder) => { + print("seal order: " + sealOrder); + let seals = { + 1: () => this.vizierSeal(), + 2: () => this.seisSeal(), + 3: () => this.infectorSeal(), + "vizier": () => this.vizierSeal(), + "seis": () => this.seisSeal(), + "infector": () => this.infectorSeal(), + }; + sealOrder.forEach(seal => {seals[seal]()}); + }; + this.diabloPrep = function () { var trapCheck, tick = getTickCount(); + switch (me.classid) { + case 1: + Pather.moveTo(7792, 5294); + + break; + default: + Pather.moveTo(7788, 5292); + + break; + } + while (getTickCount() - tick < 30000) { if (getTickCount() - tick >= 8000) { switch (me.classid) { @@ -465,28 +491,23 @@ function Diablo() { } Attack.clear(30, 0, false, this.sort); - this.vizierSeal(); - this.seisSeal(); - Precast.doPrecast(true); - this.infectorSeal(); - - switch (me.classid) { - case 1: - Pather.moveTo(7792, 5294); - - break; - default: - Pather.moveTo(7788, 5292); - - break; - } - + openSeals(Config.Diablo.SealOrder); if (Config.PublicMode) { say(Config.Diablo.DiabloMsg); } - this.diabloPrep(); + try { + print("Attempting to find Diablo"); + this.diabloPrep(); + } catch (error) { + print("Diablo wasn't found. Checking seals."); + this.vizierSeal(); + this.seisSeal(); + this.infectorSeal(); + this.diabloPrep(); + } + Attack.kill(243); // Diablo Pickit.pickItems(); diff --git a/d2bs/kolbot/libs/bots/DiabloHelper.js b/d2bs/kolbot/libs/bots/DiabloHelper.js index 6c88abae8..fc44ca7f5 100644 --- a/d2bs/kolbot/libs/bots/DiabloHelper.js +++ b/d2bs/kolbot/libs/bots/DiabloHelper.js @@ -2,6 +2,7 @@ * @filename DiabloHelper.js * @author kolton * @desc help leading player in clearing Chaos Sanctuary and killing Diablo +* @return {boolean} */ function DiabloHelper() { @@ -72,6 +73,43 @@ function DiabloHelper() { this.infLayout = this.getLayout(392, 7893); // 1 = "I", 2 = "J" }; + this.openSeal = function (classid) { + let i, + seal; + + for (i = 0; i < 5; i += 1) { + Pather.moveToPreset(108, 2, classid, classid === 394 ? 5 : 2, classid === 394 ? 5 : 0); + + seal = getUnit(2, classid); + + if (!seal) { + return false; + } + + if (classid === 394) { + Misc.click(0, 0, seal); + } else { + seal.interact(); + } + + delay(classid === 394 ? 1000 : 500); + + if (!seal.mode) { + if (classid === 394 && Attack.validSpot(seal.x + 15, seal.y)) { // de seis optimization + Pather.moveTo(seal.x + 15, seal.y); + } else { + Pather.moveTo(seal.x - 5, seal.y - 5); + } + + delay(500); + } else { + return true; + } + } + + return false; + }; + this.getBoss = function (name) { var i, boss, glow; @@ -103,6 +141,12 @@ function DiabloHelper() { this.vizierSeal = function () { this.followPath(this.vizLayout === 1 ? this.starToVizA : this.starToVizB, this.sort); + if (Config.DiabloHelper.OpenSeals) { + if (!this.openSeal(395) || !this.openSeal(396)) { + throw new Error("Failed to open Vizier seals."); + } + } + if (this.vizLayout === 1) { Pather.moveTo(7691, 5292); } else { @@ -123,6 +167,12 @@ function DiabloHelper() { this.seisSeal = function () { this.followPath(this.seisLayout === 1 ? this.starToSeisA : this.starToSeisB, this.sort); + if (Config.DiabloHelper.OpenSeals) { + if (!this.openSeal(394)) { + throw new Error("Failed to open de Seis seal."); + } + } + if (this.seisLayout === 1) { Pather.moveTo(7771, 5196); } else { @@ -141,8 +191,15 @@ function DiabloHelper() { }; this.infectorSeal = function () { + Precast.doPrecast(true); this.followPath(this.infLayout === 1 ? this.starToInfA : this.starToInfB, this.sort); + if (Config.DiabloHelper.OpenSeals) { + if (!this.openSeal(392)) { + throw new Error("Failed to open Infector seals."); + } + } + if (this.infLayout === 1) { delay(1); } else { @@ -153,6 +210,12 @@ function DiabloHelper() { throw new Error("Failed to kill Infector"); } + if (Config.DiabloHelper.OpenSeals) { + if (!this.openSeal(393)) { + throw new Error("Failed to open Infector seals."); + } + } + if (Config.FieldID) { Town.fieldID(); } @@ -160,10 +223,34 @@ function DiabloHelper() { return true; }; + const clearSeals = (sealOrder) => { + print("seal order: " + sealOrder); + let seals = { + 1: () => this.vizierSeal(), + 2: () => this.seisSeal(), + 3: () => this.infectorSeal(), + "vizier": () => this.vizierSeal(), + "seis": () => this.seisSeal(), + "infector": () => this.infectorSeal(), + }; + sealOrder.forEach(seal => {seals[seal]()}); + }; + this.diabloPrep = function () { var trapCheck, tick = getTickCount(); + switch (me.classid) { + case 1: + Pather.moveTo(7793, 5291); + + break; + default: + Pather.moveTo(7788, 5292); + + break; + } + while (getTickCount() - tick < 30000) { if (getTickCount() - tick >= 8000) { switch (me.classid) { @@ -393,8 +480,10 @@ AreaInfoLoop: } } - Pather.useWaypoint(Config.RandomPrecast ? "random" : 107); - Precast.doPrecast(true); + if (Config.DiabloHelper.SafePrecast) { + Pather.useWaypoint(Config.RandomPrecast ? "random" : 107); + Precast.doPrecast(true); + } if (Config.DiabloHelper.SkipTP) { if (me.area !== 107) { @@ -457,23 +546,22 @@ CSLoop: Pather.moveTo(7774, 5305); Attack.clear(35, 0, false, this.sort); - this.vizierSeal(); - this.seisSeal(); - Precast.doPrecast(true); - this.infectorSeal(); - - switch (me.classid) { - case 1: - Pather.moveTo(7793, 5291); - - break; - default: - Pather.moveTo(7788, 5292); - - break; + clearSeals(Config.DiabloHelper.SealOrder); + + try { + print("Attempting to find Diablo"); + this.diabloPrep(); + } catch (error) { + print("Diablo wasn't found"); + if (Config.DiabloHelper.RecheckSeals) { + print("Rechecking seals"); + this.vizierSeal(); + this.seisSeal(); + this.infectorSeal(); + this.diabloPrep(); + } } - this.diabloPrep(); Attack.kill(243); // Diablo Pickit.pickItems(); diff --git a/d2bs/kolbot/libs/common/Config.js b/d2bs/kolbot/libs/common/Config.js index b96799d68..0841f81f1 100644 --- a/d2bs/kolbot/libs/common/Config.js +++ b/d2bs/kolbot/libs/common/Config.js @@ -405,13 +405,18 @@ var Config = { EntranceTP: "Entrance TP up", StarTP: "Star TP up", DiabloMsg: "Diablo", - WalkClear: false + WalkClear: false, + SealOrder: ["vizier", "seis", "infector"], }, DiabloHelper: { Wait: 120, Entrance: false, SkipIfBaal: false, - SkipTP: false + SkipTP: false, + OpenSeals: false, + SafePrecast: true, + SealOrder: ["vizier", "seis", "infector"], + RecheckSeals: false, }, BattleOrders: { Mode: 0, diff --git a/d2bs/kolbot/libs/config/Amazon.js b/d2bs/kolbot/libs/config/Amazon.js index 89f07f635..f30674631 100644 --- a/d2bs/kolbot/libs/config/Amazon.js +++ b/d2bs/kolbot/libs/config/Amazon.js @@ -88,6 +88,7 @@ function LoadConfig() { Config.Diablo.EntranceTP = "Entrance TP up"; Config.Diablo.StarTP = "Star TP up"; Config.Diablo.DiabloMsg = "Diablo"; + Config.Diablo.SealOrder = ["vizier", "seis", "infector"]; // the order in which to clear the seals. If seals are excluded, they won't be checked unless diablo fails to appear Scripts.SealLeader = false; // Clear a safe spot around seals and invite leechers in. Leechers should run SealLeecher script. Don't run with Diablo or FastDiablo. // *** act 5 *** @@ -141,6 +142,10 @@ function LoadConfig() { Config.DiabloHelper.Entrance = true; // Start from entrance. Set to false to start from star. Config.DiabloHelper.SkipTP = false; // Don't wait for town portal and directly head to chaos. It will clear monsters around chaos entrance and wait for the runner. Config.DiabloHelper.SkipIfBaal = false; // End script if there are party members in a Baal run. + Config.DiabloHelper.OpenSeals = false; // Open seals as the helper + Config.DiabloHelper.SafePrecast = true; // take random WP to safely precast + Config.DiabloHelper.SealOrder = ["vizier", "seis", "infector"]; // the order in which to clear the seals. If seals are excluded, they won't be checked unless diablo fails to appear + Config.DiabloHelper.RecheckSeals = false; // Teleport to each seal and double-check that it was opened and boss was killed if Diablo doesn't appear Scripts.AutoBaal = false; // Baal leecher with auto leader assignment Config.AutoBaal.FindShrine = false; // false = disabled, 1 = search after hot tp message, 2 = search as soon as leader is found Config.AutoBaal.LeechSpot = [15115, 5050]; // X, Y coords of Throne Room leech spot diff --git a/d2bs/kolbot/libs/config/Assassin.js b/d2bs/kolbot/libs/config/Assassin.js index 425491951..df4927928 100644 --- a/d2bs/kolbot/libs/config/Assassin.js +++ b/d2bs/kolbot/libs/config/Assassin.js @@ -88,6 +88,7 @@ function LoadConfig() { Config.Diablo.EntranceTP = "Entrance TP up"; Config.Diablo.StarTP = "Star TP up"; Config.Diablo.DiabloMsg = "Diablo"; + Config.Diablo.SealOrder = ["vizier", "seis", "infector"]; // the order in which to clear the seals. If seals are excluded, they won't be checked unless diablo fails to appear Scripts.SealLeader = false; // Clear a safe spot around seals and invite leechers in. Leechers should run SealLeecher script. Don't run with Diablo or FastDiablo. // *** act 5 *** @@ -141,6 +142,10 @@ function LoadConfig() { Config.DiabloHelper.Entrance = true; // Start from entrance. Set to false to start from star. Config.DiabloHelper.SkipTP = false; // Don't wait for town portal and directly head to chaos. It will clear monsters around chaos entrance and wait for the runner. Config.DiabloHelper.SkipIfBaal = false; // End script if there are party members in a Baal run. + Config.DiabloHelper.OpenSeals = false; // Open seals as the helper + Config.DiabloHelper.SafePrecast = true; // take random WP to safely precast + Config.DiabloHelper.SealOrder = ["vizier", "seis", "infector"]; // the order in which to clear the seals. If seals are excluded, they won't be checked unless diablo fails to appear + Config.DiabloHelper.RecheckSeals = false; // Teleport to each seal and double-check that it was opened and boss was killed if Diablo doesn't appear Scripts.AutoBaal = false; // Baal leecher with auto leader assignment Config.AutoBaal.FindShrine = false; // false = disabled, 1 = search after hot tp message, 2 = search as soon as leader is found Config.AutoBaal.LeechSpot = [15115, 5050]; // X, Y coords of Throne Room leech spot diff --git a/d2bs/kolbot/libs/config/Barbarian.js b/d2bs/kolbot/libs/config/Barbarian.js index ba8581b30..42835dc97 100644 --- a/d2bs/kolbot/libs/config/Barbarian.js +++ b/d2bs/kolbot/libs/config/Barbarian.js @@ -88,6 +88,7 @@ function LoadConfig() { Config.Diablo.EntranceTP = "Entrance TP up"; Config.Diablo.StarTP = "Star TP up"; Config.Diablo.DiabloMsg = "Diablo"; + Config.Diablo.SealOrder = ["vizier", "seis", "infector"]; // the order in which to clear the seals. If seals are excluded, they won't be checked unless diablo fails to appear Scripts.SealLeader = false; // Clear a safe spot around seals and invite leechers in. Leechers should run SealLeecher script. Don't run with Diablo or FastDiablo. // *** act 5 *** @@ -141,6 +142,10 @@ function LoadConfig() { Config.DiabloHelper.Entrance = true; // Start from entrance. Set to false to start from star. Config.DiabloHelper.SkipTP = false; // Don't wait for town portal and directly head to chaos. It will clear monsters around chaos entrance and wait for the runner. Config.DiabloHelper.SkipIfBaal = false; // End script if there are party members in a Baal run. + Config.DiabloHelper.OpenSeals = false; // Open seals as the helper + Config.DiabloHelper.SafePrecast = true; // take random WP to safely precast + Config.DiabloHelper.SealOrder = ["vizier", "seis", "infector"]; // the order in which to clear the seals. If seals are excluded, they won't be checked unless diablo fails to appear + Config.DiabloHelper.RecheckSeals = false; // Teleport to each seal and double-check that it was opened and boss was killed if Diablo doesn't appear Scripts.AutoBaal = false; // Baal leecher with auto leader assignment Config.AutoBaal.FindShrine = false; // false = disabled, 1 = search after hot tp message, 2 = search as soon as leader is found Config.AutoBaal.LeechSpot = [15115, 5050]; // X, Y coords of Throne Room leech spot diff --git a/d2bs/kolbot/libs/config/Druid.js b/d2bs/kolbot/libs/config/Druid.js index cdbe5881c..8672fb572 100644 --- a/d2bs/kolbot/libs/config/Druid.js +++ b/d2bs/kolbot/libs/config/Druid.js @@ -88,6 +88,7 @@ function LoadConfig() { Config.Diablo.EntranceTP = "Entrance TP up"; Config.Diablo.StarTP = "Star TP up"; Config.Diablo.DiabloMsg = "Diablo"; + Config.Diablo.SealOrder = ["vizier", "seis", "infector"]; // the order in which to clear the seals. If seals are excluded, they won't be checked unless diablo fails to appear Scripts.SealLeader = false; // Clear a safe spot around seals and invite leechers in. Leechers should run SealLeecher script. Don't run with Diablo or FastDiablo. // *** act 5 *** @@ -141,6 +142,10 @@ function LoadConfig() { Config.DiabloHelper.Entrance = true; // Start from entrance. Set to false to start from star. Config.DiabloHelper.SkipTP = false; // Don't wait for town portal and directly head to chaos. It will clear monsters around chaos entrance and wait for the runner. Config.DiabloHelper.SkipIfBaal = false; // End script if there are party members in a Baal run. + Config.DiabloHelper.OpenSeals = false; // Open seals as the helper + Config.DiabloHelper.SafePrecast = true; // take random WP to safely precast + Config.DiabloHelper.SealOrder = ["vizier", "seis", "infector"]; // the order in which to clear the seals. If seals are excluded, they won't be checked unless diablo fails to appear + Config.DiabloHelper.RecheckSeals = false; // Teleport to each seal and double-check that it was opened and boss was killed if Diablo doesn't appear Scripts.AutoBaal = false; // Baal leecher with auto leader assignment Config.AutoBaal.FindShrine = false; // false = disabled, 1 = search after hot tp message, 2 = search as soon as leader is found Config.AutoBaal.LeechSpot = [15115, 5050]; // X, Y coords of Throne Room leech spot diff --git a/d2bs/kolbot/libs/config/Necromancer.js b/d2bs/kolbot/libs/config/Necromancer.js index 1e2e84c82..6af07461c 100644 --- a/d2bs/kolbot/libs/config/Necromancer.js +++ b/d2bs/kolbot/libs/config/Necromancer.js @@ -88,6 +88,7 @@ function LoadConfig() { Config.Diablo.EntranceTP = "Entrance TP up"; Config.Diablo.StarTP = "Star TP up"; Config.Diablo.DiabloMsg = "Diablo"; + Config.Diablo.SealOrder = ["vizier", "seis", "infector"]; // the order in which to clear the seals. If seals are excluded, they won't be checked unless diablo fails to appear Scripts.SealLeader = false; // Clear a safe spot around seals and invite leechers in. Leechers should run SealLeecher script. Don't run with Diablo or FastDiablo. // *** act 5 *** @@ -141,6 +142,10 @@ function LoadConfig() { Config.DiabloHelper.Entrance = true; // Start from entrance. Set to false to start from star. Config.DiabloHelper.SkipTP = false; // Don't wait for town portal and directly head to chaos. It will clear monsters around chaos entrance and wait for the runner. Config.DiabloHelper.SkipIfBaal = false; // End script if there are party members in a Baal run. + Config.DiabloHelper.OpenSeals = false; // Open seals as the helper + Config.DiabloHelper.SafePrecast = true; // take random WP to safely precast + Config.DiabloHelper.SealOrder = ["vizier", "seis", "infector"]; // the order in which to clear the seals. If seals are excluded, they won't be checked unless diablo fails to appear + Config.DiabloHelper.RecheckSeals = false; // Teleport to each seal and double-check that it was opened and boss was killed if Diablo doesn't appear Scripts.AutoBaal = false; // Baal leecher with auto leader assignment Config.AutoBaal.FindShrine = false; // false = disabled, 1 = search after hot tp message, 2 = search as soon as leader is found Config.AutoBaal.LeechSpot = [15115, 5050]; // X, Y coords of Throne Room leech spot diff --git a/d2bs/kolbot/libs/config/Paladin.js b/d2bs/kolbot/libs/config/Paladin.js index 22f64187e..52198105d 100644 --- a/d2bs/kolbot/libs/config/Paladin.js +++ b/d2bs/kolbot/libs/config/Paladin.js @@ -88,6 +88,7 @@ function LoadConfig() { Config.Diablo.EntranceTP = "Entrance TP up"; Config.Diablo.StarTP = "Star TP up"; Config.Diablo.DiabloMsg = "Diablo"; + Config.Diablo.SealOrder = ["vizier", "seis", "infector"]; // the order in which to clear the seals. If seals are excluded, they won't be checked unless diablo fails to appear Scripts.SealLeader = false; // Clear a safe spot around seals and invite leechers in. Leechers should run SealLeecher script. Don't run with Diablo or FastDiablo. // *** act 5 *** @@ -141,6 +142,10 @@ function LoadConfig() { Config.DiabloHelper.Entrance = true; // Start from entrance. Set to false to start from star. Config.DiabloHelper.SkipTP = false; // Don't wait for town portal and directly head to chaos. It will clear monsters around chaos entrance and wait for the runner. Config.DiabloHelper.SkipIfBaal = false; // End script if there are party members in a Baal run. + Config.DiabloHelper.OpenSeals = false; // Open seals as the helper + Config.DiabloHelper.SafePrecast = true; // take random WP to safely precast + Config.DiabloHelper.SealOrder = ["vizier", "seis", "infector"]; // the order in which to clear the seals. If seals are excluded, they won't be checked unless diablo fails to appear + Config.DiabloHelper.RecheckSeals = false; // Teleport to each seal and double-check that it was opened and boss was killed if Diablo doesn't appear Scripts.AutoBaal = false; // Baal leecher with auto leader assignment Config.AutoBaal.FindShrine = false; // false = disabled, 1 = search after hot tp message, 2 = search as soon as leader is found Config.AutoBaal.LeechSpot = [15115, 5050]; // X, Y coords of Throne Room leech spot diff --git a/d2bs/kolbot/libs/config/Sorceress.js b/d2bs/kolbot/libs/config/Sorceress.js index 6852b39a5..a9994166a 100644 --- a/d2bs/kolbot/libs/config/Sorceress.js +++ b/d2bs/kolbot/libs/config/Sorceress.js @@ -88,6 +88,7 @@ function LoadConfig() { Config.Diablo.EntranceTP = "Entrance TP up"; Config.Diablo.StarTP = "Star TP up"; Config.Diablo.DiabloMsg = "Diablo"; + Config.Diablo.SealOrder = ["vizier", "seis", "infector"]; // the order in which to clear the seals. If seals are excluded, they won't be checked unless diablo fails to appear Scripts.SealLeader = false; // Clear a safe spot around seals and invite leechers in. Leechers should run SealLeecher script. Don't run with Diablo or FastDiablo. // *** act 5 *** @@ -141,6 +142,10 @@ function LoadConfig() { Config.DiabloHelper.Entrance = true; // Start from entrance. Set to false to start from star. Config.DiabloHelper.SkipTP = false; // Don't wait for town portal and directly head to chaos. It will clear monsters around chaos entrance and wait for the runner. Config.DiabloHelper.SkipIfBaal = false; // End script if there are party members in a Baal run. + Config.DiabloHelper.OpenSeals = false; // Open seals as the helper + Config.DiabloHelper.SafePrecast = true; // take random WP to safely precast + Config.DiabloHelper.SealOrder = ["vizier", "seis", "infector"]; // the order in which to clear the seals. If seals are excluded, they won't be checked unless diablo fails to appear + Config.DiabloHelper.RecheckSeals = false; // Teleport to each seal and double-check that it was opened and boss was killed if Diablo doesn't appear Scripts.AutoBaal = false; // Baal leecher with auto leader assignment Config.AutoBaal.FindShrine = false; // false = disabled, 1 = search after hot tp message, 2 = search as soon as leader is found Config.AutoBaal.LeechSpot = [15115, 5050]; // X, Y coords of Throne Room leech spot