-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
90 lines (76 loc) · 2.89 KB
/
index.js
File metadata and controls
90 lines (76 loc) · 2.89 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
console.log = ChatLib.chat;
// Debug Message
register("command", () => {
ChatLib.chat(
`&3&lPerry&6Client &7Debug:
&eCT Version: &7v${ChatTriggers.MODVERSION}
&3Perry§6Client &7v${JSON.parse(FileLib.read("PerryClient", "metadata.json")).version}`
);
}).setCommandName("peTest");
console.log("index.js is loading!"); // Debug
// --------------------------------- Imports ---------------------------------
import settings from "./config";
import location from "./utils/Location";
import "./features/General";
import "./features/Trophy";
import "./features/Commands";
import "./features/Dungeons";
import "./features/Combat";
import "./utils/bazaar";
import "./utils/uuid";
import { version, consts } from "./utils/constants";
import { setRegisters } from "./utils/functions"
import { openGUI } from "./utils/overlay"
import { data } from "./utils/data";
import { getLatestReleaseVersion } from "./utils/updater";
// --------------------------------- Welcome Message ---------------------------------
if (data.first_time) {
data.first_time = false;
data.save();
ChatLib.chat("");
ChatLib.chat(`&r&7&m--------------&r${ consts.PREFIX }&r&7&m--------------`)
ChatLib.chat(`&aUse '/pe' For settings!`)
ChatLib.chat(`&aUse '/pe commands' For commands!`);
new TextComponent(`&aClick &3here&a to copy the GitHub link!`)
.setClickAction("run_command")
.setClickValue(`/ct copy https://github.com/Perry5596/PerryClient`)
.chat()
ChatLib.chat("");
};
// --------------------------------- Commands ---------------------------------
register("command", (arg) => {
if (!arg) {
settings.openGUI();
return;
}
arg = arg?.toLowerCase()
switch (arg) {
case "gui":
openGUI();
break;
case "ver":
case "version":
ChatLib.chat(`${ consts.PREFIX } &bLatest Version: &e${ getLatestReleaseVersion() }`);
ChatLib.chat(`${ consts.PREFIX } &bYou are currently on version &e${ version }`);
break;
case "commands":
ChatLib.chat(`${ consts.PREFIX } &rWrite out commands here...`);
break;
case "reload":
location.findWorld();
setRegisters();
ChatLib.chat(`${ consts.PREFIX } &aReloaded all registers!`);
break;
default:
ChatLib.chat(`${consts.PREFIX} &r\n/pe => opens settings\n/pe gui => opens gui mover\n/pe version => gets the current PerryClient version\n/pe => see all commands\n/pe reload => reloads all registers in case they aren't working`)
}
}).setCommandName(`pe`, true).setAliases("perry","perryclient","perryp_", "per").setTabCompletions("gui", "version", "commands", "reload", "help");
// --------------------------------- Extra Triggers ---------------------------------
// GUI Closed Trigger
register("guiClosed", (event) => {
if (event?.toString()?.includes("vigilance")) {
setRegisters()
}
});
setRegisters(); // Set all registers to active
console.log("index.js is done loading!"); // Debug