[Feature] Make all item types quantifiable in the party (#1808)

* Show notification when invalid item types are added to actors

* Make all item types quantifiable in the party actor

* Remove from comment

* Use isInventoryItem to set quantity

* Fix formatting
This commit is contained in:
Carlos Fernandez 2026-04-16 05:12:36 -04:00 committed by GitHub
parent d9b322406d
commit 2fde61a1d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 85 additions and 46 deletions

View file

@ -19,7 +19,8 @@ export default class DhCharacter extends DhCreature {
type: 'character',
settingSheet: DHCharacterSettings,
isNPC: false,
hasInventory: true
hasInventory: true,
quantifiable: ["loot", "consumable"]
});
}

View file

@ -8,7 +8,8 @@ export default class DhParty extends BaseDataActor {
/** @inheritdoc */
static get metadata() {
return foundry.utils.mergeObject(super.metadata, {
hasInventory: true
hasInventory: true,
quantifiable: ["weapon", "armor", "loot", "consumable"]
});
}

View file

@ -4,7 +4,6 @@
* @property {string} label - A localizable label used on application.
* @property {string} type - The system type that this data model represents.
* @property {boolean} hasDescription - Indicates whether items of this type have description field
* @property {boolean} isQuantifiable - Indicates whether items of this type have quantity field
* @property {boolean} isInventoryItem- Indicates whether items of this type is a Inventory Item
*/
@ -24,7 +23,6 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
type: 'base',
hasDescription: false,
hasResource: false,
isQuantifiable: false,
isInventoryItem: false,
hasActions: false,
hasAttribution: true
@ -83,7 +81,7 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
);
}
if (this.metadata.isQuantifiable)
if (this.metadata.isInventoryItem)
schema.quantity = new fields.NumberField({ integer: true, initial: 1, min: 0, required: true });
if (this.metadata.hasActions) schema.actions = new ActionsField();

View file

@ -7,7 +7,6 @@ export default class DHConsumable extends BaseDataItem {
label: 'TYPES.Item.consumable',
type: 'consumable',
hasDescription: true,
isQuantifiable: true,
isInventoryItem: true,
hasActions: true
});

View file

@ -7,7 +7,6 @@ export default class DHLoot extends BaseDataItem {
label: 'TYPES.Item.loot',
type: 'loot',
hasDescription: true,
isQuantifiable: true,
isInventoryItem: true,
hasActions: true
});