mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-16 05:31:07 +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) => {
|
const renderDualityButton = async event => {
|
||||||
element.querySelectorAll('.duality-roll-button').forEach(element =>
|
const button = event.currentTarget;
|
||||||
element.addEventListener('click', async event => {
|
const attributeValue = button.dataset.attribute?.toLowerCase();
|
||||||
let target = getCommandTarget();
|
|
||||||
|
const target = getCommandTarget();
|
||||||
if (!target) return;
|
if (!target) return;
|
||||||
|
|
||||||
const button = event.currentTarget;
|
const rollModifier = attributeValue ? target.system.attributes[attributeValue].data.value : null;
|
||||||
const rollModifier = button.dataset.attribute
|
|
||||||
? target.system.attributes[button.dataset.attribute].data.value
|
|
||||||
: null;
|
|
||||||
const { roll, hope, fear, advantage, disadvantage, modifiers } = await target.diceRoll({
|
const { roll, hope, fear, advantage, disadvantage, modifiers } = await target.diceRoll({
|
||||||
title: button.dataset.label,
|
title: button.dataset.label,
|
||||||
value: rollModifier
|
value: rollModifier
|
||||||
|
|
@ -163,8 +161,24 @@ Hooks.on('renderChatMessageHTML', (message, element) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
await cls.create(msgData);
|
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) => {
|
Hooks.on('chatMessage', (_, message) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue