diff --git a/changelog.md b/changelog.md index b07eda4d..4a0065f4 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,9 @@ # 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 +- 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-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..cdcc139d 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'] /* -------------------------------------------- */ @@ -1213,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: { @@ -1224,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); } @@ -2065,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 } @@ -2074,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) => { 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/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/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, }); } 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) { 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": {