From d316bba8fa18524bf99f7947f486469320f5b38b Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 7 Oct 2022 19:06:43 +0200 Subject: [PATCH] =?UTF-8?q?D=C3=A9placement=20de=20m=C3=A9thode=20compendi?= =?UTF-8?q?um?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/misc.js | 11 ----------- module/rdd-compendium-organiser.js | 15 +++++++++++++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/module/misc.js b/module/misc.js index 74acb790..682c9aec 100644 --- a/module/misc.js +++ b/module/misc.js @@ -105,17 +105,6 @@ export class Misc { return params.reduce((a, b) => a + separator + b); } - - static getEntityTypeLabel(entity) { - const documentName = entity?.documentName - const type = entity?.type - if (documentName === 'Actor' || documentName === 'Item') { - const label = CONFIG[documentName]?.typeLabels?.[type] ?? type; - return game.i18n.has(label) ? game.i18n.localize(label) : t; - } - return type; - } - static connectedGMOrUser(ownerId = undefined) { if (ownerId && game.user.id == ownerId) { return ownerId; diff --git a/module/rdd-compendium-organiser.js b/module/rdd-compendium-organiser.js index 56f9a08a..23cac6c7 100644 --- a/module/rdd-compendium-organiser.js +++ b/module/rdd-compendium-organiser.js @@ -1,5 +1,4 @@ import { SYSTEM_RDD } from "./constants.js"; -import { Misc } from "./misc.js"; export class RddCompendiumOrganiser { static init() { @@ -17,7 +16,7 @@ export class RddCompendiumOrganiser { } static async setEntityTypeName(pack, element) { - const label = Misc.getEntityTypeLabel(await pack.getDocument(element.dataset.documentId)); + const label = RddCompendiumOrganiser.getEntityTypeLabel(await pack.getDocument(element.dataset.documentId)); RddCompendiumOrganiser.insertEntityType(element, label); } @@ -27,4 +26,16 @@ export class RddCompendiumOrganiser { } } + + static getEntityTypeLabel(entity) { + const documentName = entity?.documentName + const type = entity?.type + if (documentName === 'Actor' || documentName === 'Item') { + const label = CONFIG[documentName]?.typeLabels?.[type] ?? type; + return game.i18n.has(label) ? game.i18n.localize(label) : t; + } + return type; + } + + } \ No newline at end of file