Déplacement de méthode compendium

This commit is contained in:
Vincent Vandemeulebrouck 2022-10-07 19:06:43 +02:00
parent 9621d72f92
commit d316bba8fa
2 changed files with 13 additions and 13 deletions

View File

@ -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;

View File

@ -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;
}
}