Added a setting to hide attribution

This commit is contained in:
WBHarry 2025-08-17 15:12:39 +02:00
parent e8aa2acdf0
commit 52466b2803
15 changed files with 47 additions and 15 deletions

View file

@ -2111,7 +2111,7 @@
"FIELDS": {
"displayFear": { "label": "Fear Display" },
"dualityColorScheme": { "label": "Chat Style" },
"showGenericStatusEffects": { "label": "Show Foundry Status Effects" },
"hideAttribution": { "label": "Hide Attribution" },
"expandedTitle": "Auto-expand Descriptions",
"extendCharacterDescriptions": { "label": "Characters" },
"extendAdversaryDescriptions": { "label": "Adversaries" },
@ -2121,7 +2121,8 @@
"expandRollMessageDesc": { "label": "Description" },
"expandRollMessageRoll": { "label": "Formula" },
"expandRollMessageDamage": { "label": "Damage/Healing" },
"expandRollMessageTarget": { "label": "Target" }
"expandRollMessageTarget": { "label": "Target" },
"showGenericStatusEffects": { "label": "Show Foundry Status Effects" }
},
"fearDisplay": {
"token": "Tokens",

View file

@ -50,9 +50,6 @@ export default class DhpEnvironment extends DHBaseActorSheet {
case 'header':
await this._prepareHeaderContext(context, options);
const { source, page } = this.document.system.attribution;
const attribution = [source, page ? `pg ${page}.` : null].filter(x => x).join('. ');
context.attributionLabel = attribution;
break;
case 'notes':
await this._prepareNotesContext(context, options);

View file

@ -132,8 +132,12 @@ export default function DHApplicationMixin(Base) {
async _renderFrame(options) {
const frame = await super._renderFrame(options);
const hideAttribution = game.settings.get(
CONFIG.DH.id,
CONFIG.DH.SETTINGS.gameSettings.appearance
).hideAttribution;
const headerAttribution = !this.#nonHeaderAttribution.includes(this.document.type);
if (this.document.system.metadata.hasAttribution && headerAttribution) {
if (!hideAttribution && this.document.system.metadata.hasAttribution && headerAttribution) {
const { source, page } = this.document.system.attribution;
const attribution = [source, page ? `pg ${page}.` : null].filter(x => x).join('. ');
const element = `<label class="attribution-header-label">${attribution}</label>`;
@ -147,8 +151,12 @@ export default function DHApplicationMixin(Base) {
* Refresh the custom parts of the application frame
*/
refreshFrame() {
const hideAttribution = game.settings.get(
CONFIG.DH.id,
CONFIG.DH.SETTINGS.gameSettings.appearance
).hideAttribution;
const headerAttribution = !this.#nonHeaderAttribution.includes(this.document.type);
if (this.document.system.metadata.hasAttribution && headerAttribution) {
if (!hideAttribution && this.document.system.metadata.hasAttribution && headerAttribution) {
const { source, page } = this.document.system.attribution;
const attribution = [source, page ? `pg ${page}.` : null].filter(x => x).join('. ');

View file

@ -55,6 +55,9 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) {
async _prepareContext(_options) {
const context = await super._prepareContext(_options);
context.isNPC = this.document.isNPC;
context.showAttribution = !game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance)
.hideAttribution;
return context;
}

View file

@ -64,6 +64,15 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
/* Prepare Context */
/* -------------------------------------------- */
/**@inheritdoc */
async _prepareContext(options) {
const context = super._prepareContext(options);
context.showAttribution = !game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance)
.hideAttribution;
return context;
}
/**@inheritdoc */
async _preparePartContext(partId, context, options) {
await super._preparePartContext(partId, context, options);

View file

@ -86,6 +86,13 @@ export default class BaseDataActor extends foundry.abstract.TypeDataModel {
*/
static DEFAULT_ICON = null;
get attributionLabel() {
if (!this.attribution) return;
const { source, page } = this.attribution;
return [source, page ? `pg ${page}.` : null].filter(x => x).join('. ');
}
/* -------------------------------------------- */
/**

View file

@ -89,6 +89,11 @@ export default class DhAppearance extends foundry.abstract.DataModel {
initial: false,
label: 'DAGGERHEART.SETTINGS.Appearance.FIELDS.expandRollMessageTarget.label'
})
}),
hideAttribution: new fields.BooleanField({
required: true,
initial: false,
label: 'DAGGERHEART.SETTINGS.Appearance.FIELDS.hideAttribution.label'
})
};
}

View file

@ -3,6 +3,8 @@
<h1>{{localize 'DAGGERHEART.SETTINGS.Menu.appearance.name'}}</h1>
</header>
{{formGroup settingFields.schema.fields.hideAttribution value=settingFields._source.hideAttribution localize=true}}
<fieldset>
<legend>{{localize 'DAGGERHEART.GENERAL.fear'}}</legend>
{{formGroup settingFields.schema.fields.displayFear value=settingFields._source.displayFear localize=true}}

View file

@ -8,7 +8,7 @@
{{formInput notes.field value=notes.value enriched=notes.enriched toggled=true}}
</fieldset>
{{#if document.system.attribution.artist}}
{{#if (and showAttribution document.system.attribution.artist)}}
<label class="artist-attribution">{{localize "DAGGERHEART.GENERAL.artistAttribution" artist=document.system.attribution.artist}}</label>
{{/if}}
</section>

View file

@ -18,8 +18,8 @@
</div>
{{/if}}
</div>
{{#if document.system.attribution.source}}
<label class="attribution-header-label">{{attributionLabel}}</label>
{{#if (and showAttribution document.system.attributionLabel)}}
<label class="attribution-header-label">{{document.system.attributionLabel}}</label>
{{/if}}
</div>
</div>

View file

@ -8,7 +8,7 @@
{{formInput notes.field value=notes.value enriched=notes.value toggled=true}}
</fieldset>
{{#if document.system.attribution.artist}}
{{#if (and showAttribution document.system.attribution.artist)}}
<label class="artist-attribution">{{localize "DAGGERHEART.GENERAL.artistAttribution" artist=document.system.attribution.artist}}</label>
{{/if}}
</section>

View file

@ -8,7 +8,7 @@
{{formInput systemFields.description value=document.system.description enriched=enrichedDescription toggled=true}}
</fieldset>
{{#if document.system.attribution.artist}}
{{#if (and showAttribution document.system.attribution.artist)}}
<label class="artist-attribution">{{localize "DAGGERHEART.GENERAL.artistAttribution" artist=document.system.attribution.artist}}</label>
{{/if}}
</section>

View file

@ -4,7 +4,7 @@
<h1 class='item-name'><input type='text' name='name' value='{{source.name}}' /></h1>
<div class='item-description'>
<h3>{{localize 'TYPES.Item.ancestry'}}</h3>
{{#if source.system.attributionLabel}} <div class="attribution-header-label">{{source.system.attributionLabel}}</div>{{/if}}
{{#if (and showAttribution source.system.attributionLabel)}} <div class="attribution-header-label">{{source.system.attributionLabel}}</div>{{/if}}
</div>
</div>
</header>

View file

@ -4,7 +4,7 @@
<h1 class='item-name'><input type='text' name='name' value='{{source.name}}' /></h1>
<div class='item-description'>
<h3>{{localize 'TYPES.Item.community'}}</h3>
{{#if source.system.attributionLabel}} <div class="attribution-header-label">{{source.system.attributionLabel}}</div>{{/if}}
{{#if (and showAttribution source.system.attributionLabel)}} <div class="attribution-header-label">{{source.system.attributionLabel}}</div>{{/if}}
</div>
</div>
</header>

View file

@ -24,6 +24,6 @@
{{source.system.level}}
</h3>
</div>
{{#if source.system.attributionLabel}} <div class="attribution-header-label">{{source.system.attributionLabel}}</div>{{/if}}
{{#if (and showAttribution source.system.attributionLabel)}} <div class="attribution-header-label">{{source.system.attributionLabel}}</div>{{/if}}
</div>
</header>