Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a bit of roll context to the D20Roll when building #4992

Open
roth-michael opened this issue Jan 13, 2025 · 2 comments · May be fixed by #5008
Open

Add a bit of roll context to the D20Roll when building #4992

roth-michael opened this issue Jan 13, 2025 · 2 comments · May be fixed by #5008

Comments

@roth-michael
Copy link
Contributor

Request: Either in roll.options or a new roll.type property, slap in the type of roll (attack, save, check, maybe skill - not sure if there's a need to break out skill check vs ability check). Or maybe an object with both the type and the ability/skill used, for further detail.

The main use case that has me looking at this is a custom manual Roll Resolver which adds quick-buttons for fumble/miss/hit/crit in the case of an attack, or fail/save in the case of a save. In 3.3.1, roll.options.flavor was usable for this, post-refactor the flavor is kept in the message config and therefore not stored on the roll itself.

@JPMeehan
Copy link
Contributor

Would need to be in options for serialization purposes, but could always add get type to the class

@roth-michael
Copy link
Contributor Author

Should probably be added in buildConfigure - I believe at that point message.data.flags.dnd5e.roll.type will be populated, so could do something like

  let rolls;
  if ( dialog.configure === false ) rolls = config.rolls?.map(c => this.fromConfig(c, config)) ?? [];
  else {
    const DialogClass = dialog.applicationClass ?? this.DefaultConfigurationDialog;
    rolls = await DialogClass.configure(config, dialog, message);
  }
+ const rollType = foundry.utils.getProperty(message, "data.flags.dnd5e.roll.type");
+ if ( rollType ) rolls.forEach(roll => roll.options.type ??= rollType);

Not sure if there's a cleaner way of doing that without another loop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants