43 lines
1.4 KiB
JavaScript
43 lines
1.4 KiB
JavaScript
import { TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE, TEMPLATE_COMESTIBLE } from "../../common/_module.mjs";
|
|
import { ITEM_TYPES } from "../../constants.js";
|
|
import RdDItemBaseSheet from "./common-item-sheet.mjs";
|
|
|
|
export default class RdDHerbeSheet extends RdDItemBaseSheet {
|
|
static get ITEM_TYPE() { return ITEM_TYPES.herbe; }
|
|
static get TEMPLATES() { return [TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE, TEMPLATE_COMESTIBLE]; }
|
|
|
|
static DEFAULT_OPTIONS = Object.assign({},
|
|
RdDItemBaseSheet.DEFAULT_OPTIONS,
|
|
{
|
|
classes: ["fvtt-rdd", "item", "herbe"],
|
|
position: { width: 448 },
|
|
window: { contentClasses: ["herbe-content"] },
|
|
});
|
|
|
|
static PARTS = {
|
|
main: {
|
|
template: "systems/foundryvtt-reve-de-dragon/templates/sheets/item/herbe.hbs",
|
|
},
|
|
};
|
|
|
|
async _prepareContext() {
|
|
const ctx = await super._prepareContext()
|
|
ctx.isBrut = this.document.getUtilisationCuisine() === 'brut'
|
|
return ctx
|
|
}
|
|
|
|
async _onRender(context, options) {
|
|
await super._onRender(context, options)
|
|
|
|
this.element.querySelector('.preparer-nourriture')?.addEventListener('click', async () => {
|
|
const actor = this.document.parent
|
|
if (actor) await actor.preparerNourriture(this.document)
|
|
})
|
|
|
|
this.element.querySelector('.manger-nourriture')?.addEventListener('click', async () => {
|
|
const actor = this.document.parent
|
|
if (actor) await actor.mangerNourriture(this.document)
|
|
})
|
|
}
|
|
}
|