OverlayPlugin / cactbot

FFXIV TypeScript Raiding Overlay
Apache License 2.0
84 stars 34 forks source link

[WIP] util: Tool to auto generate basic triggers #222

Closed valarnin closed 1 month ago

valarnin commented 1 month ago

Example files generated from the tool for ex2 and second expert dungeon:

example_ex2_console.txt example_ex2.ts.txt (Updated with latest changes as of c051e13) example_expert2_console.txt example_expert2.ts.txt

This tool will scan all passed log files, scanning for ability-related information, headmarker information, and optionally via flags MapEffect, BattleTalk2, NpcYell, and ActorSetPos information. Once data collection is done, it will format non-ability information as data tables, then prompt the user to determine what to do for each ability for trigger generation. There is some logic in place to determine a "good enough" default suggestion for each trigger.

Example screenshot of the selection interface, as the full console output doesn't actually include color or the list of options:

image


As is obvious if you look at the example ex2 file, the ActorSetPos logic needs some improvement before it's ready for actual use. I have made some improvements to the ActorSetPos logic. More could be made, but this is much closer to what I envisioned.

This also contains hard-coded fetch calls to the beta XIVAPI service, instead of using the XivApi class, as the XivApi class doesn't really support querying for specific rows as a single query while also returning columns.

There's plenty of cleanup and improvements that can still be made in general.

cactbotbot commented 1 month ago

@valarnin Thanks for your contribution! šŸŒµšŸš€

wexxlee commented 1 month ago

This is great - thanks so much for putting in the work on this! I'm planning to give it a workout this weekend with some of the (still-to-do) dungeons/trials, so I'll hopefully more meaningful feedback then. But I can see this adding a lot of value going forward.

This also contains hard-coded fetch calls to the beta XIVAPI service, instead of using the XivApi class, as the XivApi class doesn't really support querying for specific rows as a single query while also returning columns.

Yeah the original (and still existing) xivapi doesn't really support this outside the search endpoint, which is not really what we want to be using. I think something could be added pretty easily to the class I modified for the beta api (in #171), but I'm waiting to see how things shake out with timing after 7.05 on Tuesday before merging that.

valarnin commented 1 month ago

I have identified a few things I'd like to patch up before merging, based on having used this tool for r1n/r2n/r3n:

  1. A bug (MapEffect output isn't properly matching slots for mapping flags and offsets, so slots will end up with flags and offsets from other slots sometimes)
  2. Some common triggers that I'd like to add as options in the selection list
  3. Trigger suggestions for headmarkers

I can't speak for the efficacy of the tool for dungeon content yet, but for writing r1n/r2n/r3n it shaved probably about a third of the time off of writing triggers, and vastly reduced the time required to figure out MapEffect info for r1n despite the bug mentioned above causing some confusion.

I'll try to clean up the above listed items tomorrow or Friday and then merge it.

JLGarber commented 1 month ago

Yes, for the Alexandria package I'm working on it definitely cut a good bit of time out of the boilerplate triggers on the first attempt using it. I suspect the savings will increase from there as I get used to running it before starting trigger work.

valarnin commented 1 month ago

Someone (maybe me, IDK) hit the update branch button on github and that caused conflicts trying to push the last few updates, so I had to rebase locally and force-push. Sorry about that.

This is ready for a review of the latest three commits and then a merge pending that review.

valarnin commented 1 month ago

Oh right, here's an example of r1n default headmarker trigger selection:

// Auto-generated with:
// /home/valarnin/.nvm/versions/node/v20.14.0/bin/node /mnt/c/Users/valarnin/Source/cactbot/util/logtools/generate_triggers.ts -f /mnt/c/Stuff/Games/ACT/FFXIVLogs/Network_27100_20240716.log /mnt/c/Users/valarnin/Downloads/Network_27100_20240716.log -z AacLightHeavyweightM1 -tp R1N
import { Responses } from '../../../../../resources/responses';
import ZoneId from '../../../../../resources/zone_id';
import { RaidbossData } from '../../../../../types/data';
import { TriggerSet } from '../../../../../types/trigger';

export type Data = RaidbossData;

const headMarkerData = {
  // Offsets: 69978,261316,432942,482547,658879,708353
  // Vfx Path: com_share1f
  '5D': '5D',
  // Offsets: 62940,220684,382330,608211
  // Vfx Path: tank_lockon02k1
  'DA': 'DA',
  // Offsets: 213518,458927,475285,684854,701130
  // Vfx Path: loc05sp_05a_se_p
  '178': '178',
} as const;

const triggerSet: TriggerSet<RaidbossData> = {
  id: 'AacLightHeavyweightM1',
  zoneId: ZoneId.AacLightHeavyweightM1,
  timelineFile: '???.txt',
  triggers: [
    {
      id: 'R1N Headmarker Stack 5D',
      type: 'HeadMarker',
      netRegex: { id: headMarkerData['5D'], capture: true },
      response: Responses.stackMarkerOn(),
    },
    {
      id: 'R1N Headmarker Tankbuster DA',
      type: 'HeadMarker',
      netRegex: { id: headMarkerData['DA'], capture: true },
      response: Responses.tankBuster(),
    },
    {
      id: 'R1N Headmarker Stack 178',
      type: 'HeadMarker',
      netRegex: { id: headMarkerData['178'], capture: true },
      response: Responses.stackMarkerOn(),
    },
  ]
};

export default triggerSet;