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

View file

@ -50,9 +50,6 @@ export default class DhpEnvironment extends DHBaseActorSheet {
case 'header': case 'header':
await this._prepareHeaderContext(context, options); 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; break;
case 'notes': case 'notes':
await this._prepareNotesContext(context, options); await this._prepareNotesContext(context, options);

View file

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

View file

@ -64,6 +64,15 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
/* Prepare Context */ /* 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 */ /**@inheritdoc */
async _preparePartContext(partId, context, options) { async _preparePartContext(partId, context, options) {
await super._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; 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, initial: false,
label: 'DAGGERHEART.SETTINGS.Appearance.FIELDS.expandRollMessageTarget.label' 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> <h1>{{localize 'DAGGERHEART.SETTINGS.Menu.appearance.name'}}</h1>
</header> </header>
{{formGroup settingFields.schema.fields.hideAttribution value=settingFields._source.hideAttribution localize=true}}
<fieldset> <fieldset>
<legend>{{localize 'DAGGERHEART.GENERAL.fear'}}</legend> <legend>{{localize 'DAGGERHEART.GENERAL.fear'}}</legend>
{{formGroup settingFields.schema.fields.displayFear value=settingFields._source.displayFear localize=true}} {{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}} {{formInput notes.field value=notes.value enriched=notes.enriched toggled=true}}
</fieldset> </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> <label class="artist-attribution">{{localize "DAGGERHEART.GENERAL.artistAttribution" artist=document.system.attribution.artist}}</label>
{{/if}} {{/if}}
</section> </section>

View file

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

View file

@ -8,7 +8,7 @@
{{formInput notes.field value=notes.value enriched=notes.value toggled=true}} {{formInput notes.field value=notes.value enriched=notes.value toggled=true}}
</fieldset> </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> <label class="artist-attribution">{{localize "DAGGERHEART.GENERAL.artistAttribution" artist=document.system.attribution.artist}}</label>
{{/if}} {{/if}}
</section> </section>

View file

@ -8,7 +8,7 @@
{{formInput systemFields.description value=document.system.description enriched=enrichedDescription toggled=true}} {{formInput systemFields.description value=document.system.description enriched=enrichedDescription toggled=true}}
</fieldset> </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> <label class="artist-attribution">{{localize "DAGGERHEART.GENERAL.artistAttribution" artist=document.system.attribution.artist}}</label>
{{/if}} {{/if}}
</section> </section>

View file

@ -4,7 +4,7 @@
<h1 class='item-name'><input type='text' name='name' value='{{source.name}}' /></h1> <h1 class='item-name'><input type='text' name='name' value='{{source.name}}' /></h1>
<div class='item-description'> <div class='item-description'>
<h3>{{localize 'TYPES.Item.ancestry'}}</h3> <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>
</div> </div>
</header> </header>

View file

@ -4,7 +4,7 @@
<h1 class='item-name'><input type='text' name='name' value='{{source.name}}' /></h1> <h1 class='item-name'><input type='text' name='name' value='{{source.name}}' /></h1>
<div class='item-description'> <div class='item-description'>
<h3>{{localize 'TYPES.Item.community'}}</h3> <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>
</div> </div>
</header> </header>

View file

@ -24,6 +24,6 @@
{{source.system.level}} {{source.system.level}}
</h3> </h3>
</div> </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> </div>
</header> </header>