Dxcufgb's Workshop

API

From a macro or another module:

const api = game.modules.get("dxcufgbs-reminders").api;

// Any user
api.findReminders(actor);        // [{ item, kind, cost, entry }]: every legendary, villain and lair action and when-hit trait on the actor
api.kindOf(item);                // { kind, reason, entry, cost }: how the item is classified, and why
api.legendaryPoints(actor);      // { value, max } from system.resources.legact, or null
api.legendaryResistance(actor);  // { value, max } from system.resources.legres, or null
api.getList();                   // this world's Reminder list ({ version, features, creatures, … }), or null
api.isListed("Wing Attack");     // true if the name (or an item's name) matches an entry in the list

// GM only
await api.remindNow();                    // post the legendary / villain card now (default: game.combat)
await api.addToList(item, "villain");     // add an item or a name; the kind is optional → true if added
await api.removeFromList("Wing Attack");  // remove a name or an item's name → true if removed
await api.configureItem(item);            // open the item's Reminder dialog
api.exportList();                         // download this world's list as reminders-<world id>.json
await api.importList();                   // pick a file, confirm, replace the list → true if replaced
await api.resetList();                    // replace this world's list with the default one, without asking → true if reset
  • kind is "legendary", "villain", "lair", "hit" (when-hit trait) or null. reason is "flag" (set on the item), "never", "villain" (name or list), "activation", "list" or "none". cost comes from the activation, then the list entry; findReminders uses 1 when neither has one (hit reminders have no cost). entry is the matching list entry (its effect is the summary on the card), or empty when none matches.
  • findReminders returns every kind, whether or not that kind's reminder setting is on (only Also detect by activation type applies), and doesn't check villain actions already used this combat or the points left.
  • GM-only calls do nothing for players: they return false, null (remindNow) or nothing.
  • remindNow(combat) follows the legendary / villain reminder settings but not Only after player characters' turns. It leaves out the current combatant unless that's a player character, and returns the chat message, or null when no NPC has an option left. With Remove old reminder cards on, it replaces the previous card.
  • addToList(item, kind): without kind, the kind comes from the item's activation, then Villain Action in its name, otherwise "legendary". It returns false when the name is already listed.
  • getList() returns the stored list: don't change it in place, use addToList, removeFromList or importList.
  • resetList() doesn't ask first. Export the list before you reset it if it has changes you want to keep.

Per item

Per item: item.setFlag("dxcufgbs-reminders", "kind", "legendary" | "villain" | "lair" | "hit" | "none"), or item.unsetFlag("dxcufgbs-reminders", "kind") for automatic.

From another module

The API is set in the ready hook, so it isn't there during init or setup, and your own ready handler may run before it. Get it when you need it, not once at startup:

function bossActions(actor) {
  const api = game.modules.get("dxcufgbs-reminders")?.api;
  if (!api) return [];   // Reminders not installed, not enabled or not ready yet
  return api.findReminders(actor).filter(r => r.kind === "legendary");
}

Add { "id": "dxcufgbs-reminders", "type": "module" } to relationships.recommends in your module.json. The module calls no hooks of its own.

Data

  • flags.dxcufgbs-reminders.kind on Items: see Per item above.
  • flags.dxcufgbs-reminders.villainUsed on a Combat: { "<item uuid with . replaced by _>": true } for each villain action used in that combat. Read it; the module writes it.
  • The list file (Export / Import, and the default data/reminders.json): { "version": 1, "features": [ … ], "creatures": [ … ], … }. Import needs a features array in which every entry has a name. An entry has id, name, optional aliases, kind (legendary / villain / lair / hit), cost, match (exact ignores case, apostrophe style and text in parentheses; contains matches anywhere in the item's name), effect (the summary on the card), limit, creatures, edition, source and confirmed. When several entries match, the one whose creatures names the actor wins.
  • hit entries need no activation and have three optional fields: attack (melee, the default, or any to trigger on ranged hits too), activation (a dnd5e activation type the item must have, such as reaction) and requires (text the item's description must contain). A legendary or lair activation on the item wins over a hit entry.
  • knownDefaults in a world's list holds the ids of the default entries already offered to it, so the merge on world start doesn't add removed entries back. Default entries need a stable, unique id.

This page mirrors the Reminders wiki on GitHub.