v13 #762
@ -1,5 +1,10 @@
|
||||
# 13.0
|
||||
|
||||
## 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
|
||||
|
||||
- Migration vers la version 13 de Foundry
|
||||
|
@ -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()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -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()
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -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',
|
||||
|
@ -3,8 +3,8 @@ type: faune
|
||||
img: systems/foundryvtt-reve-de-dragon/icons/faune/ours.webp
|
||||
system:
|
||||
description: >-
|
||||
<p>Ours. Forêt, montagne, 300 kg, 600 sust.Surtout recherché
|
||||
pour sa peau (voir legrizzal, p405).</p>
|
||||
<p>Ours. Forêt, montagne, 300 kg, 600 sust. Surtout recherché
|
||||
pour sa peau (voir le grizzal, p405).</p>
|
||||
descriptionmj: ''
|
||||
encombrement: 150
|
||||
quantite: 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user