Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @filename boChantCS.js
- * @author darjkeel
- * @desc Bo and enchant other players, add/remove helper(s) to clear
- **/
- function XPboChantCS() {
- var chSorc = "HydroPKEAST", // CHAR name of enchant sorc
- boBarb = "WWHxC", // CHAR name of BO barbarian
- chCommands = ["enchant", "chant"], // list of commands to chant player, use only lowercase letters
- boCommands = ["battle orders", "bo"], // list of commands to BO the player, use only lowercase letters
- helpChars = ["HydroPKing",""], // CHAR name(s) of helper(s) e.g. ["char"], or ["char1", "char2"], 2 chars max
- helpProfs = ["",""], // PROFILE name(s) of helper(s) e.g. ["profile"] or ["profile1", "profile2"]
- helpStartCommands = ["request help"], // list of commands to start a helper, use only lowercase letters
- helpStopCommands = [""], // list of commands to stop a helper, use only lowercase letters
- clearMode = 0, // helper clear mode: 0 = all, 0xF = skip normal, 0x7 = just champion/uniques (no minions)
- gameLength = 7, // maximum game length, in minutes. leave = 0 for infinite
- teleMessage = "", // message from barb while sorc teleports to star
- starMessage = "", // message from sorc after opening portal at star
- homeMessage = "", // message from sorc after returning to pandy fort; this is when command listeners start
- endGameMessage = "", // message at the end of the game
- needGoldMsg = "", // message used when low on gold to ask players for more
- checkShrineBo = false, // check for bo shrines in the immediate area when bo'ing
- openSeisSeal = false, // open seis seal when teleporting to star
- pickitDiablo = true, // to pick or not to pick, that is the question
- moveJamella = true, // whether or not sorc should drag jamella closer to portals
- moveHalbu = true, // whether or not sorc should drag halbu closer to portals
- shitList = ShitList.read(),
- vizLayout, seisLayout, infLayout, command, i;
- this.find = function(nick) {
- var unit = getUnit(0, nick);
- if (unit) return unit.area;
- var party = getParty();
- if (!party) return false;
- do {
- if (party.name == nick) {
- return (party.area > 0) ? party.area : true;
- }
- } while (party.getNext());
- return false;
- }
- this.chant = function(nick) {
- var chanted = [];
- if (nick) {
- if (!Misc.inMyParty(nick)) {
- say("Accept party invite.");
- return false;
- }
- var unit = getUnit(0, nick);
- if (!unit || getDistance(me, unit) > 40) {
- say("Get closer.");
- return false;
- }
- }
- if (!nick) var unit = getUnit(0);
- if (unit) {
- do {
- if (unit.name !== me.name && !unit.dead && shitList.indexOf(unit.name) === -1 && Misc.inMyParty(unit.name) && (!unit.getState(16) || nick) && getDistance(me, unit) <= 40) {
- Skill.setSkill(52, 0);
- sendPacket(1, 0x11, 4, unit.type, 4, unit.gid);
- delay(500);
- chanted.push(unit.name);
- }
- } while (unit.getNext());
- }
- unit = getUnit(1);
- if (unit) {
- do {
- if (unit.getParent() && chanted.indexOf(unit.getParent().name) > -1 && (!unit.getState(16) || nick) && getDistance(me, unit) <= 40) {
- Skill.setSkill(52, 0);
- sendPacket(1, 0x11, 4, unit.type, 4, unit.gid);
- delay(500);
- }
- } while (unit.getNext());
- }
- return true;
- }
- this.grabBoShrine = function() {
- if (me.area == 107) {
- if (!me.getState(134)) {
- var spot = [me.x, me.y],
- shrine = getUnit(2, "shrine");
- if (shrine && shrine.objtype === 12) {
- Misc.getShrine(shrine);
- Pather.moveTo(spot[0], spot[1]);
- if (me.getState(134)) return true;
- }
- }
- }
- return false;
- }
- this.bo = function(nick) {
- while (me.area < 107) {
- Pather.usePortal(108, chSorc);
- delay(777777777);
- }
- if (nick) {
- if (!Misc.inMyParty(nick)) {
- say("Accept party invite.");
- return false;
- }
- if (this.find(nick) != 108) {
- say("Ask for bo again when you're at the star.");
- return false;
- }
- var unit = getUnit(0, nick);
- if (getDistance(me, unit) > 20) {
- say("Get closer.");
- return false;
- }
- }
- if (!nick) var unit = getUnit(0);
- if (unit) {
- do {
- if (unit.name !== me.name && !unit.dead && shitList.indexOf(unit.name) === -1 && Misc.inMyParty(unit.name) && ((!unit.getState(26) || !unit.getState(32) || !unit.getState(51)) || nick) && getDistance(me, unit) <= 20) {
- if (checkShrineBo) {
- if (this.grabBoShrine()) say("Bo shrine activated");
- }
- Precast.doPrecast(true);
- }
- } while (unit.getNext());
- }
- return true;
- }
- this.checkHostiles = function() {
- var rval = false,
- party = getParty();
- if (party) {
- do {
- if (party.name !== me.name && getPlayerFlag(me.gid, party.gid, 8)) {
- rval = true;
- if (Config.ShitList && shitList.indexOf(party.name) === -1) shitList.push(party.name);
- }
- } while (party.getNext());
- }
- return rval;
- }
- this.openSeal = function(id) {
- var seal = getUnit(2, id);
- if (seal && seal.mode != 0) return false;
- Pather.moveToPreset(108, 2, id, 4);
- var seal = getUnit(2, id);
- if (!seal) return false;
- i = 0;
- while (!seal.mode) {
- if (!Skill.cast(43, 0, seal)) seal.interact();
- delay(100);
- if (seal.mode == 0) {
- delay(400);
- i++
- }
- if (i > 30) return false;
- }
- return true;
- }
- this.getLayout = function(seal, value) {
- var sealPreset = getPresetUnit(108, 2, seal);
- if (!seal) {
- throw new Error("Seal preset not found.");
- }
- if (sealPreset.roomy * 5 + sealPreset.y === value || sealPreset.roomx * 5 + sealPreset.x === value) {
- return 1;
- }
- return 2;
- }
- this.initLayout = function() {
- vizLayout = getLayout(396, 5275); // 1 = "Y", 2 = "L"
- seisLayout = getLayout(394, 7773); // 1 = "2", 2 = "5"
- infLayout = getLayout(392, 7893); // 1 = "I", 2 = "J"
- }
- this.helperChaos = function() {
- this.helpAct = function(act, x, y) {
- if (act == "move") {
- var xPath = (clearMode == 0) ? true : false;
- Pather.moveTo(x, y, 3, xPath);
- Attack.clear(30, clearMode);
- }
- else if (act == "seal") {
- if (openSeal(x) == true) {
- if (y >= 1) delay(1000 * y);
- }
- }
- else if (act == "Infector of Souls" || act == "Lord de Seis" || act == "Grand Vizier of Chaos") {
- var boss = getUnit(1, act);
- if (!boss) {
- Pather.moveTo(x, y, 3, xPath);
- Attack.clear(30, clearMode);
- }
- boss = getUnit(1, act);
- if (boss) {
- if (boss.hp <= 0 || boss.mode == 0 || boss.mode == 12) {}
- else Attack.clear(30, clearMode, act);
- }
- }
- else if (act == "Diablo") {
- for (i = 0; i < 40; i++) {
- if (!getUnit(1, 243)) {
- Town.goToTown()
- Town.move("waypoint");
- Pather.useWaypoint(4, true);
- Town.goToTown();
- Pather.usePortal(null, "HydroPKHB");
- delay(me.ping*2 + 100);
- Misc.getShrinesInArea(me.area, 15, true);
- Pather.usePortal(null, null);
- Pather.usePortal(null, me.name);
- Pather.useWaypoint(103, true);
- Town.move("portalspot");
- }
- Town.goToTown(4);
- while(!Pather.usePortal(108, null)) {
- delay(100);
- }
- }
- while (Attack.kill(243));
- if (!pickitDiablo) delay(100);
- Pickit.pickItems();
- }
- else throw new Error("Invalid helpAct");
- }
- for (i = 1; i < 121; i++) {
- delay(1000);
- if (i%10 == 0 && !Misc.inMyParty(chSorc)) quit();
- if (Pather.usePortal(108, chSorc) || me.area == 108) break;
- }
- for (i = 1; !me.getState(32); i++) {
- delay(1000);
- if (i%3 == 0) {
- say("bo");
- if (!Misc.inMyParty(boBarb)) quit();
- }
- }
- Precast.doPrecast(false);
- Attack.clear(15);
- initLayout();
- var preFect = ["move", 7825, 5294, "move", 7843, 5294, "move", 7861, 5294];
- var Fect = (infLayout == 1) ? ["move", 7890, 5295, "move", 7915, 5290, "seal", 392, 1, "Infector of Souls", 7890, 5295, "Infector of Souls", 7915, 5290, "seal", 393, 0] : ["move", 7900, 5275, "move", 7930, 5280, "move", 7930, 5310, "seal", 392, 1, "move", 7930, 5310, "Infector of Souls", 7930, 5280, "Infector of Souls", 7900, 5275, "seal", 393, 0];
- var preSeis = ["move", 7794, 5265, "move", 7794, 5245, "move", 7794, 5225];
- var Seis2 = (openSeisSeal) ? ["move", 7775, 5210, "move", 7775, 5195, "Lord de Seis", 7775, 5195, "Lord de Seis", 7775, 5210] : ["move", 7775, 5210, "move", 7775, 5195, "move", 7810, 5190, "move", 7810, 5155, "move", 7785, 5155, "seal", 394, 1, "Lord de Seis", 7775, 5195, "Lord de Seis", 7775, 5210];
- var Seis5 = (openSeisSeal) ? ["move", 7810, 5195, "move", 7780, 5190, "move", 7775, 5155, "Lord de Seis", 7775, 5155, "Lord de Seis", 7780, 5190, "move", 7780, 5190, "move", 7810, 5195] : ["move", 7810, 5195, "move", 7780, 5190, "move", 7775, 5155, "move", 7805, 5155, "seal", 394, 1, "Lord de Seis", 7775, 5155, "Lord de Seis", 7780, 5190, "move", 7780, 5190, "move", 7810, 5195];
- var Seis = (seisLayout == 1) ? Seis2 : Seis5;
- var preVizi = ["move", 7765, 5294, "move", 7745, 5294, "move", 7715, 5294];
- var Vizi = (vizLayout == 1) ? ["move", 7680, 5290, "move", 7665, 5275, "seal", 396, 2, "Grand Vizier of Chaos", 7665, 5275, "Grand Vizier of Chaos", 7680, 5290, "seal", 395, 0] : ["move", 7700, 5315, "move", 7670, 5315, "seal", 396, 2, "Grand Vizier of Chaos", 7670, 5315, "Grand Vizier of Chaos", 7700, 5315, "seal", 395, 0];
- var preDia = ["move", 7765, 5294, "move", 7794, 5294, "Diablo", 666, 999];
- var helpActQueue = preFect;
- helpActQueue = helpActQueue.concat(Fect);
- helpActQueue = helpActQueue.concat(preSeis);
- helpActQueue = helpActQueue.concat(Seis);
- helpActQueue = helpActQueue.concat(preVizi);
- helpActQueue = helpActQueue.concat(Vizi);
- helpActQueue = helpActQueue.concat(preDia);
- for (var j = 1; helpActQueue.length > j; j += 3) {
- this.helpAct(helpActQueue[j - 1], helpActQueue[j], helpActQueue[j + 1]);
- delay(100);
- }
- }
- this.comeCloser = function(i) {
- if (i >= 0 && i < 50) Pather.moveTo(5085, 5045);
- if (i >= 50 && i < 80) Pather.moveTo(5079, 5044);
- if (i >= 80 && i < 130) Pather.moveTo(5067, 5042);
- if (i >= 130 && i < 150) Pather.moveTo(5061, 5041);
- if (i >= 150 && i < 180) Pather.moveTo(5055, 5040);
- if (moveJamella && i%10 == 0) Packet.moveNPC(getUnit(1, "Jamella"), me.x, me.y + 3);
- if (moveHalbu && i%10 == 0) Packet.moveNPC(getUnit(1, "Halbu"), me.x, me.y - 1);
- }
- this.needGold = function() {
- if (me.getStat(14) + me.getStat(15) <= 10000) {
- for (i = 0; me.getStat(14) + me.getStat(15) <= 10000; i++) {
- if (i%150 == 0) {
- var goldMsg = (needGoldMsg) ? needGoldMsg : "i need some gold";
- say(goldMsg)
- }
- var gold = getUnit(4, 523, 3);
- if (gold) Pickit.pickItem(gold);
- delay(100);
- }
- Town.stash();
- }
- return true;
- }
- function GameEvent(mode, param1, param2, name1, name2) {
- switch (mode) {
- case 0x00:
- if (name1 == boBarb || name1 == chSorc) {
- quit();
- break;
- }
- case 0x01:
- if (name1 == boBarb || name1 == chSorc) {
- quit();
- break;
- }
- case 0x03:
- if (name1 == boBarb || name1 == chSorc) {
- quit();
- break;
- }
- }
- }
- function ChatEvent(nick, msg) {
- command = [msg, nick];
- }
- Town.goToTown(4);
- Town.doChores();
- Town.move("portalspot");
- if (helpChars.indexOf(me.name) > -1) {
- this.helperChaos();
- }
- if (me.name == boBarb) {
- for (i = 0; i < 600; i++) {
- if (Misc.inMyParty(chSorc)) break;
- delay(100);
- }
- if (!Misc.inMyParty(chSorc)) quit();
- addEventListener("gameevent", GameEvent);
- this.needGold();
- for (i = 0; me.area != 107; i++) {
- Pather.usePortal(107, chSorc);
- if (i > 9) quit();
- delay(100);
- }
- while (this.find(chSorc) != 108) {
- this.bo();
- delay(100);
- }
- say(teleMessage);
- Pather.useWaypoint(103);
- Town.move("portalspot");
- for (i = 0; me.area != 108; i++) {
- Pather.usePortal(108, chSorc);
- if (i > 9) quit();
- delay(100);
- }
- for (i = 0; i < 150; i++) {
- this.bo();
- delay(100);
- }
- Pather.usePortal(103, chSorc);
- addEventListener("chatmsg", ChatEvent);
- var check = 1;
- while (true) {
- if (command) {
- var cmd = command[0].toLowerCase();
- if (boCommands.indexOf(cmd) > -1) {
- this.checkHostiles();
- if (shitList.indexOf(command[1]) == -1) {
- this.bo(command[1]);
- }
- else if (shitList.indexOf(command[1]) > -1) say("Sorry, " + command[1] + " you're on my shitList.");
- }
- if (helpStartCommands.indexOf(cmd) > -1) {
- this.checkHostiles();
- if (shitList.indexOf(command[1]) == -1) {
- if (helpChars[0] && !this.find(helpChars[0])) {
- D2Bot.start(helpProfs[0]);
- say("Calling helper " + helpChars[0]);
- }
- else if (helpChars[1] && !this.find(helpChars[1])) {
- D2Bot.start(helpProfs[1]);
- say("Calling helper " + helpChars[1]);
- }
- else say("All the help is here.");
- }
- else if (shitList.indexOf(command[1]) > -1) say("Sorry, " + command[1] + " you're on my shitList.");
- }
- if (helpStopCommands.indexOf(cmd) > -1) {
- this.checkHostiles();
- if (shitList.indexOf(command[1]) == -1) {
- if (Misc.inMyParty(helpChars[0])) {
- D2Bot.stop(helpProfs[0]);
- say("Dismissed helper " + helpChars[0]);
- }
- else if (Misc.inMyParty(helpChars[1])) {
- D2Bot.stop(helpProfs[1]);
- say("Dismissed helper " + helpChars[1]);
- }
- else say("What help?");
- }
- else if (shitList.indexOf(command[1]) > -1) say("Sorry, " + command[1] + " you're on my shitList.");
- }
- command = false;
- }
- if (!Misc.inMyParty(chSorc)) break;
- if (gameLength > 0) {
- if (getTickCount() - me.gamestarttime >= gameLength * 6e4) break;
- }
- if (check%30 == 0) {
- Pather.usePortal(108, chSorc);
- this.bo();
- var diablo;
- if (getUnit(1, 243)) {
- while (true) {
- diablo = getUnit(1, 243);
- if (diablo.hp < 0 || diablo.mode == 0 || diablo.mode == 12) break;
- delay(5);
- }
- if (pickitDiablo) Pickit.pickItems();
- if (endGameMessage) say(endGameMessage);
- delay(100);
- break;
- }
- else {
- Pather.usePortal(103, chSorc);
- }
- }
- delay(100);
- check++;
- }
- }
- if (me.name == chSorc) {
- for (i = 0; i < 200; i++) {
- if (Misc.inMyParty(boBarb)) break;
- delay(100);
- }
- if (!Misc.inMyParty(boBarb)) quit();
- addEventListener("gameevent", GameEvent);
- this.needGold();
- Town.move("waypoint");
- me.cancel();
- Pather.useWaypoint(107);
- Pather.moveTo(me.x+3, me.y+3);
- Pather.makePortal();
- while (!me.getState(32)) delay(100);
- Precast.doPrecast(true);
- Pather.moveTo(7792, 5291, 3);
- if (openSeisSeal) {
- this.openSeal(394);
- Pather.moveTo(7792, 5291);
- }
- Pather.makePortal();
- say(starMessage);
- for (i = 0; i < 150; i++) {
- this.chant();
- delay(100);
- }
- Pather.usePortal(103, me.name);
- say(homeMessage);
- addEventListener("chatmsg", ChatEvent);
- var moveStage = 0;
- while (true) {
- if (command) {
- var cmd = command[0].toLowerCase();
- if (chCommands.indexOf(cmd) > -1) {
- this.checkHostiles();
- if (shitList.indexOf(command[1]) == -1) {
- this.chant(command[1]);
- }
- else if (shitList.indexOf(command[1]) > -1) say("Sorry, " + command[1] + " you're on my shitList.");
- }
- if (cmd == "help") {
- this.checkHostiles();
- if (shitList.indexOf(command[1]) > -1) say("No help for the shitListed.");
- else {
- if (chCommands) say("Chant command(s): " + chCommands);
- if (boCommands) say("BO command(s): " + boCommands);
- if (helpChars && helpProfs && helpStartCommands) say("To start a helper: " + helpStartCommands);
- if (helpChars && helpProfs && helpStopCommands) say("To stop a helper: " + helpStopCommands);
- }
- }
- command = false;
- }
- if (!Misc.inMyParty(boBarb)) break;
- if (gameLength > 0) {
- if (getTickCount() - me.gamestarttime >= gameLength * 6e4) break;
- }
- this.chant();
- if (moveJamella || moveHalbu) this.comeCloser(moveStage);
- delay(100);
- moveStage++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement