diff --git a/module/actor-sheet.js b/module/actor-sheet.js
index af192a2..a62d70a 100644
--- a/module/actor-sheet.js
+++ b/module/actor-sheet.js
@@ -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: `
${item.name} ${button.text()} `
+ });
});
// Everything below here is only needed if the sheet is editable
diff --git a/styles/simple.css b/styles/simple.css
index 5729e0c..38e13fc 100644
--- a/styles/simple.css
+++ b/styles/simple.css
@@ -79,10 +79,11 @@
overflow-y: auto;
}
.worldbuilding .item-list .item {
- height: 30px;
+ min-height: 30px;
line-height: 24px;
padding: 3px 0;
border-bottom: 1px solid #BBB;
+ align-items: stretch;
}
.worldbuilding .item-list .item img {
flex: 0 0 24px;
@@ -94,10 +95,19 @@
.worldbuilding .item-list .item-controls {
flex: 0 0 36px;
}
+.worldbuilding .item-list .item-buttons {
+ display: flex;
+ flex-wrap: wrap;
+ flex-direction: row;
+ align-items: center;
+ flex: 2;
+ justify-content: flex-start;
+}
.worldbuilding .item-list .item-button {
- height: 100%;
line-height: 1;
font-size: 11px;
+ flex: none;
+ width: auto;
}
.worldbuilding .attributes-header {
padding: 5px;
diff --git a/styles/simple.less b/styles/simple.less
index cf37f71..deb4c89 100644
--- a/styles/simple.less
+++ b/styles/simple.less
@@ -87,10 +87,11 @@
overflow-y: auto;
.item {
- height: 30px;
+ min-height: 30px;
line-height: 24px;
padding: 3px 0;
border-bottom: 1px solid #BBB;
+ align-items: stretch;
img {
flex: 0 0 24px;
@@ -106,10 +107,20 @@
flex: 0 0 36px;
}
+ .item-buttons {
+ display: flex;
+ flex-wrap: wrap;
+ flex-direction: row;
+ align-items: center;
+ flex: 2;
+ justify-content: flex-start;
+ }
+
.item-button {
- height: 100%;
line-height: 1;
font-size: 11px;
+ flex: none;
+ width: auto;
}
}
diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html
index 715d1e1..d83d203 100644
--- a/templates/actor-sheet.html
+++ b/templates/actor-sheet.html
@@ -40,11 +40,20 @@
{{item.name}}
- {{#each item.data.attributes as |itemAttr key|}}
- {{#if (eq itemAttr.dtype "Formula")}}
- {{itemAttr.label}}
- {{/if}}
- {{/each}}
+ {{!-- Iterate through all attributes on the item and output buttons for any that are formula. --}}
+
+ {{#each item.data.attributes as |itemAttr key|}}
+ {{#if (eq itemAttr.dtype "Formula")}}
+ {{!-- Use the items.name.key format for shorthand. --}}
+ {{#if ../../shorthand}}
+ {{itemAttr.label}}
+ {{!-- Use the items.name.attributes.key.value format otherwise. --}}
+ {{else}}
+ {{itemAttr.label}}
+ {{/if}}
+ {{/if}}
+ {{/each}}
+