Changed Class/Multiclass to simple getters to avoid having to keep them up to date

This commit is contained in:
WBHarry 2025-08-15 17:39:06 +02:00
parent 006f9dde1f
commit 113ff2a8c5
4 changed files with 26 additions and 49 deletions

View file

@ -102,26 +102,11 @@ export default class DHClass extends BaseDataItem {
if (allowed === false) return;
}
_onCreate(data, options, userId) {
super._onCreate(data, options, userId);
if (userId !== game.user.id) return;
if (options.parent?.type === 'character') {
const path = `system.${data.system.isMulticlass ? 'multiclass.value' : 'class.value'}`;
options.parent.update({ [path]: `${options.parent.uuid}.Item.${data._id}` });
}
}
_onDelete(options, userId) {
super._onDelete(options, userId);
if (options.parent?.type === 'character') {
const path = `system.${this.isMulticlass ? 'multiclass' : 'class'}`;
options.parent.update({
[`${path}.value`]: null
});
foundry.utils.getProperty(options.parent, `${path}.subclass`)?.delete();
}
}