-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
78 lines (68 loc) · 2.62 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
const SettingsUI = require('tera-mod-ui').Settings;
exports.NetworkMod = function(mod) {
function apply() {
mod.clientInterface.configureCameraShake(mod.settings.shakeEnabled, mod.settings.shakePower, mod.settings.shakeSpeed);
if (mod.settings.fovEnabled)
mod.send('S_STEER_DEBUG_COMMAND', 1, { command: `fov ${mod.settings.fovValue}` });
if (mod.settings.distanceEnabled)
mod.send('S_DUNGEON_CAMERA_SET', 1, { enabled: true, default: mod.settings.distanceValue, max: mod.settings.distanceValue });
}
mod.game.on('leave_loading_screen', () => mod.setTimeout(() => apply(), 1000));
mod.hook("S_STEER_DEBUG_COMMAND", "event", () => {
if(mod.settings.fovEnabled) return false;
});
mod.hook("S_DUNGEON_CAMERA_SET", "event", () => {
if(mod.settings.distanceEnabled) return false;
});
// Commands
mod.command.add('camera', {
$default() {
if (ui)
ui.show();
},
shake(mode, shakePower, shakeSpeed) {
mod.settings.shakeEnabled = mode.toLowerCase() === 'on';
mod.settings.shakePower = Number(shakePower) || 1.0;
mod.settings.shakeSpeed = Number(shakeSpeed) || 1.0;
mod.command.message(`Shaking ${mod.settings.shakeEnabled ? 'enabled' : 'disabled'}!`);
apply();
},
fov(value) {
if (value === 'disable') {
mod.settings.fovEnabled = false;
mod.command.message(`FOV disabled!`);
} else {
mod.settings.fovEnabled = true;
mod.settings.fovValue = Number(value) || 71.0;
mod.command.message(`FOV set to ${mod.settings.fovValue}!`);
}
apply();
},
distance(value) {
if (value === 'disable') {
mod.settings.distanceEnabled = false;
mod.command.message(`Distance disabled!`);
} else {
mod.settings.distanceEnabled = true;
mod.settings.distanceValue = Number(value) || 170.0;
mod.command.message(`Distance set to ${mod.settings.distanceValue}!`);
}
apply();
}
});
// Settings UI
let ui = null;
if (global.TeraProxy.GUIMode) {
ui = new SettingsUI(mod, require('./settings_structure'), mod.settings, { height: 280 });
ui.on('update', settings => {
mod.settings = settings;
apply();
});
this.destructor = () => {
if (ui) {
ui.close();
ui = null;
}
};
}
}