UNPKG

alclient

Version:

A node client for interacting with Adventure Land - The Code MMORPG. This package extends the functionality of 'alclient' by managing a mongo database.

110 lines 3.77 kB
import { PingCompensatedCharacter } from "./PingCompensatedCharacter.js"; export class Rogue extends PingCompensatedCharacter { ctype = "rogue"; // NOTE: UNTESTED async invis() { if (!this.ready) throw new Error("We aren't ready yet [invis]."); const response = this.getResponsePromise("invis"); this.socket.emit("skill", { name: "invis" }); return response; } async pickpocket(target) { if (!this.ready) throw new Error("We aren't ready yet [pickpocket]"); let time; const getTime = (data) => { if (data.c.pickpocket) { time = data.c.pickpocket.ms; } }; this.socket.on("player", getTime); try { const response = this.getResponsePromise("pickpocket"); this.socket.emit("skill", { id: target, name: "pickpocket" }); await response; } finally { this.socket.off("player", getTime); } return new Promise((resolve) => setTimeout(resolve, Math.ceil(time))); } async mentalBurst(target) { if (!this.ready) throw new Error("We aren't ready yet [mentalBurst]."); const response = this.getResponsePromise("mentalburst"); this.socket.emit("skill", { id: target, name: "mentalburst", }); return response; } // NOTE: UNTESTED async poisonCoat(poison = this.locateItem("poison")) { if (!this.ready) throw new Error("We aren't ready yet [poisonCoat]."); if (poison === undefined) throw new Error("We don't have any poison in our inventory."); const response = this.getResponsePromise("pcoat"); this.socket.emit("skill", { name: "pcoat", num: poison, }); return response; } // NOTE: UNTESTED async quickPunch(target) { if (!this.ready) throw new Error("We aren't ready yet [quickPunch]."); // TODO: Item checks const response = this.getResponsePromise("quickpunch"); this.socket.emit("skill", { id: target, name: "quickpunch", }); return response; } async quickStab(target) { if (!this.ready) throw new Error("We aren't ready yet [quickStab]."); // TODO: Item checks const response = this.getResponsePromise("quickstab"); this.socket.emit("skill", { id: target, name: "quickstab", }); return response; } async rspeed(target) { if (!this.ready) throw new Error("We aren't ready yet [rspeed]."); // TODO: Improve to check if we applied it on the given character const response = this.getResponsePromise("rspeed"); this.socket.emit("skill", { id: target, name: "rspeed", }); return response; } // NOTE: UNTESTED async shadowStrike(shadowstone = this.locateItem("shadowstone")) { if (!this.ready) throw new Error("We aren't ready yet [shadowStrike]."); if (shadowstone === undefined) throw new Error("We need a shadowstone in order to shadowstrike."); const response = this.getResponsePromise("shadowstrike"); this.socket.emit("skill", { name: "shadowstrike", num: shadowstone, }); return response; } // NOTE: Untested // TODO: Add promises async stopInvis() { if (!this.ready) throw new Error("We aren't ready yet [stopInvis]."); this.socket.emit("stop", { action: "invis" }); } } //# sourceMappingURL=Rogue.js.map