Hi, friends! I'd like to build a module

Hi, friends! I'd like to build a module and I could use a shove in the right part of the docs to go looking first. The goal is to modify the default roll dialog to add an additional button. Alongside "Advantage," "Disadvantage," and "Normal," I'd like to add a button to trigger the "Emphasis" roll, a mechanic which rolls 2d20 and takes the result farthest from 10. It's a mechanic my players really enjoy for high-risk situations. I have a macro working as a quick proof-of-concept which emulates the behaviour, but I'm not sure where to start in terms of modifying the built-in roll dialog so I can do it in a less hacky way. Any ideas?
No description
S
Spewbert44d ago
For anyone who might find this later, this was how I ended up getting the button in place:
Hooks.on('renderDialog', (rollDialog, html) => {
const buttonList = html.find('.dialog-button.advantage').parent();
if (buttonList.length == 0) {
return;
}

let newButtonHtml = `<button class="dialog-button emphasis" data-button="emphasis">Emphasis</button>`;
buttonList.append(newButtonHtml);
});
Hooks.on('renderDialog', (rollDialog, html) => {
const buttonList = html.find('.dialog-button.advantage').parent();
if (buttonList.length == 0) {
return;
}

let newButtonHtml = `<button class="dialog-button emphasis" data-button="emphasis">Emphasis</button>`;
buttonList.append(newButtonHtml);
});
This code doesn't include a listener to do anything with the button press, and I'm positive there was a better way to either hook more specifically or select the element more gracefully or both, but it does work.
No description