mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 14:36:13 +01:00
* Added enrichment for Ancestries and Communities * Fixed remainder * Bit of padding * Increased left padding
41 lines
1.4 KiB
JavaScript
41 lines
1.4 KiB
JavaScript
import { getFeaturesHTMLData } from '../../helpers/utils.mjs';
|
|
import ForeignDocumentUUIDArrayField from '../fields/foreignDocumentUUIDArrayField.mjs';
|
|
import BaseDataItem from './base.mjs';
|
|
|
|
export default class DHCommunity extends BaseDataItem {
|
|
/** @inheritDoc */
|
|
static get metadata() {
|
|
return foundry.utils.mergeObject(super.metadata, {
|
|
label: 'TYPES.Item.community',
|
|
type: 'community',
|
|
hasDescription: true
|
|
});
|
|
}
|
|
|
|
/** @inheritDoc */
|
|
static defineSchema() {
|
|
return {
|
|
...super.defineSchema(),
|
|
features: new ForeignDocumentUUIDArrayField({ type: 'Item' })
|
|
};
|
|
}
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
/**@override */
|
|
static DEFAULT_ICON = 'systems/daggerheart/assets/icons/documents/items/village.svg';
|
|
|
|
/**@inheritdoc */
|
|
async getDescriptionData() {
|
|
const baseDescription = this.description;
|
|
const features = await getFeaturesHTMLData(this.features);
|
|
|
|
if (!features.length) return { prefix: null, value: baseDescription, suffix: null };
|
|
const suffix = await foundry.applications.handlebars.renderTemplate(
|
|
'systems/daggerheart/templates/sheets/items/description.hbs',
|
|
{ label: 'DAGGERHEART.ITEMS.Community.featuresLabel', features }
|
|
);
|
|
|
|
return { prefix: null, value: baseDescription, suffix };
|
|
}
|
|
}
|