mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
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:
parent
96d26a1e5b
commit
03e6570d68
6 changed files with 64 additions and 16 deletions
|
|
@ -2107,7 +2107,12 @@
|
|||
"extendCharacterDescriptions": { "label": "Characters" },
|
||||
"extendAdversaryDescriptions": { "label": "Adversaries" },
|
||||
"extendEnvironmentDescriptions": { "label": "Environments" },
|
||||
"extendItemDescriptions": { "label": "Items" }
|
||||
"extendItemDescriptions": { "label": "Items" },
|
||||
"expandRollMessage": "Auto-expand Message Sections",
|
||||
"expandRollMessageDesc": { "label": "Description" },
|
||||
"expandRollMessageRoll": { "label": "Formula" },
|
||||
"expandRollMessageDamage": { "label": "Damage/Healing" },
|
||||
"expandRollMessageTarget": { "label": "Target" }
|
||||
},
|
||||
"fearDisplay": {
|
||||
"token": "Tokens",
|
||||
|
|
|
|||
|
|
@ -71,6 +71,24 @@ 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({
|
||||
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'
|
||||
}),
|
||||
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'
|
||||
})
|
||||
})
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,8 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
|
|||
e.setAttribute('data-use-perm', document.testUserPermission(game.user, 'OWNER'));
|
||||
});
|
||||
|
||||
if (this.isContentVisible && this.type === 'dualityRoll') {
|
||||
if (this.isContentVisible) {
|
||||
if(this.type === 'dualityRoll') {
|
||||
html.classList.add('duality');
|
||||
switch (this.system.roll?.result?.duality) {
|
||||
case 1:
|
||||
|
|
@ -69,6 +70,22 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
|
|||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
const applyButtons = html.querySelector(".apply-buttons");
|
||||
applyButtons?.remove();
|
||||
|
|
|
|||
|
|
@ -17,6 +17,14 @@
|
|||
{{formGroup settingFields.schema.fields.extendItemDescriptions value=settingFields._source.extendItemDescriptions localize=true}}
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>{{localize 'DAGGERHEART.SETTINGS.Appearance.FIELDS.expandRollMessage'}}</legend>
|
||||
{{formGroup settingFields.schema.fields.expandRollMessage.fields.desc value=settingFields.expandRollMessage.desc localize=true}}
|
||||
{{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}}
|
||||
<fieldset>
|
||||
<legend>{{localize "DAGGERHEART.SETTINGS.Menu.appearance.diceSoNice.title"}}</legend>
|
||||
|
|
|
|||
|
|
@ -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-extra on-reduced">
|
||||
<div class="wrapper">
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
<div class="wrapper">
|
||||
{{#each damage as | roll index | }}
|
||||
<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}}
|
||||
</legend>
|
||||
{{#each roll.parts}}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<div class="chat-roll">
|
||||
<div class="roll-part-header"><span>{{title}}</span></div>
|
||||
{{#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}}
|
||||
<div class="roll-part-header"><div></div></div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue