Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @filename Revive.js
- * @author kolton
- * @desc handle revive
- */
- js_strict(true);
- include("json2.js");
- include("NTItemParser.dbl");
- include("OOG.js");
- include("Gambling.js");
- include("CraftingSystem.js");
- include("common/Attack.js");
- include("common/Cubing.js");
- include("common/Config.js");
- include("common/CollMap.js");
- include("common/Loader.js");
- include("common/Misc.js");
- include("common/Pickit.js");
- include("common/Pather.js");
- include("common/Precast.js");
- include("common/Prototypes.js");
- include("common/Runewords.js");
- include("common/Storage.js");
- include("common/Town.js");
- function main() {
- var townCheck = false;
- this.togglePause = function () {
- var i, script,
- scripts = ["default.dbj", "tools/antihostile.js", "tools/rushthread.js", "tools/CloneKilla.js"];
- for (i = 0; i < scripts.length; i += 1) {
- script = getScript(scripts[i]);
- if (script) {
- if (script.running) {
- if (i === 0) { // default.dbj
- print("ÿc1Pausing.");
- }
- script.pause();
- } else {
- if (i === 0) { // default.dbj
- if (!getScript("tools/clonekilla.js")) { // resume only if clonekilla isn't running
- print("ÿc2Resuming.");
- script.resume();
- }
- } else {
- script.resume();
- }
- }
- }
- }
- return true;
- };
- addEventListener("scriptmsg",
- function (msg) {
- if (msg === "townCheck") {
- if (me.area === 136) {
- print("Can't tp from uber trist.");
- } else {
- townCheck = true;
- }
- }
- });
- // Init config and attacks
- D2Bot.init();
- Config.init();
- Pickit.init();
- Attack.init();
- Storage.Init();
- CraftingSystem.buildLists();
- Runewords.init();
- Cubing.init();
- if (Config.Revive === true && me.mode === 17) {
- var corpse, bodyarea;
- rev = false;
- corpse = getUnit(0, me.name, 17);
- bodyarea = me.area;
- //this.togglePause();
- me.revive();
- print("bodyarea " + bodyarea + " corpse " + corpse);
- Pather.journeyTo(bodyarea, true);
- while (corpse && me.area === bodyarea) {
- if (getDistance(me, corpse) <= 15) {
- Pather.moveToUnit(corpse);
- corpse.interact();
- delay(500);
- rev = true;
- }
- if (rev) {
- this.togglePause();
- rev = false;
- //return true;
- }
- }
- }
- while (true) {
- if (Config.Revive === true && me.mode === 17) {
- var corpse, bodyarea,
- rev = false;
- corpse = getUnit(0, me.name, 17);
- bodyarea = me.area;
- this.togglePause();
- me.revive();
- print("bodyarea " + bodyarea + " corpse " + corpse);
- while (!me.gameReady) {
- delay(100);
- }
- try {
- //Pather.journeyTo(bodyarea, true);
- while (corpse) {
- if (me.area !== bodyarea) {
- Pather.journeyTo(bodyarea, true);
- } else if (me.area === bodyarea/*getDistance(me, corpse) <= 15*/) {
- me.overhead("Getting my body");
- Pather.moveToUnit(corpse);
- corpse.interact();
- delay(500);
- rev = true;
- }
- }
- } catch (e) {
- Misc.errorReport(e, "Revive.js");
- scriptBroadcast("quit");
- return;
- } finally {
- this.togglePause();
- rev = false;
- }
- }
- delay(50);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement