Skip to content

Commit

Permalink
move gameLogCodes to Util
Browse files Browse the repository at this point in the history
  • Loading branch information
quisquous committed Jun 25, 2023
1 parent 49696da commit d9ea386
Show file tree
Hide file tree
Showing 14 changed files with 67 additions and 57 deletions.
4 changes: 1 addition & 3 deletions resources/user_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ import _Conditions from './conditions';
const Conditions = _Conditions;
import _ContentType from './content_type';
const ContentType = _ContentType;
import _NetRegexes, { gameLogCodes as _gameLogCodes } from './netregexes';
import _NetRegexes from './netregexes';
const NetRegexes = _NetRegexes;
const gameLogCodes = _gameLogCodes;
import _Regexes from './regexes';
const Regexes = _Regexes;
import { Responses as _Responses } from './responses';
Expand All @@ -41,7 +40,6 @@ 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
2 changes: 2 additions & 0 deletions resources/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Job, Role } from '../types/job';
import { NetMatches } from '../types/net_matches';
import { OutputStrings } from '../types/trigger';

import { gameLogCodes } from './netregexes';
import Outputs from './outputs';
import { callOverlayHandler } from './overlay_plugin_api';

Expand Down Expand Up @@ -414,6 +415,7 @@ const Util = {
watchCombatantOverride = watchFunc;
clearCombatantsOverride = clearFunc;
},
gameLogCodes: gameLogCodes,
} as const;

export default Util;
15 changes: 9 additions & 6 deletions ui/raidboss/data/00-misc/test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
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 +236,7 @@ const triggerSet: TriggerSet<Data> = {
id: 'Test Lang',
type: 'GameLog',
// In game: /echo cactbot lang
netRegex: { line: 'cactbot lang.*?', code: gameLogCodes.echo, capture: false },
netRegex: { line: 'cactbot lang.*?', code: Util.gameLogCodes.echo, capture: false },
infoText: (data, _matches, output) => output.text!({ lang: data.parserLang }),
outputStrings: {
text: {
Expand All @@ -253,7 +252,7 @@ const triggerSet: TriggerSet<Data> = {
{
id: 'Test Response',
type: 'GameLog',
netRegex: { line: 'cactbot test response.*?', code: gameLogCodes.echo, capture: false },
netRegex: { line: 'cactbot test response.*?', code: Util.gameLogCodes.echo, capture: false },
response: (_data, _matches, output) => {
// cactbot-builtin-response
output.responseOutputStrings = {
Expand All @@ -273,7 +272,7 @@ const triggerSet: TriggerSet<Data> = {
{
id: 'Test Watch',
type: 'GameLog',
netRegex: { line: 'cactbot test watch.*?', code: gameLogCodes.echo, capture: false },
netRegex: { line: 'cactbot test watch.*?', code: Util.gameLogCodes.echo, capture: false },
promise: (data) =>
Util.watchCombatant({
names: [
Expand Down Expand Up @@ -315,7 +314,7 @@ const triggerSet: TriggerSet<Data> = {
{
id: 'Test Config',
type: 'GameLog',
netRegex: { line: 'cactbot test config.*?', code: gameLogCodes.echo, capture: false },
netRegex: { line: 'cactbot test config.*?', code: Util.gameLogCodes.echo, capture: false },
alertText: (data, _matches, output) => {
return output.text!({ value: data.triggerSetConfig.testTriggerOutput.toString() });
},
Expand All @@ -331,7 +330,11 @@ const triggerSet: TriggerSet<Data> = {
{
id: 'Test Combatant Cast Enable',
type: 'GameLog',
netRegex: { line: 'cactbot test combatant cast.*?', code: gameLogCodes.echo, capture: false },
netRegex: {
line: 'cactbot test combatant cast.*?',
code: Util.gameLogCodes.echo,
capture: false,
},
run: (data) => {
data.watchingForCast = true;
},
Expand Down
4 changes: 2 additions & 2 deletions ui/raidboss/data/02-arr/dungeon/haukke_manor.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Conditions from '../../../../../resources/conditions';
import { gameLogCodes } from '../../../../../resources/netregexes';
import { Responses } from '../../../../../resources/responses';
import Util from '../../../../../resources/util';
import ZoneId from '../../../../../resources/zone_id';
import { RaidbossData } from '../../../../../types/data';
import { TriggerSet } from '../../../../../types/trigger';
Expand Down Expand Up @@ -54,7 +54,7 @@ const triggerSet: TriggerSet<Data> = {
type: 'GameLog',
netRegex: {
line: 'The void lamps have begun emitting an eerie glow',
code: gameLogCodes.message,
code: Util.gameLogCodes.message,
capture: false,
},
infoText: (_data, _matches, output) => output.text!(),
Expand Down
4 changes: 2 additions & 2 deletions ui/raidboss/data/02-arr/raid/t1.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Conditions from '../../../../../resources/conditions';
import { gameLogCodes } from '../../../../../resources/netregexes';
import { Responses } from '../../../../../resources/responses';
import Util from '../../../../../resources/util';
import ZoneId from '../../../../../resources/zone_id';
import { RaidbossData } from '../../../../../types/data';
import { TriggerSet } from '../../../../../types/trigger';
Expand Down Expand Up @@ -91,7 +91,7 @@ const triggerSet: TriggerSet<Data> = {
type: 'GameLog',
netRegex: {
line: 'The Allagan megastructure will be sealed off.*?',
code: gameLogCodes.message,
code: Util.gameLogCodes.message,
capture: false,
},
delaySeconds: 35,
Expand Down
4 changes: 2 additions & 2 deletions ui/raidboss/data/02-arr/raid/t8.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { gameLogCodes } from '../../../../../resources/netregexes';
import { Responses } from '../../../../../resources/responses';
import Util from '../../../../../resources/util';
import ZoneId from '../../../../../resources/zone_id';
import { RaidbossData } from '../../../../../types/data';
import { TriggerSet } from '../../../../../types/trigger';
Expand Down Expand Up @@ -29,7 +29,7 @@ const triggerSet: TriggerSet<Data> = {
type: 'GameLog',
netRegex: {
line: 'Landmines have been scattered.*?',
code: gameLogCodes.message,
code: Util.gameLogCodes.message,
capture: false,
},
alertText: (_data, _matches, output) => output.text!(),
Expand Down
4 changes: 2 additions & 2 deletions ui/raidboss/data/03-hw/alliance/dun_scaith.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Conditions from '../../../../../resources/conditions';
import { gameLogCodes } from '../../../../../resources/netregexes';
import { Responses } from '../../../../../resources/responses';
import Util from '../../../../../resources/util';
import ZoneId from '../../../../../resources/zone_id';
import { RaidbossData } from '../../../../../types/data';
import { TriggerSet } from '../../../../../types/trigger';
Expand Down Expand Up @@ -458,7 +458,7 @@ const triggerSet: TriggerSet<Data> = {
type: 'GameLog',
netRegex: {
line: 'Shadows gather on the floor.*?',
code: gameLogCodes.message,
code: Util.gameLogCodes.message,
capture: false,
},
suppressSeconds: 5,
Expand Down
8 changes: 4 additions & 4 deletions ui/raidboss/data/03-hw/alliance/weeping_city.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Conditions from '../../../../../resources/conditions';
import { gameLogCodes } from '../../../../../resources/netregexes';
import { Responses } from '../../../../../resources/responses';
import Util from '../../../../../resources/util';
import ZoneId from '../../../../../resources/zone_id';
import { RaidbossData } from '../../../../../types/data';
import { TriggerSet } from '../../../../../types/trigger';
Expand Down Expand Up @@ -86,7 +86,7 @@ const triggerSet: TriggerSet<Data> = {
type: 'GameLog',
netRegex: {
line: 'The Queen\'s Room will be sealed off.*?',
code: gameLogCodes.message,
code: Util.gameLogCodes.message,
capture: false,
},
run: (data) => data.arachneStarted = true,
Expand All @@ -96,7 +96,7 @@ const triggerSet: TriggerSet<Data> = {
type: 'GameLog',
netRegex: {
line: 'The Gloriole will be sealed off.*?',
code: gameLogCodes.message,
code: Util.gameLogCodes.message,
capture: false,
},
run: (data) => {
Expand All @@ -109,7 +109,7 @@ const triggerSet: TriggerSet<Data> = {
type: 'GameLog',
netRegex: {
line: 'The Tomb Of The Nullstone will be sealed off.*?',
code: gameLogCodes.message,
code: Util.gameLogCodes.message,
capture: false,
},
run: (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,5 +1,5 @@
import NetRegexes, { gameLogCodes } from '../../../../../resources/netregexes';
import { Responses } from '../../../../../resources/responses';
import Util from '../../../../../resources/util';
import ZoneId from '../../../../../resources/zone_id';
import { RaidbossData } from '../../../../../types/data';
import { TriggerSet } from '../../../../../types/trigger';
Expand Down Expand Up @@ -92,13 +92,21 @@ const triggerSet: TriggerSet<Data> = {
{
id: 'BA Seal',
type: 'GameLog',
netRegex: { line: '.* will be sealed off.*?', code: gameLogCodes.message, capture: false },
netRegex: {
line: '.* will be sealed off.*?',
code: Util.gameLogCodes.message,
capture: false,
},
run: (data) => data.sealed = true,
},
{
id: 'BA Clear Data',
type: 'GameLog',
netRegex: { line: '.*is no longer sealed.*?', code: gameLogCodes.message, capture: false },
netRegex: {
line: '.*is no longer sealed.*?',
code: Util.gameLogCodes.message,
capture: false,
},
run: (data) => {
delete data.side;
delete data.mythcall;
Expand Down Expand Up @@ -252,7 +260,7 @@ const triggerSet: TriggerSet<Data> = {
type: 'GameLog',
netRegex: {
line: '[^:]*:Munderg, turn flesh to ash.*?',
code: gameLogCodes.dialog,
code: Util.gameLogCodes.dialog,
capture: false,
},
condition: (data) => data.side === 'east',
Expand Down Expand Up @@ -282,7 +290,7 @@ const triggerSet: TriggerSet<Data> = {
type: 'GameLog',
netRegex: {
line: '[^:]*:Munderg, turn blood to ice.*?',
code: gameLogCodes.dialog,
code: Util.gameLogCodes.dialog,
capture: false,
},
condition: (data) => data.side === 'east',
Expand Down
4 changes: 2 additions & 2 deletions ui/raidboss/data/04-sb/trial/byakko-ex.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Conditions from '../../../../../resources/conditions';
import { gameLogCodes } from '../../../../../resources/netregexes';
import { Responses } from '../../../../../resources/responses';
import Util from '../../../../../resources/util';
import ZoneId from '../../../../../resources/zone_id';
import { RaidbossData } from '../../../../../types/data';
import { TriggerSet } from '../../../../../types/trigger';
Expand Down Expand Up @@ -195,7 +195,7 @@ const triggerSet: TriggerSet<Data> = {
type: 'GameLog',
netRegex: {
line: '[^:]*:Twofold is my wrath, twice-cursed my foes!.*?',
code: gameLogCodes.dialog,
code: Util.gameLogCodes.dialog,
capture: false,
},
condition: (data) => data.role === 'tank',
Expand Down
4 changes: 2 additions & 2 deletions ui/raidboss/data/04-sb/trial/tsukuyomi-ex.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Conditions from '../../../../../resources/conditions';
import { gameLogCodes } from '../../../../../resources/netregexes';
import Outputs from '../../../../../resources/outputs';
import { Responses } from '../../../../../resources/responses';
import Util from '../../../../../resources/util';
import ZoneId from '../../../../../resources/zone_id';
import { RaidbossData } from '../../../../../types/data';
import { TriggerSet } from '../../../../../types/trigger';
Expand Down Expand Up @@ -163,7 +163,7 @@ const triggerSet: TriggerSet<Data> = {
// then this could push unexpectedly earlier (or paired with buster).
netRegex: {
line: '[^:]*:No\. No\.\.\. Not yet\. Not\. Yet\..*?',
code: gameLogCodes.dialog,
code: Util.gameLogCodes.dialog,
capture: false,
},
response: Responses.aoe(),
Expand Down
27 changes: 13 additions & 14 deletions ui/raidboss/data/04-sb/ultimate/unending_coil_ultimate.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Conditions from '../../../../../resources/conditions';
import { gameLogCodes } from '../../../../../resources/netregexes';
import Outputs from '../../../../../resources/outputs';
import { callOverlayHandler } from '../../../../../resources/overlay_plugin_api';
import { Responses } from '../../../../../resources/responses';
Expand Down Expand Up @@ -463,7 +462,7 @@ const triggerSet: TriggerSet<Data> = {
type: 'GameLog',
netRegex: {
line: 'From on high I descend, the hallowed moon to call.*?',
code: gameLogCodes.dialog,
code: Util.gameLogCodes.dialog,
capture: false,
},
durationSeconds: 6,
Expand All @@ -485,7 +484,7 @@ const triggerSet: TriggerSet<Data> = {
type: 'GameLog',
netRegex: {
line: 'From on high I descend, the iron path to walk.*?',
code: gameLogCodes.dialog,
code: Util.gameLogCodes.dialog,
capture: false,
},
durationSeconds: 6,
Expand All @@ -507,7 +506,7 @@ const triggerSet: TriggerSet<Data> = {
type: 'GameLog',
netRegex: {
line: 'Take fire, O hallowed moon.*?',
code: gameLogCodes.dialog,
code: Util.gameLogCodes.dialog,
capture: false,
},
durationSeconds: 6,
Expand All @@ -529,7 +528,7 @@ const triggerSet: TriggerSet<Data> = {
type: 'GameLog',
netRegex: {
line: 'Blazing path, lead me to iron rule.*?',
code: gameLogCodes.dialog,
code: Util.gameLogCodes.dialog,
capture: false,
},
infoText: (_data, _matches, output) => output.text!(),
Expand All @@ -550,7 +549,7 @@ const triggerSet: TriggerSet<Data> = {
type: 'GameLog',
netRegex: {
line: 'O hallowed moon, take fire and scorch my foes.*?',
code: gameLogCodes.dialog,
code: Util.gameLogCodes.dialog,
capture: false,
},
infoText: (_data, _matches, output) => output.text!(),
Expand All @@ -571,7 +570,7 @@ const triggerSet: TriggerSet<Data> = {
type: 'GameLog',
netRegex: {
line: 'O hallowed moon, shine you the iron path.*?',
code: gameLogCodes.dialog,
code: Util.gameLogCodes.dialog,
capture: false,
},
infoText: (_data, _matches, output) => output.text!(),
Expand All @@ -592,7 +591,7 @@ const triggerSet: TriggerSet<Data> = {
type: 'GameLog',
netRegex: {
line: 'Fleeting light! \'Neath the red moon, scorch you the earth.*?',
code: gameLogCodes.dialog,
code: Util.gameLogCodes.dialog,
capture: false,
},
delaySeconds: 4,
Expand All @@ -616,7 +615,7 @@ const triggerSet: TriggerSet<Data> = {
type: 'GameLog',
netRegex: {
line: 'Fleeting light! Amid a rain of stars, exalt you the red moon.*?',
code: gameLogCodes.dialog,
code: Util.gameLogCodes.dialog,
capture: false,
},
delaySeconds: 4,
Expand All @@ -640,7 +639,7 @@ const triggerSet: TriggerSet<Data> = {
type: 'GameLog',
netRegex: {
line: 'From on high I descend, the moon and stars to bring.*?',
code: gameLogCodes.dialog,
code: Util.gameLogCodes.dialog,
capture: false,
},
durationSeconds: 9,
Expand All @@ -662,7 +661,7 @@ const triggerSet: TriggerSet<Data> = {
type: 'GameLog',
netRegex: {
line: 'From hallowed moon I descend, a rain of stars to bring.*?',
code: gameLogCodes.dialog,
code: Util.gameLogCodes.dialog,
capture: false,
},
durationSeconds: 9,
Expand All @@ -684,7 +683,7 @@ const triggerSet: TriggerSet<Data> = {
type: 'GameLog',
netRegex: {
line: 'From hallowed moon I bare iron, in my descent to wield.*?',
code: gameLogCodes.dialog,
code: Util.gameLogCodes.dialog,
capture: false,
},
durationSeconds: 9,
Expand Down Expand Up @@ -727,7 +726,7 @@ const triggerSet: TriggerSet<Data> = {
type: 'GameLog',
netRegex: {
line: 'Unbending iron, take fire and descend.*?',
code: gameLogCodes.dialog,
code: Util.gameLogCodes.dialog,
capture: false,
},
durationSeconds: 9,
Expand All @@ -749,7 +748,7 @@ const triggerSet: TriggerSet<Data> = {
type: 'GameLog',
netRegex: {
line: 'Unbending iron, descend with fiery edge.*?',
code: gameLogCodes.dialog,
code: Util.gameLogCodes.dialog,
capture: false,
},
durationSeconds: 9,
Expand Down
Loading

0 comments on commit d9ea386

Please sign in to comment.