forked from quisquous/cactbot-user
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathraidboss.js
433 lines (417 loc) · 14.1 KB
/
raidboss.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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
// console.log('git raidboss user file');
// Options.Debug = true;
// console.log('Language set to ' + Options.Language);
// Options.SpokenAlertsEnabled = false;
// Options.Skin = 'lippe';
Options.cactbotWormholeStrat = true;
Options.PlayerNicks = {
'Paprika Rika': 'Pap',
'Elmindreda Farshaw': 'Min',
'Elmindreda Far\'shaw': 'Min',
'Mikoto Misaka': 'Miko',
'Lohpopo Lopopo': 'Loh',
'Ninene Nine': 'Nine',
'Wikiki Wiki': 'Wiki',
'Kinono Kino': 'Kino',
'The\'man The\'Myth': 'Zero',
'Sanjuro Katsuki': 'San',
'Alshiana Valtarios': 'Alshi',
'Cheesygordita Crunch': 'Cheesy',
'Tsukiya Tamada': 'Tsuki',
'Women\'s Champion': 'Kev',
'Fire Five': 'Kev',
'Skill Issue': 'Kev',
'Shisui Miwa': 'Derp',
'Goshu Tsukinoe': 'goshu',
'Goshu Banhi': 'goshu',
'Hoochi Coochie': 'Kev',
'Heal Er': 'Glory',
'Phoebe Blu': 'Kev',
'Leshwi Shanay-im': 'Min',
'Wind-up Mizzen': 'Mizzen',
'Jujube Jube': 'Pap',
};
// Prepend emoji to all added timeline events to make them stand out.
function emojify(arr) {
const emojo = '👋';
const search = Regexes.parse(/^\s*(\y{Float})\s+"\s*(?!-)/);
for (let i = 0; i < arr.length; ++i)
arr[i] = arr[i].replace(search, '$1 " ' + emojo + ' ');
return arr;
}
Options.Triggers.push(
...[
{
zoneRegex: /.*/,
filename: 'user global',
triggers: [
{
id: 'Suicide Is Painless',
disabled: true,
netRegex: NetRegexes.wasDefeated({ targetId: '1.*?', sourceId: '00' }),
infoText: function(data, matches) {
console.log(JSON.stringify(matches));
return 'TEST: ' + matches.target;
},
},
{
/* eslint-disable max-len */
// [6/23/2020 6:57:07 PM] Info: raidbossy: BrowserConsole: CB01|2020-06-23T18:57:12.3510000-07:00|400063E7|Nael Deus Darnus|7D8|Iron Chariot|400063E7|Nael Deus Darnus|2.20||X|Y|Z|heading|647cb90332a59100625777855ef0d638 (Source: , Line: 11)
// [6/23/2020 6:57:07 PM] Info: raidbossy: BrowserConsole: 20|2020-06-23T18:57:12.3510000-07:00|400063E7|Nael Deus Darnus|7D8|Iron Chariot|400063E7|Nael Deus Darnus|2.20||647cb90332a59100625777855ef0d638 (Source: , Line: 18)
/* eslint-enable */
id: 'test overlayplugin',
disabled: true,
netRegex: /(?<line>^CB01.*$)/,
run: function(data, matches) {
console.log(matches.line);
},
},
{
id: 'VFX Funtimes',
// eslint-disable-next-line max-len
// 252|2021-03-20T11:19:04.9210000-07:00|00000038|400005F5|10686258|00000003|00C20014|0B1F0000|60563C98|00000000|E0000015|00000808|000000E1|E0000000|00000000|00000000||c0d981f91816e317d4e05a734b44ab75
netRegex: NetRegexes.gainsEffect({ effectId: '808' }),
disabled: true,
infoText: (data, matches) => `(${matches.target}: ${matches.count})`,
sound: null,
tts: null,
run: (data, matches) => {
console.log(`(${matches.target}: ${matches.count})`);
},
},
],
},
{
zoneId: ZoneId.MiddleLaNoscea,
triggers: [
{
id: 'Test Lang',
netRegex: NetRegexes.echo({ line: 'cactbot lang.*?', capture: false }),
infoText: (data, _, output) => {
return output.text({ parserLang: data.parserLang });
},
outputStrings: {
text: {
en: 'Language2: ${parserLang}',
},
},
},
{
id: 'Test Lang',
regex: Regexes.echo({ line: 'boop1.*?', capture: false }),
infoText: (data, _, output) => {
return output.text({ parserLang: data.parserLang });
},
outputStrings: {
text: {
en: 'Language3: ${parserLang}',
},
},
},
{
id: 'Test Boop 2',
regex: Regexes.echo({ line: 'boop2.*?', capture: false }),
promise: async (data) => {
const combatants1 = await callOverlayHandler({
call: 'getCombatants',
});
const combatants2 = await window.callOverlayHandler({
call: 'getCombatants',
});
const names1 = combatants1.combatants.map((c) => c.Name);
const names2 = combatants2.combatants.map((c) => c.Name);
console.log(`names1: ${JSON.stringify(names1)}`);
console.log(`names2: ${JSON.stringify(names2)}`);
},
},
],
},
{
// /echo :Bahamut Prime:26E8: for adds
// /echo :Bahamut Prime:2707: for golden
zoneRegex: /The Unending Coil Of Bahamut \(Ultimate\)/,
filename: 'user ucob',
timeline: [
'1208 "(conv, shake)"', // Morn Afah #1
'1214 "(holm)"', // Akh Morn #1
'1238 "(early veng)"', // Akh Morn #2
'1264 "(reprisal)"', // Morn Afah #2
'1297 "(raw shake)"', // Morn Afah #3
'1309 "(hallow)"', // Akh Morn #3
'1348 "(conv, reprisal)"', // Morn Afah #4
'1398 "(shake)"', // Morn Afah #5
'1412 "(thots n prayers)"', // Enrage
'alarmtext "Sentence/Ravensbeak" before 10 "PAP USE YOUR BLOODY COOLDOWNS"',
'infotext "Morn Afah #1" before 10 "conv, shake"',
'infotext "Morn Afah #2" before 8 "reprisal"',
'infotext "Morn Afah #3" before 8 "raw shake"',
'infotext "Morn Afah #4" before 8 "conv, reprisal"',
'infotext "Morn Afah #5" before 8 "shake"',
],
},
{
zoneRegex: /^The Weapon's Refrain \(Ultimate\)$/,
filename: 'user uwu',
timeline: ['alarmtext "Dark IV" after 1 "USE THE BLOODY TANK LB!"'],
},
{
zoneRegex: {
en: /The Second Coil Of Bahamut - Turn \(2\)/,
},
filename: 'user t7',
triggers: [
{
id: 'T7 Voice',
regex: /1A:(\y{Name}) gains the effect of Cursed Voice from {2}for (\y{Float}) Seconds/,
run: function(data, matches) {
data.voices = data.voices || {};
data.voices[matches[1]] = matches[2];
},
},
{
id: 'T7 Voice Got Three',
regex: /1A:\y{Name} gains the effect of Cursed Voice/,
condition: function(data) {
// In case log lines get dropped wait a little and go anyway.
return data.voices && Object.keys(data.voices).length === 3;
},
infoText: function(data) {
if (!data.voices)
return;
// Never freeze.
const neverPerson = 'Paprika Rika';
// Always freeze first.
const priorityPerson = 'Ryythe Larke';
// Prefer not this person, unless the next best person has a short time.
const preferPerson = 'Elmindreda Far\'shaw';
const minPreferSeconds = 6;
delete data.voices[neverPerson];
let order = [];
if (priorityPerson in data.voices) {
delete data.voices[priorityPerson];
order.push(priorityPerson);
}
const preferPersonTime = data.voices[preferPerson];
delete data.voices[preferPerson];
const sortedVoices = Object.keys(data.voices).sort((a, b) => {
return data.voices[b] - data.voices[a];
});
order = order.concat(sortedVoices);
if (preferPersonTime) {
const bestTime = data.voices[order[0]];
if (
bestTime < minPreferSeconds &&
order[0] !== priorityPerson &&
preferPersonTime > bestTime
)
order.unshift(preferPerson);
else
order.push(preferPerson);
}
delete data.voices;
return 'Freeze: ' + order.map(data.ShortName).join(', ');
},
},
{
id: 'T7 Voice Cleanup',
regex: /1A:\y{Name} gains the effect of Cursed Voice/,
suppressSeconds: 10,
delaySeconds: 5,
run: function(data) {
delete data.voices;
},
},
],
},
{
zoneRegex: /^Eden's Gate: Resurrection \(Savage\)$/,
filename: 'user e1s',
timeline: function(data) {
if (data.job !== 'DRK')
return;
return emojify([
'1 "Remember Early Rampart"',
'5 "Reprisal"',
'36 "Missionary"',
'51 "Living"',
'65 "Reprisal"',
'139 "Missionary"',
'141 "Reprisal"',
'520 "Missionary"',
'550 "Reprisal"',
'616 "Missionary"',
'626 "Reprisal"',
'670 "Living"',
'723 "Reprisal"',
'hideall "--hold--"',
'612 "--hold--"',
'alarmtext "--hold--" before 0 "PAP HOLD YOUR BLOODY COOLDOWNS"',
]);
},
},
{
zoneRegex: /^Eden's Gate: Descent \(Savage\)$/,
filename: 'user e2s',
timeline: function(data) {
if (data.job !== 'DRK')
return;
return emojify([
'26 "Reprisal"',
'29 "Missionary"',
'102 "Reprisal"',
'107 "Missionary"',
'221 "Reprisal"',
'246 "Missionary"',
'290 "Spare Reprisal"',
'372 "Missionary"',
]);
},
},
{
zoneRegex: /^Eden's Gate: Inundation \(Savage\)$/,
filename: 'user e3s',
timeline: function(data) {
if (data.job !== 'DRK')
return;
return emojify([
'3 "Missionary"',
'23 "goshu hallowed"',
'50 "Reprisal?"',
'hideall "--hold--"',
'104 "--hold--"',
'alarmtext "--hold--" before 0 "PAP HOLD YOUR BLOODY COOLDOWNS"',
'125 "Reprisal"',
'145 "Missionary"',
'155 "Provoke"',
'167 "Living"',
'195 "Reprisal"',
'235 "Missionary"',
'310 "rampart"',
'312 "Reprisal"',
'314 "shadow wall"',
'337.5 "Missionary"',
'418 "Reprisal"',
'427 "Missionary"',
'475 "Provoke"',
'489 "Reprisal"',
'490 "Living"',
'513 "Missionary"',
]);
},
},
{
zoneRegex: /^Eden's Gate: Sepulture \(Savage\)$/,
filename: 'user e4s',
timeline: function(data) {
if (data.job !== 'DRK')
return;
return emojify([
'10 "Living"',
'35 "Missionary"',
'40 "dark mind"',
'50 "Reprisal"',
'330 "Missionary"',
'340 "Reprisal"',
'630 "Missionary"',
'662 "Reprisal"',
'715 "TBN Goshu"',
'alarmtext "TBN Goshu" before 5 "SAVE GOSHU"',
'1020 "Missionary"',
'1052 "rampart"',
'1056 "dark mind"',
'1056 "shadow wall"',
'1067 "Reprisal"',
'1171 "Missionary"',
'1179 "Reprisal"',
'1285 "rampart"',
'1292 "dark mind"',
'1283.5 "Missionary"',
'1290 "Reprisal"',
'1315 "provoke"',
'1317 "Living"',
'1370 "Reprisal"',
'1403 "shadow wall"',
'1410 "Missionary"',
'1415 "dark mind"',
'1433 "Reprisal"',
'1480 "rampart"',
]);
},
},
],
);
// Play tts as well as the on screen text.
const playTTS = {
SpeechAlert: true,
TextAlert: true,
SoundAlert: true,
};
// Run regardless of condition.
const alwaysTrueCondition = {
Condition: function(data, matches) {
if (matches.source !== data.me && !data.party.inAlliance(matches.source))
return false;
return true;
},
};
Options.PerTriggerOptions = {
'O4S2 Flood of Naught: Inside': playTTS,
'O4S2 Flood of Naught: Outside': playTTS,
'O4S2 Flood of Naught: Colors Purple Blue': playTTS,
'O4S2 Flood of Naught: Colors Blue Purple': playTTS,
'UCU Nael Quote 1': playTTS,
'UCU Nael Quote 2': playTTS,
'UCU Nael Quote 3': playTTS,
'UCU Nael Quote 4': playTTS,
'UCU Nael Quote 5': playTTS,
'UCU Nael Quote 6': playTTS,
'UCU Nael Quote 7': playTTS,
'UCU Nael Quote 8': playTTS,
'UCU Nael Quote 9': playTTS,
'UCU Nael Quote 10': playTTS,
'UCU Nael Quote 11': playTTS,
'UCU Nael Quote 12': playTTS,
'UCU Nael Quote 13': playTTS,
'UCU Nael Quote 14': playTTS,
'General Provoke': alwaysTrueCondition,
'General Ultimatum': alwaysTrueCondition,
'General Shirk': alwaysTrueCondition,
'General Holmgang': alwaysTrueCondition,
'General Hallowed': alwaysTrueCondition,
'General Living': alwaysTrueCondition,
'General Walking': alwaysTrueCondition,
};
Object.assign(Options.PerTriggerOptions, {
'Test Poke': {
SpeechAlert: true,
TTSText: function(data) {
console.log('boop');
return data.pokes;
},
},
});
// Here's an example of a adding a custom regen trigger.
// It reminds you to use regen again when you are in Sastasha (unsynced).
Options.Triggers.push({
// The zone this should apply to.
// This should match the zoneId in the triggers file.
zoneId: ZoneId.Sastasha,
triggers: [
// A more complicated regen trigger.
{
// This is a made up id.
id: 'User Example Regen',
// This will match log lines from ACT that look like this:
// "Nacho Queen gains the effect of Regen from Taco Cat for 21.00 Seconds."
regex: Regexes.gainsEffect({ effect: 'Regen' }),
delaySeconds: function(data, matches) {
// Wait the amount of seconds regen lasts before reminding you to
// reapply it. This is not smart enough to figure out if you
// cast it twice, and is left as an exercise for the reader to
// figure out how to do so via storing variables on `data`.
return data.ParseLocaleFloat(matches.duration);
},
alertText: 'Regen',
},
],
});