mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 15:39:02 +01:00
Added button render to renderJournalEntryPageProseMirrorSheet and renderHandlebarsApplication
This commit is contained in:
parent
4501edcf4a
commit
bdba416f21
1 changed files with 48 additions and 34 deletions
|
|
@ -129,16 +129,14 @@ Hooks.on(socketEvent.GMUpdate, async (action, uuid, update) => {
|
|||
}
|
||||
});
|
||||
|
||||
Hooks.on('renderChatMessageHTML', (message, element) => {
|
||||
element.querySelectorAll('.duality-roll-button').forEach(element =>
|
||||
element.addEventListener('click', async event => {
|
||||
let target = getCommandTarget();
|
||||
const renderDualityButton = async event => {
|
||||
const button = event.currentTarget;
|
||||
const attributeValue = button.dataset.attribute?.toLowerCase();
|
||||
|
||||
const target = getCommandTarget();
|
||||
if (!target) return;
|
||||
|
||||
const button = event.currentTarget;
|
||||
const rollModifier = button.dataset.attribute
|
||||
? target.system.attributes[button.dataset.attribute].data.value
|
||||
: null;
|
||||
const rollModifier = attributeValue ? target.system.attributes[attributeValue].data.value : null;
|
||||
const { roll, hope, fear, advantage, disadvantage, modifiers } = await target.diceRoll({
|
||||
title: button.dataset.label,
|
||||
value: rollModifier
|
||||
|
|
@ -163,8 +161,24 @@ Hooks.on('renderChatMessageHTML', (message, element) => {
|
|||
};
|
||||
|
||||
await cls.create(msgData);
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
Hooks.on('renderChatMessageHTML', (_, element) => {
|
||||
element
|
||||
.querySelectorAll('.duality-roll-button')
|
||||
.forEach(element => element.addEventListener('click', renderDualityButton));
|
||||
});
|
||||
|
||||
Hooks.on('renderJournalEntryPageProseMirrorSheet', (_, element) => {
|
||||
element
|
||||
.querySelectorAll('.duality-roll-button')
|
||||
.forEach(element => element.addEventListener('click', renderDualityButton));
|
||||
});
|
||||
|
||||
Hooks.on('renderHandlebarsApplication', (_, element) => {
|
||||
element
|
||||
.querySelectorAll('.duality-roll-button')
|
||||
.forEach(element => element.addEventListener('click', renderDualityButton));
|
||||
});
|
||||
|
||||
Hooks.on('chatMessage', (_, message) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue