Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @filename boChantCS.js
- * @author darjamalos von keelinstein
- * @desc Bo and enchant other players, add/remove helper(s) to clear
- **/
- function boChantCS() {
- var chSorc = "Erwin_Rommel", // CHAR name of enchant sorc
- boBarb = "BYOB", // CHAR name of BO barbarian
- chCommands = ["chant"], // list of commands to chant player, use only lowercase letters
- boCommands = ["bo"], // list of commands to BO the player, use only lowercase letters
- helpChars = ["geothermal" , "skynyrd"], // CHAR name(s) of helper(s) e.g. ["char"], or ["char1", "char2"], 2 chars max
- helpProfs = ["agility." ,"hillbilly"], // PROFILE name(s) of helper(s) e.g. ["profile"] or ["profile1", "profile2"]
- helpStartCommands = [""], // list of commands to start a helper, use only lowercase letters
- helpStopCommands = ["asdfghjkl"], // 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 = 9, // maximum game length, in minutes. leave = 0 for infinite
- teleMessage = "get ready!", // message from barb while sorc teleporting to star
- starMessage = "Star TP up", // message from sorc after opening portal at star
- homeMessage = "", // message from sorc after returning to pandy fort; this is when command listeners start
- endGameMessage = "ok guys lets start over!", // message at the end of the game
- needGoldMsg = "bring me gold please! drop close in front of me!", // message used when low on gold to ask players for more
- checkShrineBo = true, // check for bo shrines in the immediate area when bo'ing
- openSeisSeal = true, // 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(100);
- }
- 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) {
- 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() {
- 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);
- initLayout();
- Attack.clear(15);
- Pather.moveTo(7825, 5294);
- Attack.clear(30, clearMode);
- Pather.moveTo(7843, 5294);
- Attack.clear(30, clearMode);
- Pather.moveTo(7861, 5294);
- Attack.clear(30, clearMode);
- if (infLayout == 1) { // "I"
- Pather.moveTo(7890, 5295);
- Attack.clear(30, clearMode);
- Pather.moveTo(7915, 5290);
- Attack.clear(30, clearMode);
- this.openSeal(392);
- delay(500);
- Pather.moveTo(7890, 5295);
- if (getUnit(1, getLocaleString(2853))) Attack.clear(30, clearMode, getLocaleString(2853))
- else {
- Attack.clear(30, clearMode);
- Pather.moveTo(7915, 5290);
- (getUnit(1, getLocaleString(2853))) ? Attack.clear(30, clearMode, getLocaleString(2853)) : Attack.clear(30, clearMode);
- }
- this.openSeal(393);
- }
- if (infLayout == 2) { // "J"
- Pather.moveTo(7900, 5275);
- Attack.clear(30, clearMode);
- Pather.moveTo(7930, 5280);
- Attack.clear(30, clearMode);
- Pather.moveTo(7930, 5310);
- Attack.clear(30, clearMode);
- this.openSeal(392);
- delay(1000);
- Pather.moveTo(7930, 5280);
- if (getUnit(1, getLocaleString(2853))) Attack.clear(30, clearMode, getLocaleString(2853))
- else {
- Attack.clear(30, clearMode);
- Pather.moveTo(7900, 5275);
- (getUnit(1, getLocaleString(2853))) ? Attack.clear(30, clearMode, getLocaleString(2853)) : Attack.clear(30, clearMode);
- }
- this.openSeal(393);
- }
- Pather.moveTo(7794, 5265);
- Attack.clear(30, clearMode);
- Pather.moveTo(7794, 5244);
- Attack.clear(30, clearMode);
- Pather.moveTo(7794, 5215);
- Attack.clear(30, clearMode);
- if (seisLayout == 1) { // "2"
- Pather.moveTo(7775, 5195);
- Attack.clear(30, clearMode);
- if (!openSeisSeal) {
- Pather.moveTo(7810, 5190);
- Attack.clear(30, clearMode);
- Pather.moveTo(7810, 5155);
- Attack.clear(30, clearMode);
- Pather.moveTo(7785, 5155);
- Attack.clear(30, clearMode);
- this.openSeal(394);
- Pather.moveTo(7775, 5195);
- if (getUnit(1, getLocaleString(2852))) Attack.clear(30, clearMode, getLocaleString(2852))
- else {
- Attack.clear(30, clearMode);
- Pather.moveTo(7794, 5215);
- (getUnit(1, getLocaleString(2852))) ? Attack.clear(30, clearMode, getLocaleString(2852)) : Attack.clear(30, clearMode);
- }
- }
- }
- if (seisLayout == 2) { // "5"
- Pather.moveTo(7810, 5195);
- Attack.clear(30, clearMode);
- Pather.moveTo(7780, 5190);
- Attack.clear(30, clearMode);
- Pather.moveTo(7775, 5155);
- Attack.clear(30, clearMode);
- if (!openSeisSeal) {
- Pather.moveTo(7805, 5155);
- Attack.clear(30, clearMode);
- this.openSeal(394);
- Pather.moveTo(7775, 5155);
- if (getUnit(1, getLocaleString(2852))) Attack.clear(30, clearMode, getLocaleString(2852))
- else {
- Attack.clear(30, clearMode);
- Pather.moveTo(7780, 5190);
- (getUnit(1, getLocaleString(2852))) ? Attack.clear(30, clearMode, getLocaleString(2852)) : Attack.clear(30, clearMode);
- }
- }
- Pather.moveTo(7780, 5190);
- Pather.moveTo(7810, 5195);
- }
- Pather.moveTo(7765, 5294);
- Attack.clear(30, clearMode);
- Pather.moveTo(7736, 5294);
- Attack.clear(30, clearMode);
- Pather.moveTo(7700, 5294);
- Attack.clear(30, clearMode);
- if (vizLayout == 1) { // "Y"
- Pather.moveTo(7680, 5290);
- Attack.clear(30, clearMode);
- Pather.moveTo(7665, 5275);
- Attack.clear(30, clearMode);
- this.openSeal(396);
- delay(1000);
- Pather.moveTo(7680, 5290);
- if (getUnit(1, getLocaleString(2851))) Attack.clear(30, clearMode, getLocaleString(2851))
- else {
- Attack.clear(30, clearMode);
- Pather.moveTo(7665, 5310);
- (getUnit(1, getLocaleString(2851))) ? Attack.clear(30, clearMode, getLocaleString(2851)) : Attack.clear(30, clearMode);
- }
- this.openSeal(395);
- }
- if (vizLayout == 2) { // "L"
- Pather.moveTo(7700, 5315);
- Attack.clear(30, clearMode);
- Pather.moveTo(7670, 5315);
- Attack.clear(30, clearMode);
- this.openSeal(396);
- delay(1000);
- if (getUnit(1, getLocaleString(2851))) Attack.clear(30, clearMode, getLocaleString(2851))
- else {
- Attack.clear(30, clearMode);
- Pather.moveTo(7700, 5315);
- if (getUnit(1, getLocaleString(2851))) Attack.clear(30, clearMode, getLocaleString(2851))
- else {
- Attack.clear(30, clearMode);
- Pather.moveTo(7700, 5294);
- (getUnit(1, getLocaleString(2851))) ? Attack.clear(30, clearMode, getLocaleString(2851)) : Attack.clear(30, clearMode);
- }
- }
- this.openSeal(395);
- }
- Pather.moveTo(7794, 5294);
- for (i = 0; i < 40; i++) {
- if (!getUnit(1, 243)) {
- delay(500);
- }
- }
- if (getUnit(1, 243)) Attack.kill(243);
- if (pickitDiablo) Pickit.pickItems();
- }
- 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 - 2);
- }
- 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 < 200; i++) {
- if (Misc.inMyParty(chSorc)) break;
- delay(100);
- }
- if (!Misc.inMyParty(chSorc)) quit();
- addEventListener("gameevent", GameEvent);
- this.needGold();
- while (me.area != 107) {
- Pather.usePortal(107, chSorc);
- delay(100);
- }
- while (this.find(chSorc) != 108) {
- this.bo();
- delay(100);
- }
- say(teleMessage);
- Pather.useWaypoint(103);
- Town.move("portalspot");
- while (me.area != 108) {
- Pather.usePortal(108, chSorc);
- 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);
- 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);
- 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