Skip to content

Commit

Permalink
Construct roll formula on chat card buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
apewall committed Feb 16, 2024
1 parent a63e2d6 commit 4e2f094
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/module/item/entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,8 @@ export default class OseItem extends Item {

_getRollTag(data) {
if (data.roll) {
const roll = `${data.roll}${
data.rollTarget ? CONFIG.OSE.roll_type[data.rollType] : ""
}${data.rollTarget ? data.rollTarget : ""}`;
const roll = `${data.roll}${data.rollTarget ? CONFIG.OSE.roll_type[data.rollType] : ""
}${data.rollTarget ? data.rollTarget : ""}`;
return {
label: `${game.i18n.localize("OSE.items.Roll")} ${roll}`,
};
Expand Down Expand Up @@ -390,6 +389,7 @@ export default class OseItem extends Item {
hasSave: this.hasSave,
config: CONFIG.OSE,
};
templateData.rollFormula = new Roll(templateData.data.roll, templateData).formula;
templateData.data.properties = this.system.autoTags;

// Render the chat card template
Expand Down
2 changes: 1 addition & 1 deletion src/templates/chat/item-card.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h2>{{item.name}}</h2>
{{/if}}

{{#if data.roll}}
<button data-action="formula">{{ localize "OSE.Roll"}} {{data.roll}} {{#if data.blindroll}}({{localize
<button data-action="formula">{{ localize "OSE.Roll"}} {{rollFormula}} {{#if data.blindroll}}({{localize
'OSE.items.BlindRoll'}}){{/if}}</button>
{{/if}}

Expand Down

0 comments on commit 4e2f094

Please sign in to comment.