Max Cards loadout switch & Homebrew setting (#412)

* Max Cards loadout switch & Homebrew setting

* Fixes

* Fixes
This commit is contained in:
Dapoulp 2025-07-26 00:50:39 +02:00 committed by GitHub
parent 2a4777f1a0
commit dddee78356
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 42 additions and 4 deletions

View file

@ -259,7 +259,12 @@ export default class CharacterSheet extends DHBaseActorSheet {
name: 'toLoadout',
icon: 'fa-solid fa-arrow-up',
condition: target => getDocFromElement(target).system.inVault,
callback: target => getDocFromElement(target).update({ 'system.inVault': false })
callback: target => {
const doc = getDocFromElement(target),
actorLoadout = doc.actor.system.loadoutSlot;
if(actorLoadout.available) return doc.update({ 'system.inVault': false });
ui.notifications.warn(game.i18n.format('DAGGERHEART.UI.Notifications.loadoutMaxReached', { max: actorLoadout.max }))
}
},
{
name: 'toVault',
@ -729,7 +734,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
const item = await Item.implementation.fromDropData(data);
const itemData = item.toObject();
if (item.type === 'domainCard' && this.document.system.domainCards.loadout.length >= 5) {
if (item.type === 'domainCard' && !this.document.system.loadoutSlot.available) {
itemData.system.inVault = true;
}

View file

@ -310,6 +310,10 @@ export default function DHApplicationMixin(Base) {
options.unshift({
name: 'DAGGERHEART.APPLICATIONS.ContextMenu.useItem',
icon: 'fa-solid fa-burst',
condition: target => {
const doc = getDocFromElement(target);
return !(doc.type === 'domainCard' && doc.system.inVault)
},
callback: (target, event) => getDocFromElement(target).use(event)
});