Add settings to auto expand roll message sections

This commit is contained in:
Dapoolp 2025-08-15 15:32:40 +02:00
parent b3c0344b91
commit af2246f999
6 changed files with 42 additions and 4 deletions

View file

@ -71,6 +71,20 @@ export default class DhAppearance extends foundry.abstract.DataModel {
extendItemDescriptions: new fields.BooleanField({
initial: false,
label: 'DAGGERHEART.SETTINGS.Appearance.FIELDS.extendItemDescriptions.label'
}),
expandRollMessage: new fields.SchemaField({
roll: new fields.BooleanField({
initial: false,
label: 'DAGGERHEART.SETTINGS.Appearance.FIELDS.expandRollMessageRoll.label'
}),
damage: new fields.BooleanField({
initial: false,
label: 'DAGGERHEART.SETTINGS.Appearance.FIELDS.expandRollMessageDamage.label'
}),
target: new fields.BooleanField({
initial: false,
label: 'DAGGERHEART.SETTINGS.Appearance.FIELDS.expandRollMessageTarget.label'
})
})
};
}

View file

@ -67,6 +67,19 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
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.forEach(s => {
if(s.classList.contains("roll-section")) {
const toExpand = s.querySelector('[data-action="expandRoll"]');
toExpand.classList.toggle("expanded", autoExpandRoll.roll);
} else if(s.classList.contains("damage-section"))
s.classList.toggle("expanded", autoExpandRoll.damage);
else if(s.classList.contains("target-section"))
s.classList.toggle("expanded", autoExpandRoll.target);
})
}
if(!game.user.isGM) {