mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-06-05 20:34:15 +02:00
Fixed linting
This commit is contained in:
parent
a842299969
commit
9453d60707
2 changed files with 19 additions and 17 deletions
|
|
@ -133,16 +133,15 @@ export default class ClassSheet extends DHBaseItemSheet {
|
||||||
if (!this.document.system.identifier) {
|
if (!this.document.system.identifier) {
|
||||||
return ui.notifications.error(
|
return ui.notifications.error(
|
||||||
game.i18n.localize('DAGGERHEART.UI.Notifications.classMissingIdentifier')
|
game.i18n.localize('DAGGERHEART.UI.Notifications.classMissingIdentifier')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.system.classIdentifiers.includes(this.document.system.identifier))
|
if (item.system.classIdentifiers.includes(this.document.system.identifier)) return;
|
||||||
return;
|
|
||||||
|
|
||||||
await item.update({ 'system.classIdentifiers': [...item.system.classIdentifiers, this.document.system.identifier] });
|
await item.update({
|
||||||
}
|
'system.classIdentifiers': [...item.system.classIdentifiers, this.document.system.identifier]
|
||||||
|
});
|
||||||
else if (['feature', 'ActiveEffect'].includes(itemType)) {
|
} else if (['feature', 'ActiveEffect'].includes(itemType)) {
|
||||||
super._onDrop(event);
|
super._onDrop(event);
|
||||||
} else if (this.document.parent?.type !== 'character') {
|
} else if (this.document.parent?.type !== 'character') {
|
||||||
if (itemType === 'weapon') {
|
if (itemType === 'weapon') {
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ export default class DHClass extends BaseDataItem {
|
||||||
isMulticlass: new fields.BooleanField({ initial: false }),
|
isMulticlass: new fields.BooleanField({ initial: false }),
|
||||||
identifier: new fields.StringField(),
|
identifier: new fields.StringField(),
|
||||||
/* Subclasses is legacy. If we can safetely migrate it away at some point we could remove it*/
|
/* 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);
|
const oldLinkedSubclasses = this.subclasses.filter(x => x);
|
||||||
if (!this.identifier) return oldLinkedSubclasses;
|
if (!this.identifier) return oldLinkedSubclasses;
|
||||||
|
|
||||||
const subclasses = game.items.filter(x => x.type === 'subclass' && x.system.classIdentifiers.includes(this.identifier));
|
const subclasses = game.items.filter(
|
||||||
for(const pack of game.packs) {
|
x => x.type === 'subclass' && x.system.classIdentifiers.includes(this.identifier)
|
||||||
const indexes = await pack.getIndex({ fields: ['system.classIdentifiers']});
|
);
|
||||||
for(const index of indexes) {
|
for (const pack of game.packs) {
|
||||||
|
const indexes = await pack.getIndex({ fields: ['system.classIdentifiers'] });
|
||||||
|
for (const index of indexes) {
|
||||||
if (
|
if (
|
||||||
index.type === 'subclass' &&
|
index.type === 'subclass' &&
|
||||||
(index.system.classIdentifiers??[]).includes(this.identifier &&
|
(index.system.classIdentifiers ?? []).includes(
|
||||||
!subclasses.find(x => x.uuid === index.uuid))
|
this.identifier && !subclasses.find(x => x.uuid === index.uuid)
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
const subclass = await foundry.utils.fromUuid(index.uuid);
|
const subclass = await foundry.utils.fromUuid(index.uuid);
|
||||||
subclasses.push(subclass);
|
subclasses.push(subclass);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return subclasses;
|
return subclasses;
|
||||||
}
|
}
|
||||||
|
|
||||||
async _preCreate(data, options, user) {
|
async _preCreate(data, options, user) {
|
||||||
if (this.actor?.type === 'character') {
|
if (this.actor?.type === 'character') {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue