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

@ -2107,7 +2107,11 @@
"extendCharacterDescriptions": { "label": "Characters" }, "extendCharacterDescriptions": { "label": "Characters" },
"extendAdversaryDescriptions": { "label": "Adversaries" }, "extendAdversaryDescriptions": { "label": "Adversaries" },
"extendEnvironmentDescriptions": { "label": "Environments" }, "extendEnvironmentDescriptions": { "label": "Environments" },
"extendItemDescriptions": { "label": "Items" } "extendItemDescriptions": { "label": "Items" },
"expandRollMessage": "Auto-expand Roll Message",
"expandRollMessageRoll": { "label": "Roll" },
"expandRollMessageDamage": { "label": "Damage/Healing" },
"expandRollMessageTarget": { "label": "Targets" }
}, },
"fearDisplay": { "fearDisplay": {
"token": "Tokens", "token": "Tokens",

View file

@ -71,6 +71,20 @@ export default class DhAppearance extends foundry.abstract.DataModel {
extendItemDescriptions: new fields.BooleanField({ extendItemDescriptions: new fields.BooleanField({
initial: false, initial: false,
label: 'DAGGERHEART.SETTINGS.Appearance.FIELDS.extendItemDescriptions.label' 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'); html.classList.add('critical');
break; 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) { if(!game.user.isGM) {

View file

@ -17,6 +17,13 @@
{{formGroup settingFields.schema.fields.extendItemDescriptions value=settingFields._source.extendItemDescriptions localize=true}} {{formGroup settingFields.schema.fields.extendItemDescriptions value=settingFields._source.extendItemDescriptions localize=true}}
</fieldset> </fieldset>
<fieldset>
<legend>{{localize 'DAGGERHEART.SETTINGS.Appearance.FIELDS.expandRollMessage'}}</legend>
{{formGroup settingFields.schema.fields.expandRollMessage.fields.roll value=settingFields.expandRollMessage.roll localize=true}}
{{formGroup settingFields.schema.fields.expandRollMessage.fields.damage value=settingFields.expandRollMessage.damage localize=true}}
{{formGroup settingFields.schema.fields.expandRollMessage.fields.target value=settingFields.expandRollMessage.target localize=true}}
</fieldset>
{{#if showDiceSoNice}} {{#if showDiceSoNice}}
<fieldset> <fieldset>
<legend>{{localize "DAGGERHEART.SETTINGS.Menu.appearance.diceSoNice.title"}}</legend> <legend>{{localize "DAGGERHEART.SETTINGS.Menu.appearance.diceSoNice.title"}}</legend>

View file

@ -1,4 +1,4 @@
<div class="roll-part damage-section dice-roll" data-action="expandRoll"> <div class="roll-part damage-section dice-roll" data-action="expandRoll"{{#if (empty damage)}} hidden{{/if}}>
<div class="roll-part-header"><div><span>{{localize (ifThen hasHealing "DAGGERHEART.ACTIONS.TYPES.healing.name" "DAGGERHEART.ACTIONS.TYPES.damage.name")}}</span></div></div> <div class="roll-part-header"><div><span>{{localize (ifThen hasHealing "DAGGERHEART.ACTIONS.TYPES.healing.name" "DAGGERHEART.ACTIONS.TYPES.damage.name")}}</span></div></div>
<div class="roll-part-extra on-reduced"> <div class="roll-part-extra on-reduced">
<div class="wrapper"> <div class="wrapper">
@ -12,7 +12,7 @@
<div class="wrapper"> <div class="wrapper">
{{#each damage as | roll index | }} {{#each damage as | roll index | }}
<fieldset> <fieldset>
<legend>{{log @root}} <legend>
{{localize (concat 'DAGGERHEART.CONFIG.HealingType.' index '.inChatRoll')}} <div class="roll-formula">{{localize "DAGGERHEART.GENERAL.total"}}: {{roll.total}}</div>{{#if (and (eq index "hitPoints")../isDirect)}} <div class="roll-formula">{{localize "DAGGERHEART.CONFIG.DamageType.direct.short"}}</div>{{/if}} {{localize (concat 'DAGGERHEART.CONFIG.HealingType.' index '.inChatRoll')}} <div class="roll-formula">{{localize "DAGGERHEART.GENERAL.total"}}: {{roll.total}}</div>{{#if (and (eq index "hitPoints")../isDirect)}} <div class="roll-formula">{{localize "DAGGERHEART.CONFIG.DamageType.direct.short"}}</div>{{/if}}
</legend> </legend>
{{#each roll.parts}} {{#each roll.parts}}

View file

@ -1,7 +1,7 @@
<div class="chat-roll"> <div class="chat-roll">
<div class="roll-part-header"><span>{{title}}</span></div> <div class="roll-part-header"><span>{{title}}</span></div>
{{#if hasRoll}}{{> 'systems/daggerheart/templates/ui/chat/parts/roll-part.hbs'}}{{/if}} {{#if hasRoll}}{{> 'systems/daggerheart/templates/ui/chat/parts/roll-part.hbs'}}{{/if}}
{{#if (and (not (empty damage)) (or hasDamage hasHealing))}}{{> 'systems/daggerheart/templates/ui/chat/parts/damage-part.hbs'}}{{/if}} {{#if (or hasDamage hasHealing)}}{{> 'systems/daggerheart/templates/ui/chat/parts/damage-part.hbs'}}{{/if}}
{{#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>