From 9453d607078abdad436b64460ac65b5cb0333789 Mon Sep 17 00:00:00 2001 From: WBHarry Date: Fri, 1 May 2026 19:18:25 +0200 Subject: [PATCH] Fixed linting --- module/applications/sheets/items/class.mjs | 13 ++++++------ module/data/item/class.mjs | 23 ++++++++++++---------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/module/applications/sheets/items/class.mjs b/module/applications/sheets/items/class.mjs index 4ac02602..154f9ad9 100644 --- a/module/applications/sheets/items/class.mjs +++ b/module/applications/sheets/items/class.mjs @@ -133,16 +133,15 @@ export default class ClassSheet extends DHBaseItemSheet { if (!this.document.system.identifier) { return ui.notifications.error( game.i18n.localize('DAGGERHEART.UI.Notifications.classMissingIdentifier') - ); + ); } - if (item.system.classIdentifiers.includes(this.document.system.identifier)) - return; + if (item.system.classIdentifiers.includes(this.document.system.identifier)) return; - await item.update({ 'system.classIdentifiers': [...item.system.classIdentifiers, this.document.system.identifier] }); - } - - else if (['feature', 'ActiveEffect'].includes(itemType)) { + await item.update({ + 'system.classIdentifiers': [...item.system.classIdentifiers, this.document.system.identifier] + }); + } else if (['feature', 'ActiveEffect'].includes(itemType)) { super._onDrop(event); } else if (this.document.parent?.type !== 'character') { if (itemType === 'weapon') { diff --git a/module/data/item/class.mjs b/module/data/item/class.mjs index 07bc9821..e53b0b70 100644 --- a/module/data/item/class.mjs +++ b/module/data/item/class.mjs @@ -53,7 +53,7 @@ export default class DHClass extends BaseDataItem { isMulticlass: new fields.BooleanField({ initial: false }), identifier: new fields.StringField(), /* Subclasses is legacy. If we can safetely migrate it away at some point we could remove it*/ - subclasses: new ForeignDocumentUUIDArrayField({ type: 'Item', required: false }), + subclasses: new ForeignDocumentUUIDArrayField({ type: 'Item', required: false }) }; } @@ -76,23 +76,26 @@ export default class DHClass extends BaseDataItem { const oldLinkedSubclasses = this.subclasses.filter(x => x); if (!this.identifier) return oldLinkedSubclasses; - const subclasses = game.items.filter(x => x.type === 'subclass' && x.system.classIdentifiers.includes(this.identifier)); - for(const pack of game.packs) { - const indexes = await pack.getIndex({ fields: ['system.classIdentifiers']}); - for(const index of indexes) { + const subclasses = game.items.filter( + x => x.type === 'subclass' && x.system.classIdentifiers.includes(this.identifier) + ); + for (const pack of game.packs) { + const indexes = await pack.getIndex({ fields: ['system.classIdentifiers'] }); + for (const index of indexes) { if ( - index.type === 'subclass' && - (index.system.classIdentifiers??[]).includes(this.identifier && - !subclasses.find(x => x.uuid === index.uuid)) + index.type === 'subclass' && + (index.system.classIdentifiers ?? []).includes( + this.identifier && !subclasses.find(x => x.uuid === index.uuid) + ) ) { const subclass = await foundry.utils.fromUuid(index.uuid); subclasses.push(subclass); } } } - + return subclasses; - } + } async _preCreate(data, options, user) { if (this.actor?.type === 'character') {