-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
69 lines (61 loc) · 1.79 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
const Vec3 = require('tera-vec3');
const config = require('./config.json');
module.exports = function GhilliegladeHelper(mod) {
const chestIds = [81341, 81342];
const data = {
9713: {
spawn: new Vec3(54997, 116171, 4517),
redirect: new Vec3(52227, 117334, 4386),
w: 1.6
},
7005: {
spawn: new Vec3(-481, 6301, 1956),
redirect: new Vec3(-341, 8665, 2180),
w: -0.96
}
};
let enabled = config.enabled || true;
let reset = false;
mod.game.me.on('change_zone', (zone) => {
if (!enabled) return;
if (zone == 9714 && reset) {
mod.send('C_RESET_ALL_DUNGEON', 1, {});
reset = false;
mod.command.message('Ghillieglade has been reset.');
}
});
mod.hook('S_SPAWN_ME', 3, event => {
if (!enabled || !data[mod.game.me.zone]) return;
if (event.loc.equals(data[mod.game.me.zone].spawn)) {
event.loc = data[mod.game.me.zone].redirect;
event.w = data[mod.game.me.zone].w;
}
return true;
});
mod.hook('S_SPAWN_NPC', (mod.majorPatchVersion < 79 ? 10 : 11), event => {
if (!enabled) return;
if (event.huntingZoneId == 713 && chestIds.includes(event.templateId)) {
reset = true;
mod.command.message('Ghillieglade will be reset next time entering Velik Sanctuary.');
}
});
mod.hook('C_RESET_ALL_DUNGEON', 1, event => {
if (!enabled) return;
if (mod.game.me.zone == 9713) {
reset = false;
mod.command.message('Ghillieglade was reset manually.');
}
});
mod.command.add('ggh', {
$default() {
mod.command.message('Usage: /8 ggh - Turn module on/off.');
},
$none() {
enabled = !enabled;
mod.command.message(enabled ? 'Module enabled.' : 'Module disabled.');
},
})
this.destructor = function() {
mod.command.remove('ggh');
};
};