forked from CatAnnaDev/Fast-Solo-Dungeons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
172 lines (148 loc) · 5.33 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
const SettingsUI = require('tera-mod-ui').Settings;
const Vec3 = require('tera-vec3');
module.exports = function Solodungeon(mod) {
if (mod.proxyAuthor !== 'caali' || !global.TeraProxy)
mod.warn('You are trying to use this module on an unsupported version of tera-proxy. It may not work as expected, and even if it does now it may break at any point in the future.');
const blacklist = [9713];
const whitelist = [9031, 9032, 3016];
let loot,
zone;
mod.command.add('fastsolo', () => {
if (ui) {
ui.show();
} else {
mod.settings.fastsolo = !mod.settings.fastsolo;
mod.command.message(`Fast solo dungeons is now ${mod.settings.fastsolo ? "enabled" : "disabled"}.`);
}
});
mod.command.add('acereset', () => {
if (ui) {
ui.show();
} else {
mod.settings.acereset = !mod.settings.acereset;
mod.command.message(`Autoreset is now ${mod.settings.acereset ? "enabled" : "disabled"}.`);
}
});
mod.hook('S_LOAD_TOPO', 3, event => {
zone = event.zone;
loot = {};
});
mod.hook('S_SPAWN_ME', 3, event => {
if (!mod.settings.fastsolo) return;
switch(zone) {
case 9713: // Ghillie
event.loc = new Vec3(52233, 117319, 4382)
event.w = 1.5
return true;
case 9031: // Ace Akasha
event.loc = new Vec3(72424, 133968, -502)
event.w = 1.5
return true;
case 9032: // Ace Baracos
event.loc = new Vec3(28214, 178550, -1675)
event.w = 1.5
return true;
case 3016: // Ace Lilith
event.loc = new Vec3(-99889, 59995, 8023)
event.w = -1.3
return true;
default: return;
}
});
mod.hook('S_SPAWN_DROPITEM', 8, event => {
if(!(blacklist.indexOf(event.item) > -1)) loot[event.gameId.toString()] = 1;
});
mod.hook('S_DESPAWN_DROPITEM', 4, event => {
if(event.gameId.toString() in loot) delete loot[event.gameId.toString()];
if(Object.keys(loot).length < 1 && (zone == 9031 || zone == 9032 || zone == 3016)) resetinstance();
});
function resetinstance() {
if (!mod.settings.acereset) return;
if(whitelist.indexOf(zone) > -1) mod.send('C_RESET_ALL_DUNGEON', 1, null);
}
const data = {7005: {spawn: new Vec3(-481, 6301, 1956), redirect: new Vec3(-341, 8665, 2180), w: -0.96}};
const chestloc = new Vec3(52562, 117921, 4431);
const chests = [81341, 81342];
let banyaka = 81301,
reset = false;
mod.command.add('velikaredirect', () => {
if (ui) {
ui.show();
} else {
mod.settings.velikaredirect = !mod.settings.velikaredirect;
mod.command.message(`Velikaredirect is now ${mod.settings.velikaredirect ? "enabled" : "disabled"}.`);
}
});
mod.command.add('ghilliereset', () => {
if (ui) {
ui.show();
} else {
mod.settings.ghilliereset = !mod.settings.ghilliereset;
mod.command.message(`Ghilliereset is now ${mod.settings.ghilliereset ? "enabled" : "disabled"}.`);
}
});
mod.command.add('boxredirect', () => {
if (ui) {
ui.show();
} else {
mod.settings.boxredirect = !mod.settings.boxredirect;
mod.command.message(`Boxredirect is now ${mod.settings.boxredirect ? "enabled" : "disabled"}.`);
}
});
mod.hook('S_BOSS_GAGE_INFO',3,(event) => {
if(!mod.settings.boxredirect) return;
if ((Number.parseInt(event.curHp) / Number.parseInt(event.maxHp)*10000)/100 <= 20 && event.templateId == banyaka) {
teleport();
}
});
mod.game.me.on('change_zone', (zone) => {
if (!mod.settings.ghilliereset) 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 (!mod.settings.velikaredirect || !data[mod.game.me.zone]) return;
if (event.loc.equals(data[mod.game.me.zone].spawn)) {
event.loc = data[mod.game.me.zone].redirect;
if (data[mod.game.me.zone].w)
event.w = data[mod.game.me.zone].w;
}
return true;
});
mod.hook('S_SPAWN_NPC', 11, event => {
if (!mod.settings.ghilliereset) return;
if (event.huntingZoneId == 713 && chests.includes(event.templateId)) {
reset = true;
mod.command.message('Ghillieglade will be reset the next time you enter veliks sanctuary.');
}
});
mod.hook('C_RESET_ALL_DUNGEON', 1, event => {
if (!mod.settings.ghilliereset) return;
if (mod.game.me.zone == 9713) {
reset = false;
mod.command.message('Ghillieglade was reset manually.');
}
});
function teleport() {
mod.send('S_INSTANT_MOVE', 3, {
gameId: mod.game.me.gameId,
loc: chestloc,
w: 0.18
});
return false;
}
let ui = null;
if (global.TeraProxy.GUIMode) {
ui = new SettingsUI(mod, require('./settings_structure'), mod.settings, { height: 255 }, { alwaysOnTop: true });
ui.on('update', settings => { mod.settings = settings; });
this.destructor = () => {
if (ui) {
ui.close();
ui = null;
}
};
}
};