mirror of
https://github.com/RoY7x/worldbuilding.git
synced 2025-07-04 13:47:10 -04:00
8: Add rolls to items on actor sheets
- Utilized the revisions made to roll syntax to allow for rollable buttons on item lists on actor sheets. Rolls are evaluated using `@items.ITEM.KEY`, where ITEM is the item name (slugified), and KEY is an attribute key for a formula attribute.
This commit is contained in:
parent
00dfec6014
commit
786d4095a9
5 changed files with 29 additions and 0 deletions
|
@ -34,6 +34,12 @@ export class SimpleActorSheet extends ActorSheet {
|
|||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
// Handle rollable attributes.
|
||||
html.find('.items .rollable').click(ev => {
|
||||
let r = new Roll($(ev.currentTarget).data('roll'), this.actor.getRollData());
|
||||
r.roll().toMessage();
|
||||
});
|
||||
|
||||
// Everything below here is only needed if the sheet is editable
|
||||
if (!this.options.editable) return;
|
||||
|
||||
|
|
|
@ -82,4 +82,11 @@ Hooks.once("init", async function() {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Slugify a string.
|
||||
*/
|
||||
Handlebars.registerHelper('slugify', function(value) {
|
||||
return value.slugify({strict: true});
|
||||
});
|
||||
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue