mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 15:39:02 +01:00
Pass the actor id through the button; fix /dr and /fr flavor text
This commit is contained in:
parent
2c93defd9c
commit
1058b152c2
7 changed files with 15 additions and 12 deletions
|
|
@ -300,8 +300,8 @@ Hooks.on('chatMessage', (_, message) => {
|
||||||
const difficulty = rollCommand.difficulty;
|
const difficulty = rollCommand.difficulty;
|
||||||
|
|
||||||
const target = getCommandTarget({ allowNull: true });
|
const target = getCommandTarget({ allowNull: true });
|
||||||
const title = traitValue
|
const title = flavor ??
|
||||||
? game.i18n.format('DAGGERHEART.UI.Chat.dualityRoll.abilityCheckTitle', {
|
traitValue ? game.i18n.format('DAGGERHEART.UI.Chat.dualityRoll.abilityCheckTitle', {
|
||||||
ability: game.i18n.localize(SYSTEM.ACTOR.abilities[traitValue].label)
|
ability: game.i18n.localize(SYSTEM.ACTOR.abilities[traitValue].label)
|
||||||
})
|
})
|
||||||
: game.i18n.localize('DAGGERHEART.GENERAL.duality');
|
: game.i18n.localize('DAGGERHEART.GENERAL.duality');
|
||||||
|
|
|
||||||
|
|
@ -180,7 +180,8 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV
|
||||||
'systems/daggerheart/templates/ui/chat/deathMove.hbs',
|
'systems/daggerheart/templates/ui/chat/deathMove.hbs',
|
||||||
{
|
{
|
||||||
player: this.actor.name,
|
player: this.actor.name,
|
||||||
actor: { name: this.actor.name, img: this.actor.img },
|
actor: this.actor,
|
||||||
|
actorId: this.actor._id,
|
||||||
author: game.users.get(game.user.id),
|
author: game.users.get(game.user.id),
|
||||||
title: game.i18n.localize(this.selectedMove.name),
|
title: game.i18n.localize(this.selectedMove.name),
|
||||||
img: this.selectedMove.img,
|
img: this.selectedMove.img,
|
||||||
|
|
|
||||||
|
|
@ -391,6 +391,7 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
||||||
|
|
||||||
async riskItAllClearStressAndHitPoints(event, data) {
|
async riskItAllClearStressAndHitPoints(event, data) {
|
||||||
const resourceValue = event.target.dataset.resourceValue;
|
const resourceValue = event.target.dataset.resourceValue;
|
||||||
new game.system.api.applications.dialogs.RiskItAllDialog(data.actor, resourceValue).render({ force: true });
|
const actor = game.actors.get(event.target.dataset.actorId);
|
||||||
|
new game.system.api.applications.dialogs.RiskItAllDialog(actor, resourceValue).render({ force: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import { abilities } from '../config/actorConfig.mjs';
|
||||||
import { getCommandTarget, rollCommandToJSON } from '../helpers/utils.mjs';
|
import { getCommandTarget, rollCommandToJSON } from '../helpers/utils.mjs';
|
||||||
|
|
||||||
export default function DhDualityRollEnricher(match, _options) {
|
export default function DhDualityRollEnricher(match, _options) {
|
||||||
const roll = rollCommandToJSON(match[1], match[0]);
|
const roll = rollCommandToJSON(match[0]);
|
||||||
if (!roll) return match[0];
|
if (!roll) return match[0];
|
||||||
|
|
||||||
return getDualityMessage(roll.result, roll.flavor);
|
return getDualityMessage(roll.result, roll.flavor);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { getCommandTarget, rollCommandToJSON } from '../helpers/utils.mjs';
|
import { getCommandTarget, rollCommandToJSON } from '../helpers/utils.mjs';
|
||||||
|
|
||||||
export default function DhFateRollEnricher(match, _options) {
|
export default function DhFateRollEnricher(match, _options) {
|
||||||
const roll = rollCommandToJSON(match[1], match[0]);
|
const roll = rollCommandToJSON(match[0]);
|
||||||
if (!roll) return match[0];
|
if (!roll) return match[0];
|
||||||
|
|
||||||
return getFateMessage(roll.result, roll?.flavor);
|
return getFateMessage(roll.result, roll?.flavor);
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@ export const capitalize = string => {
|
||||||
return string.charAt(0).toUpperCase() + string.slice(1);
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||||
};
|
};
|
||||||
|
|
||||||
export function rollCommandToJSON(text, raw) {
|
export function rollCommandToJSON(text) {
|
||||||
if (!text) return {};
|
if (!text) return {};
|
||||||
|
|
||||||
const flavorMatch = raw?.match(/{(.*)}$/);
|
const flavorMatch = text?.match(/{(.*)}$/);
|
||||||
const flavor = flavorMatch ? flavorMatch[1] : null;
|
const flavor = flavorMatch ? flavorMatch[1] : null;
|
||||||
|
|
||||||
// Match key="quoted string" OR key=unquotedValue
|
// Match key="quoted string" OR key=unquotedValue
|
||||||
|
|
@ -31,7 +31,7 @@ export function rollCommandToJSON(text, raw) {
|
||||||
}
|
}
|
||||||
result[key] = value;
|
result[key] = value;
|
||||||
}
|
}
|
||||||
return Object.keys(result).length > 0 ? { result, flavor } : null;
|
return { result, flavor };
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getCommandTarget = (options = {}) => {
|
export const getCommandTarget = (options = {}) => {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{#if this.showRiskItAllButton}}
|
{{#if this.showRiskItAllButton}}
|
||||||
<div>
|
<div>
|
||||||
<button class="risk-it-all-button" data-resource-value="{{this.riskItAllHope}}">
|
<button class="risk-it-all-button" data-resource-value="{{this.riskItAllHope}}" data-actor-id="{{this.actorId}}">
|
||||||
<span>
|
<span>
|
||||||
{{this.riskItAllButtonLabel}}
|
{{this.riskItAllButtonLabel}}
|
||||||
</span>
|
</span>
|
||||||
|
|
@ -28,4 +28,5 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue