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

Combat.rollInitiative does not appear to respect rollMode parameter #6667

Closed
anathemamask opened this issue Feb 7, 2022 · 0 comments
Closed
Assignees
Labels
bug Functionality which is not working as intended combat Issues related to Combat and the Combat Tracker dice Issues related to dice rolling and the Dice system

Comments

@anathemamask
Copy link
Collaborator

Submitted via email

When calling Combat.rollInitiative with parameter {messageOptions: {rollMode: "gmroll"}} the rollMode parameter is not honored and the initiative is rolled using game.settings.get("core", "rollMode") as a fallback.

Steps to reproduce

  1. In any system, create an actor and a scene
  2. Activate the scene, add the actor to the scene and begin combat with the token
  3. Run the following macro:
game.combat.data.combatants.forEach(combatant => {
game.combat.rollInitiative([combatant.data._id], {messageOptions: {rollMode: "gmroll"}});
});

Expected behaviour

The roll is performed as a gmroll.

Actual behaviour

The roll is performed as set in game.settings.get("core", "rollMode").

Analysis

The issue stems from the fact that Roll.toMessage with create = false parameter does not return an object that contains rollMode.

The issue does not happen, if Roll.toMessage is called with create = true.

When the messageData is created, it is populated with whisper attribute array, which is populated with user IDs to which the message must be whispered to. It does not contain rollMode attribute. It is then passed to the ChatMessage.implementation.create method, and eventually ChatMessage._preCreate will be called. The ChatMessage._preCreate method, when retrieving a roll message, expects for the messageData object to contain rollMode, but it does not.

As the Roll.toMessage method populates the messageData with the whisper attribute, I believe the ChatMessage._preCreate needs to be modified to use the whisper attribute, instead of rollMode in messageData.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Functionality which is not working as intended combat Issues related to Combat and the Combat Tracker dice Issues related to dice rolling and the Dice system
Projects
No open projects
Status: No status
Development

No branches or pull requests

2 participants