forked from GrafNikola/tera-guide
-
Notifications
You must be signed in to change notification settings - Fork 17
/
9070.js
111 lines (97 loc) · 4.48 KB
/
9070.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
// Manglemire
//
// made by michengs / HSDN / ambushing
const OPCODES = {
"S_DUNGEON_EVENT_GAGE": {
366226: 39917,
367078: 47028,
367080: 57835,
367081: 39359,
376012: 47078
}
};
function addOpcodeAndDefinition(mod, name, version = null, definition = null) {
if (OPCODES[name] !== undefined && OPCODES[name][mod.dispatch.protocolVersion] !== undefined) {
mod.dispatch.addOpcode(name, OPCODES[name][mod.dispatch.protocolVersion]);
}
if (version !== null && definition !== null) {
mod.dispatch.addDefinition(name, version, definition);
}
}
module.exports = (dispatch, handlers, guide, lang) => {
guide.type = SP;
addOpcodeAndDefinition(dispatch._mod, "S_DUNGEON_EVENT_GAGE", 2, [
["name", "refString"],
["message", "refString"],
["unk", "int32"],
["type", "int32"],
["value", "int32"],
["name", "string"],
["message", "string"]
]);
const numbers = { 470046: 3, 470047: 6, 470048: 9 };
const boss_numbers = new Set();
let event_gage = 0;
dispatch.hook("S_ABNORMALITY_BEGIN", 4, event => {
if (numbers[event.id] !== undefined) {
boss_numbers.add(numbers[event.id]);
}
});
dispatch.hook("S_ABNORMALITY_END", 1, event => {
if (numbers[event.id] !== undefined) {
boss_numbers.delete(numbers[event.id]);
}
});
dispatch.hook("S_DUNGEON_EVENT_GAGE", 2, event => {
event_gage = event.value;
});
function is_telling_truth() {
const ones = event_gage % 10;
const tens = Math.floor((event_gage % 100) / 10);
return !boss_numbers.has(ones) && !boss_numbers.has(tens);
}
return {
"nd-470-1000": [
{ type: "stop_timers" },
{ type: "despawn_all" },
{ type: "func", func: () => {
boss_numbers.clear();
event_gage = 0;
} }
],
"s-470-1000-1105-0": [{ type: "text", sub_type: "message", message: "Jump", message_RU: "Прыжок" }],
"s-470-1000-1106-0": [{ type: "text", sub_type: "message", message: "Smash", message_RU: "Удар" }],
"s-470-1000-1120-0": [{ type: "text", sub_type: "message", message: "Pull", message_RU: "Притяжка" }],
"s-470-1000-1114-0": [{ type: "text", sub_type: "message", message: "Spray", message_RU: "Спрей" }],
"s-470-1000-1201-0": [
{ type: "text", sub_type: "message", message: "Stun", message_RU: "Стан" },
{ type: "spawn", func: "circle", args: [true, 553, 0, 0, 12, 250, 0, 2500] }
],
"s-470-1000-1307-0": [{ type: "text", sub_type: "message", message: "With a Bomb - Go away. No Bomb - Enter the circle", message_RU: "С бомбой - отойти. Без бомбы - войти в круг" }],
"s-470-1000-2105-0": [{ type: "text", sub_type: "message", message: "Jump", message_RU: "Прыжок" }],
"s-470-1000-2106-0": [{ type: "text", sub_type: "message", message: "Smash", message_RU: "Удар" }],
"s-470-1000-2107-0": [
{ type: "text", sub_type: "message", message: "Stun", message_RU: "Стан" },
{ type: "spawn", func: "circle", args: [true, 553, 0, 100, 12, 250, 0, 2500] }
],
"s-470-1000-2114-0": [{ type: "text", sub_type: "message", message: "Line", message_RU: "Полоса" }],
"s-470-1000-3106-0": [{ type: "text", sub_type: "message", message: "100" }],
"s-470-1000-3213-0": [ // "My shield will save me!" (shield)
{ type: "text", sub_type: "message", message: "Break shield", message_RU: "Сломать щит", check_func: () => is_telling_truth() },
{ type: "text", sub_type: "message", message: "Puddles (run away)", message_RU: "Лужи (убегать)", check_func: () => !is_telling_truth() }
],
"s-470-1000-3212-0": [ // "I will kill you all!" (aoe around boss)
{ type: "text", sub_type: "message", message: "Out", message_RU: "Наружу", check_func: () => is_telling_truth() },
{ type: "text", sub_type: "message", message: "In", message_RU: "Внутрь", check_func: () => !is_telling_truth() }
],
"s-470-1000-3218-0": [ // "One of you must die!" (aoe around player)
{ type: "text", sub_type: "message", message: "Out", message_RU: "Наружу", check_func: () => is_telling_truth() },
{ type: "text", sub_type: "message", message: "In", message_RU: "Внутрь", check_func: () => !is_telling_truth() }
],
"qb-470-1000-470019": [
{ type: "text", sub_type: "alert", message: "Truth", message_RU: "Правда", check_func: () => is_telling_truth() },
{ type: "text", sub_type: "alert", message: "Lie", message_RU: "Ложь", check_func: () => !is_telling_truth() }
],
"qb-470-1000-470011": [{ type: "text", sub_type: "message", message: "Stand on stars", message_RU: "Встать на звезду" }]
};
};