Added a check for card duplicates on character

This commit is contained in:
WBHarry 2025-07-01 13:47:14 +02:00
parent 9d038d283a
commit 6a9ccc8c3f

View file

@ -429,8 +429,8 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
return;
}
if (
Object.values(this.levelup.levels).some(level => {
const cardExistsInCharacter = this.actor.items.find(x => x.name === item.name); // Any other way to check? The item is a copy so different ids
const cardExistsInLevelup = Object.values(this.levelup.levels).some(level => {
const achievementExists = Object.values(level.achievements.domainCards).some(
card => card.uuid === item.uuid
);
@ -441,8 +441,8 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
});
return achievementExists || advancementExists;
})
) {
});
if (cardExistsInCharacter || cardExistsInLevelup) {
ui.notifications.error(
game.i18n.localize('DAGGERHEART.Application.LevelUp.notifications.error.domainCardDuplicate')
);