Skip to content

Commit

Permalink
raidboss: convert NetRegexes.echo/message/dialog to params
Browse files Browse the repository at this point in the history
Part of #4986.
  • Loading branch information
quisquous committed Jun 25, 2023
1 parent e67c9e2 commit f5017c0
Show file tree
Hide file tree
Showing 15 changed files with 157 additions and 88 deletions.
12 changes: 9 additions & 3 deletions resources/netregexes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ const keysThatRequireTranslationAsConst = [
export const keysThatRequireTranslation: readonly string[] = keysThatRequireTranslationAsConst;
export type KeysThatRequireTranslation = typeof keysThatRequireTranslationAsConst[number];

export const gameLogCodes = {
echo: '0038',
dialog: '0044',
message: '0839',
} as const;

const defaultParams = <
T extends LogDefinitionTypes,
V extends LogDefinitionVersions,
Expand Down Expand Up @@ -474,7 +480,7 @@ export default class NetRegexes {
['type', 'timestamp', 'code', 'name', 'line', 'capture'],
);

return NetRegexes.gameLog({ ...params, code: '0038' });
return NetRegexes.gameLog({ ...params, code: gameLogCodes.echo });
}

/**
Expand All @@ -489,7 +495,7 @@ export default class NetRegexes {
['type', 'timestamp', 'code', 'name', 'line', 'capture'],
);

return NetRegexes.gameLog({ ...params, code: '0044' });
return NetRegexes.gameLog({ ...params, code: gameLogCodes.dialog });
}

/**
Expand All @@ -504,7 +510,7 @@ export default class NetRegexes {
['type', 'timestamp', 'code', 'name', 'line', 'capture'],
);

return NetRegexes.gameLog({ ...params, code: '0839' });
return NetRegexes.gameLog({ ...params, code: gameLogCodes.message });
}

/**
Expand Down
4 changes: 3 additions & 1 deletion resources/user_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ import _Conditions from './conditions';
const Conditions = _Conditions;
import _ContentType from './content_type';
const ContentType = _ContentType;
import _NetRegexes from './netregexes';
import _NetRegexes, { gameLogCodes as _gameLogCodes } from './netregexes';
const NetRegexes = _NetRegexes;
const gameLogCodes = _gameLogCodes;
import _Regexes from './regexes';
const Regexes = _Regexes;
import { Responses as _Responses } from './responses';
Expand All @@ -40,6 +41,7 @@ const ZoneInfo = _ZoneInfo;
console.assert(Conditions);
console.assert(ContentType);
console.assert(NetRegexes);
console.assert(gameLogCodes);
console.assert(Regexes);
console.assert(Responses);
console.assert(Outputs);
Expand Down
12 changes: 6 additions & 6 deletions ui/raidboss/data/00-misc/test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import NetRegexes from '../../../../resources/netregexes';
import NetRegexes, { gameLogCodes } from '../../../../resources/netregexes';
import outputs from '../../../../resources/outputs';
import { ConfigValue } from '../../../../resources/user_config';
import Util from '../../../../resources/util';
Expand Down Expand Up @@ -237,7 +237,7 @@ const triggerSet: TriggerSet<Data> = {
id: 'Test Lang',
type: 'GameLog',
// In game: /echo cactbot lang
netRegex: NetRegexes.echo({ line: 'cactbot lang.*?', capture: false }),
netRegex: { line: 'cactbot lang.*?', code: gameLogCodes.echo, capture: false },
infoText: (data, _matches, output) => output.text!({ lang: data.parserLang }),
outputStrings: {
text: {
Expand All @@ -253,7 +253,7 @@ const triggerSet: TriggerSet<Data> = {
{
id: 'Test Response',
type: 'GameLog',
netRegex: NetRegexes.echo({ line: 'cactbot test response.*?', capture: false }),
netRegex: { line: 'cactbot test response.*?', code: gameLogCodes.echo, capture: false },
response: (_data, _matches, output) => {
// cactbot-builtin-response
output.responseOutputStrings = {
Expand All @@ -273,7 +273,7 @@ const triggerSet: TriggerSet<Data> = {
{
id: 'Test Watch',
type: 'GameLog',
netRegex: NetRegexes.echo({ line: 'cactbot test watch.*?', capture: false }),
netRegex: { line: 'cactbot test watch.*?', code: gameLogCodes.echo, capture: false },
promise: (data) =>
Util.watchCombatant({
names: [
Expand Down Expand Up @@ -315,7 +315,7 @@ const triggerSet: TriggerSet<Data> = {
{
id: 'Test Config',
type: 'GameLog',
netRegex: NetRegexes.echo({ line: 'cactbot test config.*?', capture: false }),
netRegex: { line: 'cactbot test config.*?', code: gameLogCodes.echo, capture: false },
alertText: (data, _matches, output) => {
return output.text!({ value: data.triggerSetConfig.testTriggerOutput.toString() });
},
Expand All @@ -331,7 +331,7 @@ const triggerSet: TriggerSet<Data> = {
{
id: 'Test Combatant Cast Enable',
type: 'GameLog',
netRegex: NetRegexes.echo({ line: 'cactbot test combatant cast.*?', capture: false }),
netRegex: { line: 'cactbot test combatant cast.*?', code: gameLogCodes.echo, capture: false },
run: (data) => {
data.watchingForCast = true;
},
Expand Down
7 changes: 4 additions & 3 deletions ui/raidboss/data/02-arr/dungeon/haukke_manor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Conditions from '../../../../../resources/conditions';
import NetRegexes from '../../../../../resources/netregexes';
import { gameLogCodes } from '../../../../../resources/netregexes';
import { Responses } from '../../../../../resources/responses';
import ZoneId from '../../../../../resources/zone_id';
import { RaidbossData } from '../../../../../types/data';
Expand Down Expand Up @@ -52,10 +52,11 @@ const triggerSet: TriggerSet<Data> = {
// Void Lamp Spawn
id: 'Haukke Normal Void Lamps',
type: 'GameLog',
netRegex: NetRegexes.message({
netRegex: {
line: 'The void lamps have begun emitting an eerie glow',
code: gameLogCodes.message,
capture: false,
}),
},
infoText: (_data, _matches, output) => output.text!(),
outputStrings: {
text: {
Expand Down
7 changes: 4 additions & 3 deletions ui/raidboss/data/02-arr/raid/t1.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Conditions from '../../../../../resources/conditions';
import NetRegexes from '../../../../../resources/netregexes';
import { gameLogCodes } from '../../../../../resources/netregexes';
import { Responses } from '../../../../../resources/responses';
import ZoneId from '../../../../../resources/zone_id';
import { RaidbossData } from '../../../../../types/data';
Expand Down Expand Up @@ -89,10 +89,11 @@ const triggerSet: TriggerSet<Data> = {
{
id: 'T1 Slime Timer First',
type: 'GameLog',
netRegex: NetRegexes.message({
netRegex: {
line: 'The Allagan megastructure will be sealed off.*?',
code: gameLogCodes.message,
capture: false,
}),
},
delaySeconds: 35,
suppressSeconds: 5,
infoText: (_data, _matches, output) => output.text!(),
Expand Down
8 changes: 6 additions & 2 deletions ui/raidboss/data/02-arr/raid/t8.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import NetRegexes from '../../../../../resources/netregexes';
import { gameLogCodes } from '../../../../../resources/netregexes';
import { Responses } from '../../../../../resources/responses';
import ZoneId from '../../../../../resources/zone_id';
import { RaidbossData } from '../../../../../types/data';
Expand Down Expand Up @@ -27,7 +27,11 @@ const triggerSet: TriggerSet<Data> = {
{
id: 'T8 Landmine Start',
type: 'GameLog',
netRegex: NetRegexes.message({ line: 'Landmines have been scattered.*?', capture: false }),
netRegex: {
line: 'Landmines have been scattered.*?',
code: gameLogCodes.message,
capture: false,
},
alertText: (_data, _matches, output) => output.text!(),
run: (data) => data.landmines = {},
outputStrings: {
Expand Down
8 changes: 6 additions & 2 deletions ui/raidboss/data/03-hw/alliance/dun_scaith.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Conditions from '../../../../../resources/conditions';
import NetRegexes from '../../../../../resources/netregexes';
import { gameLogCodes } from '../../../../../resources/netregexes';
import { Responses } from '../../../../../resources/responses';
import ZoneId from '../../../../../resources/zone_id';
import { RaidbossData } from '../../../../../types/data';
Expand Down Expand Up @@ -456,7 +456,11 @@ const triggerSet: TriggerSet<Data> = {
// However, the RP text seems to be the only indicator.
id: 'Dun Scaith Shadow Links',
type: 'GameLog',
netRegex: NetRegexes.message({ line: 'Shadows gather on the floor.*?', capture: false }),
netRegex: {
line: 'Shadows gather on the floor.*?',
code: gameLogCodes.message,
capture: false,
},
suppressSeconds: 5,
response: Responses.stopMoving(),
},
Expand Down
18 changes: 12 additions & 6 deletions ui/raidboss/data/03-hw/alliance/weeping_city.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Conditions from '../../../../../resources/conditions';
import NetRegexes from '../../../../../resources/netregexes';
import { gameLogCodes } from '../../../../../resources/netregexes';
import { Responses } from '../../../../../resources/responses';
import ZoneId from '../../../../../resources/zone_id';
import { RaidbossData } from '../../../../../types/data';
Expand Down Expand Up @@ -84,16 +84,21 @@ const triggerSet: TriggerSet<Data> = {
// only when that boss is in progress.
id: 'Weeping City HeadMarker Arachne',
type: 'GameLog',
netRegex: NetRegexes.message({
netRegex: {
line: 'The Queen\'s Room will be sealed off.*?',
code: gameLogCodes.message,
capture: false,
}),
},
run: (data) => data.arachneStarted = true,
},
{
id: 'Weeping City HeadMarker Ozma',
type: 'GameLog',
netRegex: NetRegexes.message({ line: 'The Gloriole will be sealed off.*?', capture: false }),
netRegex: {
line: 'The Gloriole will be sealed off.*?',
code: gameLogCodes.message,
capture: false,
},
run: (data) => {
data.arachneStarted = false;
data.ozmaStarted = true;
Expand All @@ -102,10 +107,11 @@ const triggerSet: TriggerSet<Data> = {
{
id: 'Weeping City HeadMarker Calofisteri',
type: 'GameLog',
netRegex: NetRegexes.message({
netRegex: {
line: 'The Tomb Of The Nullstone will be sealed off.*?',
code: gameLogCodes.message,
capture: false,
}),
},
run: (data) => {
data.ozmaStarted = false;
data.calStarted = true;
Expand Down
4 changes: 4 additions & 0 deletions ui/raidboss/data/04-sb/dungeon/bardams_mettle.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import Conditions from '../../../../../resources/conditions';
<<<<<<< HEAD
=======
import { gameLogCodes } from '../../../../../resources/netregexes';
>>>>>>> a952b1cdc... raidboss: convert NetRegexes.echo/message/dialog to params
import { Responses } from '../../../../../resources/responses';
import ZoneId from '../../../../../resources/zone_id';
import { RaidbossData } from '../../../../../types/data';
Expand Down
18 changes: 13 additions & 5 deletions ui/raidboss/data/04-sb/eureka/eureka_hydatos.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import NetRegexes from '../../../../../resources/netregexes';
import NetRegexes, { gameLogCodes } from '../../../../../resources/netregexes';
import { Responses } from '../../../../../resources/responses';
import ZoneId from '../../../../../resources/zone_id';
import { RaidbossData } from '../../../../../types/data';
Expand Down Expand Up @@ -92,13 +92,13 @@ const triggerSet: TriggerSet<Data> = {
{
id: 'BA Seal',
type: 'GameLog',
netRegex: NetRegexes.message({ line: '.* will be sealed off.*?', capture: false }),
netRegex: { line: '.* will be sealed off.*?', code: gameLogCodes.message, capture: false },
run: (data) => data.sealed = true,
},
{
id: 'BA Clear Data',
type: 'GameLog',
netRegex: NetRegexes.message({ line: '.*is no longer sealed.*?', capture: false }),
netRegex: { line: '.*is no longer sealed.*?', code: gameLogCodes.message, capture: false },
run: (data) => {
delete data.side;
delete data.mythcall;
Expand Down Expand Up @@ -250,7 +250,11 @@ const triggerSet: TriggerSet<Data> = {
{
id: 'BA Owain Fire Element',
type: 'GameLog',
netRegex: NetRegexes.dialog({ line: '[^:]*:Munderg, turn flesh to ash.*?', capture: false }),
netRegex: {
line: '[^:]*:Munderg, turn flesh to ash.*?',
code: gameLogCodes.dialog,
capture: false,
},
condition: (data) => data.side === 'east',
alertText: (_data, _matches, output) => output.getToIce!(),
infoText: (_data, _matches, output) => output.switchMagia!(),
Expand All @@ -276,7 +280,11 @@ const triggerSet: TriggerSet<Data> = {
{
id: 'BA Owain Ice Element',
type: 'GameLog',
netRegex: NetRegexes.dialog({ line: '[^:]*:Munderg, turn blood to ice.*?', capture: false }),
netRegex: {
line: '[^:]*:Munderg, turn blood to ice.*?',
code: gameLogCodes.dialog,
capture: false,
},
condition: (data) => data.side === 'east',
alertText: (_data, _matches, output) => output.getToFire!(),
infoText: (_data, _matches, output) => output.switchMagia!(),
Expand Down
7 changes: 4 additions & 3 deletions ui/raidboss/data/04-sb/trial/byakko-ex.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Conditions from '../../../../../resources/conditions';
import NetRegexes from '../../../../../resources/netregexes';
import { gameLogCodes } from '../../../../../resources/netregexes';
import { Responses } from '../../../../../resources/responses';
import ZoneId from '../../../../../resources/zone_id';
import { RaidbossData } from '../../../../../types/data';
Expand Down Expand Up @@ -193,10 +193,11 @@ const triggerSet: TriggerSet<Data> = {
{
id: 'ByaEx Tiger Add',
type: 'GameLog',
netRegex: NetRegexes.dialog({
netRegex: {
line: '[^:]*:Twofold is my wrath, twice-cursed my foes!.*?',
code: gameLogCodes.dialog,
capture: false,
}),
},
condition: (data) => data.role === 'tank',
infoText: (_data, _matches, output) => output.text!(),
outputStrings: {
Expand Down
7 changes: 4 additions & 3 deletions ui/raidboss/data/04-sb/trial/tsukuyomi-ex.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Conditions from '../../../../../resources/conditions';
import NetRegexes from '../../../../../resources/netregexes';
import { gameLogCodes } from '../../../../../resources/netregexes';
import Outputs from '../../../../../resources/outputs';
import { Responses } from '../../../../../resources/responses';
import ZoneId from '../../../../../resources/zone_id';
Expand Down Expand Up @@ -161,10 +161,11 @@ const triggerSet: TriggerSet<Data> = {
// There's no "starts using" here. She pushes at 35% to this ability.
// This happens after 2nd meteors naturally, but if dps is good
// then this could push unexpectedly earlier (or paired with buster).
netRegex: NetRegexes.dialog({
netRegex: {
line: '[^:]*:No\. No\.\.\. Not yet\. Not\. Yet\..*?',
code: gameLogCodes.dialog,
capture: false,
}),
},
response: Responses.aoe(),
},
{
Expand Down
Loading

0 comments on commit f5017c0

Please sign in to comment.