bol/module/item/item.js

41 lines
1.0 KiB
JavaScript
Raw Normal View History

2021-07-08 10:12:12 +02:00
/**
* Extend the basic Item with some very simple modifications.
* @extends {Item}
*/
export class BoLItem extends Item {
/**
* Augment the basic Item data model with additional dynamic data.
*/
prepareData() {
super.prepareData();
2021-11-08 14:40:29 +01:00
// console.debug("Item prepareData");
2021-07-08 10:12:12 +02:00
// Get the Item's data
const itemData = this.data;
2021-11-08 14:40:29 +01:00
// console.log(itemData);
2021-07-08 10:12:12 +02:00
const actorData = this.actor ? this.actor.data : {};
const data = itemData.data;
}
2021-11-08 14:40:29 +01:00
get properties() {
return this.data.properties;
}
/* -------------------------------------------- */
/**
* Get the Array of item properties which are used in the small sidebar of the description tab
* @return {Array}
* @private
*/
get itemProperties() {
const props = [];
if ( this.data.type === "item" ) {
const entries = Object.entries(this.data.data.properties);
props.push(...entries.filter(e => e[1] === true).map(e => { return game.bol.config.itemProperties2[e[0]] }));
2021-11-08 14:40:29 +01:00
}
return props.filter(p => !!p);
}
2021-07-08 10:12:12 +02:00
}