Files
fvtt-donjon-et-cie/modules/applications/sheets/donjon-et-cie-employe-sheet.mjs

50 lines
1.7 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* Donjon & Cie - Systeme FoundryVTT
*
* Donjon & Cie est un jeu de role edite par John Doe.
* Ce systeme FoundryVTT est une implementation independante et n'est pas
* affilie a John Doe.
*
* @author LeRatierBretonnien
* @copyright 20252026 LeRatierBretonnien
* @license CC BY-NC-SA 4.0 https://creativecommons.org/licenses/by-nc-sa/4.0/
*/
import DonjonEtCieActorSheet from "./base-actor-sheet.mjs";
import { DonjonEtCieUtility } from "../../donjon-et-cie-utility.mjs";
export default class DonjonEtCieEmployeSheet extends DonjonEtCieActorSheet {
static DEFAULT_OPTIONS = {
...super.DEFAULT_OPTIONS,
classes: [...super.DEFAULT_OPTIONS.classes, "employe"],
position: { width: 980, height: 860 }
};
static PARTS = {
main: { template: "systems/fvtt-donjon-et-cie/templates/actors/employe-sheet.hbs" }
};
async _prepareContext() {
const context = await super._prepareContext();
const indexedSections = Object.fromEntries(context.sections.map((section) => [section.key, section]));
const getSection = (key) => indexedSections[key] ?? {
key,
label: context.config.actorSections[key]?.label ?? key,
createType: context.config.actorSections[key]?.createType ?? key,
items: []
};
return {
...context,
magicResources: DonjonEtCieUtility.getMagicResourceContext(this.document),
favorEntries: this.document.getFavorEntries(),
chaosTable: DonjonEtCieUtility.getChaosTableEntries(),
traitsSection: getSection("traits"),
combatSections: ["armes", "armures", "consommables", "equipements"].map(getSection),
spellSection: getSection("sortileges"),
capacitySection: getSection("capacites"),
profileSections: ["langues"].map(getSection)
};
}
}