This commit is contained in:
WBHarry 2026-01-27 18:55:25 +01:00
parent 82b60859da
commit c95520c9d8
2 changed files with 18 additions and 23 deletions

View file

@ -532,17 +532,6 @@ export default function DHApplicationMixin(Base) {
callback: async target => (await getDocFromElement(target)).toChat(this.document.uuid) callback: async target => (await getDocFromElement(target)).toChat(this.document.uuid)
}); });
if (deletable)
options.push({
name: 'CONTROLS.CommonDelete',
icon: 'fa-solid fa-trash',
callback: async (target, event) => {
const doc = await getDocFromElement(target);
if (event.shiftKey) return doc.delete();
else return doc.deleteDialog();
}
});
options.push({ options.push({
name: 'Unfavorite', name: 'Unfavorite',
icon: 'fa-regular fa-star', icon: 'fa-regular fa-star',
@ -553,15 +542,9 @@ export default function DHApplicationMixin(Base) {
}, },
callback: async (target, _event) => { callback: async (target, _event) => {
const doc = await getDocFromElement(target); const doc = await getDocFromElement(target);
if (doc.type === 'domainCard') { this.document.update({
this.document.setFavoriteItem(doc, false); 'system.sidebarFavorites': this.document.system.sidebarFavorites.filter(x => x.id !== doc.id)
} else { });
this.document.update({
'system.sidebarFavorites': this.document.system.sidebarFavorites.filter(
x => x.id !== doc.id
)
});
}
} }
}); });
@ -583,6 +566,17 @@ export default function DHApplicationMixin(Base) {
} }
}); });
if (deletable)
options.push({
name: 'CONTROLS.CommonDelete',
icon: 'fa-solid fa-trash',
callback: async (target, event) => {
const doc = await getDocFromElement(target);
if (event.shiftKey) return doc.delete();
else return doc.deleteDialog();
}
});
return options.map(option => ({ return options.map(option => ({
...option, ...option,
icon: `<i class="${option.icon}"></i>` icon: `<i class="${option.icon}"></i>`

View file

@ -1001,8 +1001,9 @@ export default class DhpActor extends Actor {
return ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.loadoutMaxReached')); return ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.loadoutMaxReached'));
} }
await card?.update({ 'system.inVault': !card.system.inVault }, { render }); const toVault = options.toVault ?? !card.system.inVault;
return [{ item: card, add: !card.system.inVault }]; await card?.update({ 'system.inVault': toVault }, { render });
return [{ item: card, add: !toVault }];
} }
async unequipBeforeEquip(itemToEquip, options = { render: true }) { async unequipBeforeEquip(itemToEquip, options = { render: true }) {
@ -1083,7 +1084,7 @@ export default class DhpActor extends Actor {
else favoritesToRemove.push(data.item); else favoritesToRemove.push(data.item);
} }
} else if (item.type === 'domainCard') { } else if (item.type === 'domainCard') {
const changedData = await this.toggleDomainCardVault(item, { render: false }); const changedData = await this.toggleDomainCardVault(item, { render: false, toVault: !setFavorited });
for (const data of changedData) { for (const data of changedData) {
if (data.add) favoritesToAdd.push(data.item); if (data.add) favoritesToAdd.push(data.item);
else favoritesToRemove.push(data.item); else favoritesToRemove.push(data.item);