forked from busann/anti-cc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
48 lines (42 loc) · 1.17 KB
/
index.js
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
module.exports = function antiCC(mod) {
let enabled = false;
mod.command.add("cc", () => {
enabled = !enabled;
mod.command.message("Anti-CC enabled: " + enabled);
});
let gameId = 0,
location = null,
locRealTime = 0;
mod.hook('C_PLAYER_LOCATION', 5, event => {
location = event
locRealTime = Date.now()
});
mod.hook('S_LOGIN', 14, event => {
gameId = event.gameId;
});
mod.hook('S_EACH_SKILL_RESULT', 14, {order: -10000000}, event => {
if (!enabled) return;
if (event.target === gameId && event.reaction.enable) {
mod.toServer('C_PLAYER_LOCATION', 5, Object.assign({}, location, {
type: 2,
time: location.time - locRealTime + Date.now() - 50
}));
mod.toServer('C_PLAYER_LOCATION', 5, Object.assign(location, {
type: 7,
time: location.time - locRealTime + Date.now() + 50
}));
event.reaction.enable = false;
event.reaction.instantPush = false;
event.reaction.air = false;
event.reaction.airChain = false;
event.reaction.loc.x = 0;
event.reaction.loc.y = 0;
event.reaction.loc.z = 0;
event.reaction.w = 0;
event.reaction.stage = 0;
event.reaction.id = 0;
event.reaction.movement = [];
return true;
}
});
};