|
本帖最后由 小渔 于 2017-4-21 09:38 编辑
1、//强化过关脚本//加在强化女巫脚本里替换原来的:
Scripts.Enchant = true;
Config.Enchant.Triggers = ["chant", "cows", "wps", "time left", "givegold", "takegold", "ngvote", "stats"]; // Chat commands for enchant, cow level and waypoint giving etc...
Config.Enchant.GetLeg = true; // Get Wirt's Leg from Tristram. If set to false, it will check for the leg in town.
Config.Enchant.UseLogs = false; // Automatically enchant nearby players and their minions
Config.Enchant.LogName = "normhccl"; //name of chanter used for logging
Config.Enchant.AutoChant = true; // Automatically enchant nearby players and their minions
Config.Enchant.GameLength = 120; // Game length in minutes 因为要强化升级,时间上设了2小时,一般是20分钟,自己改。
Config.Enchant.GoldDrop = 5000; // Gold she drops when users use givegold cmd
Config.Enchant.NGVLength = 7; // Minutes that must pass before allowing people to vote for next game
Config.Enchant.JoinMsg = ""; // Join msg LEAVE BLANK TO DISABLE 说话的都让我去除了。
Config.Enchant.EndMsg = ""; // endgame msg LEAVE BLANK TO DISABLE
Config.Enchant.GiveRc = false; // Do you want to give/take raven claws.
Config.Enchant.GRC = "takerc"; // Command used to grab raven claw
Config.Enchant.DRC = "droprc"; // Command used to grab raven claw
Config.Enchant.LastRc = "Last raven claw was used by "; // Msg calling out last person that used a rc if she is out
Config.Enchant.NoRc = "No raven claws available if you want you can bring me some."; //Msg used if no raven claw is avaliable
Config.Enchant.HaveRc = "Enjoy the raven claw please return it when you are finished."; //Msg used if a raven claw is dropped
Config.Enchant.ThanksRc = "Thanks for returning the raven claw"; // Msg used when a user donates raven claw
Config.Enchant.Rusher = true; //Do you want to rush?
Config.Enchant.Andy = "andy";
Config.Enchant.Cube = "cube";
Config.Enchant.Staff = "staff";
Config.Enchant.Amulet = "amu";
Config.Enchant.Summoner = "sum";
Config.Enchant.Duri = "duri";
Config.Enchant.Trav = "trav";
Config.Enchant.Meph = "meph";
Config.Enchant.Izual = "izu"
Config.Enchant.Diablo = "dia";
Config.Enchant.Shenk = "shen";
Config.Enchant.Anya = "anya";
Config.Enchant.Ancients = "3baba";
Config.Enchant.Baal = "baal";
Config.Enchant.Wayps = [".1-1",".1-2",".1-3",".1-4",".1-5",".1-6" ,".1-7",".1-8",".2-1",".2-2",".2-3",".2-4",".2-5",".2-6",".2-7",".2-8",".3-1",".3-2",".3-3",".3-4" ,".3-5",".3-6" ,".3-7",".3-8",".4-1",".4-2" ,".5-1",".5-2" ,".5-3",".5-4" ,".5-5",".5-6" ,".5-7",".5-8" ];//只会列举法。^_^
2、另建enchant.js文件:
/**
* @filename Enchant.js
* @author kolton
* @desc Enchant other players, open cow portal and give waypoints on command
*/
function Enchant() {
hideConsole();
var command, hostile, nick, spot, tick, s, m,
startTime = getTickCount(),
shitList = [],
playerLevels = {},
playerCount = 0,
chantList = [],
countYes = 0,
countNo = 0,
voted = false,
greet = [];
this.CheckLevel = function () {
var player = getParty();
if (player) {
do {
if (player.name !== me.name) {
if (!playerLevels[player.name]) {
playerLevels[player.name] = player.level;
}
if (player.level > playerLevels[player.name]) {
if (Config.Enchant.UseLogs) {
chantList.push(player.name,"Level");
ChantList.add(player.name,"Level");
chantList.push(Config.Enchant.LogName,"Level");
ChantList.add(Config.Enchant.LogName,"Level")
}
playerLevels[player.name] = player.level;
}
}
} while (player.getNext());
}
};
this.playerIn = function (nick) {
if (nick) {
var _players = getParty();
if (_players) {
while (_players.getNext()) {
if(_players.name == nick) {
if(_players.area == me.area) {
return true;
}
else
{
return false;
}
}
}
}
}
};
this.WebFile = function (state) {
playerCount = 0
var _player = getParty();
if (_player) {
while (_player.getNext()) {
playerCount++;
}
}
Misc.fileAction("logs/webserver/games/"+Config.Enchant.LogName+".txt", 1, "Game: " + me.gamename.toLowerCase() + " Players: " + playerCount + " Status: " + state + "");
};
this.givegold = function (nick) {
var YesFiled = "logs/GaveGold.txt"
var File1d = Misc.fileAction(YesFiled,0)
var resa = File1d.match(nick, "g")
if (resa) {
say("!" + nick + " I already gave you some gold...");
}
else
{
Misc.fileAction("logs/GaveGold.txt",2,""+nick+"")
Town.move("stash");
if (me.getStat(15) + me.getStat(12) >= 200000) {
say("!Giving " + nick + " some gold");
gold(Config.Enchant.GoldDrop)
}
else
{
say("!Sorry " + nick + " im low on gold please bring me some");
}
}
};
this.Vote = function (nick,vote) {
var YesFiled = "logs/Voted.txt"
var File1d = Misc.fileAction(YesFiled,0)
var resa = File1d.match(nick, "g")
if (resa) {
say("!" + nick + " You have already voted...");
}
else
{
Misc.fileAction("logs/Voted.txt",2,""+nick+"")
if (vote === "yes") {
countYes++;
}
if (vote === "no") {
countNo++;
}
}
};
this.takegold = function (nick) {
var gold, stash1, gid1;
gold = getUnit(4, 523);
stash1 = getUnit(2, 267);
if (gold) {
if (getDistance(me, gold) <= 30) {
gid1 = gold.gid;
say("!Thanks for the gold.");
Pickit.pickItem(gold);
return me.getItem(-1, -1, gid1);
Town.move("stash");
}
else
{
say("ut the gold closer to the me.");
}
}
else
{
say("You need to drop some gold first " + nick + "");
}
return true;
};
this.MyStats = function (nick) {
chantList.push(Config.Enchant.LogName,"Mystats");
ChantList.add(Config.Enchant.LogName,"Mystats")
chantList.push(nick,"Mystats");
ChantList.add(nick,"Mystats")
};
this.ngvt = function () {
say("15 second vote started type yes or no.");
Misc.fileAction("logs/Voted.txt",1,"")
voted = true;
countYes = 0;
countNo = 0;
delay(15000);
this.ChkVote();
voted = false;
};
this.chatEvent = function (nick, msg) {
if (nick) {
switch (msg) {
case "yes":
if (voted === true) {
this.Vote(nick,"yes");
}
break;
case "no":
if (voted === true) {
this.Vote(nick,"no");
}
break;
case Config.Enchant.DRC:
if (Config.Enchant.GiveRc) {
this.droprc(nick);
}
else
{
say("Sorry this command is disabled.")
}
break;
case Config.Enchant.GRC:
if (Config.Enchant.GiveRc) {
this.takerc(nick);
}
else
{
say("Sorry this command is disabled.")
}
break;
case Config.Enchant.Andy:
if (Config.Enchant.Rusher) {
if (!Misc.inMyParty(nick)) {
say("Accept party invite, noob.");
return false;
}
this.Andy(nick);
}
else
{
say("Sorry this command is disabled.")
}
break;
case Config.Enchant.Cube:
if (Config.Enchant.Rusher) {
if (!Misc.inMyParty(nick)) {
say("Accept party invite, noob.");
return false;
}
this.Cube(nick);
}
else
{
say("Sorry this command is disabled.")
}
break;
case Config.Enchant.Staff:
if (Config.Enchant.Rusher) {
if (!Misc.inMyParty(nick)) {
say("Accept party invite, noob.");
return false;
}
this.Staff(nick);
}
else
{
say("Sorry this command is disabled.")
}
break;
case Config.Enchant.Amulet:
if (Config.Enchant.Rusher) {
if (!Misc.inMyParty(nick)) {
say("Accept party invite, noob.");
return false;
}
this.Amulet(nick);
}
else
{
say("Sorry this command is disabled.")
}
break;
case Config.Enchant.Summoner:
if (Config.Enchant.Rusher) {
if (!Misc.inMyParty(nick)) {
say("Accept party invite, noob.");
return false;
}
this.Summoner(nick);
}
else
{
say("Sorry this command is disabled.")
}
break;
case Config.Enchant.Duri:
if (Config.Enchant.Rusher) {
if (!Misc.inMyParty(nick)) {
say("Accept party invite, noob.");
return false;
}
this.Duri(nick);
}
else
{
say("Sorry this command is disabled.")
}
break;
case Config.Enchant.Trav:
if (Config.Enchant.Rusher) {
if (!Misc.inMyParty(nick)) {
say("Accept party invite, noob.");
return false;
}
this.Trav(nick);
}
else
{
say("Sorry this command is disabled.")
}
break;
case Config.Enchant.Meph:
if (Config.Enchant.Rusher) {
if (!Misc.inMyParty(nick)) {
say("Accept party invite, noob.");
return false;
}
this.Meph(nick);
}
else
{
say("Sorry this command is disabled.")
}
break;
case Config.Enchant.Izual:
if (Config.Enchant.Rusher) {
if (!Misc.inMyParty(nick)) {
say("Accept party invite, noob.");
return false;
}
this.Izual(nick);
}
else
{
say("Sorry this command is disabled.")
}
break;
case Config.Enchant.Diablo:
if (Config.Enchant.Rusher) {
if (!Misc.inMyParty(nick)) {
say("Accept party invite, noob.");
return false;
}
this.Diablo(nick);
}
else
{
say("Sorry this command is disabled.")
}
break;
case Config.Enchant.Shenk:
if (Config.Enchant.Rusher) {
if (!Misc.inMyParty(nick)) {
say("Accept party invite, noob.");
return false;
}
this.Shenk(nick);
}
else
{
say("Sorry this command is disabled.")
}
break;
case Config.Enchant.Anya:
if (Config.Enchant.Rusher) {
if (!Misc.inMyParty(nick)) {
say("Accept party invite, noob.");
return false;
}
this.Anya(nick);
}
else
{
say("Sorry this command is disabled.")
}
break;
case Config.Enchant.Ancients:
if (Config.Enchant.Rusher) {
if (!Misc.inMyParty(nick)) {
say("Accept party invite, noob.");
return false;
}
this.Ancients(nick);
}
else
{
say("Sorry this command is disabled.")
}
break;
case Config.Enchant.Baal:
if (Config.Enchant.Rusher) {
if (!Misc.inMyParty(nick)) {
say("Accept party invite, noob.");
return false;
}
this.Baal(nick);
}
else
{
say("Sorry this command is disabled.")
}
break;
}
}
};
this.Andy = function (nick) {
say("");
Town.doChores();
Pather.useWaypoint(35, true);
Precast.doPrecast(true);
if (!Pather.moveToExit([36, 37], true) || !Pather.moveTo(22582, 9612)) {
throw new Error("andy failed");
}
Pather.makePortal();
Attack.securePosition(me.x, me.y, 40, 3000, true);
say("anquan");
var failTimer = 30,
tick = getTickCount();
while (!this.playerIn(nick)) {
if (getTickCount() - tick >= failTimer * 1000) {
say("wtf " + nick + " never showed up...")
Pather.usePortal(null, me.name);
Pather.useWaypoint(1, true);
Town.move("waypoint");
return false;
}
Pather.moveTo(22582, 9612);
delay(250);
}
Attack.kill(156);
say("");
Pather.moveTo(22582, 9612);
Pather.usePortal(null, me.name);
Pather.useWaypoint(1, true);
Town.move("waypoint");
return true;
};
this.Cube = function (nick) {
say("");
Pather.useWaypoint(57, true);
Precast.doPrecast(true);
if (!Pather.moveToExit(60, true) || !Pather.moveToPreset(me.area, 2, 354)) {
throw new Error("cube failed");
}
Pather.makePortal();
Attack.securePosition(me.x, me.y, 30, 3000, true);
say("safe");
while (!this.playerIn()) {
delay(100);
}
while (this.playerIn()) {
delay(100);
}
Pather.usePortal(null, me.name);
Pather.useWaypoint(1, true);
Town.move("waypoint");
return true;
};
this.Staff = function (nick) {
say("");
Town.doChores();
Pather.useWaypoint(43, true);
Precast.doPrecast(true);
if (!Pather.moveToExit([62, 63, 64], true) || !Pather.moveToPreset(me.area, 2, 356)) {
throw new Error("staff failed");
}
Pather.makePortal();
Attack.securePosition(me.x, me.y, 30, 3000, true);
say("Staff UP");
Pather.usePortal(null, me.name);
Pather.useWaypoint(1, true);
Town.move("waypoint");
return true;
};
this.Amulet = function (nick) {
say("");
Town.doChores();
Pather.useWaypoint(44, true);
Precast.doPrecast(true);
if (!Pather.moveToExit([45, 58, 61], true) || !Pather.moveTo(15044, 14045)) {
throw new Error("amulet failed");
}
Pather.makePortal();
if (me.diff < 2) {
Attack.securePosition(me.x, me.y, 25, 3000);
} else {
Attack.securePosition(me.x, me.y, 25, 3000, true, true);
}
say("Amulet UP");
Pather.usePortal(null, me.name);
Pather.useWaypoint(1, true);
Town.move("waypoint");
return true;
};
this.Summoner = function (nick) {
say("");
Town.doChores();
Pather.useWaypoint(74, true);
Precast.doPrecast(true);
var i, journal,
preset = getPresetUnit(me.area, 2, 357),
spot = {};
switch (preset.roomx * 5 + preset.x) {
case 25011:
spot = {x: 25081, y: 5446};
break;
case 25866:
spot = {x: 25830, y: 5447};
break;
case 25431:
switch (preset.roomy * 5 + preset.y) {
case 5011:
spot = {x: 25449, y: 5081};
break;
case 5861:
spot = {x: 25447, y: 5822};
break;
}
break;
}
if (!Pather.moveToUnit(spot)) {
throw new Error("summoner failed");
}
Pather.makePortal();
Attack.securePosition(me.x, me.y, 25, 3000);
say("anquan");
var failTimer = 30,
tick = getTickCount();
while (!this.playerIn(nick)) {
if (getTickCount() - tick >= failTimer * 1000) {
say("wtf " + nick + " never showed up...")
Pather.usePortal(null, me.name);
Pather.useWaypoint(1, true);
Town.move("waypoint");
return false;
}
delay(1000);
}
Pather.moveToPreset(me.area, 2, 357);
Attack.kill(250);
say("");
Pickit.pickItems();
Pather.moveToPreset(me.area, 2, 357);
journal = getUnit(2, 357);
for (i = 0; i < 5; i += 1) {
journal.interact();
delay(1000);
me.cancel();
if (Pather.getPortal(46)) {
break;
}
}
if (i === 5) {
throw new Error("summoner failed");
}
Pather.usePortal(46);
Pather.useWaypoint(1, true);
Town.move("waypoint");
return true;
};
this.Duri = function (nick) {
say("");
if (me.inTown) {
Town.doChores();
Pather.useWaypoint(46, true);
}
Precast.doPrecast(true);
if (!Pather.moveToExit(getRoom().correcttomb, true) || !Pather.moveToPreset(me.area, 2, 152)) {
throw new Error("duriel failed");
}
Pather.makePortal();
Attack.securePosition(me.x, me.y, 30, 3000, true, me.diff === 2);
say("Duriel UP");
var failTimer = 30,
tick = getTickCount();
while (!this.playerIn(nick)) {
if (getTickCount() - tick >= failTimer * 1000) {
say("wtf " + nick + " never showed up...")
Pather.usePortal(null, me.name);
Pather.useWaypoint(1, true);
Town.move("waypoint");
return false;
}
//Pather.moveToPreset(me.area, 2, 152, 0, -5);
delay(1000);
}
while (!getUnit(2, 100)) {
delay(1000);
}
Pather.useUnit(2, 100, 73);
Attack.kill(211);
Pickit.pickItems();
say("");
Town.goToTown(1);
Town.move("waypoint");
return true;
};
this.Trav = function (nick) {
say("");
Town.doChores();
Pather.useWaypoint(83, true);
Precast.doPrecast(true);
var coords = [me.x, me.y];
Pather.moveTo(coords[0] + 23, coords[1] - 102);
Pather.makePortal();
Attack.securePosition(me.x, me.y, 40, 3000);
say("Trav UP");
var failTimer = 30,
tick = getTickCount();
while (!this.playerIn(nick)) {
delay(250);
if (getTickCount() - tick >= failTimer * 1000) {
say("wtf " + nick + " never showed up...")
Pather.usePortal(null, me.name);
Pather.useWaypoint(1, true);
Town.move("waypoint");
return false;
}
}
Pather.moveTo(coords[0] + 30, coords[1] - 134);
Pather.moveTo(coords[0] + 86, coords[1] - 130);
Pather.moveTo(coords[0] + 71, coords[1] - 94);
Attack.securePosition(me.x, me.y, 40, 3000);
/*Attack.kill(getLocaleString(2863));
Attack.kill(getLocaleString(2862));
Attack.kill(getLocaleString(2860));*/
say("");
Pather.moveTo(coords[0] + 23, coords[1] - 102);
Pather.usePortal(null, me.name);
Town.goToTown(1);
Town.move("waypoint");
return true;
};
this.Meph = function (nick) {
say("");
Town.doChores();
Pather.useWaypoint(101, true);
Precast.doPrecast(true);
Pather.moveToExit(102, true);
Pather.moveTo(17591, 8070);
Pather.makePortal();
say("Meph UP");
var failTimer = 30,
tick = getTickCount();
while (!this.playerIn(nick)) {
delay(250);
if (getTickCount() - tick >= failTimer * 1000) {
say("wtf " + nick + " never showed up...")
Pather.usePortal(null, me.name);
Pather.useWaypoint(1, true);
Town.move("waypoint");
return false;
}
}
Attack.kill(242);
Pickit.pickItems();
Pather.makePortal();
say("");
Pather.usePortal(null);
Town.goToTown(1);
Town.move("waypoint");
return true;
};
this.Izual = function (nick) {
var tyrael;
Pather.useWaypoint(106, true);
Precast.doPrecast(true);
if (!Pather.moveToPreset(105, 1, 256)) {
return false;
}
Pather.makePortal();
Town.goToTown();
say("izual");
Town.doChores();
delay(4000);
Pather.usePortal(null, me.name);
Attack.kill(256); // Izual
Town.goToTown(1);
Town.move("waypoint");
return true;
};
this.Diablo = function (nick) {
say("");
this.getLayout = function (seal, value) {
var sealPreset = getPresetUnit(108, 2, seal);
if (!seal) {
throw new Error("Seal preset not found. Can't continue.");
}
if (sealPreset.roomy * 5 + sealPreset.y === value || sealPreset.roomx * 5 + sealPreset.x === value) {
return 1;
}
return 2;
};
this.initLayout = function () {
this.vizLayout = this.getLayout(396, 5275);
this.seisLayout = this.getLayout(394, 7773);
this.infLayout = this.getLayout(392, 7893);
};
this.getBoss = function (name) {
var i, boss,
glow = getUnit(2, 131);
for (i = 0; i < (name === getLocaleString(2853) ? 14 : 12); i += 1) {
boss = getUnit(1, name);
if (boss) {
if (name === getLocaleString(2852)) {
this.chaosPreattack(getLocaleString(2852), 8);
}
Attack.kill(name);
Pickit.pickItems();
return true;
}
delay(250);
}
return !!glow;
};
this.chaosPreattack = function (name, amount) {
var i, n, target, positions;
switch (me.classid) {
case 0:
break;
case 1:
break;
case 2:
break;
case 3:
target = getUnit(1, name);
if (!target) {
return;
}
positions = [[6, 11], [0, 8], [8, -1], [-9, 2], [0, -11], [8, -8]];
for (i = 0; i < positions.length; i += 1) {
if (Attack.validSpot(target.x + positions[0], target.y + positions[1])) { // check if we can move there
Pather.moveTo(target.x + positions[0], target.y + positions[1]);
Skill.setSkill(Config.AttackSkill[2], 0);
for (n = 0; n < amount; n += 1) {
Skill.cast(Config.AttackSkill[1], 1);
}
break;
}
}
break;
case 4:
break;
case 5:
break;
case 6:
break;
}
};
this.openSeal = function (id) {
Pather.moveToPreset(108, 2, id, 4);
var i, tick,
seal = getUnit(2, id);
if (seal) {
for (i = 0; i < 3; i += 1) {
seal.interact();
tick = getTickCount();
while (getTickCount() - tick < 500) {
if (seal.mode) {
return true;
}
delay(10);
}
}
}
return false;
};
Town.doChores();
Pather.useWaypoint(107, true);
Precast.doPrecast(true);
Pather.moveTo(7790, 5544);
this.initLayout();
if (!this.openSeal(395) || !this.openSeal(396)) {
throw new Error("Failed to open seals");
}
if (this.vizLayout === 1) {
Pather.moveTo(7691, 5292);
} else {
Pather.moveTo(7695, 5316);
}
if (!this.getBoss(getLocaleString(2851))) {
throw new Error("Failed to kill Vizier");
}
if (!this.openSeal(394)) {
throw new Error("Failed to open seals");
}
if (this.seisLayout === 1) {
Pather.moveTo(7771, 5196);
} else {
Pather.moveTo(7798, 5186);
}
if (!this.getBoss(getLocaleString(2852))) {
throw new Error("Failed to kill de Seis");
}
if (!this.openSeal(392) || !this.openSeal(393)) {
throw new Error("Failed to open seals");
}
if (this.infLayout === 1) {
delay(1);
} else {
Pather.moveTo(7928, 5295); // temp
}
if (!this.getBoss(getLocaleString(2853))) {
throw new Error("Failed to kill Infector");
}
Pather.moveTo(7763, 5267);
Pather.makePortal();
Pather.moveTo(7727, 5267);
say("Diablo UP");
var failTimer = 30,
tick = getTickCount();
while (!this.playerIn(nick)) {
delay(250);
if (getTickCount() - tick >= failTimer * 1000) {
say("wtf " + nick + " never showed up...")
Pather.usePortal(null, me.name);
Pather.useWaypoint(1, true);
Town.move("waypoint");
return false;
}
}
Pather.moveTo(7763, 5267);
while (!getUnit(1, 243)) {
delay(500);
}
Attack.kill(243);
say("DIABLO DEAD");
if (me.gametype > 0) {
say("a5");
while (!this.playersInAct(5)) {
delay(250);
}
}
Pickit.pickItems();
if (!Pather.usePortal(null, me.name)) {
Town.goToTown();
}
Town.goToTown(1);
Town.move("waypoint");
return true;
};
//增加act5
this.Shenk = function (nick) {
Town.doChores();
say("");
Pather.useWaypoint(111, true);
Precast.doPrecast(true);
Pather.moveTo(3883, 5113);
Pather.makePortal();
Attack.securePosition(me.x, me.y, 15, 3000);
var failTimer = 30,
tick = getTickCount();
while (!this.playerIn(nick)) {
if (getTickCount() - tick >= failTimer * 1000) {
say("wtf " + nick + " never showed up...")
Pather.usePortal(null, me.name);
Pather.useWaypoint(1, true);
Town.move("waypoint");
return false;
}
}
Attack.kill(getLocaleString(22435)); // Shenk the Overseer
Pickit.pickItems();
Town.goToTown(1);
Town.move("waypoint");
return true;
};
this.Anya = function (nick) {
say("");
var anya;
Pather.useWaypoint(113, true);
Precast.doPrecast(true);
if (!Pather.moveToExit(114, true) || !Pather.moveToPreset(me.area, 2, 460)) {
throw new Error();
}
delay(1000);
anya = getUnit(2, 558);
Pather.moveToUnit(anya);
Attack.securePosition(me.x, me.y, 40, 3000, true);
Pather.makePortal();
Town.goToTown(1);
Town.move("waypoint");
return true;
};
this.Ancients = function (nick) {
say("3baba");
var altar;
Town.doChores();
Pather.useWaypoint(118, true);
Precast.doPrecast(true);
if (!Pather.moveToExit(120, true)) {
throw new Error("Failed to go to Ancients way.");
}
Pather.moveTo(10089, 12622);
Pather.makePortal();
say("kuai lai");
while (!this.playerIn(nick)) {
delay(250);
}
Pather.moveTo(10048, 12628);
altar = getUnit(2, 546);
if (altar) {
while (altar.mode !== 2) {
Pather.moveToUnit(altar);
altar.interact();
delay(2000 + me.ping);
me.cancel();
}
}
while (!getUnit(1, 542)) {
delay(250);
}
Attack.clear(50);
Pather.moveTo(10089, 12622);
me.cancel();
Pather.makePortal();
if (!Pather.usePortal(null, me.name)) {
Town.goToTown();
}
Town.goToTown(1);
Town.move("waypoint");
return true;
};
this.Baal = function (nick) {
say("");
var tick, portal;
this.preattack = function () {
var check;
switch (me.classid) {
case 1:
if ([56, 59, 64].indexOf(Config.AttackSkill[1]) > -1) {
if (me.getState(121)) {
delay(500);
} else {
Skill.cast(Config.AttackSkill[1], 0, 15093, 5024);
}
}
return true;
case 3: // Paladin
if (Config.AttackSkill[3] !== 112) {
return false;
}
if (getDistance(me, 15093, 5029) > 3) {
Pather.moveTo(15093, 5029);
}
if (Config.AttackSkill[4] > 0) {
Skill.setSkill(Config.AttackSkill[4], 0);
}
Skill.cast(Config.AttackSkill[3], 1);
return true;
case 5: // Druid
if (Config.AttackSkill[3] === 245) {
Skill.cast(Config.AttackSkill[3], 0, 15093, 5029);
return true;
}
break;
case 6:
if (Config.UseTraps) {
check = ClassAttack.checkTraps({x: 15093, y: 5029});
if (check) {
ClassAttack.placeTraps({x: 15093, y: 5029}, 5);
return true;
}
}
break;
}
return false;
};
this.checkThrone = function () {
var monster = getUnit(1);
if (monster) {
do {
if (Attack.checkMonster(monster) && monster.y < 5080) {
switch (monster.classid) {
case 23:
case 62:
return 1;
case 105:
case 381:
return 2;
case 557:
return 3;
case 558:
return 4;
case 571:
return 5;
default:
Attack.getIntoPosition(monster, 10, 0x4);
Attack.clear(15);
return false;
}
}
} while (monster.getNext());
}
return false;
};
this.clearThrone = function () {
var i, monster,
monList = [],
pos = [15097, 5054, 15085, 5053, 15085, 5040, 15098, 5040, 15099, 5022, 15086, 5024];
if (Config.AvoidDolls) {
monster = getUnit(1, 691);
if (monster) {
do {
if (monster.x >= 15072 && monster.x <= 15118 && monster.y >= 5002 && monster.y <= 5079 && Attack.checkMonster(monster) && Attack.skipCheck(monster)) {
monList.push(copyUnit(monster));
}
} while (monster.getNext());
}
if (monList.length) {
Attack.clearList(monList);
}
}
for (i = 0; i < pos.length; i += 2) {
Pather.moveTo(pos, pos[i + 1]);
Attack.clear(30);
}
};
this.checkHydra = function () {
var monster = getUnit(1, "hydra");
if (monster) {
do {
if (monster.mode !== 12 && monster.getStat(172) !== 2) {
Pather.moveTo(15118, 5002);
while (monster.mode !== 12) {
delay(500);
if (!copyUnit(monster).x) {
break;
}
}
break;
}
} while (monster.getNext());
}
return true;
};
if (me.inTown) {
Town.doChores();
Pather.useWaypoint(129, true);
Precast.doPrecast(true);
if (!Pather.moveToExit([130, 131], true)) {
throw new Error("Failed to move to Throne of Destruction.");
}
}
Pather.moveTo(15113, 5002);
Attack.clear(15);
this.clearThrone();
Pather.makePortal();
say("anquan,xialai");
Precast.doPrecast(true);
tick = getTickCount();
Pather.moveTo(15093, me.classid === 3 ? 5029 : 5039);
MainLoop:
while (true) {
if (getDistance(me, 15093, me.classid === 3 ? 5029 : 5039) > 3) {
Pather.moveTo(15093, me.classid === 3 ? 5029 : 5039);
}
if (!getUnit(1, 543)) {
break MainLoop;
}
switch (this.checkThrone()) {
case 1:
Attack.clear(40);
tick = getTickCount();
Precast.doPrecast(true);
break;
case 2:
Attack.clear(40);
tick = getTickCount();
break;
case 4:
Attack.clear(40);
tick = getTickCount();
break;
case 3:
Attack.clear(40);
this.checkHydra();
tick = getTickCount();
break;
case 5:
Attack.clear(40);
break MainLoop;
default:
if (getTickCount() - tick < 7e3) {
if (me.getState(2)) {
Skill.setSkill(109, 0);
}
break;
}
if (!this.preattack()) {
delay(100);
}
break;
}
Precast.doPrecast(false);
delay(10);
}
this.clearThrone();
Pather.moveTo(15092, 5011);
Precast.doPrecast(true);
while (getUnit(1, 543)) {
delay(500);
}
delay(1000);
portal = getUnit(2, 563);
if (portal) {
Pather.usePortal(null, null, portal);
} else {
throw new Error("Couldn't find portal.");
}
Pather.moveTo(15213, 5908);
Pather.makePortal();
Pather.moveTo(15170, 5950);
delay(1000);
say("3");
while (!this.playerIn()) {
delay(250);
}
Pather.moveTo(15134, 5923);
Attack.kill(544); // Baal
Pickit.pickItems();
return true;
};
this.ChkVote = function () {
if (countYes <= countNo) {
say("no won so were staying here");
}
else
{
say("yes won going to next game in 15 seconds");
delay(15000);
Misc.fileAction("logs/Voted.txt",1,"")
quit();
}
countYes = 0;
countNo = 0;
Misc.fileAction("logs/Voted.txt",1,"")
};
this.ClearGaveGold = function () {
Misc.fileAction("logs/GaveGold.txt",1,"")
}
this.timeleft = function () {
tick = Config.Enchant.GameLength * 6e4 - getTickCount() + startTime;
m = Math.floor(tick / 60000);
s = Math.floor((tick / 1000) % 60);
say("Time left: " + (m ? m + " minute" + (m > 1 ? "s" : "") + ", " : "") + s + " second" + (s > 1 ? "s." : "."));
};
this.enchant = function (nick) {
if (!Misc.inMyParty(nick)) {
say("Accept party invite, noob.");
return false;
}
var partyUnit,
unit = getUnit(0, nick);
if (getDistance(me, unit) > 35) {
say("Get closer.");
return false;
}
if (Config.Enchant.UseLogs) {
this.WebFile("Chainting " + nick + "");
}
if (!unit) {
partyUnit = getParty(nick);
// wait until party area is readable?
if ([40, 75, 103, 109].indexOf(partyUnit.area) > -1) {
say("Wait for me at waypoint.");
Town.goToTown([1, 40, 75, 103, 109].indexOf(partyUnit.area) + 1); // index+1 for town 2,3,4,5
unit = getUnit(0, nick);
} else {
say("You need to be in one of the towns.");
Town.move("waypoint");
return false;
}
}
if (unit) {
do {
if (!unit.dead) { // player is alive
if (getDistance(me, unit) >= 35) {
say("You went too far away.");
return false;
}
Skill.setSkill(52, 0);
sendPacket(1, 0x11, 4, unit.type, 4, unit.gid);
if (Config.Enchant.UseLogs) {
chantList.push(unit.name,"Chant");
ChantList.add(unit.name,"Chant");
chantList.push(Config.Enchant.LogName,"Chant");
ChantList.add(Config.Enchant.LogName,"Chant")
}
delay(500);
}
} while (unit.getNext());
} else {
say("Couldn't find you, champ.");
}
unit = getUnit(1);
if (unit) {
do {
if (unit.getParent() && unit.getParent().name === nick) { // merc or any other owned unit
Skill.setSkill(52, 0);
sendPacket(1, 0x11, 4, unit.type, 4, unit.gid);
if (Config.Enchant.UseLogs) {
chantList.push("" + Config.Enchant.LogName + "Minion","Chant");
ChantList.add("" + Config.Enchant.LogName + "Minion","Chant");
}
delay(500);
}
} while (unit.getNext());
}
return true;
};
this.autoChant = function () {
var unit,
chanted = [];
// Player
unit = getUnit(0);
if (unit) {
do {
if (Config.Enchant.UseLogs) {
this.WebFile("Chainting " + unit.name + "");
}
if (unit.name !== me.name && !unit.dead && shitList.indexOf(unit.name) === -1 && Misc.inMyParty(unit.name) && !unit.getState(16) && getDistance(me, unit) <= 40) {
Skill.setSkill(52, 0);
sendPacket(1, 0x11, 4, unit.type, 4, unit.gid);
delay(500);
if (Config.Enchant.UseLogs) {
chantList.push(unit.name,"Chant");
ChantList.add(unit.name,"Chant");
chantList.push(Config.Enchant.LogName,"Chant");
ChantList.add(Config.Enchant.LogName,"Chant")
}
chanted.push(unit.name);
}
} while (unit.getNext());
}
// Minion
unit = getUnit(1);
if (unit) {
do {
if (unit.getParent() && chanted.indexOf(unit.getParent().name) > -1 && !unit.getState(16) && getDistance(me, unit) <= 40) {
Skill.setSkill(52, 0);
sendPacket(1, 0x11, 4, unit.type, 4, unit.gid);
delay(500);
if (Config.Enchant.UseLogs) {
chantList.push("" + Config.Enchant.LogName + "Minion","Chant");
ChantList.add("" + Config.Enchant.LogName + "Minion","Chant");
}
}
} while (unit.getNext());
}
return true;
};
this.droprc = function (nick) {
var YesFiled = "logs/webserver/games/"+Config.Enchant.LogName+"trc.txt"
var File1d = Misc.fileAction(YesFiled,0)
var resa = File1d.match(nick, "g")
if (resa) {
say("" + nick + " I already gave you a rc..");
}
else
{
var rcs ,lrc;
if (me.getItem(70)) {
rcs = me.getItem(70);
say(Config.Enchant.HaveRc);
rcs.drop();
Misc.fileAction("logs/webserver/games/"+Config.Enchant.LogName+"lrc.txt", 1, "" + nick + "");
Misc.fileAction("logs/webserver/games/"+Config.Enchant.LogName+"trc.txt", 2, "" + nick + "");
}
else
{
lrc = (Misc.fileAction("logs/webserver/games/"+Config.Enchant.LogName+"rc.txt", 0));
if (lrc) {
say(Config.Enchant.LastRc + lrc + ".");
}
else
{
say(Config.Enchant.NoRc);
}
}
}
};
this.takerc = function (nick) {
var rc;
rc = getUnit(4, 70);
if (rc) {
if (getDistance(me, rc) <= 15) {
say(Config.Enchant.ThanksRc);
Pickit.pickItems();
}
}
else
{
say("lease bring the raven claw closer to me.");
}
Pickit.pickItems();
};
this.getLeg = function () {
var i, portal, wirt, leg, gid, wrongLeg;
if (me.getItem(88)) {
return me.getItem(88);
}
if (!Config.Enchant.GetLeg) {
leg = getUnit(4, 88);
if (leg) {
do {
if (leg.name.indexOf("?c1") > -1) {
wrongLeg = true;
} else if (getDistance(me, leg) <= 15) {
gid = leg.gid;
Pickit.pickItem(leg);
return me.getItem(-1, -1, gid);
}
} while (leg.getNext());
}
say("Bring the leg " + (wrongLeg ? "from this difficulty" : "") + " close to me.");
return false;
}
Pather.useWaypoint(4);
Precast.doPrecast(true);
Pather.moveToPreset(me.area, 1, 737, 8, 8);
for (i = 0; i < 6; i += 1) {
portal = Pather.getPortal(38);
if (portal) {
Pather.usePortal(null, null, portal);
break;
}
delay(500);
}
if (!portal) {
say("Failed to enter Tristram ");
Town.goToTown();
Town.move("waypoint");
return false;
}
Pather.moveTo(25048, 5177);
wirt = getUnit(2, 268);
for (i = 0; i < 8; i += 1) {
wirt.interact();
delay(500);
leg = getUnit(4, 88);
if (leg) {
gid = leg.gid;
Pickit.pickItem(leg);
Town.goToTown();
return me.getItem(-1, -1, gid);
}
}
Town.goToTown();
say("Failed to get the leg ");
Town.move("waypoint");
return false;
};
this.getTome = function () {
var tome, akara, myTome;
myTome = me.findItem("tbk", 0, 3);
tome = me.getItem("tbk");
// In case of 2 tomes or tome stuck in cube
if (tome) {
do {
if (!myTome || tome.gid !== myTome.gid) {
return copyUnit(tome);
}
} while (tome.getNext());
}
if (Config.Enchant.UseLogs) {
this.WebFile("Buying tome");
}
Town.move("akara");
akara = getUnit(1, NPC.Akara);
if (!akara || akara.area !== me.area || getDistance(me, akara) > 20) {
say("Akara not found.");
return false;
}
myTome = me.findItem("tbk", 0, 3);
tome = me.getItem("tbk");
if (tome) {
do {
if (!myTome || tome.gid !== myTome.gid) {
return copyUnit(tome);
}
} while (tome.getNext());
}
akara = Town.initNPC("Shop");
if (!akara) {
say("Failed to buy tome ");
return false;
}
tome = akara.getItem("tbk");
if (tome.buy()) {
tome = me.getItem("tbk");
if (tome) {
do {
if (!myTome || tome.gid !== myTome.gid) {
return copyUnit(tome);
}
} while (tome.getNext());
}
}
return false;
};
this.openPortal = function (nick) {
if (!Misc.inMyParty(nick)) {
say("Accept party invite, noob.");
return true;
}
if (Pather.getPortal(39)) {
say("Cow portal already open.");
return true;
}
if (me.getQuest(4, 10)) { // king dead or cain not saved
say("Can't open the portal because I killed Cow King.");
return false;
}
if (Config.Enchant.GetLeg && !me.getQuest(4, 0)) {
say("Can't get leg because I don't have Cain quest.");
return false;
}
switch (me.gametype) {
case 0: // classic
if (!me.getQuest(26, 0)) { // diablo not completed
say("I don't have Diablo quest.");
return false;
}
break;
case 1: // expansion
if (!me.getQuest(40, 0)) { // baal not completed
say("I don't have Baal quest.");
return false;
}
break;
}
var i, leg, tome;
leg = this.getLeg();
if (!leg) {
return false;
}
tome = this.getTome();
if (!tome) {
return false;
}
if (!Town.openStash() || !Cubing.emptyCube() || !Storage.Cube.MoveTo(leg) || !Storage.Cube.MoveTo(tome) || !Cubing.openCube()) {
return false;
}
transmute();
delay(500);
for (i = 0; i < 10; i += 1) {
if (Pather.getPortal(39)) {
if (Config.Enchant.UseLogs) {
chantList.push(Config.Enchant.LogName,"Cow");
ChantList.add(Config.Enchant.LogName,"Cow");
chantList.push(nick,"Cow");
ChantList.add(nick,"Cow");
}
return true;
}
delay(200);
}
say("Failed to open cow portal.");
return false;
};
this.getWpNick = function (nick) {
if (!this.wpNicks) {
this.wpNicks = {};
}
if (this.wpNicks.hasOwnProperty(nick)) {
if (this.wpNicks[nick].requests > 4) {
return "maxrequests";
}
if (getTickCount() - this.wpNicks[nick].timer < 60000) {
return "mintime";
}
return true;
}
return false;
};
this.addWpNick = function (nick) {
this.wpNicks[nick] = {timer: getTickCount(), requests: 0};
};
this.giveWps = function (nick) {
if (!Misc.inMyParty(nick)) {
say("Accept party invite, noob.");
return false;
}
var i, act, timeout, wpList;
switch (this.getWpNick(nick)) {
case "maxrequests":
say(nick + ", you have spent all your waypoint requests for this game.");
return false;
case "mintime":
say(nick + ", you may request waypoints every 60 seconds.");
return false;
case false:
this.addWpNick(nick);
break;
}
act = this.getPlayerAct(nick);
switch (act) {
case 1:
wpList = [3, 4, 5, 6, 27, 29, 32, 35];
break;
case 2:
wpList = [48, 42, 57, 43, 44, 52, 74, 46];
break;
case 3:
wpList = [76, 77, 78, 79, 80, 81, 83, 101];
break;
case 4:
wpList = [106, 107];
break;
case 5:
wpList = [111, 112, 113, 115, 123, 117, 118, 129];
break;
}
MainLoop:
for (i = 0; i < wpList.length; i += 1) {
if (this.checkHostiles()) {
break;
}
try {
Pather.useWaypoint(wpList, true);
Pather.makePortal();
say(getArea().name + " TP up");
for (timeout = 0; timeout < 20; timeout += 1) {
if (getUnit(0, nick)) {
break;
}
delay(1000);
}
if (timeout >= 20) {
say("Aborting wp giving.");
break MainLoop;
}
delay(5000);
} catch (error) {
}
}
Town.doChores();
Town.goToTown(1);
Town.move("waypoint");
this.wpNicks[nick].requests += 1;
this.wpNicks[nick].timer = getTickCount();
return true;
};
this.getPlayerAct = function (name) {
var unit = getParty();
if (unit) {
do {
if (unit.name === name) {
if (unit.area <= 39) {
return 1;
}
if (unit.area >= 40 && unit.area <= 74) {
return 2;
}
if (unit.area >= 75 && unit.area <= 102) {
return 3;
}
if (unit.area >= 103 && unit.area <= 108) {
return 4;
}
return 5;
}
} while (unit.getNext());
}
return false;
};
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.floodCheck = function (command) {
var cmd = command[0],
nick = command[1];
if ([ "help",
Config.Enchant.Triggers[0].toLowerCase(),
Config.Enchant.Triggers[1].toLowerCase(),
Config.Enchant.Triggers[2].toLowerCase(),
Config.Enchant.Triggers[3].toLowerCase(),
Config.Enchant.Triggers[4].toLowerCase(),
Config.Enchant.Triggers[5].toLowerCase(),
Config.Enchant.Triggers[6].toLowerCase(),
Config.Enchant.Triggers[7].toLowerCase()
].indexOf(cmd.toLowerCase()) === -1) {
return false;
}
if (!this.cmdNicks) {
this.cmdNicks = {};
}
if (!this.cmdNicks.hasOwnProperty(nick)) {
this.cmdNicks[nick] = {
firstCmd: getTickCount(),
commands: 0,
ignored: false
};
}
if (this.cmdNicks[nick].ignored) {
if (getTickCount() - this.cmdNicks[nick].ignored < 60000) {
return true; // ignore flooder
}
// unignore flooder
this.cmdNicks[nick].ignored = false;
this.cmdNicks[nick].commands = 0;
}
this.cmdNicks[nick].commands += 1;
if (getTickCount() - this.cmdNicks[nick].firstCmd < 10000) {
if (this.cmdNicks[nick].commands > 5) {
this.cmdNicks[nick].ignored = getTickCount();
say(nick + ", you are being ignored for 60 seconds because of flooding.");
}
} else {
this.cmdNicks[nick].firstCmd = getTickCount();
this.cmdNicks[nick].commands = 0;
}
return false;
};
function ChatEvent(nick, msg) {
command = [msg, nick];
}
function GreetEvent(mode, param1, param2, name1, name2) {
switch (mode) {
case 0x02: //join
if (me.inTown && me.mode === 5) { // idle in town
greet.push(name1);
if (Config.Enchant.UseLogs) {
chantList.push(name2,"Join");
ChantList.add(name2,"Join");
chantList.push(name1,"Join");
ChantList.add(name1,"Join");
}
}
break;
case 0x03: //leave
if (me.inTown && me.mode === 5) { // idle in town
if (Config.Enchant.UseLogs) {
chantList.push(name1,"Leave");
ChantList.add(name1,"Leave");
chantList.push(name2,"Leave");
ChantList.add(name2,"Leave");
}
}
break;
case 0x00: //drop
if (me.inTown && me.mode === 5) { // idle in town
if (Config.Enchant.UseLogs) {
chantList.push(name1,"Drop");
ChantList.add(name1,"Drop");
chantList.push(name2,"Drop");
ChantList.add(name2,"Drop");
}
}
break;
case 0x06: //death
if (me.inTown && me.mode === 5) { // idle in town
if (Config.Enchant.UseLogs) {
chantList.push(name1,"Death");
ChantList.add(name1,"Death");
chantList.push(name2,"Death");
ChantList.add(name2,"Death");
chantList.push(Config.Enchant.LogName,"Death");
ChantList.add(Config.Enchant.LogName,"Death");
}
}
break;
}
}
// START
if (Config.ShitList) {
shitList = ShitList.read();
}
this.ClearGaveGold();
Misc.fileAction("logs/webserver/games/"+Config.Enchant.LogName+"trc.txt", 1, "");
addEventListener("chatmsg", this.chatEvent);
addEventListener("chatmsg", ChatEvent);
addEventListener("gameevent", GreetEvent);
Town.doChores();
Town.goToTown(1);
Town.move("waypoint");
if (Config.Enchant.UseLogs) {
this.WebFile("Game just started");
chantList = ChantList.read();
chantList.push(Config.Enchant.LogName,"Join");
ChantList.add(Config.Enchant.LogName,"Join");
}
//spots = {
// x: me.x,
// y: me.y
//};
while (true) {
while (greet.length > 0) {
nick = greet.shift();
if (shitList.indexOf(nick) === -1) {
say(Config.Enchant.JoinMsg);
}
}
//if (spots && getDistance(me, spots) > 10) {
// Pather.moveTo(spots.x, spots.y);
//}
if (command && !this.floodCheck(command)) {
switch (command[0].toLowerCase()) {
case "help":
this.checkHostiles();
if (shitList.indexOf(command[1]) > -1) {
say("No " + command[0] + " for the shitlisted.");
break;
}
say("Commands:" +
(Config.Enchant.Triggers[0] ? " | Enhant: " + Config.Enchant.Triggers[0] : "") +
(Config.Enchant.Triggers[1] ? " | Open cow level: " + Config.Enchant.Triggers[1] : "") +
(Config.Enchant.Triggers[2] ? " | Give waypoints: " + Config.Enchant.Triggers[2] : "") +
(Config.Enchant.Triggers[3] ? " | Time Left: " + Config.Enchant.Triggers[3] : "") +
(Config.Enchant.Triggers[4] ? " | GiveGold: " + Config.Enchant.Triggers[4] : "") +
(Config.Enchant.Triggers[5] ? " | TakeGold: " + Config.Enchant.Triggers[5] : "") +
(Config.Enchant.Triggers[6] ? " | ngvote: " + Config.Enchant.Triggers[6] : "") +
(Config.Enchant.Triggers[7] ? " | stats: " + Config.Enchant.Triggers[7] : ""));
//if (Config.Enchant.AutoChant) {
say("Auto enchant is ON");
//}
if (Config.Enchant.GiveRc) {
say("Take Raven claw " + Config.Enchant.GRC + " Drop Raven Claw " + Config.Enchant.DRC + ".")
}
if (Config.Enchant.Rusher) {
say("Rushing Options: " + Config.Enchant.Andy + ", " + Config.Enchant.Staff + ", " + Config.Enchant.Amulet + ", " + Config.Enchant.Summoner + ", " + Config.Enchant.Duri + ", " + Config.Enchant.Trav + ", " + Config.Enchant.Meph + ", " + Config.Enchant.Diablo +", " + Config.Enchant.Shenk +", " + Config.Enchant.Anya + ", " + Config.Enchant.Ancients + ".")
}
break;
case Config.Enchant.Triggers[0].toLowerCase(): // chant
this.checkHostiles();
if (shitList.indexOf(command[1]) > -1) {
say("No chant for the shitlisted.");
break;
}
this.enchant(command[1]);
break;
case Config.Enchant.Triggers[1].toLowerCase(): // cows
hostile = this.checkHostiles();
if (shitList.indexOf(command[1]) > -1) {
say("No cows for the shitlisted.");
break;
}
if (Config.Enchant.UseLogs) {
this.WebFile("Making cows");
}
this.openPortal(command[1]);
me.cancel();
break;
case Config.Enchant.Triggers[2].toLowerCase(): // wps
hostile = this.checkHostiles();
if (shitList.indexOf(command[1]) > -1) {
say("No waypoints for the shitlisted.");
break;
}
if (hostile) {
say("Command disabled because of hostiles.");
break;
}
if (Config.Enchant.UseLogs) {
this.WebFile("Giving waypoints");
}
this.giveWps(command[1]);
break;
case Config.Enchant.Triggers[3].toLowerCase(): // timeleft
hostile = this.checkHostiles();
if (shitList.indexOf(command[1]) > -1) {
say("Fk to time.");
break;
}
if (hostile) {
say("Command disabled because of hostiles.");
break;
}
if (Config.Enchant.UseLogs) {
this.WebFile("Checking time");
}
this.timeleft(command[1]);
break;
case Config.Enchant.Triggers[4].toLowerCase(): // givegold
hostile = this.checkHostiles();
if (shitList.indexOf(command[1]) > -1) {
say("No gold for the shitlisted.");
break;
}
if (hostile) {
say("Command disabled because of hostiles.");
break;
}
if (Config.Enchant.UseLogs) {
this.WebFile("Giving out gold");
}
this.givegold(command[1]);
break;
case Config.Enchant.Triggers[5].toLowerCase(): // takegold
hostile = this.checkHostiles();
if (shitList.indexOf(command[1]) > -1) {
say("Gimeyogoldnoob.");
this.takegold(command[1]);
break;
}
if (hostile) {
say("Command disabled because of hostiles.");
break;
}
if (Config.Enchant.UseLogs) {
this.WebFile("Grabing some gold");
}
this.takegold(command[1]);
break;
case Config.Enchant.Triggers[6].toLowerCase(): // ngvote
hostile = this.checkHostiles();
if (shitList.indexOf(command[1]) > -1) {
say("You wish...");
break;
}
if (hostile) {
say("Command disabled because of hostiles.");
break;
}
if (getTickCount() - me.gamestarttime >= Config.Enchant.NGVLength * 6e4) {
if (Config.Enchant.UseLogs) {
this.WebFile("NGVOTE Started");
}
this.ngvt(command[1]);
break;
}
else
{
say("Wait a little more!");
break;
}
break;
case Config.Enchant.Triggers[7].toLowerCase(): // stats
hostile = this.checkHostiles();
if (shitList.indexOf(command[1]) > -1) {
say("No stats for you...");
break;
}
if (hostile) {
say("Command disabled because of hostiles.");
break;
}
if (Config.Enchant.UseLogs) {
this.WebFile("Checking stats");
}
this.MyStats(command[1]);
break;
//单独给wps
case Config.Enchant.Wayps[0].toLowerCase(): // .1-1
Pather.useWaypoint(3, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[1].toLowerCase(): // .1-2
Pather.useWaypoint(4, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[2].toLowerCase(): // .1-3
Pather.useWaypoint(5, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[3].toLowerCase(): // .1-4
Pather.useWaypoint(6, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[4].toLowerCase(): // .1-5
Pather.useWaypoint(27, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[5].toLowerCase(): // .1-6
Pather.useWaypoint(29, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[6].toLowerCase(): // .1-7
Pather.useWaypoint(32, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[7].toLowerCase(): // .1-8
Pather.useWaypoint(35, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[8].toLowerCase(): // .2-1
Pather.useWaypoint(48, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[9].toLowerCase(): // .2-2
Pather.useWaypoint(42, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[10].toLowerCase(): // .2-3
Pather.useWaypoint(57, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[11].toLowerCase(): // .2-4
Pather.useWaypoint(43, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[12].toLowerCase(): // .2-5
Pather.useWaypoint(44, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[13].toLowerCase(): // .2-6
Pather.useWaypoint(52, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[14].toLowerCase(): // .2-7
Pather.useWaypoint(74, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[15].toLowerCase(): // .2-8
Pather.useWaypoint(46, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[16].toLowerCase(): // .3-1
Pather.useWaypoint(76, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[17].toLowerCase(): // .3-2
Pather.useWaypoint(77, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[18].toLowerCase(): // .3-3
Pather.useWaypoint(78, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[19].toLowerCase(): // .3-4
Pather.useWaypoint(79, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[20].toLowerCase(): // .3-5
Pather.useWaypoint(80, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[21].toLowerCase(): // .3-6
Pather.useWaypoint(81, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[22].toLowerCase(): // .3-7
Pather.useWaypoint(83, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[23].toLowerCase(): // .3-8
Pather.useWaypoint(101, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[24].toLowerCase(): // .4-1
Pather.useWaypoint(106, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[25].toLowerCase(): // .4-2
Pather.useWaypoint(107, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[26].toLowerCase(): // .5-1
Pather.useWaypoint(111, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[27].toLowerCase(): // .5-2
Pather.useWaypoint(112, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[28].toLowerCase(): // .5-3
Pather.useWaypoint(113, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[29].toLowerCase(): // .5-4
Pather.useWaypoint(115, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[30].toLowerCase(): // .5-5
Pather.useWaypoint(123, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[31].toLowerCase(): // .5-6
Pather.useWaypoint(117, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[32].toLowerCase(): // .5-7
Pather.useWaypoint(118, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
case Config.Enchant.Wayps[33].toLowerCase(): // .5-8
Pather.useWaypoint(129, true);
Pather.makePortal();
//say(getArea().name + " TP up");
Town.goToTown(1);
Town.move("waypoint");
break;
}
}
command = "";
if (me.act > 1) {
Town.goToTown(1);
Town.move("waypoint");
if (Config.Enchant.UseLogs) {
this.WebFile("Going back to act 1");
}
}
if (Config.Enchant.AutoChant) {
this.autoChant();
}
if (Config.Enchant.UseLogs) {
this.CheckLevel();
}
if (getTickCount() - startTime >= Config.Enchant.GameLength * 6e4) {
if (Config.Enchant.UseLogs) {
this.WebFile("Going to next game");
}
say(Config.Enchant.EndMsg);
delay(10000);
break;
}
delay(200);
}
return true;
}
3、在d2bot-with-kolbot-cn\d2bs\kolbot\libs下的OOG.js最后添加以下内容://以下是根据网站上enchant功能加的//
var ChantList = {
create: function () {
var string,
obj = {
chantlist: []
};
string = JSON.stringify(obj);
Misc.fileAction( Config.Enchant.LogName+"chantlist.json", 1, string);
return obj;
},
getObj: function () {
var obj,
string = Misc.fileAction( Config.Enchant.LogName+"chantlist.json", 0);
try {
obj = JSON.parse(string);
} catch (e) {
obj = this.create();
}
if (obj) {
return obj;
}
print("Failed to read chantlist. Using null values");
return {chantlist: []};
},
read: function () {
var obj;
if (!FileTools.exists(Config.Enchant.LogName+"chantlist.json")) {
this.create();
}
obj = this.getObj();
return obj.chantlist;
},
add: function (name,data) {
var obj, i, cl, cr, oc, nc, string, string1;
string = Misc.fileAction( Config.Enchant.LogName+"chantlist.json", 0);
obj = JSON.parse(string);
cr = this.read();
cl = cr.length
string = Misc.fileAction( Config.Enchant.LogName+"chantlist.json", 0);
var res = string.match(name, "g")
if (res) {
for(i = 0; i < cl; i++) {
if (obj.chantlist.Char == name) {
if (data === "Chant") {
oc = obj.chantlist.Chant
nc = oc + 1
obj.chantlist.Chant = nc;
string1 = JSON.stringify(obj);
Misc.fileAction( Config.Enchant.LogName+"chantlist.json", 1, string1);
}
if (data === "Cow") {
oc = obj.chantlist.Cow
nc = oc + 1
obj.chantlist.Cow = nc;
string1 = JSON.stringify(obj);
Misc.fileAction( Config.Enchant.LogName+"chantlist.json", 1, string1);
}
if (data === "Death") {
oc = obj.chantlist.Death
nc = oc + 1
obj.chantlist.Death = nc;
string1 = JSON.stringify(obj);
Misc.fileAction( Config.Enchant.LogName+"chantlist.json", 1, string1);
}
if (data === "Level") {
oc = obj.chantlist.Level
nc = oc + 1
obj.chantlist.Level = nc;
string1 = JSON.stringify(obj);
Misc.fileAction( Config.Enchant.LogName+"chantlist.json", 1, string1);
}
if (data === "Join") {
oc = obj.chantlist.Join
nc = oc + 1
obj.chantlist.Join = nc;
string1 = JSON.stringify(obj);
Misc.fileAction( Config.Enchant.LogName+"chantlist.json", 1, string1);
}
if (data === "Leave") {
oc = obj.chantlist.Leave
nc = oc + 1
obj.chantlist.Leave = nc;
string1 = JSON.stringify(obj);
Misc.fileAction( Config.Enchant.LogName+"chantlist.json", 1, string1);
}
if (data === "Drop") {
oc = obj.chantlist.Drop
nc = oc + 1
obj.chantlist.Drop = nc;
string1 = JSON.stringify(obj);
Misc.fileAction( Config.Enchant.LogName+"chantlist.json", 1, string1);
}
if (data === "Mystats") {
say("<" + name + "> Chants: " + obj.chantlist.Chant + " Joins: " + obj.chantlist.Join + " Leaves: " + obj.chantlist.Leave + " Drop: " + obj.chantlist.Drop + " Cows: " + obj.chantlist.Cow+ " Levels: " +obj.chantlist.Level +" Deaths: " + obj.chantlist.Death + ".");
}
}
}
}
else
{
if (data === "Chant") {
obj = this.getObj();
obj.chantlist.push({ Char: name, Chant: 1, Cow: 0, Join: 0, Leave: 0, Death: 0, Level: 0, Drop: 0});
string = JSON.stringify(obj);
Misc.fileAction( Config.Enchant.LogName+"chantlist.json", 1, string);
}
if (data === "Cow") {
obj = this.getObj();
obj.chantlist.push({ Char: name, Chant: 0, Cow: 1, Join: 0, Leave: 0, Death: 0, Level: 0, Drop: 0});
string = JSON.stringify(obj);
Misc.fileAction( Config.Enchant.LogName+"chantlist.json", 1, string);
}
if (data === "Death") {
obj = this.getObj();
obj.chantlist.push({ Char: name, Chant: 0, Cow: 0, Join: 0, Leave: 0, Death: 1, Level: 0, Drop: 0});
string = JSON.stringify(obj);
Misc.fileAction( Config.Enchant.LogName+"chantlist.json", 1, string);
}
if (data === "Level") {
obj = this.getObj();
obj.chantlist.push({ Char: name, Chant: 0, Cow: 0, Join: 0, Leave: 0, Death: 0, Level: 1, Drop: 0});
string = JSON.stringify(obj);
Misc.fileAction( Config.Enchant.LogName+"chantlist.json", 1, string);
}
if (data === "Join") {
obj = this.getObj();
obj.chantlist.push({ Char: name, Chant: 0, Cow: 0, Join: 1, Leave: 0, Death: 0, Level: 0, Drop: 0});
string = JSON.stringify(obj);
Misc.fileAction( Config.Enchant.LogName+"chantlist.json", 1, string);
}
if (data === "Leave") {
obj = this.getObj();
obj.chantlist.push({ Char: name, Chant: 0, Cow: 0, Join: 0, Leave: 1, Death: 0, Level: 0, Drop: 0});
string = JSON.stringify(obj);
Misc.fileAction( Config.Enchant.LogName+"chantlist.json", 1, string);
}
if (data === "Drop") {
obj = this.getObj();
obj.chantlist.push({ Char: name, Chant: 0, Cow: 0, Join: 0, Leave: 0, Death: 0, Level: 0, Drop: 1});
string = JSON.stringify(obj);
Misc.fileAction( Config.Enchant.LogName+"chantlist.json", 1, string);
}
if (data === "Mystats") {
say("Wtf your not in the list " + name + "...");
}
}
}
};
4、开bot,记得要用没过关的人物开游戏(最好是新建的bb,你懂的!)有需要的可以试试
|
|