mirror of
https://github.com/RoY7x/worldbuilding.git
synced 2025-07-04 13:47:10 -04:00
Merge branch '14-item-rolls'
This commit is contained in:
commit
9bb368d9e2
5 changed files with 69 additions and 2 deletions
|
@ -25,6 +25,7 @@ export class SimpleActorSheet extends ActorSheet {
|
|||
for ( let attr of Object.values(data.data.attributes) ) {
|
||||
attr.isCheckbox = attr.dtype === "Boolean";
|
||||
}
|
||||
data.shorthand = !!game.settings.get("worldbuilding", "macroShorthand");
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@ -34,6 +35,19 @@ export class SimpleActorSheet extends ActorSheet {
|
|||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
// Handle rollable attributes.
|
||||
html.find('.items .rollable').click(ev => {
|
||||
let button = $(ev.currentTarget);
|
||||
let r = new Roll(button.data('roll'), this.actor.getRollData());
|
||||
const li = button.parents(".item");
|
||||
const item = this.actor.getOwnedItem(li.data("itemId"));
|
||||
r.roll().toMessage({
|
||||
user: game.user._id,
|
||||
speaker: ChatMessage.getSpeaker({ actor: this.actor }),
|
||||
flavor: `<h2>${item.name}</h2><h3>${button.text()}</h3>`
|
||||
});
|
||||
});
|
||||
|
||||
// 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