FEAT: formatting code

FIX: fix fields used
FEAT: add jsdoc
This commit is contained in:
Joaquin Pereyra 2025-06-06 18:17:14 -03:00
parent 6c147a5c00
commit f3942280b6
13 changed files with 96 additions and 114 deletions

View file

@ -1,7 +1,8 @@
/**
* Describes metadata about the item data model type
* @typedef {Object} ItemDataModelMetadata
* @property {string} type - The system type that this data model represents (e.g., "weapon", "armor", "consumable")
* @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
*/
@ -33,12 +34,20 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
}
/**
* Obtain a data object used to evaluate any dice rolls associated with this Item
* @param {object} [options]
* Convenient access to the item's actor, if it exists.
* @returns {foundry.documents.Actor | null}
*/
get actor() {
return this.parent.actor;
}
/**
* Obtain a data object used to evaluate any dice rolls associated with this Item Type
* @param {object} [options] - Options which modify the getRollData method.
* @returns {object}
*/
getRollData(options = {}) {
const actorRollData = this.parent.actor?.getRollData() ?? {};
const actorRollData = this.actor?.getRollData() ?? {};
const data = { ...actorRollData, item: { ...this } };
return data;
}