Fixed so that the reaction rolls from chat messages work with diceSoNice (#1465)

This commit is contained in:
WBHarry 2025-12-24 00:11:01 +01:00 committed by GitHub
parent 1b7893324a
commit 7e2b144bf4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -124,29 +124,21 @@ export default class SaveField extends fields.SchemaField {
*/ */
static async updateSaveMessage(result, message, targetId) { static async updateSaveMessage(result, message, targetId) {
if (!result) return; if (!result) return;
const updateMsg = async function (message, targetId, result) {
// setTimeout(async () => { const chatMessage = ui.chat.collection.get(message._id),
const chatMessage = ui.chat.collection.get(message._id), changes = {
changes = { flags: {
flags: { [game.system.id]: {
[game.system.id]: { reactionRolls: {
reactionRolls: { [targetId]: {
[targetId]: { result: result.roll.total,
result: result.roll.total, success: result.roll.success
success: result.roll.success
}
} }
} }
} }
}; }
await chatMessage.update(changes); };
// }, 100); await chatMessage.update(changes);
};
if (game.modules.get('dice-so-nice')?.active)
game.dice3d
.waitFor3DAnimationByMessageID(result.message.id ?? result.message._id)
.then(async () => await updateMsg(message, targetId, result));
else await updateMsg(message, targetId, result);
} }
/** /**