Les monnaies ont de la valeur et enc
Résout un pb de NaN sur enc total
This commit is contained in:
parent
8a7d8a6930
commit
3e5e745067
@ -1,7 +1,7 @@
|
||||
import { Misc } from "./misc.js";
|
||||
import { RdDUtility } from "./rdd-utility.js";
|
||||
|
||||
const typesObjetsEquipement = ["objet", "arme", "armure", "conteneur", "herbe", "ingredient", "livre", "potion", "munition", "nourritureboisson"];
|
||||
const typesObjetsEquipement = ["objet", "arme", "armure", "conteneur", "herbe", "ingredient", "livre", "potion", "munition", "nourritureboisson", "monnaie"];
|
||||
const typesObjetsOeuvres = ["oeuvre", "recettecuisine", "musique", "chant", "danse", "jeu"];
|
||||
/* -------------------------------------------- */
|
||||
export class RdDItem extends Item {
|
||||
@ -15,15 +15,19 @@ export class RdDItem extends Item {
|
||||
prepareDerivedData() {
|
||||
super.prepareDerivedData();
|
||||
const itemData = this.data;
|
||||
const tplData = itemData.data;
|
||||
if (RdDItem.getTypeObjetsEquipement().includes(itemData.type)) {
|
||||
const quantite = itemData.type == 'conteneur' ? 1 : (tplData.quantite ?? 0);
|
||||
if (tplData.encombrement != undefined) {
|
||||
tplData.encTotal = Math.max(tplData.encombrement, 0) * quantite;
|
||||
}
|
||||
if (tplData.cout != undefined) {
|
||||
tplData.prixTotal = Math.max(tplData.cout, 0) * quantite;
|
||||
}
|
||||
this._calculsEquipement(itemData);
|
||||
}
|
||||
}
|
||||
|
||||
_calculsEquipement(itemData) {
|
||||
const tplData = itemData.data;
|
||||
const quantite = itemData.type == 'conteneur' ? 1 : (tplData.quantite ?? 0);
|
||||
if (tplData.encombrement != undefined) {
|
||||
tplData.encTotal = Math.max(tplData.encombrement, 0) * quantite;
|
||||
}
|
||||
if (tplData.cout != undefined) {
|
||||
tplData.prixTotal = Math.max(tplData.cout, 0) * quantite;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user