From d479ef7559a632b6c56fb3873b0cf07c856a6405 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sat, 20 Apr 2024 23:14:16 -0600 Subject: [PATCH] Add basic displaying for ActiveEffects and dropdown support --- module/dotdungeon.mjs | 1 + module/sheets/Items/GenericItemSheet.mjs | 1 + module/sheets/Items/UntypedItemSheet.mjs | 15 +++++++++ .../untyped/v2/tabs/effects.v2.untyped.hbs | 31 +++++++++++++++++-- 4 files changed, 45 insertions(+), 3 deletions(-) diff --git a/module/dotdungeon.mjs b/module/dotdungeon.mjs index c76f259..8731314 100644 --- a/module/dotdungeon.mjs +++ b/module/dotdungeon.mjs @@ -41,6 +41,7 @@ import DOTDUNGEON from "./config.mjs"; Hooks.once(`init`, async () => { console.debug(`.dungeon | Initializing`); + CONFIG.ActiveEffect.legacyTransferral = false; loadSettings(); diff --git a/module/sheets/Items/GenericItemSheet.mjs b/module/sheets/Items/GenericItemSheet.mjs index 31821e1..936bd6c 100644 --- a/module/sheets/Items/GenericItemSheet.mjs +++ b/module/sheets/Items/GenericItemSheet.mjs @@ -30,6 +30,7 @@ export class GenericItemSheet extends ItemSheet { ctx.item = this.item; ctx.system = this.item.system; ctx.flags = this.item.flags; + ctx.effects = this.item.effects; ctx.config = DOTDUNGEON; ctx.icons = {}; diff --git a/module/sheets/Items/UntypedItemSheet.mjs b/module/sheets/Items/UntypedItemSheet.mjs index 1154842..eb3783d 100644 --- a/module/sheets/Items/UntypedItemSheet.mjs +++ b/module/sheets/Items/UntypedItemSheet.mjs @@ -57,6 +57,21 @@ export class UntypedItemSheet extends GenericItemSheet { if (!this.isEditable) return; console.debug(`.dungeon | Adding event listeners for Untyped Item: ${this.item.id}`); + + new GenericContextMenu(html, `.effect.panel`, [ + { + name: localizer(`dotdungeon.common.edit`), + callback: async (html) => { + (await fromUuid(html.closest(`.effect`)[0].dataset.embeddedId))?.sheet.render(true); + }, + }, + { + name: localizer(`dotdungeon.common.delete`), + callback: async () => { + (await fromUuid(html.closest(`.effect`)[0].dataset.embeddedId))?.delete(true); + }, + } + ]); }; async getData() { diff --git a/templates/items/untyped/v2/tabs/effects.v2.untyped.hbs b/templates/items/untyped/v2/tabs/effects.v2.untyped.hbs index 630bce2..a4e08eb 100644 --- a/templates/items/untyped/v2/tabs/effects.v2.untyped.hbs +++ b/templates/items/untyped/v2/tabs/effects.v2.untyped.hbs @@ -1,7 +1,32 @@
-
- Am Effect, Hewwo -
+ {{#each effects as | effect |}} +
+
+ {{effect.name}} +
+
+ {{ifThen effect.disabled "Disabled" "Enabled"}} +
+ {{!-- TODO: For some reason this embedded update logic was failing + +
+ +
+ --}} +
+ {{/each}}