-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.js
116 lines (92 loc) · 3.14 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
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
const DEFAULT_HOOK_SETTINGS = {order: -1000000, filter: {fake: false}};
const JOB_ZERK = 3;
const SKILL_DEXTER = 340100;
const SKILL_SINISTER = 350100;
const CAST_INTERVAL = 120;
const SKILL_UNLEASH = 330100;
const SKILL_UNLEASH_LENGTH = 3966;
const UNLEASH_DURATION = 21000;
module.exports = function ZerkHue(dispatch) {
const {command} = dispatch;
let gameId,
model,
job,
attackSpeed,
xloc,
yloc,
zloc,
wloc,
enabled = false;
let unleashInterval = null;
let lastCast = SKILL_DEXTER;
command.add('zerk', () => {
enabled = !enabled;
command.message(`Zerk skript: ${enabled}`);
});
dispatch.hook('S_LOGIN', 10, DEFAULT_HOOK_SETTINGS, event => {
gameId = event.gameId;
model = event.templateId;
job = (model - 10101) % 100;
enabled = [JOB_ZERK].includes(job);
});
dispatch.hook('C_PLAYER_LOCATION', 5, DEFAULT_HOOK_SETTINGS, event => {
if (!enabled) return;
xloc = event.dest.x;
yloc = event.dest.y;
zloc = event.dest.z;
wloc = event.w;
});
dispatch.hook('S_PLAYER_STAT_UPDATE', 10, DEFAULT_HOOK_SETTINGS, event => {
if(!enabled) return;
attackSpeed = (event.attackSpeed + event.attackSpeedBonus) / event.attackSpeed;
if (event.hp == 0) {
clearInterval(unleashInterval);
unleashInterval = null;
lastCast = SKILL_DEXTER;
}
});
dispatch.hook('C_START_SKILL', 7, DEFAULT_HOOK_SETTINGS, event => {
if (!enabled) return;
if ([SKILL_DEXTER, SKILL_SINISTER].includes(event.skill.id)) {
return false;
}
});
dispatch.hook('S_ABNORMALITY_BEGIN', 3, (event) => {
if (!enabled || !(event.target == gameId)) return;
if (event.id == 401730) {
const unleashFunction = () => {
dispatch.toServer('C_START_SKILL', 7, {
skill: { reserved: 0, npc: false, type: 1, huntingZoneId: 0, id: lastCast },
w: wloc,
loc: {x: xloc, y: yloc, z: zloc + 2},
dest: {x: 0, y: 0, z: 0},
unk: true,
moving: false,
continue: false,
target: 0n,
unk2: false
});
lastCast = lastCast == SKILL_DEXTER ? SKILL_SINISTER : SKILL_DEXTER;
};
unleashInterval = setInterval(unleashFunction, CAST_INTERVAL);
unleashFunction();
setTimeout(() => {
clearInterval(unleashInterval);
unleashInterval = null;
lastCast = SKILL_DEXTER;
}, UNLEASH_DURATION);
}
});
dispatch.hook('S_ACTION_STAGE', 9, {order: -1000000, filter: {fake: null}}, event => {
if (!enabled || !(event.gameId == gameId)) return;
if ([SKILL_DEXTER.toString().substring(0, 4), SKILL_SINISTER.toString().substring(0, 4)].includes(event.skill.id.toString().substring(0, 4))) {
return false;
}
});
dispatch.hook('S_ACTION_END', 5, {order: -1000000, filter: {fake: null}}, event => {
if (!enabled || !(event.gameId == gameId)) return;
if ([SKILL_DEXTER.toString().substring(0, 4), SKILL_SINISTER.toString().substring(0, 4)].includes(event.skill.id.toString().substring(0, 4))) {
return false;
}
});
}