From 2373acc295bdc7c89e9cde77c0c70405b28edda4 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Mon, 6 Nov 2023 23:02:22 +0100 Subject: [PATCH] =?UTF-8?q?Fix:=20afficher=20les=20vues=20d=C3=A9taill?= =?UTF-8?q?=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog.md | 2 ++ module/actor-sheet.js | 32 ++++++++------------------ module/actor.js | 9 -------- module/actor/base-actor-reve-sheet.js | 33 +++++++-------------------- module/actor/base-actor-sheet.js | 32 ++++++++++++++++++++++---- module/actor/commerce-sheet.js | 7 ++---- module/actor/creature-sheet.js | 12 ++++------ module/actor/entite-sheet.js | 9 +++----- module/actor/vehicule-sheet.js | 8 ++----- 9 files changed, 59 insertions(+), 85 deletions(-) diff --git a/changelog.md b/changelog.md index b07eda4d..1cbd54ab 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,6 @@ # v11.0 +## v11.1.1 - Les fumebols de Werther de Zloth +- Fix: on peut de nouveau afficher les vues détaillées ## v11.1.0 - Les choix de Werther de Zloth - Les options suivantes peuvent être désactivées: - La transformation de stress à Château Dormant diff --git a/module/actor-sheet.js b/module/actor-sheet.js index 750c6896..e63c0411 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -26,15 +26,10 @@ export class RdDActorSheet extends RdDBaseActorReveSheet { /** @override */ static get defaultOptions() { - RdDUtility.initAfficheContenu(); - return mergeObject(super.defaultOptions, { - classes: ["rdd", "sheet", "actor"], + return mergeObject(RdDBaseActorReveSheet.defaultOptions, { template: "systems/foundryvtt-reve-de-dragon/templates/actor-sheet.html", width: 550, - tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac" }], - dragDrop: [{ dragSelector: ".item-list .item", dropSelector: undefined }], showCompNiveauBase: false, - vueDetaillee: false, vueArchetype: false, }); } @@ -87,7 +82,7 @@ export class RdDActorSheet extends RdDBaseActorReveSheet { RdDItemArme.computeNiveauArmes(formData.combat, formData.competences); formData.combat.push(RdDItemArme.mainsNues(actor)); formData.combat.push(RdDItemArme.empoignade(actor)); - + formData.esquives = this.actor.getCompetences("Esquive"); formData.combat = RdDCombatManager.listActionsArmes(formData.combat, formData.competences, formData.system.carac); formData.empoignades = this.actor.getEmpoignades(); @@ -131,6 +126,13 @@ export class RdDActorSheet extends RdDBaseActorReveSheet { this.actor.conjurerPossession(poss) }) + this.html.find('.subacteur-label a').click(async event => { + let actorId = RdDSheetUtility.getEventItemData(event, 'actor-id'); + let actor = game.actors.get(actorId); + if (actor) { + actor.sheet.render(true); + } + }); this.html.find('.subacteur-delete').click(async event => { const li = RdDSheetUtility.getEventElement(event); const actorId = li.data("actor-id"); @@ -169,9 +171,7 @@ export class RdDActorSheet extends RdDBaseActorReveSheet { this.html.find('.creer-blessure-legere').click(async event => RdDItemBlessure.createBlessure(this.actor, 2)); this.html.find('.creer-blessure-grave').click(async event => RdDItemBlessure.createBlessure(this.actor, 4)); this.html.find('.creer-blessure-critique').click(async event => RdDItemBlessure.createBlessure(this.actor, 6)); - this.html.find('.creer-une-oeuvre').click(async event => { - this.selectTypeOeuvreToCreate(); - }); + this.html.find('.creer-une-oeuvre').click(async event => this.selectTypeOeuvreToCreate()); this.html.find('.blessure-premierssoins-done').change(async event => { const blessure = this.getBlessure(event); @@ -232,13 +232,6 @@ export class RdDActorSheet extends RdDBaseActorReveSheet { this.html.find('.recettecuisine-label a').click(async event => { this.actor.rollRecetteCuisine(RdDSheetUtility.getItemId(event)); }); - this.html.find('.subacteur-label a').click(async event => { - let actorId = RdDSheetUtility.getEventItemData(event, 'actor-id'); - let actor = game.actors.get(actorId); - if (actor) { - actor.sheet.render(true); - } - }); // Boutons spéciaux MJs this.html.find('.forcer-tmr-aleatoire').click(async event => { @@ -325,11 +318,6 @@ export class RdDActorSheet extends RdDBaseActorReveSheet { this.render(true); }); - this.html.find('.vue-detaillee').click(async event => { - this.options.vueDetaillee = !this.options.vueDetaillee; - this.render(true); - }); - // On pts de reve change this.html.find('.pointsreve-value').change(async event => { let reveValue = event.currentTarget.value; diff --git a/module/actor.js b/module/actor.js index c0e7f15a..8230dd95 100644 --- a/module/actor.js +++ b/module/actor.js @@ -35,15 +35,6 @@ import { ExperienceLog, XP_TOPIC } from "./actor/experience-log.js"; import { TYPES } from "./item.js"; import { RdDBaseActorSang } from "./actor/base-actor-sang.js"; -const POSSESSION_SANS_DRACONIC = { - img: 'systems/foundryvtt-reve-de-dragon/icons/entites/possession.webp', - name: 'Sans draconic', - system: { - niveau: 0, - defaut_carac: "reve-actuel", - } -}; - export const MAINS_DIRECTRICES = ['Droitier', 'Gaucher', 'Ambidextre'] /* -------------------------------------------- */ diff --git a/module/actor/base-actor-reve-sheet.js b/module/actor/base-actor-reve-sheet.js index ea074ff1..cb50aacd 100644 --- a/module/actor/base-actor-reve-sheet.js +++ b/module/actor/base-actor-reve-sheet.js @@ -8,7 +8,14 @@ import { RdDBaseActorSheet } from "./base-actor-sheet.js"; */ export class RdDBaseActorReveSheet extends RdDBaseActorSheet { - /* -------------------------------------------- */ + /** @override */ + static get defaultOptions() { + return mergeObject(RdDBaseActorSheet.defaultOptions, { + width: 550 + }); + } + + /* -------------------------------------------- */ /** @override */ activateListeners(html) { super.activateListeners(html); @@ -16,11 +23,6 @@ export class RdDBaseActorReveSheet extends RdDBaseActorSheet { // Everything below here is only needed if the sheet is editable if (!this.options.editable) return; - this.html.find('.item-action').click(async event => { - const item = RdDSheetUtility.getItem(event, this.actor); - item?.actionPrincipale(this.actor, async () => this.render()) - }); - this.html.find('.encaisser-direct').click(async event => { this.actor.encaisser(); }) @@ -51,25 +53,6 @@ export class RdDBaseActorReveSheet extends RdDBaseActorSheet { } }); - if (this.options.vueDetaillee) { - // On carac change - this.html.find('.carac-value').change(async event => { - let caracName = event.currentTarget.name.replace(".value", "").replace("system.carac.", ""); - this.actor.updateCarac(caracName, parseInt(event.target.value)); - }); - // On competence change - this.html.find('.competence-value').change(async event => { - let compName = event.currentTarget.attributes.compname.value; - //console.log("Competence changed :", compName); - this.actor.updateCompetence(compName, parseInt(event.target.value)); - }); - } - - this.html.find('.vue-detaillee').click(async event => { - this.options.vueDetaillee = !this.options.vueDetaillee; - this.render(true); - }); - this.html.find('.endurance-plus').click(async event => { this.actor.santeIncDec("endurance", 1); }); diff --git a/module/actor/base-actor-sheet.js b/module/actor/base-actor-sheet.js index ef137193..447c2a31 100644 --- a/module/actor/base-actor-sheet.js +++ b/module/actor/base-actor-sheet.js @@ -16,13 +16,10 @@ export class RdDBaseActorSheet extends ActorSheet { /** @override */ static get defaultOptions() { RdDUtility.initAfficheContenu(); - return mergeObject(super.defaultOptions, { + return mergeObject(ActorSheet.defaultOptions, { classes: ["rdd", "sheet", "actor"], - template: "systems/foundryvtt-reve-de-dragon/templates/actor-sheet.html", - width: 550, tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac" }], dragDrop: [{ dragSelector: ".item-list .item", dropSelector: undefined }], - showCompNiveauBase: false, vueDetaillee: false }); } @@ -135,6 +132,13 @@ export class RdDBaseActorSheet extends ActorSheet { super.activateListeners(html); this.html = html; + if (!this.options.editable) return; + + this.html.find('.item-action').click(async event => { + const item = RdDSheetUtility.getItem(event, this.actor); + item?.actionPrincipale(this.actor, async () => this.render()) + }); + this.html.find('.conteneur-name a').click(async event => { RdDUtility.toggleAfficheContenu(this.getItemId(event)); this.render(true); @@ -167,6 +171,26 @@ export class RdDBaseActorSheet extends ActorSheet { this.html.find('.nettoyer-conteneurs').click(async event => { this.actor.nettoyerConteneurs(); }); + + this.html.find('.vue-detaillee').click(async event => { + this.options.vueDetaillee = !this.options.vueDetaillee; + this.render(true); + }); + + if (this.options.vueDetaillee) { + // On carac change + this.html.find('.carac-value').change(async event => { + let caracName = event.currentTarget.name.replace(".value", "").replace("system.carac.", ""); + this.actor.updateCarac(caracName, parseInt(event.target.value)); + }); + // On competence change + this.html.find('.competence-value').change(async event => { + let compName = event.currentTarget.attributes.compname.value; + //console.log("Competence changed :", compName); + this.actor.updateCompetence(compName, parseInt(event.target.value)); + }); + } + } _rechercherKeyup(event) { diff --git a/module/actor/commerce-sheet.js b/module/actor/commerce-sheet.js index 8ade8124..c63fc742 100644 --- a/module/actor/commerce-sheet.js +++ b/module/actor/commerce-sheet.js @@ -12,12 +12,9 @@ export class RdDCommerceSheet extends RdDBaseActorSheet { /** @override */ static get defaultOptions() { return mergeObject(super.defaultOptions, { - classes: ["rdd", "sheet", "actor"], template: "systems/foundryvtt-reve-de-dragon/templates/actor/commerce-actor-sheet.html", - width: 600, - height: 720, - tabs: [], - dragDrop: [{ dragSelector: ".item-list .item", dropSelector: undefined }] + width: 600, height: 720, + tabs: [] }); } get title() { diff --git a/module/actor/creature-sheet.js b/module/actor/creature-sheet.js index c9306196..a036229b 100644 --- a/module/actor/creature-sheet.js +++ b/module/actor/creature-sheet.js @@ -1,20 +1,16 @@ -import { RdDActorSheet } from "../actor-sheet.js"; +import { RdDBaseActorReveSheet } from "./base-actor-reve-sheet.js"; /** * Extend the basic ActorSheet with some very simple modifications * @extends {ActorSheet} */ -export class RdDCreatureSheet extends RdDActorSheet { +export class RdDCreatureSheet extends RdDBaseActorReveSheet { /** @override */ static get defaultOptions() { - return mergeObject(super.defaultOptions, { - classes: ["rdd", "sheet", "actor"], + return mergeObject(RdDBaseActorReveSheet.defaultOptions, { template: "systems/foundryvtt-reve-de-dragon/templates/actor-creature-sheet.html", - width: 640, - height: 720, - tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac" }], - dragDrop: [{ dragSelector: ".item-list .item", dropSelector: undefined }] + width: 640, height: 720 }); } diff --git a/module/actor/entite-sheet.js b/module/actor/entite-sheet.js index 975a2d10..5feaa7db 100644 --- a/module/actor/entite-sheet.js +++ b/module/actor/entite-sheet.js @@ -6,15 +6,12 @@ export class RdDActorEntiteSheet extends RdDBaseActorReveSheet { /** @override */ static get defaultOptions() { - return mergeObject(super.defaultOptions, { - classes: ["rdd", "sheet", "actor"], + return mergeObject(RdDBaseActorReveSheet.defaultOptions, { template: "systems/foundryvtt-reve-de-dragon/templates/actor-entite-sheet.html", - width: 640, - height: 720, - tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac" }], - dragDrop: [{ dragSelector: ".item-list .item", dropSelector: undefined }] + width: 640, height: 720, }); } + async getData() { let formData = await super.getData(); formData.resonances = this.actor.system.sante.resonnance.actors.map(actorId => game.actors.get(actorId)) diff --git a/module/actor/vehicule-sheet.js b/module/actor/vehicule-sheet.js index fcd4dcf6..da24b32d 100644 --- a/module/actor/vehicule-sheet.js +++ b/module/actor/vehicule-sheet.js @@ -8,13 +8,9 @@ export class RdDActorVehiculeSheet extends RdDBaseActorSheet { static get defaultOptions() { RdDUtility.initAfficheContenu(); - return mergeObject(super.defaultOptions, { - classes: ["rdd", "sheet", "actor"], + return mergeObject(RdDBaseActorSheet.defaultOptions, { template: "systems/foundryvtt-reve-de-dragon/templates/actor-vehicule-sheet.html", - width: 640, - height: 720, - tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac" }], - dragDrop: [{ dragSelector: ".item-list .item", dropSelector: undefined }] + width: 640, height: 720, }); }