const api = foundry.applications.api; const sheets = foundry.applications.sheets; export default class pokemonCharacterSheet extends api.HandlebarsApplicationMixin(sheets.ActorSheetV2) { sheetContext = {}; static DEFAULT_OPTIONS = { tag: "form", classes: ["pokemon", "sheet", "characterSheet"], actions: { }, form: { submitOnChange: true, closeOnSubmit: false }, position: { width: 650 } } static PARTS = { header: { template: "systems/pokemon/templates/sheets/character/header.hbs" }, sidebar: { template: "systems/pokemon/templates/sheets/character/sidebar.hbs" } } get title() { return this.actor.name; } /** @override */ getData() { const data = super.getData(); data.dtypes = ['String', 'Number', 'Boolean']; // // Prepare items. // if (this.actor.type == 'character') { // this._prepareCharacterItems(data); // } // data['totalWealth'] = this.actor.itemTypes.item.reduce((total, item) => total + (!isNaN(item.system.cost) ? item.system.cost * (item.system.quantity ?? 0) : 0), this.actor.system.money); data.data = this.actor.system; // data['origins'] = this.actor.origins; return data; } /** @override */ _configureRenderOptions(options) { super._configureRenderOptions(options); if (this.document.limited) options.parts = ["header"] else options.parts = ["header", "sidebar"]; } /** @override */ async _prepareContext(options) { // ################################################################################################# // ################################################################################################# // ## ## // ## Creates Basic Datamodel, which is used to fill the HTML together with Handelbars with Data. ## // ## ## // ################################################################################################# // ################################################################################################# const baseData = await super._prepareContext(); let context = { // Set General Values owner: baseData.document.isOwner, editable: baseData.editable, actor: baseData.document, system: baseData.document.system, items: baseData.document.items, config: CONFIG.POKEMON, isGM: baseData.user.isGM, effects: baseData.document.effects }; this.sheetContext = context; return context; } /** @override */ _onRender(context, options) { const tabs = new foundry.applications.ux.Tabs({navSelector: ".tabs", contentSelector: ".content", initial: "tab1"}); tabs.bind(this.element); const tabs2 = new foundry.applications.ux.Tabs({navSelector: ".tabs2", contentSelector: ".content2", initial: "tab2-1"}); tabs2.bind(this.element); } }