From 2a797ed8ed0b1dd39a53612662a82c5050285b60 Mon Sep 17 00:00:00 2001 From: Alexander Minges Date: Fri, 2 May 2025 11:53:38 +0200 Subject: [PATCH] Update class imports to use fully qualified Foundry paths --- src/apps/active-effect-config.js | 2 +- src/apps/actor/base-sheet.js | 2 +- src/apps/actor/character-sheet.js | 9 ++++++--- src/apps/actor/creature-sheet.js | 9 ++++++--- src/apps/item-sheet.js | 11 +++++++---- src/dice/check-factory.js | 2 +- src/dice/roll.js | 2 +- src/handlebars/handlebars-partials.js | 2 +- src/hooks/init.js | 23 ++++++++++++++++------- src/utils/utils.js | 2 +- 10 files changed, 41 insertions(+), 23 deletions(-) diff --git a/src/apps/active-effect-config.js b/src/apps/active-effect-config.js index e0acae02..fc02074d 100644 --- a/src/apps/active-effect-config.js +++ b/src/apps/active-effect-config.js @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: MIT -export class DS4ActiveEffectConfig extends ActiveEffectConfig { +export class DS4ActiveEffectConfig extends foundry.applications.sheets.ActiveEffectConfig { /** @override */ static get defaultOptions() { return foundry.utils.mergeObject(super.defaultOptions, { diff --git a/src/apps/actor/base-sheet.js b/src/apps/actor/base-sheet.js index 75a74b11..39d22cc9 100644 --- a/src/apps/actor/base-sheet.js +++ b/src/apps/actor/base-sheet.js @@ -16,7 +16,7 @@ import { disableOverriddenFields } from "../sheet-helpers"; /** * The base sheet class for all {@link DS4Actor}s. */ -export class DS4ActorSheet extends ActorSheet { +export class DS4ActorSheet extends foundry.appv1.sheets.ActorSheet { /** @override */ static get defaultOptions() { return foundry.utils.mergeObject(super.defaultOptions, { diff --git a/src/apps/actor/character-sheet.js b/src/apps/actor/character-sheet.js index 368fe176..2d33b262 100644 --- a/src/apps/actor/character-sheet.js +++ b/src/apps/actor/character-sheet.js @@ -17,9 +17,12 @@ export class DS4CharacterActorSheet extends DS4ActorSheet { /** @override */ async getData(options = {}) { const context = await super.getData(options); - context.data.system.profile.biography = await TextEditor.enrichHTML(context.data.system.profile.biography, { - async: true, - }); + context.data.system.profile.biography = await foundry.applications.ux.TextEditor.implementation.enrichHTML( + context.data.system.profile.biography, + { + async: true, + }, + ); return context; } } diff --git a/src/apps/actor/creature-sheet.js b/src/apps/actor/creature-sheet.js index fe89dec0..21acb003 100644 --- a/src/apps/actor/creature-sheet.js +++ b/src/apps/actor/creature-sheet.js @@ -17,9 +17,12 @@ export class DS4CreatureActorSheet extends DS4ActorSheet { /** @override */ async getData(options = {}) { const context = await super.getData(options); - context.data.system.baseInfo.description = await TextEditor.enrichHTML(context.data.system.baseInfo.description, { - async: true, - }); + context.data.system.baseInfo.description = await foundry.applications.ux.TextEditor.implementation.enrichHTML( + context.data.system.baseInfo.description, + { + async: true, + }, + ); return context; } } diff --git a/src/apps/item-sheet.js b/src/apps/item-sheet.js index 1fc6f0aa..e9b84533 100644 --- a/src/apps/item-sheet.js +++ b/src/apps/item-sheet.js @@ -12,7 +12,7 @@ import { disableOverriddenFields } from "./sheet-helpers"; /** * The Sheet class for DS4 Items */ -export class DS4ItemSheet extends ItemSheet { +export class DS4ItemSheet extends foundry.appv1.sheets.ItemSheet { /** @override */ static get defaultOptions() { return foundry.utils.mergeObject(super.defaultOptions, { @@ -33,9 +33,12 @@ export class DS4ItemSheet extends ItemSheet { /** @override */ async getData(options = {}) { const superContext = await super.getData(options); - superContext.data.system.description = await TextEditor.enrichHTML(superContext.data.system.description, { - async: true, - }); + superContext.data.system.description = await foundry.applications.ux.TextEditor.implementation.enrichHTML( + superContext.data.system.description, + { + async: true, + }, + ); const context = { ...superContext, config: DS4, diff --git a/src/dice/check-factory.js b/src/dice/check-factory.js index 6063ca98..7070e7e2 100644 --- a/src/dice/check-factory.js +++ b/src/dice/check-factory.js @@ -166,7 +166,7 @@ async function askForInteractiveRollData(checkTargetNumber, options = {}, { temp }), id, }; - const renderedHtml = await renderTemplate(usedTemplate, templateData); + const renderedHtml = await foundry.applications.handlebars.renderTemplate(usedTemplate, templateData); const dialogPromise = new Promise((resolve) => { new DialogWithListeners( diff --git a/src/dice/roll.js b/src/dice/roll.js index bc632a07..833f6b19 100644 --- a/src/dice/roll.js +++ b/src/dice/roll.js @@ -29,6 +29,6 @@ export class DS4Roll extends Roll { isCoup: isPrivate ? null : isCoup, isFumble: isPrivate ? null : isFumble, }; - return renderTemplate(template, chatData); + return foundry.applications.handlebars.renderTemplate(template, chatData); } } diff --git a/src/handlebars/handlebars-partials.js b/src/handlebars/handlebars-partials.js index 747c13c4..70cd1e35 100644 --- a/src/handlebars/handlebars-partials.js +++ b/src/handlebars/handlebars-partials.js @@ -56,5 +56,5 @@ export async function registerHandlebarsPartials() { "systems/ds4/templates/sheets/shared/components/control-button-group.hbs", "systems/ds4/templates/sheets/shared/components/rollable-image.hbs", ]; - await loadTemplates(templatePaths); + await foundry.applications.handlebars.loadTemplates(templatePaths); } diff --git a/src/hooks/init.js b/src/hooks/init.js index 199b32bd..a57f4a6e 100644 --- a/src/hooks/init.js +++ b/src/hooks/init.js @@ -65,16 +65,25 @@ async function init() { registerSystemSettings(); - DocumentSheetConfig.unregisterSheet(Actor, "core", ActorSheet); - DocumentSheetConfig.registerSheet(Actor, "ds4", DS4CharacterActorSheet, { + foundry.applications.apps.DocumentSheetConfig.unregisterSheet(Actor, "core", foundry.appv1.sheets.ActorSheet); + foundry.applications.apps.DocumentSheetConfig.registerSheet(Actor, "ds4", DS4CharacterActorSheet, { types: ["character"], makeDefault: true, }); - DocumentSheetConfig.registerSheet(Actor, "ds4", DS4CreatureActorSheet, { types: ["creature"], makeDefault: true }); - DocumentSheetConfig.unregisterSheet(Item, "core", ItemSheet); - DocumentSheetConfig.registerSheet(Item, "ds4", DS4ItemSheet, { makeDefault: true }); - DocumentSheetConfig.unregisterSheet(ActiveEffect, "core", ActiveEffectConfig); - DocumentSheetConfig.registerSheet(ActiveEffect, "ds4", DS4ActiveEffectConfig, { makeDefault: true }); + foundry.applications.apps.DocumentSheetConfig.registerSheet(Actor, "ds4", DS4CreatureActorSheet, { + types: ["creature"], + makeDefault: true, + }); + foundry.applications.apps.DocumentSheetConfig.unregisterSheet(Item, "core", foundry.appv1.sheets.ItemSheet); + foundry.applications.apps.DocumentSheetConfig.registerSheet(Item, "ds4", DS4ItemSheet, { makeDefault: true }); + foundry.applications.apps.DocumentSheetConfig.unregisterSheet( + ActiveEffect, + "core", + foundry.applications.sheets.ActiveEffectConfig, + ); + foundry.applications.apps.DocumentSheetConfig.registerSheet(ActiveEffect, "ds4", DS4ActiveEffectConfig, { + makeDefault: true, + }); preloadFonts(); await registerHandlebarsPartials(); diff --git a/src/utils/utils.js b/src/utils/utils.js index f7fec6cb..ae2f52eb 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -40,7 +40,7 @@ export function getCanvas() { * @returns {Game} */ export function getGame() { - enforce(game instanceof Game, "Game is not initialized yet."); + enforce(game instanceof foundry.Game, "Game is not initialized yet."); return game; }