mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 15:39:02 +01:00
Troubleshooting
Created test button in 'duality-roll.hbs' and functionality in chatLog.mjs
This commit is contained in:
parent
5aa9ba661a
commit
f91994a62e
2 changed files with 23 additions and 0 deletions
|
|
@ -58,6 +58,9 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
|||
html.querySelectorAll('.action-use-button').forEach(element =>
|
||||
element.addEventListener('click', event => this.actionUseButton.call(this, event, data.message))
|
||||
);
|
||||
html.querySelectorAll('.reroll-button').forEach(element =>
|
||||
element.addEventListener('click', event => this.rerollEvent.call(this, event, data.message))
|
||||
);
|
||||
};
|
||||
|
||||
setupHooks() {
|
||||
|
|
@ -297,4 +300,21 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
|||
|
||||
action.use();
|
||||
};
|
||||
|
||||
//Reroll Functionality
|
||||
rerollEvent = async(_,event,message)=> {
|
||||
const originalMessage = message;
|
||||
|
||||
if (originalMessage && originalMessage.isRoll) {
|
||||
console.log("Reroll button clicked for message:", originalMessage.id);
|
||||
|
||||
// Rerolling the original roll and send it to chat.
|
||||
originalMessage.roll.reroll().then(newRoll => {
|
||||
newRoll.toMessage({
|
||||
speaker: ChatMessage.getSpeaker({ actor: originalMessage.speaker.actor }),
|
||||
flavor: `(Reroll) ${originalMessage.flavor}`
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,3 +152,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="reroll-div">
|
||||
<button class="reroll-button"><i class="fas fa-dice"></i><span>Reroll</span></button>
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue