FEAT: BaseDataItem class

add TODO comments for future improvements
FIX: Remove effect field on template
FIX: remove unused DhpEffects file
This commit is contained in:
Joaquin Pereyra 2025-05-30 20:31:34 -03:00
parent 5a2c69d48f
commit ec7f32cdc7
14 changed files with 298 additions and 201 deletions

View file

@ -0,0 +1,32 @@
/**
* @typedef {Object} ItemDataModelMetadata
* @property {String} type - System type that this type data model represents
* @property {Boolean} hasDescription
*/
const fields = foundry.data.fields;
export default class BaseDataItem extends foundry.abstract.TypeDataModel {
/** @returns {ItemDataModelMetadata}*/
static get metadata() {
return {
label: "Base Item",
type: "base",
hasDescription: false,
isQuantifiable: false
};
}
/** @inheritDoc */
static defineSchema() {
const schema = {};
if (this.metadata.hasDescription)
schema.description = new fields.HTMLField({ required: true, nullable: true });
if (this.metadata.isQuantifiable)
schema.quantity = new fields.NumberField({ integer: true, initial: 1, min: 0, required: true });
return schema;
}
}