forked from public/foundryvtt-reve-de-dragon
Standardisation inventaire et prix
Les objets d'inventaire ont maintenant tous: coût, encombrement, qualité, quantité Le coût est toujours exprimé en sols, y compris pour les monnaies. Les paiements et achat-ventes sont fait en sols.
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import { DialogItemVente } from "./dialog-item-vente.js";
|
||||
import { Grammar } from "./grammar.js";
|
||||
import { Monnaie } from "./item-monnaie.js";
|
||||
import { RdDHerbes } from "./rdd-herbes.js";
|
||||
import { RdDUtility } from "./rdd-utility.js";
|
||||
|
||||
@ -69,6 +70,30 @@ export class RdDItem extends Item {
|
||||
return defaultItemImg[itemType];
|
||||
}
|
||||
|
||||
static isEquipementFieldEditable(type, field) {
|
||||
switch (field) {
|
||||
case 'quantite':
|
||||
if (['conteneur'].includes(type)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 'cout':
|
||||
if(['monnaie'].includes(type)){
|
||||
return game.user.isGM;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static getUniteQuantite(type) {
|
||||
switch (type) {
|
||||
case "monnaie": return "(Pièces)"
|
||||
case "herbe": return "(Brins)"
|
||||
case "ingredient": return "(Pépins ou Brins)"
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
constructor(itemData, context) {
|
||||
if (!itemData.img) {
|
||||
@ -167,12 +192,12 @@ export class RdDItem extends Item {
|
||||
return Math.max(this.system.encombrement ?? 0, 0);
|
||||
}
|
||||
|
||||
prixTotalDeniers() {
|
||||
return this.getQuantite() * this.valeurDeniers()
|
||||
valeurTotale() {
|
||||
return this.getQuantite() * this.valeur()
|
||||
}
|
||||
|
||||
valeurDeniers() {
|
||||
return Math.max(Math.round(this.system.cout ? (this.system.cout * 100) : (this.system.cout ?? 0)), 0)
|
||||
valeur() {
|
||||
return this.system.cout ?? 0
|
||||
}
|
||||
|
||||
prepareDerivedData() {
|
||||
@ -494,7 +519,7 @@ export class RdDItem extends Item {
|
||||
/* -------------------------------------------- */
|
||||
_monnaieChatData() {
|
||||
return [
|
||||
`<b>Valeur en Deniers</b>: ${this.system.cout}`,
|
||||
`<b>Valeur en Sols</b>: ${this.system.cout}`,
|
||||
`<b>Encombrement</b>: ${this.system.encombrement}`
|
||||
]
|
||||
}
|
||||
@ -564,5 +589,4 @@ export class RdDItem extends Item {
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user