From 2373acc295bdc7c89e9cde77c0c70405b28edda4 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Mon, 6 Nov 2023 23:02:22 +0100 Subject: [PATCH 1/4] =?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, }); } From 862a2676832aab77bbdabfd61e5b67bf3e074455 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Mon, 6 Nov 2023 23:03:44 +0100 Subject: [PATCH 2/4] =?UTF-8?q?Fix:=20ouvrir=20contenants=20des=20v=C3=A9h?= =?UTF-8?q?icules/cr=C3=A9atures?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog.md | 1 + module/actor.js | 28 +++++++++++++++++++++------- module/actor/base-actor.js | 9 +++++++++ module/item.js | 19 ++++--------------- 4 files changed, 35 insertions(+), 22 deletions(-) diff --git a/changelog.md b/changelog.md index 1cbd54ab..80f19eea 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,7 @@ # v11.0 ## v11.1.1 - Les fumebols de Werther de Zloth - Fix: on peut de nouveau afficher les vues détaillées +- Fix: on peut ouvrir les sacs et contenants portés par les véhicules et créatures ## 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.js b/module/actor.js index 8230dd95..56e756c3 100644 --- a/module/actor.js +++ b/module/actor.js @@ -1204,10 +1204,27 @@ export class RdDActor extends RdDBaseActorSang { new RdDRollDialogEthylisme(html, rollData, this, r => this.saouler(r.forceAlcool)).render(true); } + async actionPrincipale(item, onActionItem = async () => { }) { + let result = await super.actionPrincipale(item, onActionItem) + if (result) { return result } + + result = await this.actionNourritureboisson(item, onActionItem) + if (result) { return result } + + switch (item.type) { + case TYPES.potion: return await this.consommerPotion(item, onActionItem); + case TYPES.livre: return await this.actionLire(item); + case TYPES.conteneur: return await item.sheet.render(true); + case TYPES.herbe: return await this.actionHerbe(item, onActionItem); + case TYPES.queue: case TYPES.ombre: return await this.actionRefoulement(item); + } + return undefined + } + async actionNourritureboisson(item, onActionItem) { switch (item.getUtilisationCuisine()) { case 'brut': { - let d = new Dialog({ + const utilisation = new Dialog({ title: "Nourriture brute", content: `Que faire de votre ${item.name}`, buttons: { @@ -1215,17 +1232,14 @@ export class RdDActor extends RdDBaseActorSang { 'manger': { icon: '', label: 'Manger cru', callback: async () => await this.mangerNourriture(item, onActionItem) } } }); - d.render(true); - return true; + return utilisation.render(true); } case 'pret': - await this.mangerNourriture(item, onActionItem); - return true; + return await this.mangerNourriture(item, onActionItem); } - return false; + return undefined; } - async mangerNourriture(item, onActionItem) { return (await DialogConsommer.create(this, item, onActionItem)).render(true); } diff --git a/module/actor/base-actor.js b/module/actor/base-actor.js index cc79030b..fca1564c 100644 --- a/module/actor/base-actor.js +++ b/module/actor/base-actor.js @@ -2,6 +2,7 @@ import { ChatUtility } from "../chat-utility.js"; import { SYSTEM_SOCKET_ID } from "../constants.js"; import { Grammar } from "../grammar.js"; import { Monnaie } from "../item-monnaie.js"; +import { TYPES } from "../item.js"; import { Misc } from "../misc.js"; import { RdDAudio } from "../rdd-audio.js"; import { RdDConfirm } from "../rdd-confirm.js"; @@ -687,4 +688,12 @@ export class RdDBaseActor extends Actor { async jetEthylisme() { this.actionImpossible("jet d'éthylisme") } async rollAppelChance() { this.actionImpossible("appel à la chance") } async jetDeMoral() { this.actionImpossible("jet de moral") } + + async actionPrincipale(item, onActionItem = async () => { }) { + switch (item.type) { + case TYPES.conteneur: return await item.sheet.render(true); + } + return undefined + } + } \ No newline at end of file diff --git a/module/item.js b/module/item.js index 35c1b053..c9dd25bb 100644 --- a/module/item.js +++ b/module/item.js @@ -498,11 +498,11 @@ export class RdDItem extends Item { if (this.actor?.isPersonnage()) { const warn = options.warnIfNot; if (this.getUtilisationCuisine() == 'brut') { - return 'Utiliser'; + return 'Cuisiner'; } switch (this.type) { case TYPES.nourritureboisson: return this._actionOrWarnQuantiteZero(this.system.boisson ? 'Boire' : 'Manger', warn); - case TYPES.potion: return this._actionOrWarnQuantiteZero('Boire', warn); + case TYPES.potion: return this._actionOrWarnQuantiteZero('Consommer', warn); case TYPES.livre: return this._actionOrWarnQuantiteZero('Lire', warn); case TYPES.herbe: return this.isHerbeAPotion() ? this._actionOrWarnQuantiteZero('Décoction', warn) : undefined; case TYPES.queue: case TYPES.ombre: return this.system.refoulement > 0 ? 'Refouler' : undefined; @@ -513,19 +513,8 @@ export class RdDItem extends Item { /* -------------------------------------------- */ async actionPrincipale(actor, onActionItem = async () => { }) { - if (!this.getActionPrincipale()) { - return; - } - if (await actor.actionNourritureboisson(this, onActionItem)) { - return; - } - switch (this.type) { - case TYPES.potion: return await actor.consommerPotion(this, onActionItem); - case TYPES.livre: return await actor.actionLire(this); - case TYPES.conteneur: return await this.sheet.render(true); - case TYPES.herbe: return await actor.actionHerbe(this, onActionItem); - case TYPES.queue: case TYPES.ombre: return await actor.actionRefoulement(this); - } + if (!this.getActionPrincipale()) { return } + await actor?.actionPrincipale(this, onActionItem); } _actionOrWarnQuantiteZero(actionName, warn) { From 78ee23da96e15dbf129eafdfde3d6364b7c21c61 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Mon, 6 Nov 2023 23:04:35 +0100 Subject: [PATCH 3/4] =?UTF-8?q?Fix:=20proportions=20du=20gibier=20cuisin?= =?UTF-8?q?=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog.md | 2 ++ module/actor.js | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 80f19eea..4a0065f4 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,8 @@ ## v11.1.1 - Les fumebols de Werther de Zloth - Fix: on peut de nouveau afficher les vues détaillées - Fix: on peut ouvrir les sacs et contenants portés par les véhicules et créatures +- Fix: cuisiner du gibier prend maintenant bien les proportaions en compte + ## 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.js b/module/actor.js index 56e756c3..cdcc139d 100644 --- a/module/actor.js +++ b/module/actor.js @@ -2070,7 +2070,7 @@ export class RdDActor extends RdDBaseActorSang { type: 'recettecuisine', img: item.img, system: { - sust: 1, + sust: item.system.sust, exotisme: item.system.exotisme, ingredients: item.name } @@ -2079,7 +2079,7 @@ export class RdDActor extends RdDBaseActorSang { verbe: 'Préparer', compName: 'cuisine', proportions: 1, - proportionsMax: Math.min(50, item.system.sust), + proportionsMax: Math.min(50, item.system.quantite), ajouterEquipement: true }; await this._rollArt(artData, 'odoratgout', nourriture, async (cuisine) => { From 940237852b6b2f442aa06401a30d25e831a576c9 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Mon, 6 Nov 2023 23:05:40 +0100 Subject: [PATCH 4/4] Version 11.1.1 --- system.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system.json b/system.json index f30e1b27..14f5f809 100644 --- a/system.json +++ b/system.json @@ -1,8 +1,8 @@ { "id": "foundryvtt-reve-de-dragon", "title": "Rêve de Dragon", - "version": "11.1.0", - "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-11.1.0.zip", + "version": "11.1.1", + "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-11.1.1.zip", "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v11/system.json", "changelog": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/branch/v11/changelog.md", "compatibility": {