mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-06-08 21:58:11 +02:00
Compare commits
3 commits
05167b697a
...
43805331ad
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43805331ad | ||
|
|
210978fd87 | ||
|
|
533421abba |
4 changed files with 14 additions and 5 deletions
|
|
@ -439,10 +439,13 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
|
||||||
'system.domain': { key: 'system.domain', value: this.setup.class?.system.domains ?? null }
|
'system.domain': { key: 'system.domain', value: this.setup.class?.system.domains ?? null }
|
||||||
};
|
};
|
||||||
|
|
||||||
if (type === 'subclasses')
|
if (type === 'subclasses') {
|
||||||
|
const classItem = this.setup.class;
|
||||||
|
const uuid = classItem?._stats.compendiumSource ?? classItem?.uuid;
|
||||||
presets.filter = {
|
presets.filter = {
|
||||||
'system.linkedClass.uuid': { key: 'system.linkedClass.uuid', value: this.setup.class?.uuid }
|
'system.linkedClass': { key: 'system.linkedClass', value: uuid }
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if (equipment.includes(type))
|
if (equipment.includes(type))
|
||||||
presets.filter = {
|
presets.filter = {
|
||||||
|
|
@ -610,7 +613,8 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
|
||||||
[foundry.utils.randomID()]: {}
|
[foundry.utils.randomID()]: {}
|
||||||
};
|
};
|
||||||
} else if (item.type === 'subclass' && event.target.closest('.subclass-card')) {
|
} else if (item.type === 'subclass' && event.target.closest('.subclass-card')) {
|
||||||
if (this.setup.class.system.subclasses.every(subclass => subclass.uuid !== item.uuid)) {
|
const classSubclasses = await this.setup.class.system.fetchSubclasses();
|
||||||
|
if (classSubclasses.every(subclass => subclass.uuid !== item.uuid)) {
|
||||||
ui.notifications.error(game.i18n.localize('DAGGERHEART.UI.Notifications.subclassNotInClass'));
|
ui.notifications.error(game.i18n.localize('DAGGERHEART.UI.Notifications.subclassNotInClass'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,10 @@ export default class SubclassSheet extends DHBaseItemSheet {
|
||||||
const uuid = item._stats.compendiumSource ?? item.uuid;
|
const uuid = item._stats.compendiumSource ?? item.uuid;
|
||||||
if (this.document.system.linkedClass !== uuid) {
|
if (this.document.system.linkedClass !== uuid) {
|
||||||
await this.document.update({ 'system.linkedClass': uuid });
|
await this.document.update({ 'system.linkedClass': uuid });
|
||||||
|
// Re-render all class sheets for instant feedback
|
||||||
|
for (const app of foundry.applications.instances.values()) {
|
||||||
|
if (app.document?.type === 'class') app.render();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -200,7 +200,7 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
|
||||||
const features = [];
|
const features = [];
|
||||||
for (let f of this.features) {
|
for (let f of this.features) {
|
||||||
const fBase = f.item ?? f;
|
const fBase = f.item ?? f;
|
||||||
const feature = fBase.system ? fBase : await foundry.utils.fromUuid(fBase.uuid);
|
const feature = fBase.pack ? await foundry.utils.fromUuid(fBase.uuid) : fBase;
|
||||||
features.push(
|
features.push(
|
||||||
foundry.utils.mergeObject(
|
foundry.utils.mergeObject(
|
||||||
feature.toObject(),
|
feature.toObject(),
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,8 @@ export default class DHSubclass extends BaseDataItem {
|
||||||
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.missingClass'));
|
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.missingClass'));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (actorClass.system.subclasses.every(x => x.uuid !== dataUuid)) {
|
|
||||||
|
if ((await actorClass.system.fetchSubclasses()).every(x => x.uuid !== dataUuid)) {
|
||||||
ui.notifications.error(game.i18n.localize('DAGGERHEART.UI.Notifications.subclassNotInClass'));
|
ui.notifications.error(game.i18n.localize('DAGGERHEART.UI.Notifications.subclassNotInClass'));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue