Repository navigation
API
dxcufgb edited this page Nov 5, 2026
·
2 revisions
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-
kindis"legendary","villain","lair","hit"(when-hit trait) ornull.reasonis"flag"(set on the item),"never","villain"(name or list),"activation","list"or"none".costcomes from the activation, then the list entry;findRemindersuses 1 when neither has one (hitreminders have no cost).entryis the matching list entry (itseffectis the summary on the card), or empty when none matches. -
findRemindersreturns 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, ornullwhen no NPC has an option left. With Remove old reminder cards on, it replaces the previous card. -
addToList(item, kind): withoutkind, the kind comes from the item's activation, then Villain Action in its name, otherwise"legendary". It returnsfalsewhen the name is already listed. -
getList()returns the stored list: don't change it in place, useaddToList,removeFromListorimportList. -
resetList()doesn't ask first. Export the list before you reset it if it has changes you want to keep.
Per item: item.setFlag("dxcufgbs-reminders", "kind", "legendary" | "villain" | "lair" | "hit" | "none"), or item.unsetFlag("dxcufgbs-reminders", "kind") for automatic.
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.
-
flags.dxcufgbs-reminders.kindon Items: see Per item above. -
flags.dxcufgbs-reminders.villainUsedon 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 afeaturesarray in which every entry has aname. An entry hasid,name, optionalaliases,kind(legendary/villain/lair/hit),cost,match(exactignores case, apostrophe style and text in parentheses;containsmatches anywhere in the item's name),effect(the summary on the card),limit,creatures,edition,sourceandconfirmed. When several entries match, the one whosecreaturesnames the actor wins. -
hitentries need no activation and have three optional fields:attack(melee, the default, oranyto trigger on ranged hits too),activation(a dnd5e activation type the item must have, such asreaction) andrequires(text the item's description must contain). A legendary or lair activation on the item wins over ahitentry. -
knownDefaultsin a world's list holds theids 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, uniqueid.
Dxcufgb's Workshop: every Foundry VTT project, video and changelog in one place · Support on Ko-fi · MIT License
Using it
For module authors
About
Help