[Feature] Sortable inventories and adversary/environment drag/drop (#1357)

* Add ability to sort inventories in player and party sheets

* Format base actor sheet

* Check item validity when creating on an actor

* Block dragdrop on adversaries and environments

* Support drag and drop in adversary and environment sheets

* Fix regression with dropping to character sheet

* Move vault when created handling to domain card preCreate
This commit is contained in:
Carlos Fernandez 2025-12-06 06:05:10 -08:00 committed by GitHub
parent 2171c1b433
commit b57e98071f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 151 additions and 195 deletions

View file

@ -141,6 +141,10 @@ export default class DhpAdversary extends BaseDataActor {
return this.parent.items.filter(x => x.type === 'feature');
}
isItemValid(source) {
return source.type === "feature";
}
async _preUpdate(changes, options, user) {
const allowed = await super._preUpdate(changes, options, user);
if (allowed === false) return false;

View file

@ -108,6 +108,10 @@ export default class DhCompanion extends BaseDataActor {
get proficiency() {
return this.partner?.system?.proficiency ?? 1;
}
isItemValid() {
return false;
}
prepareBaseData() {
this.attack.roll.bonus = this.partner?.system?.spellcastModifier ?? 0;

View file

@ -51,4 +51,8 @@ export default class DhEnvironment extends BaseDataActor {
get features() {
return this.parent.items.filter(x => x.type === 'feature');
}
isItemValid(source) {
return source.type === "feature";
}
}

View file

@ -25,6 +25,10 @@ export default class DhParty extends BaseDataActor {
/* -------------------------------------------- */
isItemValid(source) {
return ["weapon", "armor", "consumable", "loot"].includes(source.type);
}
prepareBaseData() {
super.prepareBaseData();

View file

@ -66,6 +66,10 @@ export default class DHDomainCard extends BaseDataItem {
ui.notifications.error(game.i18n.localize('DAGGERHEART.UI.Notifications.duplicateDomainCard'));
return false;
}
if (!this.actor.system.loadoutSlot.available) {
data.system.inVault = true;
}
}
}