14: Tweak styles, tweak roll template

- Adjusted styles of item buttons.
- Fixed an issue with item buttons when not using shorthand syntax.
- Updated the `roll.toMessage()` call to include the player/actor name
  and the item/attribute name.
This commit is contained in:
Matt Smith 2020-08-09 20:25:48 -05:00
parent 786d4095a9
commit 9ae2cce47a
4 changed files with 49 additions and 11 deletions

View file

@ -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;
}
@ -36,8 +37,15 @@ export class SimpleActorSheet extends ActorSheet {
// Handle rollable attributes.
html.find('.items .rollable').click(ev => {
let r = new Roll($(ev.currentTarget).data('roll'), this.actor.getRollData());
r.roll().toMessage();
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