From 6e405ea753c66c9b936ff8257deec3b63e992fbc Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 6 Jun 2025 00:33:23 +0200 Subject: [PATCH 1/2] Fix: on peut de nouveau acheter aux commerces --- changelog.md | 4 ++++ module/actor/commerce-sheet.js | 31 ------------------------------- module/actor/commerce.js | 25 +++++++++++++++++++++++++ module/item/item-actions.js | 6 +++--- 4 files changed, 32 insertions(+), 34 deletions(-) diff --git a/changelog.md b/changelog.md index 5f6aa36b..74180007 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # 13.0 +## 13.0.3 - La dernière auberge d'Illysis + +- On peut de nouveau acheter aux commerces + ## 13.0.0 - Le début de l'errance d'Illysis - Migration vers la version 13 de Foundry diff --git a/module/actor/commerce-sheet.js b/module/actor/commerce-sheet.js index 57644d2e..caaa7e96 100644 --- a/module/actor/commerce-sheet.js +++ b/module/actor/commerce-sheet.js @@ -1,6 +1,4 @@ -import { DialogItemAchat } from "../achat-vente/dialog-item-achat.js"; import { RdDItem } from "../item.js"; -import { RdDUtility } from "../rdd-utility.js"; import { RdDBaseActorSheet } from "./base-actor-sheet.js"; /** @@ -44,13 +42,8 @@ export class RdDCommerceSheet extends RdDBaseActorSheet { activateListeners(html) { super.activateListeners(html); - this.html.find('a.item-acheter').click(async event => await this.vente(this.getItem(event))); - this.html.find('.service-acheter').click(async event => await this.vente(this.getItem(event))); - if (!this.options.editable) return; - this.html.find('a.item-quantite-moins').click(async event => await this.getItem(event)?.quantiteIncDec(-1, { supprimerSiZero: false })); - this.html.find('a.item-quantite-plus').click(async event => await this.getItem(event)?.quantiteIncDec(1)); this.html.find('input.item-quantite').change(async event => { const newQuantite = Math.max(0, Number.parseInt(this.html.find(event.currentTarget).val())); await this.getItem(event)?.update({ "system.quantite": newQuantite }); @@ -64,28 +57,4 @@ export class RdDCommerceSheet extends RdDBaseActorSheet { getTypesInventaire() { return RdDItem.getItemTypesInventaire('all'); } - - - async vente(item) { - const acheteur = RdDUtility.getSelectedActor(); - if (!acheteur) { - ui.notifications.warn(`Pas d'acheteur sélectionné`); - return; - } - const disponible = this.actor.getQuantiteDisponible(item) - if (disponible == 0) { - ui.notifications.warn(`${this.getAlias()} n'a plus de ${item.name} en vente`); - return; - } - - await DialogItemAchat.onAcheter({ - item, - vendeur: this.actor, - acheteur, - quantiteIllimite: disponible == undefined, - nbLots: disponible ?? 1, - tailleLot: 1, - prixLot: item.calculerPrixCommercant() - }); - } } diff --git a/module/actor/commerce.js b/module/actor/commerce.js index 0b7f9a99..9d52ac36 100644 --- a/module/actor/commerce.js +++ b/module/actor/commerce.js @@ -1,4 +1,6 @@ +import { DialogItemAchat } from "../achat-vente/dialog-item-achat.js"; import { Misc } from "../misc.js"; +import { RdDUtility } from "../rdd-utility.js"; import { RdDBaseActor } from "./base-actor.js"; export class RdDCommerce extends RdDBaseActor { @@ -37,4 +39,27 @@ export class RdDCommerce extends RdDBaseActor { const pourcentage = this.system.pourcentage ?? 100; return Misc.keepDecimals(Math.ceil(item.system.cout * pourcentage) / 100, 2); } + async vente(item) { + const acheteur = RdDUtility.getSelectedActor(); + if (!acheteur) { + ui.notifications.warn(`Pas d'acheteur sélectionné`); + return; + } + const disponible = this.getQuantiteDisponible(item) + if (disponible == 0) { + ui.notifications.warn(`${this.getAlias()} n'a plus de ${item.name} en vente`); + return; + } + + await DialogItemAchat.onAcheter({ + item, + vendeur: this, + acheteur, + quantiteIllimite: disponible == undefined, + nbLots: disponible ?? 1, + tailleLot: 1, + prixLot: item.calculerPrixCommercant() + }); + } + } \ No newline at end of file diff --git a/module/item/item-actions.js b/module/item/item-actions.js index b4ce6d9a..522ac437 100644 --- a/module/item/item-actions.js +++ b/module/item/item-actions.js @@ -1,3 +1,4 @@ +import { ACTOR_TYPES } from "../constants.js" import { Misc } from "../misc.js" import { RdDSheetUtility } from "../rdd-sheet-utility.js" import { RdDUtility } from "../rdd-utility.js" @@ -19,9 +20,8 @@ const _VENDRE = { } const _ACHAT_SERVICE = { code: 'item-service-acheter', label: 'Acheter', icon: it => 'fa-regular fa-coins', - //filter: it => Misc.toInt(it.system.quantite) > 0, - //optionsFilter: options => options.editable, - //action: (item, actor) => item.proposerVente() + filter: it => Misc.toInt(it.system.quantite) > 0 && it.parent?.type == ACTOR_TYPES.commerce, + action: (item, actor) => actor.vente(item) } const _MONTRER = { code: 'item-montrer', label: 'Montrer', icon: it => 'fa-solid fa-comment', From da2dca1769a9036418b7e50ed5ed02afbb498e9e Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Mon, 2 Jun 2025 21:42:18 +0200 Subject: [PATCH 2/2] Fix: espaces description Grizzal --- changelog.md | 1 + .../faune-flore-mineraux/faune_Ours_E59KBe57YIoAc8qV.yml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 74180007..1ecb804d 100644 --- a/changelog.md +++ b/changelog.md @@ -3,6 +3,7 @@ ## 13.0.3 - La dernière auberge d'Illysis - On peut de nouveau acheter aux commerces +- La description des Grizzal a des espaces ## 13.0.0 - Le début de l'errance d'Illysis diff --git a/packs_src/faune-flore-mineraux/faune_Ours_E59KBe57YIoAc8qV.yml b/packs_src/faune-flore-mineraux/faune_Ours_E59KBe57YIoAc8qV.yml index 4fad73a8..b3b48e87 100644 --- a/packs_src/faune-flore-mineraux/faune_Ours_E59KBe57YIoAc8qV.yml +++ b/packs_src/faune-flore-mineraux/faune_Ours_E59KBe57YIoAc8qV.yml @@ -3,8 +3,8 @@ type: faune img: systems/foundryvtt-reve-de-dragon/icons/faune/ours.webp system: description: >- -

Ours. Forêt, montagne, 300 kg, 600 sust.Surtout recherché - pour sa peau (voir legrizzal, p405).

+

Ours. Forêt, montagne, 300 kg, 600 sust. Surtout recherché + pour sa peau (voir le grizzal, p405).

descriptionmj: '' encombrement: 150 quantite: 1