Skip to content

[#6923] Add system-specific adventure importer dialog with actions#6946

Merged
arbron merged 3 commits into
6.0.xfrom
adventure-importer
Jul 1, 2026
Merged

[#6923] Add system-specific adventure importer dialog with actions#6946
arbron merged 3 commits into
6.0.xfrom
adventure-importer

Conversation

@arbron

@arbron arbron commented Apr 16, 2026

Copy link
Copy Markdown
Collaborator

Adds a new Adventure Importer sheet that follows the dnd5e design style. Following the example of core with its V2 importer, this sheet is not made default and instead must be opted into on a per-adventure basis.

Adventure Importer 5e

The new sheet includes support for pre- and post-import actions which are presented as checkboxes on the importer sheet to give control to users. There are three actions initially provided by the system: "Activate Scene", "Display Journal", and "Customize World", but modules can add their own actions.

Each adventure can use flags to define which of the actions is run when that adventure is imported and customize their behavior. There is also a new AdventureRegistry that allows defining actions for a single adventure or for all adventures in a module. Actions added through the registry can support custom handlers without having to add to the global configuraiton.

// These actions will be run across all adventures in the module
dnd5e.registry.adventures.setModule("dnd-adventures-faerun", {
  importActions: ["activateScene", "displayJournal"]
});

// This specific adventure has a different set of actions
dnd5e.registry.adventures.setAdventure("Compendium.dnd-adventures-faerun.adventures.Adventure.OJuc9WnDJDAETIFr", {
  importActions: [{ id: "displayJournal", journalId: "x0TaNijLJkanmufc" }]
});
Adventure Quickstart Dialog

The system also contains a dialog that presents actions available after using quickstart to load the adventure. By adding a separate quickstart handler actions can opt in to support on quickstarted adventures. These actions are passed all of the adventures that have that action and their configs so they can optimize if more than one adventure is quickstarted.

@arbron arbron added this to the D&D5E 6.0.0 milestone Apr 16, 2026
@arbron arbron self-assigned this Apr 16, 2026
@arbron arbron added ui User interface related features or bugs api ux User experience related features or bugs priority: high labels Apr 16, 2026
arbron added a commit that referenced this pull request Apr 17, 2026
Adds a new window that pops up when the system is first launched to
provide some first run improvements to users. This window displays
a welcome message & several links to documentation & support pages.

Beneath that are some important settings that are useful to get set
immediately including rules version, calendar, bastion, and whether
the metric system is used. Any changes to these settings are saved
when the window is closed and a reload will be prompted if needed.

The second tab contains a list of all of the first-party modules
offered for the system. These modules can be easily enabled from
this screen and any selected modules will be enabled when the app
is closed.

The list of modules is contained in a JSON file included with the
system, but it will also check the copy of that file on the
`publish-wiki` branch of the GitHub. This should allow the system
to add new modules to this listing without requiring a new system
version.

 ### Todo
- [ ] Write welcome dialog & links
- [ ] Modify compendium browser filters to match selected rules
      and enabled modules
- [ ] Integrate with adventure quickstart dialog #6946

Closes #6922
arbron added a commit that referenced this pull request Apr 17, 2026
Adds a new window that pops up when the system is first launched to
provide some first run improvements to users. This window displays
a welcome message & several links to documentation & support pages.

Beneath that are some important settings that are useful to get set
immediately including rules version, calendar, bastion, and whether
the metric system is used. Any changes to these settings are saved
when the window is closed and a reload will be prompted if needed.

The second tab contains a list of all of the first-party modules
offered for the system. These modules can be easily enabled from
this screen and any selected modules will be enabled when the app
is closed.

The list of modules is contained in a JSON file included with the
system, but it will also check the copy of that file on the
`publish-wiki` branch of the GitHub. This should allow the system
to add new modules to this listing without requiring a new system
version.

 ### Todo
- [ ] Write welcome dialog & links
- [ ] Modify compendium browser filters to match selected rules
      and enabled modules
- [ ] Integrate with adventure quickstart dialog #6946

Closes #6922
arbron added a commit that referenced this pull request Apr 17, 2026
Adds a new window that pops up when the system is first launched to
provide some first run improvements to users. This window displays
a welcome message & several links to documentation & support pages.

Beneath that are some important settings that are useful to get set
immediately including rules version, calendar, bastion, and whether
the metric system is used. Any changes to these settings are saved
when the window is closed and a reload will be prompted if needed.

The second tab contains a list of all of the first-party modules
offered for the system. These modules can be easily enabled from
this screen and any selected modules will be enabled when the app
is closed.

The list of modules is contained in a JSON file included with the
system, but it will also check the copy of that file on the
`publish-wiki` branch of the GitHub. This should allow the system
to add new modules to this listing without requiring a new system
version.

 ### Todo
- [ ] Write welcome dialog & links
- [ ] Modify compendium browser filters to match selected rules
      and enabled modules
- [ ] Integrate with adventure quickstart dialog #6946

Closes #6922
@arbron arbron changed the base branch from 5.3.x to 6.0.x June 2, 2026 17:49
arbron added a commit that referenced this pull request Jun 5, 2026
Adds a new window that pops up when the system is first launched to
provide some first run improvements to users. This window displays
a welcome message & several links to documentation & support pages.

Beneath that are some important settings that are useful to get set
immediately including rules version, calendar, bastion, and whether
the metric system is used. Any changes to these settings are saved
when the window is closed and a reload will be prompted if needed.

The second tab contains a list of all of the first-party modules
offered for the system. These modules can be easily enabled from
this screen and any selected modules will be enabled when the app
is closed.

The list of modules is contained in a JSON file included with the
system, but it will also check the copy of that file on the
`publish-wiki` branch of the GitHub. This should allow the system
to add new modules to this listing without requiring a new system
version.

 ### Todo
- [ ] Write welcome dialog & links
- [ ] Modify compendium browser filters to match selected rules
      and enabled modules
- [ ] Integrate with adventure quickstart dialog #6946

Closes #6922
@arbron arbron mentioned this pull request Jun 29, 2026
33 tasks

@Fyorl Fyorl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good consolidation. Some parts of the design I am not convinced of yet.

So far our use of registries in the system are passive, they collect information at load. We don't have modules actively writing into them. For that pattern we use CONFIG.DND5E. I would prefer we continue with that, so I would propose either namespacing CONFIG.DND5E.adventures.importActions, e.g. CONFIG.DND5E.adventures.importActions.dnd-tomb-annihilation = { myHandler: ... }, with shared actions going under the dnd5e namespace; or keeping the shared actions at the top-level and requiring custom actions be prefixed, e.g. CONFIG.DND5E.adventures.importActions["dnd-tomb-annihilation.myHandler"] = ...

I am also not a fan of the flags and having multiple ways to define handler payloads. I would prefer we just had one way, also via CONFIG.DND5E, e.g.

CONFIG.DND5E.adventure.imports["Compendium.dnd-tomb-annihilation.adventures.Adventure..."] = [
  { id: "activateScene", initialScene: "..." },
  { id: "displayJournal", initialJournal: "..." }
];

Comment thread module/applications/adventure/importer.mjs Outdated
Comment thread module/documents/adventure.mjs Outdated
@arbron

arbron commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator Author

Good consolidation. Some parts of the design I am not convinced of yet.

So far our use of registries in the system are passive, they collect information at load. We don't have modules actively writing into them. For that pattern we use CONFIG.DND5E. I would prefer we continue with that, so I would propose either namespacing CONFIG.DND5E.adventures.importActions, e.g. CONFIG.DND5E.adventures.importActions.dnd-tomb-annihilation = { myHandler: ... }, with shared actions going under the dnd5e namespace; or keeping the shared actions at the top-level and requiring custom actions be prefixed, e.g. CONFIG.DND5E.adventures.importActions["dnd-tomb-annihilation.myHandler"] = ...

I am also not a fan of the flags and having multiple ways to define handler payloads. I would prefer we just had one way, also via CONFIG.DND5E, e.g.

CONFIG.DND5E.adventure.imports["Compendium.dnd-tomb-annihilation.adventures.Adventure..."] = [
  { id: "activateScene", initialScene: "..." },
  { id: "displayJournal", initialJournal: "..." }
];

Switching over to config sounds good.

My main motivation to also having flags as an option is it allows simple setups to be done without requiring adventure modules to dig into code. A creator can just set a few flags on the adventure itself and not have to add a javascript file and handle extra configuration. I'll put up my updated version to see what you think, but I can still pull out the flag stuff.

@arbron arbron requested a review from Fyorl June 30, 2026 19:58
@Fyorl

Fyorl commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

My main motivation to also having flags as an option is it allows simple setups to be done without requiring adventure modules to dig into code. A creator can just set a few flags on the adventure itself and not have to add a javascript file and handle extra configuration.

Is the idea that they would add these flags directly to their unpacked adventure YAML? Because adding flags in-app also requires some macro/coding, right? Or were you thinking of adding another app like with the journal flags?

@arbron

arbron commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator Author

My main motivation to also having flags as an option is it allows simple setups to be done without requiring adventure modules to dig into code. A creator can just set a few flags on the adventure itself and not have to add a javascript file and handle extra configuration.

Is the idea that they would add these flags directly to their unpacked adventure YAML? Because adding flags in-app also requires some macro/coding, right? Or were you thinking of adding another app like with the journal flags?

Wasn't thinking of another config app, but a macro that just does adventure.setFlag("dnd5e", "importActions", ["openScene"]); is pretty simple.

@Fyorl Fyorl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't thinking of another config app, but a macro that just does adventure.setFlag("dnd5e", "importActions", ["openScene"]); is pretty simple.

Well a macro is code, but I suppose it's less code. Seems like it's basically free to support flags though so I don't really have any objection. This all looks good to me.

Comment thread module/documents/adventure.mjs Outdated
Comment thread module/_types.mjs Outdated
Comment thread module/applications/adventure/quickstart-dialog.mjs Outdated
arbron added 3 commits July 1, 2026 09:50
Adds a new Adventure Importer sheet that follows the dnd5e design
style. Following the example of core with its V2 importer, this
sheet is not made default and instead must be opted into on a
per-adventure basis.

The new sheet includes support for pre- and post-import actions
which are presented as checkboxes on the importer sheet to give
control to users. There are three actions initially provided by
the system: "Activate Scene", "Display Journal", and "Customize
World", but modules can add their own actions.

Each adventure can use flags to define which of the actions is run
when that adventure is imported and customize their behavior.
There is also a new `AdventureRegistry` that allows defining
actions for a single adventure or for all adventures in a module.
Actions added through the registry can support custom handlers
without having to add to the global configuraiton.

```javascript
// These actions will be run across all adventures in the module
dnd5e.registry.adventures.setModule("dnd-adventures-faerun", {
  importActions: ["activateScene", "displayJournal"]
});

// This specific adventure has a different set of actions
dnd5e.registry.adventures.setAdventure("Compendium.dnd-adventures-faerun.adventures.Adventure.OJuc9WnDJDAETIFr", {
  importActions: [{ id: "displayJournal", journalId: "x0TaNijLJkanmufc" }]
});
```

The system also contains a dialog that presents actions available
after using quickstart to load the adventure. By adding a separate
quickstart handler actions can opt in to support on quickstarted
adventures. These actions are passed all of the adventures that
have that action and their configs so they can optimize if more
than one adventure is quickstarted.
@arbron arbron force-pushed the adventure-importer branch from 6fef49f to 53ba9e7 Compare July 1, 2026 16:53
@arbron arbron merged commit 5810752 into 6.0.x Jul 1, 2026
@arbron arbron deleted the adventure-importer branch July 1, 2026 16:54
arbron added a commit that referenced this pull request Jul 2, 2026
Adds a new window that pops up when the system is first launched to
provide some first run improvements to users. This window displays
a welcome message & several links to documentation & support pages.

Beneath that are some important settings that are useful to get set
immediately including rules version, calendar, bastion, and whether
the metric system is used. Any changes to these settings are saved
when the window is closed and a reload will be prompted if needed.

The second tab contains a list of all of the first-party modules
offered for the system. These modules can be easily enabled from
this screen and any selected modules will be enabled when the app
is closed.

The list of modules is contained in a JSON file included with the
system, but it will also check the copy of that file on the
`publish-wiki` branch of the GitHub. This should allow the system
to add new modules to this listing without requiring a new system
version.

 ### Todo
- [ ] Write welcome dialog & links
- [ ] Modify compendium browser filters to match selected rules
      and enabled modules
- [ ] Integrate with adventure quickstart dialog #6946

Closes #6922
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api priority: high ui User interface related features or bugs ux User experience related features or bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants