Display fallback icon iin the effects tab if no icon is available

This commit is contained in:
Johannes Loher 2021-07-23 17:32:26 +02:00
parent 710659510e
commit e10a3f17ac
4 changed files with 9 additions and 2 deletions

View file

@ -211,7 +211,7 @@
"DS4.CreatureBaseInfoSizeCategory": "Größenkategorie",
"DS4.CreatureBaseInfoExperiencePoints": "Erfahrungspunkte",
"DS4.CreatureBaseInfoDescription": "Beschreibung",
"DS4.WarningManageActiveEffectOnOwnedItem": "Das Verwalten von aktiven Effekten innerhalb eines besessen Items wird derzeit nicht unterstützt und wird in einem nachfolgenden Update hinzugefügt.",
"DS4.WarningManageActiveEffectOnOwnedItem": "Das Verwalten von aktiven Effekten innerhalb eines besessen Items wird derzeit nicht unterstützt und wird in einem nachfolgenden Update hinzugefügt. Falls Sie eigentlich den auf den Aktor übertragenen Effekt verwalten wollen, können Sie dies im 'Effekte'-Tab des Aktorbogens tun.",
"DS4.WarningActorCannotOwnItem": "Der Aktor '{actorName}' vom Typ '{actorType}' kann das Item '{itemName}' vom Typ '{itemType}' nicht besitzen.",
"DS4.ErrorDiceCoupFumbleOverlap": "Es gibt eine Überlappung zwischen Patzern und Immersiegen.",
"DS4.ErrorSlayingDiceRecursionLimitExceeded": "Die maximale Rekursionstiefe für slayende Würfelwürfe wurde überschritten.",

View file

@ -211,7 +211,7 @@
"DS4.CreatureBaseInfoSizeCategory": "Size Category",
"DS4.CreatureBaseInfoExperiencePoints": "Experience Points",
"DS4.CreatureBaseInfoDescription": "Description",
"DS4.WarningManageActiveEffectOnOwnedItem": "Managing Active Effects within an Owned Item is not currently supported and will be added in a subsequent update.",
"DS4.WarningManageActiveEffectOnOwnedItem": "Managing Active Effects within an Owned Item is not currently supported and will be added in a subsequent update. If you actually want to manage the effect that has been transferred to the actor, you can do so in the 'Effects' tab in the actor sheet.",
"DS4.WarningActorCannotOwnItem": "The actor '{actorName}' of type '{actorType}' cannot own the item '{itemName}' of type '{itemType}'.",
"DS4.ErrorDiceCoupFumbleOverlap": "There is an overlap between Fumbles and Coups.",
"DS4.ErrorSlayingDiceRecursionLimitExceeded": "Maximum recursion depth for slaying dice roll exceeded.",

View file

@ -13,6 +13,11 @@ declare global {
type PromisedType<T> = T extends Promise<infer U> ? U : T;
export class DS4ActiveEffect extends ActiveEffect {
/**
* A fallback icon that can be used if no icon is defined for the effect.
*/
static FALLBACK_ICON = "icons/svg/aura.svg";
/**
* A cached reference to the source document to avoid recurring database lookups
*/

View file

@ -5,6 +5,7 @@
//
// SPDX-License-Identifier: MIT
import { DS4ActiveEffect } from "../../active-effect";
import { ModifiableDataBaseTotal } from "../../common/common-data";
import { DS4 } from "../../config";
import { getCanvas, getGame } from "../../helpers";
@ -49,6 +50,7 @@ export class DS4ActorSheet extends ActorSheet<ActorSheet.Options, DS4ActorSheetD
const enrichedEffectPromises = this.actor.effects.map(async (effect) => {
return {
...effect.toObject(),
icon: effect.data.icon ?? DS4ActiveEffect.FALLBACK_ICON,
sourceName: await effect.getCurrentSourceName(),
};
});