diff --git a/lang/en.json b/lang/en.json index a05d6da0..ee6ac23b 100755 --- a/lang/en.json +++ b/lang/en.json @@ -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", diff --git a/module/applications/sheets/actors/environment.mjs b/module/applications/sheets/actors/environment.mjs index c2748a58..9fd003c6 100644 --- a/module/applications/sheets/actors/environment.mjs +++ b/module/applications/sheets/actors/environment.mjs @@ -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); diff --git a/module/applications/sheets/api/application-mixin.mjs b/module/applications/sheets/api/application-mixin.mjs index b03eb92d..15b84cff 100644 --- a/module/applications/sheets/api/application-mixin.mjs +++ b/module/applications/sheets/api/application-mixin.mjs @@ -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 = ``; @@ -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('. '); diff --git a/module/applications/sheets/api/base-actor.mjs b/module/applications/sheets/api/base-actor.mjs index 67cec44f..33c5a0e2 100644 --- a/module/applications/sheets/api/base-actor.mjs +++ b/module/applications/sheets/api/base-actor.mjs @@ -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; } diff --git a/module/applications/sheets/api/base-item.mjs b/module/applications/sheets/api/base-item.mjs index 6b548d2a..b4af283b 100644 --- a/module/applications/sheets/api/base-item.mjs +++ b/module/applications/sheets/api/base-item.mjs @@ -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); diff --git a/module/data/actor/base.mjs b/module/data/actor/base.mjs index 36573325..bdb810dd 100644 --- a/module/data/actor/base.mjs +++ b/module/data/actor/base.mjs @@ -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('. '); + } + /* -------------------------------------------- */ /** diff --git a/module/data/settings/Appearance.mjs b/module/data/settings/Appearance.mjs index e493b187..36f6bb5a 100644 --- a/module/data/settings/Appearance.mjs +++ b/module/data/settings/Appearance.mjs @@ -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' }) }; } diff --git a/templates/settings/appearance-settings.hbs b/templates/settings/appearance-settings.hbs index cd0fab3e..aa094d69 100644 --- a/templates/settings/appearance-settings.hbs +++ b/templates/settings/appearance-settings.hbs @@ -3,6 +3,8 @@