"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Rogue = void 0;
const Constants_1 = require("./Constants");
const PingCompensatedCharacter_1 = require("./PingCompensatedCharacter");
class Rogue extends PingCompensatedCharacter_1.PingCompensatedCharacter {
    invis() {
        this.socket.emit("skill", { name: "invis" });
    }
    mentalBurst(target) {
        const marked = new Promise((resolve, reject) => {
            const cooldownCheck = (data) => {
                if (/skill_timeout\s*\(\s*['"]mentalburst['"]\s*,?\s*(\d+\.?\d+?)?\s*\)/.test(data.code)) {
                    this.socket.removeListener("eval", cooldownCheck);
                    resolve();
                }
            };
            setTimeout(() => {
                this.socket.removeListener("eval", cooldownCheck);
                reject(`mentalburst timeout (${Constants_1.Constants.TIMEOUT}ms)`);
            }, Constants_1.Constants.TIMEOUT);
            this.socket.on("eval", cooldownCheck);
        });
        this.socket.emit("skill", {
            name: "mentalburst",
            id: target
        });
        return marked;
    }
    poisonCoat() {
        const poisonCoated = new Promise((resolve, reject) => {
            const cooldownCheck = (data) => {
                if (/skill_timeout\s*\(\s*['"]pcoat['"]\s*,?\s*(\d+\.?\d+?)?\s*\)/.test(data.code)) {
                    this.socket.removeListener("eval", cooldownCheck);
                    resolve();
                }
            };
            setTimeout(() => {
                this.socket.removeListener("eval", cooldownCheck);
                reject(`poisoncoat timeout (${Constants_1.Constants.TIMEOUT}ms)`);
            }, Constants_1.Constants.TIMEOUT);
            this.socket.on("eval", cooldownCheck);
        });
        this.socket.emit("skill", {
            name: "pcoat"
        });
        return poisonCoated;
    }
    quickPunch(target) {
        const marked = new Promise((resolve, reject) => {
            const cooldownCheck = (data) => {
                if (/skill_timeout\s*\(\s*['"]quickpunch['"]\s*,?\s*(\d+\.?\d+?)?\s*\)/.test(data.code)) {
                    this.socket.removeListener("eval", cooldownCheck);
                    resolve();
                }
            };
            setTimeout(() => {
                this.socket.removeListener("eval", cooldownCheck);
                reject(`quickpunch timeout (${Constants_1.Constants.TIMEOUT}ms)`);
            }, Constants_1.Constants.TIMEOUT);
            this.socket.on("eval", cooldownCheck);
        });
        this.socket.emit("skill", {
            name: "quickpunch",
            id: target
        });
        return marked;
    }
    quickStab(target) {
        const marked = new Promise((resolve, reject) => {
            const cooldownCheck = (data) => {
                if (/skill_timeout\s*\(\s*['"]quickstab['"]\s*,?\s*(\d+\.?\d+?)?\s*\)/.test(data.code)) {
                    this.socket.removeListener("eval", cooldownCheck);
                    resolve();
                }
            };
            setTimeout(() => {
                this.socket.removeListener("eval", cooldownCheck);
                reject(`quickstab timeout (${Constants_1.Constants.TIMEOUT}ms)`);
            }, Constants_1.Constants.TIMEOUT);
            this.socket.on("eval", cooldownCheck);
        });
        this.socket.emit("skill", {
            name: "quickstab",
            id: target
        });
        return marked;
    }
    rspeed(target) {
        const marked = new Promise((resolve, reject) => {
            const cooldownCheck = (data) => {
                if (/skill_timeout\s*\(\s*['"]rspeed['"]\s*,?\s*(\d+\.?\d+?)?\s*\)/.test(data.code)) {
                    this.socket.removeListener("eval", cooldownCheck);
                    resolve();
                }
            };
            setTimeout(() => {
                this.socket.removeListener("eval", cooldownCheck);
                reject(`rspeed timeout (${Constants_1.Constants.TIMEOUT}ms)`);
            }, Constants_1.Constants.TIMEOUT);
            this.socket.on("eval", cooldownCheck);
        });
        this.socket.emit("skill", {
            name: "rspeed",
            id: target
        });
        return marked;
    }
    shadowStrike(shadowstone = this.locateItem("shadowstone")) {
        if (shadowstone === undefined)
            return Promise.reject("We need a shadowstone in order to shadowstrike.");
        const shadowStriked = new Promise((resolve, reject) => {
            const cooldownCheck = (data) => {
                if (/skill_timeout\s*\(\s*['"]shadowstrike['"]\s*,?\s*(\d+\.?\d+?)?\s*\)/.test(data.code)) {
                    this.socket.removeListener("eval", cooldownCheck);
                    resolve();
                }
            };
            setTimeout(() => {
                this.socket.removeListener("eval", cooldownCheck);
                reject(`shadowstrike timeout (${Constants_1.Constants.TIMEOUT}ms)`);
            }, Constants_1.Constants.TIMEOUT);
            this.socket.on("eval", cooldownCheck);
        });
        this.socket.emit("skill", {
            name: "shadowstrike",
            num: shadowstone
        });
        return shadowStriked;
    }
}
exports.Rogue = Rogue;
//# sourceMappingURL=Rogue.js.map