diff --git a/src/lang/de.json b/src/lang/de.json index a268faa3..5a6b293c 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -125,7 +125,7 @@ "DS4.EffectEnabled": "Aktiv", "DS4.EffectEnabledAbbr": "A", "DS4.EffectLabel": "Bezeichnung", - "DS4.EffectSource": "Quelle", + "DS4.EffectSourceName": "Quelle", "DS4.ActorName": "Name", "DS4.ActorImageAltText": "Bild des Aktors", "DS4.ActorTypeCharacter": "Charakter", diff --git a/src/lang/en.json b/src/lang/en.json index 1b94e0cc..9ce4238a 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -125,7 +125,7 @@ "DS4.EffectEnabled": "Enabled", "DS4.EffectEnabledAbbr": "E", "DS4.EffectLabel": "Label", - "DS4.EffectSource": "Source", + "DS4.EffectSourceName": "Source", "DS4.ActorName": "Name", "DS4.ActorImageAltText": "Image of the Actor", "DS4.ActorTypeCharacter": "Character", diff --git a/src/module/active-effect.ts b/src/module/active-effect.ts index 1ae6eccc..6ae292d6 100644 --- a/src/module/active-effect.ts +++ b/src/module/active-effect.ts @@ -21,4 +21,11 @@ export class DS4ActiveEffect extends ActiveEffect { } return super.apply(actor, change); } + + /** + * A public wrapper for {@link ActiveEffect#_getSourceName}. + */ + async getSourceName(): Promise { + return this._getSourceName(); + } } diff --git a/src/module/actor/sheets/actor-sheet.ts b/src/module/actor/sheets/actor-sheet.ts index 859c3821..7f111cdc 100644 --- a/src/module/actor/sheets/actor-sheet.ts +++ b/src/module/actor/sheets/actor-sheet.ts @@ -11,7 +11,6 @@ import { getCanvas, getGame } from "../../helpers"; import { DS4Item } from "../../item/item"; import { DS4Settings, getDS4Settings } from "../../settings"; import notifications from "../../ui/notifications"; -import { DS4Actor } from "../actor"; import { isCheck } from "../actor-data-properties"; /** @@ -61,16 +60,10 @@ export class DS4ActorSheet extends ActorSheet { - const originatingDocument = effect.origin !== undefined ? await fromUuid(effect.origin) : undefined; - const source = - (originatingDocument instanceof DS4Actor || originatingDocument instanceof DS4Item - ? originatingDocument.name - : null) ?? undefined; - + const enrichedEffectPromises = this.actor.effects.map(async (effect) => { return { - ...effect, - source, + ...effect.toObject(), + sourceName: await effect.getSourceName(), }; }); const enrichedEffects = await Promise.all(enrichedEffectPromises); @@ -335,5 +328,5 @@ interface DS4ActorSheetData extends ActorSheet.Data { type ActiveEffectDataSource = foundry.data.ActiveEffectData["_source"]; interface EnrichedActiveEffectDataSource extends ActiveEffectDataSource { - source?: string; + sourceName: string; } diff --git a/src/templates/sheets/actor/components/effect-list-entry.hbs b/src/templates/sheets/actor/components/effect-list-entry.hbs index 2fa4f334..99419a5b 100644 --- a/src/templates/sheets/actor/components/effect-list-entry.hbs +++ b/src/templates/sheets/actor/components/effect-list-entry.hbs @@ -22,8 +22,8 @@ SPDX-License-Identifier: MIT {{!-- label --}}
{{effectData.label}}
- {{!-- source --}} -
{{effectData.source}}
+ {{!-- source name --}} +
{{effectData.sourceName}}
{{!-- control buttons --}} {{> systems/ds4/templates/sheets/actor/components/overview-control-buttons.hbs diff --git a/src/templates/sheets/actor/components/effect-list-header.hbs b/src/templates/sheets/actor/components/effect-list-header.hbs index 3256c9b2..87ef2326 100644 --- a/src/templates/sheets/actor/components/effect-list-header.hbs +++ b/src/templates/sheets/actor/components/effect-list-header.hbs @@ -18,8 +18,8 @@ SPDX-License-Identifier: MIT {{!-- label --}}
{{localize 'DS4.EffectLabel'}}
- {{!-- origin --}} -
{{localize 'DS4.EffectSource'}}
+ {{!-- source name --}} +
{{localize 'DS4.EffectSourceName'}}
{{!-- control buttons placeholder --}}