export class CharacterSheet extends ActorSheet { /**@override */ static get defaultOptions() { return foundry.utils.mergeObject(super.defaultOptions, { classes: ['dsa41', 'sheet', 'actor', 'character'], width: 520, height: 480, tabs: [ { navSelector: '.sheet-tabs', contentSelector: '.sheet-body', initial: 'description', }, ], }); } /** @override */ get template() { return `systems/DSA_4-1/templates/actor/actor-character-sheet.hbs`; } /** @override */ getData() { // Retrieve the data structure from the base sheet. You can inspect or log // the context variable to see the structure, but some key properties for // sheets are the actor object, the data object, whether or not it's // editable, the items array, and the effects array. const context = super.getData(); // Use a safe clone of the actor data for further operations. const actorData = context.data; // Add the actor's data to context.data for easier access, as well as flags. context.system = actorData.system; context.flags = actorData.flags; context.attributs = [ { attribut: "mu", name: "Mut", wert: actorData.system.attribute.mu ?? 0, }, { attribut: "kl", name: "Klugheit", wert: actorData.system.attribute.kl ?? 0, }, { attribut: "in", name: "Intuition", wert: actorData.system.attribute.in ?? 0, }, { attribut: "ch", name: "Charisma", wert: actorData.system.attribute.ch ?? 0, }, { attribut: "ff", name: "Fingerfertigkeit", wert: actorData.system.attribute.ff ?? 0, }, { attribut: "ge", name: "Geschicklichkeit", wert: actorData.system.attribute.ge ?? 0, }, { attribut: "ko", name: "Konstitution", wert: actorData.system.attribute.ko ?? 0, }, { attribut: "kk", name: "Körperkraft", wert: actorData.system.attribute.kk ?? 0, }, ]; context.skills = []; if ( context.system.talente?.length >= 0) { context.system.talente.forEach(talent => { const tempTalent = talent(); console.log(tempTalent.system.probe); context.skills.push({ talentName: tempTalent.name, probe: `ROLLDATA(${Object.values(tempTalent.system.probe).join("/")})` }); }) } console.log(context); return context; } _onRoll(event) { event.preventDefault(); const dataset = event.currentTarget.dataset; console.log(dataset) if (dataset.roll) { let label = dataset.label ? `[Attribut] ${dataset.label}` : ''; console.log(this.actor.getRollData()); let roll = new Roll(dataset.roll, this.actor.getRollData()); roll.toMessage({ speaker: ChatMessage.getSpeaker({ actor: this.actor }), flavor: label, rollMode: game.settings.get('core', 'rollMode'), }); return roll; } } activateListeners(html) { super.activateListeners(html); html.on('click', '.attribut.rollable', (evt) => { console.log(evt); this._onRoll(evt); }); // Everything below here is only needed if the sheet is editable if (!this.isEditable) return; } }