Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Universal Baal leecher by Kolton with Autoleader by Ethic
- Pure leech script for throne and Baal
- Reenters throne/chamber upon death and picks the corpse back up
- Make sure you setup safeMsg and baalMsg accordingly
- */
- function NT_AutoBaal() {
- // editable variables
- var safeMsg = ["safe", "throne clear", "leechers can come", "tp is up", "1 clear"], // safe message - casing doesn't matter
- baalMsg = ["baal"], // baal message - casing doesn't matter
- // internal variables
- i, baalCheck, throneCheck, leader, suspect, solofail, portal;
- addEventListener('chatmsg', // chat event, listen to what leader says
- function (nick, msg) { // handler function
- if (nick === leader) { // filter leader messages
- for (i = 0; i < safeMsg.length; i = i + 1) { // loop through all predefined messages to find a match
- if (msg.toLowerCase().indexOf(safeMsg[i]) > -1) { // leader says a safe message
- throneCheck = true; // safe to enter throne
- break;
- }
- }
- for (i = 0; i < baalMsg.length; i = i + 1) { // loop through all predefined messages to find a match
- if (msg.toLowerCase().indexOf(baalMsg[i]) > -1) { // leader says a baal message
- baalCheck = true; // safe to enter baal chamber
- break;
- }
- }
- }
- }
- );
- function AutoLeaderDetect(destination) { // autoleader by Ethic
- do {
- solofail = 0;
- suspect = getParty(); // get party object (players in game)
- do {
- if (suspect.name !== me.name) { // player isn't alone
- solofail = solofail + 1;
- }
- if (suspect.area === destination) { // first player in our party found in destination area...
- leader = suspect.name; // ... is our leader
- print("ÿc4AutoBaal: ÿc0Autodetected " + leader);
- return true;
- }
- } while (suspect.getNext());
- if (solofail === 0) { // empty game, nothing left to do
- return false;
- }
- NTC_Delay(500);
- } while (!leader); // repeat until leader is found (or until game is empty)
- return false;
- }
- // shrine hunter add-on
- FindXPShrine();
- if (!NTTM_CheckAct(5)) {
- throw new Error("NTTM_CheckAct failed."); // critical error - can't reach harrogath
- }
- NTTMGR_TownManager();
- NTTM_TownMove("portalspot");
- if (AutoLeaderDetect(131)) { // find the first player in area 131 - throne of destruction
- while (NTC_InMyParty(leader)) { // do our stuff while partied
- if (throneCheck && me.area === 109) { // wait for throne signal - leader's safe message
- print("ÿc4AutoBaal: ÿc0Trying to take TP to throne.");
- NTM_UsePortal("BluePortal", 131, leader); // take TP to throne
- NTC_Delay(500);
- NTM_MoveTo(15113, 5050); // move to a safe spot
- NTP_DoPrecast(true);
- NTT_GetCorpses(); // check for corpse - happens if you die and reenter
- }
- if (baalCheck && me.area === 131) { // wait for baal signal - leader's baal message
- NTM_MoveTo(15092, 5010); // move closer to chamber portal
- NTP_DoPrecast(true);
- while (NTC_GetUnit(NTC_UNIT_MONSTER, 543)) { // wait for baal to go through the portal
- NTC_Delay(500);
- }
- portal = NTC_GetUnit(NTC_UNIT_OBJECT, 563);
- NTC_Delay(5000); // wait for others to enter first - helps with curses and tentacles from spawning around you
- print("ÿc4AutoBaal: ÿc0Entering chamber.");
- if (NTM_UsePortal("Portal", 132, null, portal)) { // enter chamber
- NTM_MoveTo(15166, 5903); // go to a safe position
- }
- NTT_GetCorpses(); // check for corpse - happens if you die and reenter
- }
- if (me.mode === 0 || me.mode === 17) { // death check
- NTC_Delay(1500);
- me.revive(); // revive if dead
- }
- NTC_Delay(500);
- }
- } else {
- throw new Error("Empty game.");
- }
- return true;
- }
- // shrine hunter functions
- function FindXPShrine() {
- if (!NTTM_TownMove("waypoint")) {
- return false;
- }
- if (!NTM_UsePortal("Waypoint", 4)) {
- return false;
- }
- if (!FindShrines(4)) {
- if (!FindShrines(3)) {
- if (!FindShrines(2)) {
- NTTM_CheckAct();
- me.overhead("No XP shrines :(");
- return true;
- }
- }
- }
- me.overhead("Shrine found!");
- return true;
- }
- function FindShrines(area) {
- var i, n, room, shrine,
- ShrineIds = [2, 81, 83],
- ShrineLocs = [],
- unit = getPresetUnits(area);
- if (unit) {
- for (i = 0; i < unit.length; i += 1) {
- for (n = 0; n < ShrineIds.length; n = n + 1) {
- if (ShrineIds[n] === unit[i].id) {
- ShrineLocs.push([unit[i].roomx * 5 + unit[i].x, unit[i].roomy * 5 + unit[i].y]);
- }
- }
- }
- }
- while (ShrineLocs.length > 0) {
- ShrineLocs.sort(Sort);
- room = ShrineLocs.shift();
- NTM_MoveTo(room[0] + 3, room[1]);
- shrine = NTC_GetUnit(NTC_UNIT_OBJECT);
- if (shrine) {
- do {
- if (shrine.objtype === 15 && getDistance(me, shrine) <= 10) {
- for (i = 0; i < 30; i += 1) {
- if (i % 10 === 0 && NTM_GetCloserInt(shrine)) {
- shrine.interact()
- }
- NTC_Delay(200);
- if (shrine.mode) {
- NTTM_CheckAct();
- return true;
- }
- }
- }
- } while (shrine.getNext());
- }
- }
- return false;
- }
- function Sort (a, b) {
- return (getDistance(me.x, me.y, a[0], a[1]) - getDistance(me.x, me.y, b[0], b[1]));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement