[Feature] 340-341 RollMode & ChatSpeaker (#347)

* Added RollMode to standalone DamageDialog and to RollDialog. ChatMessage now add ChatSpeaker

* Just a little fix for Damage Action

---------

Co-authored-by: Dapoolp <elcatnet@gmail.com>
This commit is contained in:
WBHarry 2025-07-15 17:01:17 +02:00 committed by GitHub
parent da6d9418b7
commit 045754d107
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 112 additions and 42 deletions

View file

@ -37,4 +37,15 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
e.setAttribute('data-use-perm', document.testUserPermission(game.user, 'OWNER'));
});
}
async _preCreate(data, options, user) {
options.speaker = ChatMessage.getSpeaker();
const rollActorOwner = data.rolls?.[0]?.data?.parent?.owner;
if (rollActorOwner) {
data.author = rollActorOwner ? rollActorOwner.id : data.author;
await this.updateSource({ author: rollActorOwner ?? user });
}
return super._preCreate(data, options, rollActorOwner ?? user);
}
}