Fixed linting

This commit is contained in:
WBHarry 2026-05-01 19:18:25 +02:00
parent a842299969
commit 9453d60707
2 changed files with 19 additions and 17 deletions

View file

@ -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') {