Fix duplicate messages

This commit is contained in:
Dapoolp 2025-08-08 20:01:34 +02:00
parent c7f3ec8ab3
commit a8b98bed38
16 changed files with 96 additions and 171 deletions

View file

@ -33,14 +33,6 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
html.querySelectorAll('.simple-roll-button').forEach(element => html.querySelectorAll('.simple-roll-button').forEach(element =>
element.addEventListener('click', event => this.onRollSimple(event, data.message)) element.addEventListener('click', event => this.onRollSimple(event, data.message))
); );
html.querySelectorAll('.target-container').forEach(element => {
element.addEventListener('mouseenter', this.hoverTarget);
element.addEventListener('mouseleave', this.unhoverTarget);
element.addEventListener('click', this.clickTarget);
});
html.querySelectorAll('.button-target-selection').forEach(element => {
element.addEventListener('click', event => this.onTargetSelection(event, data.message));
});
html.querySelectorAll('.healing-button').forEach(element => html.querySelectorAll('.healing-button').forEach(element =>
element.addEventListener('click', event => this.onHealing(event, data.message)) element.addEventListener('click', event => this.onHealing(event, data.message))
); );
@ -138,33 +130,6 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
}); });
} }
onTargetSelection(event, message) {
event.stopPropagation();
const msg = ui.chat.collection.get(message._id);
msg.system.targetMode = Boolean(event.target.dataset.targetHit);
}
hoverTarget(event) {
event.stopPropagation();
const token = canvas.tokens.get(event.currentTarget.dataset.token);
if (!token?.controlled) token._onHoverIn(event, { hoverOutOthers: true });
}
unhoverTarget(event) {
const token = canvas.tokens.get(event.currentTarget.dataset.token);
if (!token?.controlled) token._onHoverOut(event);
}
clickTarget(event) {
event.stopPropagation();
const token = canvas.tokens.get(event.currentTarget.dataset.token);
if (!token) {
ui.notifications.info(game.i18n.localize('DAGGERHEART.UI.Notifications.attackTargetDoesNotExist'));
return;
}
game.canvas.pan(token);
}
async onRollSimple(event, message) { async onRollSimple(event, message) {
const buttonType = event.target.dataset.type ?? 'damage', const buttonType = event.target.dataset.type ?? 'damage',
total = message.rolls.reduce((a, c) => a + Roll.fromJSON(c).total, 0), total = message.rolls.reduce((a, c) => a + Roll.fromJSON(c).total, 0),

View file

@ -145,9 +145,9 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
if (this.rollDamage && this.damage.parts.length) await this.rollDamage(event, config); if (this.rollDamage && this.damage.parts.length) await this.rollDamage(event, config);
else if (this.trigger) await this.trigger(event, config); else if (this.trigger) await this.trigger(event, config);
else if (this.hasSave || this.hasEffect) { else if (this.hasSave || this.hasEffect) {
const roll = new Roll(''); const roll = new CONFIG.Dice.daggerheart.DHRoll('');
roll._evaluated = true; roll._evaluated = true;
if (this.hasTarget) config.targetSelection = config.targets.length > 0; if(config.hasTarget) config.targetSelection = config.targets.length > 0;
await CONFIG.Dice.daggerheart.DHRoll.toMessage(roll, config); await CONFIG.Dice.daggerheart.DHRoll.toMessage(roll, config);
} }
} }
@ -180,7 +180,6 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
hasHealing: this.damage?.parts?.length && this.type === 'healing', hasHealing: this.damage?.parts?.length && this.type === 'healing',
hasEffect: !!this.effects?.length, hasEffect: !!this.effects?.length,
hasSave: this.hasSave, hasSave: this.hasSave,
hasTarget: true,
selectedRollMode: game.settings.get('core', 'rollMode'), selectedRollMode: game.settings.get('core', 'rollMode'),
isFastForward: event.shiftKey, isFastForward: event.shiftKey,
data: this.getRollData(), data: this.getRollData(),
@ -253,8 +252,11 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
) )
) this.update({ 'uses.value': this.uses.value + 1 }); ) this.update({ 'uses.value': this.uses.value + 1 });
if(config.roll?.success || successCost) if(config.roll?.success || successCost) {
(config.message ?? config.parent).update({'system.successConsumed': true}) setTimeout(() => {
(config.message ?? config.parent).update({'system.successConsumed': true})
}, 50);
}
} }
/* */ /* */
@ -375,15 +377,15 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
async updateChatMessage(message, targetId, changes, chain = true) { async updateChatMessage(message, targetId, changes, chain = true) {
setTimeout(async () => { setTimeout(async () => {
const chatMessage = ui.chat.collection.get(message._id), const chatMessage = ui.chat.collection.get(message._id);
msgTarget =
chatMessage.system.targets.find(mt => mt.id === targetId) ??
chatMessage.system.oldTargets.find(mt => mt.id === targetId);
msgTarget.saved = changes;
await chatMessage.update({ await chatMessage.update({
system: { flags: {
targets: chatMessage.system.targets, [game.system.id]: {
oldTargets: chatMessage.system.oldTargets "reactionRolls": {
[targetId]: changes
}
}
} }
}); });
}, 100); }, 100);

View file

@ -24,7 +24,6 @@ export default class DHActorRoll extends foundry.abstract.TypeDataModel {
title: new fields.StringField(), title: new fields.StringField(),
roll: new fields.ObjectField(), roll: new fields.ObjectField(),
targets: targetsField(), targets: targetsField(),
oldTargets: targetsField(),
targetSelection: new fields.BooleanField({ initial: false }), targetSelection: new fields.BooleanField({ initial: false }),
hasRoll: new fields.BooleanField({ initial: false }), hasRoll: new fields.BooleanField({ initial: false }),
hasDamage: new fields.BooleanField({ initial: false }), hasDamage: new fields.BooleanField({ initial: false }),
@ -64,26 +63,14 @@ export default class DHActorRoll extends foundry.abstract.TypeDataModel {
return actionItem.system.actionsList?.find(a => a.id === this.source.action); return actionItem.system.actionsList?.find(a => a.id === this.source.action);
} }
// get messageTemplate() {
// return 'systems/daggerheart/templates/ui/chat/roll.hbs';
// }
get targetMode() { get targetMode() {
return this.targetSelection; return this.targetSelection;
} }
set targetMode(mode) { set targetMode(mode) {
this.targetSelection = mode; this.targetSelection = mode;
this.updateTargets();
this.registerTargetHook(); this.registerTargetHook();
this.parent.update( this.updateTargets();
{
system: {
targetSelection: this.targetSelection,
oldTargets: this.oldTargets
}
}
);
} }
get hitTargets() { get hitTargets() {
@ -91,31 +78,23 @@ export default class DHActorRoll extends foundry.abstract.TypeDataModel {
} }
async updateTargets() { async updateTargets() {
this.currentTargets = this.getTargetList(); if(!ui.chat.collection.get(this.parent.id)) return;
if(!this.targetSelection) { let targets;
this.currentTargets.forEach(ct => { if(this.targetSelection)
if(this.targets.find(t => t.actorId === ct.actorId)) return; targets = this.targets;
const indexTarget = this.oldTargets.findIndex(ot => ot.actorId === ct.actorId); else
if(indexTarget === -1) targets = Array.from(game.user.targets).map(t => game.system.api.fields.ActionFields.TargetField.formatTarget(t));
this.oldTargets.push(ct);
}); this.parent.setFlag(game.system.id, "targets", targets);
if(this.hasSave) this.setPendingSaves(); await this.parent.updateSource({
// if(this.currentTargets.length) { system: {
if(!this.parent._id) return; targetSelection: this.targetSelection
const updates = await this.parent.update( }
{ });
system: {
oldTargets: this.oldTargets
}
}
);
if(!updates && ui.chat.collection.get(this.parent.id))
ui.chat.updateMessage(this.parent);
// }
}
} }
registerTargetHook() { registerTargetHook() {
if(!this.parent.isAuthor) return;
if(this.targetSelection && this.targetHook !== null) { if(this.targetSelection && this.targetHook !== null) {
Hooks.off("targetToken", this.targetHook); Hooks.off("targetToken", this.targetHook);
this.targetHook = null; this.targetHook = null;
@ -127,9 +106,10 @@ export default class DHActorRoll extends foundry.abstract.TypeDataModel {
prepareDerivedData() { prepareDerivedData() {
if(this.hasTarget) { if(this.hasTarget) {
this.hasHitTarget = this.targets.filter(t => t.hit === true).length > 0; this.hasHitTarget = this.targets.filter(t => t.hit === true).length > 0;
this.updateTargets(); this.currentTargets = this.getTargetList();
this.registerTargetHook(); this. registerTargetHook();
if(this.targetSelection === true) {
if(this.targetSelection === true && this.hasRoll) {
this.targetShort = this.targets.reduce((a,c) => { this.targetShort = this.targets.reduce((a,c) => {
if(c.hit) a.hit += 1; if(c.hit) a.hit += 1;
else a.miss += 1; else a.miss += 1;
@ -140,17 +120,21 @@ export default class DHActorRoll extends foundry.abstract.TypeDataModel {
} }
this.canViewSecret = this.parent.speakerActor?.testUserPermission(game.user, 'OBSERVER'); this.canViewSecret = this.parent.speakerActor?.testUserPermission(game.user, 'OBSERVER');
this.canButtonApply = game.user.isGM;
} }
getTargetList() { getTargetList() {
return this.targetSelection !== true const targets = this.targetSelection && this.parent.isAuthor ? this.targets : (this.parent.getFlag(game.system.id, "targets") ?? this.targets),
? Array.from(game.user.targets).map(t =>{ reactionRolls = this.parent.getFlag(game.system.id, "reactionRolls");
const target = game.system.api.fields.ActionFields.TargetField.formatTarget(t),
oldTarget = this.targets.find(ot => ot.actorId === target.actorId) ?? this.oldTargets.find(ot => ot.actorId === target.actorId); if(reactionRolls) {
if(oldTarget) return oldTarget; Object.entries(reactionRolls).forEach(([k, r]) => {
return target; const target = targets.find(t => t.id === k);
}) if(target) target.saved = r;
: this.targets; });
}
return targets;
} }
setPendingSaves() { setPendingSaves() {

View file

@ -15,6 +15,7 @@ export default class TargetField extends fields.SchemaField {
static prepareConfig(config) { static prepareConfig(config) {
if (!this.target?.type) return []; if (!this.target?.type) return [];
config.hasTarget = true;
let targets; let targets;
if (this.target?.type === CONFIG.DH.GENERAL.targetTypes.self.id) if (this.target?.type === CONFIG.DH.GENERAL.targetTypes.self.id)
targets = [this.actor.token ?? this.actor.prototypeToken]; targets = [this.actor.token ?? this.actor.prototypeToken];

View file

@ -141,6 +141,7 @@ export default class D20Roll extends DHRoll {
static postEvaluate(roll, config = {}) { static postEvaluate(roll, config = {}) {
const data = super.postEvaluate(roll, config); const data = super.postEvaluate(roll, config);
data.type = config.roll?.type; data.type = config.roll?.type;
data.difficulty = config.roll.difficulty;
if (config.targets?.length) { if (config.targets?.length) {
config.targetSelection = true; config.targetSelection = true;
config.targets.forEach(target => { config.targets.forEach(target => {
@ -148,10 +149,9 @@ export default class D20Roll extends DHRoll {
target.hit = roll.isCritical || roll.total >= difficulty; target.hit = roll.isCritical || roll.total >= difficulty;
}); });
data.success = config.targets.some(target => target.hit) data.success = config.targets.some(target => target.hit)
} else if (config.roll.difficulty) { } else if (config.roll.difficulty)
data.difficulty = config.roll.difficulty;
data.success = roll.isCritical || roll.total >= config.roll.difficulty; data.success = roll.isCritical || roll.total >= config.roll.difficulty;
}
data.advantage = { data.advantage = {
type: config.roll.advantage, type: config.roll.advantage,
dice: roll.dAdvantage?.denomination, dice: roll.dAdvantage?.denomination,

View file

@ -2,7 +2,7 @@ import D20RollDialog from '../applications/dialogs/d20RollDialog.mjs';
export default class DHRoll extends Roll { export default class DHRoll extends Roll {
baseTerms = []; baseTerms = [];
constructor(formula, data, options) { constructor(formula, data = {}, options = {}) {
super(formula, data, options); super(formula, data, options);
if (!this.data || !Object.keys(this.data).length) this.data = options.data; if (!this.data || !Object.keys(this.data).length) this.data = options.data;
} }
@ -94,6 +94,7 @@ export default class DHRoll extends Roll {
system: config, system: config,
rolls: [roll] rolls: [roll]
}; };
config.selectedRollMode ??= game.settings.get('core', 'rollMode');
if(roll._evaluated) return await cls.create(msg, { rollMode: config.selectedRollMode }); if(roll._evaluated) return await cls.create(msg, { rollMode: config.selectedRollMode });
return msg; return msg;
} }

View file

@ -1,11 +1,5 @@
export default class DhpChatMessage extends foundry.documents.ChatMessage { export default class DhpChatMessage extends foundry.documents.ChatMessage {
async renderHTML() { async renderHTML() {
// if (this.system.messageTemplate)
// this.content = await foundry.applications.handlebars.renderTemplate(this.system.messageTemplate, {
// ...this.system,
// _source: this.system._source
// });
const actor = game.actors.get(this.speaker.actor); const actor = game.actors.get(this.speaker.actor);
const actorData = actor && this.isContentVisible ? actor : { const actorData = actor && this.isContentVisible ? actor : {
img: this.author.avatar ? this.author.avatar : 'icons/svg/mystery-man.svg', img: this.author.avatar ? this.author.avatar : 'icons/svg/mystery-man.svg',
@ -20,17 +14,6 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
return html; return html;
} }
/* async _preCreate(data, options, user) {
options.speaker = ChatMessage.getSpeaker();
const rollActorOwner = data.rolls?.[0]?.data?.parent?.owner;
if (rollActorOwner) {
data.author = rollActorOwner ? rollActorOwner.id : data.author;
await this.updateSource({ author: rollActorOwner ?? user });
}
return super._preCreate(data, options, rollActorOwner ?? user);
} */
enrichChatMessage(html) { enrichChatMessage(html) {
const elements = html.querySelectorAll('[data-perm-id]'); const elements = html.querySelectorAll('[data-perm-id]');
elements.forEach(e => { elements.forEach(e => {
@ -72,6 +55,10 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
element.addEventListener('mouseleave', this.unhoverTarget); element.addEventListener('mouseleave', this.unhoverTarget);
element.addEventListener('click', this.clickTarget); element.addEventListener('click', this.clickTarget);
}); });
html.querySelectorAll('.button-target-selection').forEach(element => {
element.addEventListener('click', this.onTargetSelection.bind(this));
});
} }
getTargetList() { getTargetList() {
@ -173,4 +160,9 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
} }
game.canvas.pan(token); game.canvas.pan(token);
} }
onTargetSelection(event) {
event.stopPropagation();
this.system.targetMode = Boolean(event.target.dataset.targetHit);
}
} }

View file

@ -22,15 +22,7 @@
"description": "", "description": "",
"chatDisplay": false, "chatDisplay": false,
"actionType": "action", "actionType": "action",
"cost": [ "cost": [],
{
"scalable": false,
"key": "Y7waM3ljoRLyk38N",
"value": 1,
"keyIsID": true,
"step": null
}
],
"uses": { "uses": {
"value": null, "value": null,
"max": "", "max": "",
@ -74,7 +66,7 @@
{ {
"key": "system.bonuses.rally", "key": "system.bonuses.rally",
"mode": 2, "mode": 2,
"value": "1d6", "value": "d6",
"priority": null "priority": null
} }
], ],

View file

@ -22,15 +22,7 @@
"description": "", "description": "",
"chatDisplay": true, "chatDisplay": true,
"actionType": "action", "actionType": "action",
"cost": [ "cost": [],
{
"scalable": false,
"key": "oxv0m8AFUQVFKtZ4",
"value": 1,
"keyIsID": true,
"step": null
}
],
"uses": { "uses": {
"value": null, "value": null,
"max": "", "max": "",
@ -74,7 +66,7 @@
{ {
"key": "system.bonuses.rally", "key": "system.bonuses.rally",
"mode": 2, "mode": 2,
"value": "1d8", "value": "d8",
"priority": null "priority": null
} }
], ],

View file

@ -22,19 +22,6 @@
} }
} }
} }
[data-use-perm='false'] {
pointer-events: none;
border-color: transparent;
}
[data-view-perm='false'] {
> * {
display: none;
}
&::after {
content: '??';
}
}
} }
.daggerheart, .daggerheart,
@ -43,6 +30,19 @@
--text-color: light-dark(@dark-blue, @golden); --text-color: light-dark(@dark-blue, @golden);
--bg-color: light-dark(@dark-blue-40, @golden-40); --bg-color: light-dark(@dark-blue-40, @golden-40);
[data-use-perm='false'] {
pointer-events: none;
border-color: transparent;
}
[data-view-perm='false'] {
&[data-perm-hidden='true'], > * {
display: none;
}
&::after {
content: '??';
}
}
&.duality { &.duality {
&.hope { &.hope {
--text-color: @golden; --text-color: @golden;
@ -177,10 +177,6 @@
} }
} }
} }
.roll-difficulty {
margin-top: -5px;
}
} }
} }
@ -254,7 +250,7 @@
.button-target-selection { .button-target-selection {
flex: 1; flex: 1;
text-align: center; text-align: center;
padding: 5px 0; margin: -5px 0;
} }
.button-target-selection:hover, .button-target-selection:hover,

View file

@ -5,25 +5,25 @@
<li class="scalable-input"> <li class="scalable-input">
<div class="form-group span-2"> <div class="form-group span-2">
<div class="form-fields nest-inputs"> <div class="form-fields nest-inputs">
<input name="uses.enabled" type="checkbox"{{#if uses.enabled}} checked{{/if}}> <input id="action-uses" name="uses.enabled" type="checkbox"{{#if uses.enabled}} checked{{/if}}>
<label for="uses.enabled">Uses{{#if uses.consumeOnSuccess}}<span class="hint">{{localize "DAGGERHEART.ACTIONS.Settings.consumeOnSuccess.short"}}{{/if}}</span></label> <label for="action-uses">Uses{{#if uses.consumeOnSuccess}}<span class="hint">{{localize "DAGGERHEART.ACTIONS.Settings.consumeOnSuccess.short"}}{{/if}}</span></label>
</div> </div>
</div> </div>
<label class="modifier-label">{{uses.value}}/{{formulaValue uses.max @root.rollConfig.data}}</label> <label class="modifier-label" for="action-uses">{{uses.value}}/{{formulaValue uses.max @root.rollConfig.data}}</label>
</li> </li>
{{/if}} {{/if}}
{{#each costs as | cost index |}} {{#each costs as | cost index |}}
<li class="scalable-input"> <li class="scalable-input">
<div class="form-group{{#unless (and scalable maxStep)}} span-2{{/unless}}"> <div class="form-group{{#unless (and scalable maxStep)}} span-2{{/unless}}">
<div class="form-fields nest-inputs"> <div class="form-fields nest-inputs">
<input name="costs.{{index}}.enabled" type="checkbox"{{#if enabled}} checked{{/if}}> <input id="action-costs-{{index}}" name="costs.{{index}}.enabled" type="checkbox"{{#if enabled}} checked{{/if}}>
<label>{{label}}{{#if cost.consumeOnSuccess}}<span class="hint">{{localize "DAGGERHEART.ACTIONS.Settings.consumeOnSuccess.short"}}</span>{{/if}}</label> <label for="action-costs-{{index}}">{{label}}{{#if cost.consumeOnSuccess}}<span class="hint">{{localize "DAGGERHEART.ACTIONS.Settings.consumeOnSuccess.short"}}</span>{{/if}}</label>
</div> </div>
</div> </div>
{{#if (and scalable maxStep)}} {{#if (and scalable maxStep)}}
<input type="range" value="{{scale}}" min="0" max="{{maxStep}}" step="1" name="costs.{{index}}.scale" data-tooltip="{{localize "DAGGERHEART.ACTIONS.Settings.cost.stepTooltip" step=step}}" data-tooltip-direction="UP"> <input type="range" value="{{scale}}" min="0" max="{{maxStep}}" step="1" name="costs.{{index}}.scale" data-tooltip="{{localize "DAGGERHEART.ACTIONS.Settings.cost.stepTooltip" step=step}}" data-tooltip-direction="UP">
{{/if}} {{/if}}
<label class="modifier-label">{{total}}/{{max}}</label> <label class="modifier-label" for="action-costs-{{index}}">{{total}}/{{max}}</label>
</li> </li>
{{/each}} {{/each}}
</ul> </ul>

View file

@ -1,4 +1,4 @@
<li class="card-item" data-item-uuid="{{item.uuid}}"> <li class="card-item" data-item-uuid="{{item.uuid}}" data-type="domainCard">
<img src="{{item.img}}" data-action="useItem" class="card-img" /> <img src="{{item.img}}" data-action="useItem" class="card-img" />
<div class="card-label"> <div class="card-label">
<div <div

View file

@ -1,17 +1,17 @@
<div class="roll-buttons"> <div class="roll-buttons">
{{#if hasDamage}} {{#if hasDamage}}
{{#unless (empty damage)}} {{#unless (empty damage)}}
<button class="duality-action damage-button">{{localize "DAGGERHEART.UI.Chat.damageRoll.dealDamage"}}</button> {{#if canButtonApply}}<button class="duality-action damage-button">{{localize "DAGGERHEART.UI.Chat.damageRoll.dealDamage"}}</button>{{/if}}
{{else}} {{else}}
<button class="duality-action duality-action-damage">{{localize "DAGGERHEART.UI.Chat.attackRoll.rollDamage"}}</button> <button class="duality-action duality-action-damage">{{localize "DAGGERHEART.UI.Chat.attackRoll.rollDamage"}}</button>
{{/unless}} {{/unless}}
{{/if}} {{/if}}
{{#if hasHealing}} {{#if hasHealing}}
{{#unless (empty damage)}} {{#unless (empty damage)}}
<button class="duality-action damage-button">{{localize "DAGGERHEART.UI.Chat.healingRoll.applyHealing"}}</button> {{#if canButtonApply}}<button class="duality-action damage-button">{{localize "DAGGERHEART.UI.Chat.healingRoll.applyHealing"}}</button>{{/if}}
{{else}} {{else}}
<button class="duality-action duality-action-damage">{{localize "DAGGERHEART.UI.Chat.attackRoll.rollHealing"}}</button> <button class="duality-action duality-action-damage">{{localize "DAGGERHEART.UI.Chat.attackRoll.rollHealing"}}</button>
{{/unless}} {{/unless}}
{{/if}} {{/if}}
{{#if hasEffect}}<button class="duality-action-effect">{{localize "DAGGERHEART.UI.Chat.attackRoll.applyEffect"}}</button>{{/if}} {{#if (and hasEffect canButtonApply)}}<button class="duality-action-effect">{{localize "DAGGERHEART.UI.Chat.attackRoll.applyEffect"}}</button>{{/if}}
</div> </div>

View file

@ -14,11 +14,11 @@
</div> </div>
{{#if roll.difficulty}} {{#if roll.difficulty}}
<span class="roll-difficulty{{#unless roll.success}} is-miss{{/unless}}"> <span class="roll-difficulty{{#unless roll.success}} is-miss{{/unless}}">
{{#if canViewSecret}} {{!-- {{#if canViewSecret}} --}}
difficulty {{roll.difficulty}} difficulty {{roll.difficulty}}
{{else}} {{!-- {{else}}
{{localize (ifThen roll.success "DAGGERHEART.GENERAL.success" "DAGGERHEART.GENERAL.failure")}} {{localize (ifThen roll.success "DAGGERHEART.GENERAL.success" "DAGGERHEART.GENERAL.failure")}}
{{/if}} {{/if}} --}}
</span> </span>
{{/if}} {{/if}}
</div> </div>

View file

@ -14,7 +14,7 @@
<div class="roll-part-content dice-result"> <div class="roll-part-content dice-result">
<div class="dice-tooltip"> <div class="dice-tooltip">
<div class="wrapper"> <div class="wrapper">
{{#if targets.length}} {{#if (and parent.isAuthor targets.length)}}
<div class="target-selector"> <div class="target-selector">
<div class="roll-part-header"><div></div></div> <div class="roll-part-header"><div></div></div>
<div class="target-choice"> <div class="target-choice">
@ -29,7 +29,7 @@
<div class="roll-target" data-token="{{id}}"> <div class="roll-target" data-token="{{id}}">
<img class="target-img" src="{{img}}"> <img class="target-img" src="{{img}}">
<div class="target-data"> <div class="target-data">
<div class="target-name" data-perm-id="{{actorId}}">{{name}}</div> <div class="target-name" data-perm-id="{{actorId}}"><span>{{name}}</span></div>
{{#if (and ../targetSelection ../hasRoll)}} {{#if (and ../targetSelection ../hasRoll)}}
<div class="target-hit-status {{#if hit}}is-hit{{else}}is-miss{{/if}}"> <div class="target-hit-status {{#if hit}}is-hit{{else}}is-miss{{/if}}">
{{#if hit}} {{#if hit}}
@ -40,7 +40,7 @@
</div> </div>
{{/if}} {{/if}}
</div> </div>
{{#if (and ../hasSave (or hit (not @root.targetSelection)))}} {{#if (and ../hasSave (or hit (not @root.hasRoll)))}}
<div class="target-save{{#if saved.result includeZero=true}} is-rolled{{/if}}" data-perm-id="{{actorId}}"> <div class="target-save{{#if saved.result includeZero=true}} is-rolled{{/if}}" data-perm-id="{{actorId}}">
<i class="fa-solid {{#if saved.result includeZero=true}}{{#if saved.success}}fa-check{{else}}fa-xmark{{/if}}{{else}}fa-shield{{/if}} fa-lg"></i> <i class="fa-solid {{#if saved.result includeZero=true}}{{#if saved.success}}fa-check{{else}}fa-xmark{{/if}}{{else}}fa-shield{{/if}} fa-lg"></i>
</div> </div>

View file

@ -5,4 +5,4 @@
{{#if hasTarget}}{{> 'systems/daggerheart/templates/ui/chat/parts/target-part.hbs'}}{{/if}} {{#if hasTarget}}{{> 'systems/daggerheart/templates/ui/chat/parts/target-part.hbs'}}{{/if}}
<div class="roll-part-header"><div></div></div> <div class="roll-part-header"><div></div></div>
</div> </div>
{{> 'systems/daggerheart/templates/ui/chat/parts/button-part.hbs'}} {{#if (or parent.isAuthor canButtonApply)}}{{> 'systems/daggerheart/templates/ui/chat/parts/button-part.hbs'}}{{/if}}