use notification wrapper

This commit is contained in:
Johannes Loher 2021-02-21 04:09:48 +01:00
parent 5d249d4c10
commit d7fb8fd61a
2 changed files with 4 additions and 2 deletions

View file

@ -2,6 +2,7 @@ import { ModifiableMaybeData } from "../../common/common-data";
import { DS4 } from "../../config"; import { DS4 } from "../../config";
import { DS4Item } from "../../item/item"; import { DS4Item } from "../../item/item";
import { DS4ItemData } from "../../item/item-data"; import { DS4ItemData } from "../../item/item-data";
import notifications from "../../ui/notifications";
import { DS4Actor } from "../actor"; import { DS4Actor } from "../actor";
/** /**
@ -257,7 +258,7 @@ export class DS4ActorSheet extends ActorSheet<ActorSheet.Data<DS4Actor>> {
): Promise<boolean | undefined | ActorSheet.OwnedItemData<DS4Actor>> { ): Promise<boolean | undefined | ActorSheet.OwnedItemData<DS4Actor>> {
const item = await DS4Item.fromDropData(data); const item = await DS4Item.fromDropData(data);
if (item && !this.actor.canOwnItemType(item.data.type)) { if (item && !this.actor.canOwnItemType(item.data.type)) {
ui.notifications?.warn( notifications.warn(
game.i18n.format("DS4.WarningActorCannotOwnItem", { game.i18n.format("DS4.WarningActorCannotOwnItem", {
actorName: this.actor.name, actorName: this.actor.name,
actorType: this.actor.data.type, actorType: this.actor.data.type,

View file

@ -1,4 +1,5 @@
import { DS4 } from "../config"; import { DS4 } from "../config";
import notifications from "../ui/notifications";
import { DS4Item } from "./item"; import { DS4Item } from "./item";
import { isDS4ItemDataTypePhysical } from "./item-data"; import { isDS4ItemDataTypePhysical } from "./item-data";
@ -82,7 +83,7 @@ export class DS4ItemSheet extends ItemSheet<ItemSheet.Data<DS4Item>> {
event.preventDefault(); event.preventDefault();
if (this.item.isOwned) { if (this.item.isOwned) {
return ui.notifications?.warn(game.i18n.localize("DS4.WarningManageActiveEffectOnOwnedItem")); return notifications.warn(game.i18n.localize("DS4.WarningManageActiveEffectOnOwnedItem"));
} }
const a = event.currentTarget; const a = event.currentTarget;
const li = $(a).parents(".effect"); const li = $(a).parents(".effect");