-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
88 lines (76 loc) · 2.66 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
const SettingsUI = require('tera-mod-ui').Settings;
exports.NetworkMod = function(mod) {
// Hooks (thanks to Foglio/Risenio for some of these)
mod.hook('S_FIN_INTER_PARTY_MATCH', 'event', () => {
if(mod.settings.instanceMatching)
mod.clientInterface.flashWindow();
});
mod.hook('S_BATTLE_FIELD_ENTRANCE_INFO', 'event', () => {
if(mod.settings.instanceMatching)
mod.clientInterface.flashWindow();
});
mod.hook('S_WHISPER', 'event', () => {
if(mod.settings.whisper)
mod.clientInterface.flashWindow();
});
mod.hook('S_OTHER_USER_APPLY_PARTY', 'event', () => {
if(mod.settings.lfgApplication)
mod.clientInterface.flashWindow();
});
mod.hook('S_ASK_TELEPORT', 'event', () => {
if(mod.settings.partySummon)
mod.clientInterface.flashWindow();
});
mod.hook('S_NOTIFY_GUILD_QUEST_URGENT', 'event', () => {
if(mod.settings.gbam)
mod.clientInterface.flashWindow();
});
mod.hook('S_SYSTEM_MESSAGE', 1, event => {
const msg = mod.parseSystemMessage(event.message);
switch(msg.id)
{
case 'SMT_FIELDBOSS_APPEAR':
{
if(mod.settings.worldBoss)
mod.clientInterface.flashWindow();
break;
}
}
});
mod.game.me.on('enter_combat', () => {
if(mod.settings.enterCombat)
mod.clientInterface.flashWindow();
});
// Commands
const PURPOSES = ['instanceMatching', 'worldBoss', 'whisper', 'lfgApplication', 'partySummon', 'enterCombat', 'gbam'];
mod.command.add('flasher', {
$default(purpose) {
if (PURPOSES.indexOf(purpose) < 0) {
if (ui) {
ui.show();
} else {
mod.command.message(purpose ? `Invalid mode: ${purpose}!` : 'Must specify mode!');
mod.command.message(`Valid modes: ${PURPOSES.join(', ')}`);
}
return;
}
if (mod.settings[purpose])
mod.command.message(`${purpose} disabled!`);
else
mod.command.message(`${purpose} enabled!`);
mod.settings[purpose] = !mod.settings[purpose];
}
});
// Settings UI
let ui = null;
if (global.TeraProxy.GUIMode) {
ui = new SettingsUI(mod, require('./settings_structure'), mod.settings, { height: 295 });
ui.on('update', settings => mod.settings = settings);
this.destructor = () => {
if (ui) {
ui.close();
ui = null;
}
};
}
}