mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-18 07:59:03 +01:00
Added difficulty support in rollDialog/rollMessage and [[/dr]]
This commit is contained in:
parent
867947c2c5
commit
2616ff59be
6 changed files with 37 additions and 8 deletions
|
|
@ -1,10 +1,10 @@
|
|||
export default class DhpChatMessage extends foundry.documents.ChatMessage {
|
||||
async renderHTML() {
|
||||
if (this.system.messageTemplate)
|
||||
this.content = await foundry.applications.handlebars.renderTemplate(
|
||||
this.system.messageTemplate,
|
||||
this.system
|
||||
);
|
||||
this.content = await foundry.applications.handlebars.renderTemplate(this.system.messageTemplate, {
|
||||
...this.system,
|
||||
_source: this.system._source
|
||||
});
|
||||
|
||||
/* We can change to fully implementing the renderHTML function if needed, instead of augmenting it. */
|
||||
const html = await super.renderHTML();
|
||||
|
|
|
|||
|
|
@ -27,13 +27,15 @@ export function getDualityMessage(roll) {
|
|||
data-title="${label}"
|
||||
data-label="${dataLabel}"
|
||||
data-hope="${roll.hope ?? 'd12'}"
|
||||
data-fear="${roll.fear ?? 'd12'}"
|
||||
data-fear="${roll.fear ?? 'd12'}"
|
||||
${roll.difficulty ? `data-difficulty="${roll.difficulty}"` : ''}
|
||||
${roll.trait && abilities[roll.trait] ? `data-trait="${roll.trait}"` : ''}
|
||||
${roll.advantage ? 'data-advantage="true"' : ''}
|
||||
${roll.disadvantage ? 'data-disadvantage="true"' : ''}
|
||||
>
|
||||
<i class="fa-solid fa-circle-half-stroke"></i>
|
||||
${label}
|
||||
${roll.difficulty ? `(${roll.difficulty})` : ''}
|
||||
</button>
|
||||
`;
|
||||
|
||||
|
|
@ -43,7 +45,8 @@ export function getDualityMessage(roll) {
|
|||
export const renderDualityButton = async event => {
|
||||
const button = event.currentTarget,
|
||||
traitValue = button.dataset.trait?.toLowerCase(),
|
||||
target = getCommandTarget();
|
||||
target = getCommandTarget(),
|
||||
difficulty = button.dataset.difficulty;
|
||||
if (!target) return;
|
||||
|
||||
const config = {
|
||||
|
|
@ -52,6 +55,7 @@ export const renderDualityButton = async event => {
|
|||
roll: {
|
||||
modifier: traitValue ? target.system.traits[traitValue].value : null,
|
||||
label: button.dataset.label,
|
||||
difficulty: difficulty,
|
||||
type: button.dataset.actionType ?? null // Need check
|
||||
},
|
||||
chatMessage: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue