foundryvtt-reve-de-dragon/module/actor/export-scriptarium/actor-export-sheet.js
Vincent Vandemeulebrouck e91eea532d Ajout feuille encart
Feuille de PNJ au format des encarts Scriptarium.
Aucune possibilité de jets de dés pour l'instant.
2024-10-05 00:42:27 +02:00

50 lines
1.9 KiB
JavaScript

import { RdDActorSheet } from "../../actor-sheet.js"
import { SYSTEM_RDD } from "../../constants.js";
import { Misc } from "../../misc.js";
import { ExportScriptarium } from "./export-scriptarium.js";
import { Mapping } from "./mapping.js";
export class RdDActorExportSheet extends RdDActorSheet {
static async init() {
await loadTemplates([
"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs",
"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs",
"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac-derivee.hbs",
"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/esquive.hbs",
"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/protection.hbs",
"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs",
])
Actors.registerSheet(SYSTEM_RDD, RdDActorExportSheet, { types: ["personnage"], makeDefault: false, label: "Feuille d'encart" })
}
static get defaultOptions() {
return foundry.utils.mergeObject(RdDActorSheet.defaultOptions, {
template: "systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/actor-export-sheet.hbs",
width: 550,
showCompNiveauBase: false,
vueArchetype: false,
}, { inplace: false })
}
constructor(actor, options) {
super(actor, options)
}
async getData() {
const formData = await super.getData()
const values = Mapping.getAsObject(this.actor);
// Add any structured, precomputed list of data
formData.export = values
return formData
}
activateListeners(html) {
super.activateListeners(html);
this.html.find('.button-export').click(async event => {
ExportScriptarium.INSTANCE.exportActors([this.actor],
`${this.actor.uuid}-${this.actor.name}`
)
})
}
}