Feature/519 auto expand roll message (#959)

* Add settings to auto expand roll message sections

* Change Settings labels to match roll message ones

* Add setting to auto expand chat card desc
This commit is contained in:
Dapoulp 2025-08-17 14:42:55 +02:00 committed by GitHub
parent 96d26a1e5b
commit 03e6570d68
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 64 additions and 16 deletions

View file

@ -54,19 +54,36 @@ 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"),
itemDesc = html.querySelector(".domain-card-move");
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(itemDesc && autoExpandRoll.desc)
itemDesc.setAttribute("open", "");
}
if(!game.user.isGM) {