Add setting to auto expand chat card desc

This commit is contained in:
Dapoolp 2025-08-15 16:03:04 +02:00
parent ffbd3242ad
commit 6dc09198ed
4 changed files with 26 additions and 16 deletions

View file

@ -73,6 +73,10 @@ export default class DhAppearance extends foundry.abstract.DataModel {
label: 'DAGGERHEART.SETTINGS.Appearance.FIELDS.extendItemDescriptions.label'
}),
expandRollMessage: new fields.SchemaField({
desc: new fields.BooleanField({
initial: false,
label: 'DAGGERHEART.SETTINGS.Appearance.FIELDS.expandRollMessageDesc.label'
}),
roll: new fields.BooleanField({
initial: false,
label: 'DAGGERHEART.SETTINGS.Appearance.FIELDS.expandRollMessageRoll.label'

View file

@ -54,22 +54,25 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
e.setAttribute('data-use-perm', document.testUserPermission(game.user, 'OWNER'));
});
if (this.isContentVisible && this.type === 'dualityRoll') {
html.classList.add('duality');
switch (this.system.roll?.result?.duality) {
case 1:
html.classList.add('hope');
break;
case -1:
html.classList.add('fear');
break;
default:
html.classList.add('critical');
break;
if (this.isContentVisible) {
if(this.type === 'dualityRoll') {
html.classList.add('duality');
switch (this.system.roll?.result?.duality) {
case 1:
html.classList.add('hope');
break;
case -1:
html.classList.add('fear');
break;
default:
html.classList.add('critical');
break;
}
}
const autoExpandRoll = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance).expandRollMessage,
rollSections = html.querySelectorAll(".roll-part");
rollSections = html.querySelectorAll(".roll-part"),
itemDesc = html.querySelector(".domain-card-move");
rollSections.forEach(s => {
if(s.classList.contains("roll-section")) {
const toExpand = s.querySelector('[data-action="expandRoll"]');
@ -78,8 +81,9 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
s.classList.toggle("expanded", autoExpandRoll.damage);
else if(s.classList.contains("target-section"))
s.classList.toggle("expanded", autoExpandRoll.target);
})
});
if(itemDesc && autoExpandRoll.desc)
itemDesc.setAttribute("open", "");
}
if(!game.user.isGM) {