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

@ -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(),
};
});