mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 19:51:08 +01:00
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:
parent
5a2c69d48f
commit
ec7f32cdc7
14 changed files with 298 additions and 201 deletions
32
module/data/items/base.mjs
Normal file
32
module/data/items/base.mjs
Normal 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;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue