Repository navigation
Expand file tree
/
Copy pathcommands.js
More file actions
51 lines (48 loc) · 1.36 KB
/
Copy pathcommands.js
File metadata and controls
51 lines (48 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
"use strict";
const {
journalPath,
customLocations
} = require("./utils");
const { push } = Array.prototype;
const tryRequire = () => {
delete require.cache[require.resolve(journalPath)];
try { return require(journalPath); }
catch(_) { return []; }
};
function journalOptions() {
const argLen = arguments.length;
let tmp;
if (!argLen) {
if (!this.enabled) {
customLocations.length = 0;
push.apply(customLocations, tryRequire());
}
return this.cmd.message(`Journal ${(this.enabled = !this.enabled) ? "ena" : "disa"}bled`);
}
else switch((tmp = arguments[0]) && tmp.toLowerCase()) {
case "ui":
case "webui":
if (this.webui) {
this.webui.open();
}
else {
this.cmd.message(`<font color="#ff0000">WebUI dependency is not present.</font>`);
}
return;
}
if (this.currentContract !== 54) {
return this.cmd.message(`<font color="#ff0000">Travel journal must be open to save custom locations.</font>`);
}
const name = [];
{
const copy = [];
let i = 0;
do copy[i] = arguments[i];
while(++i < argLen);
push.apply(name, copy.join(" ").split(":"));
}
const province = name.length > 1 ? name.shift() : "";
this.newCustom = province ? `${name.join(":")}\t${province}` : name.join(":");
this.send("C_ADD_TELEPORT_TO_POS_LIST", 1, { name: "*\t*" });
}
module.exports = journalOptions;