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 { Misc } from "./misc.js";
|
||||||
import { RdDUtility } from "./rdd-utility.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"];
|
const typesObjetsOeuvres = ["oeuvre", "recettecuisine", "musique", "chant", "danse", "jeu"];
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
export class RdDItem extends Item {
|
export class RdDItem extends Item {
|
||||||
@ -15,15 +15,19 @@ export class RdDItem extends Item {
|
|||||||
prepareDerivedData() {
|
prepareDerivedData() {
|
||||||
super.prepareDerivedData();
|
super.prepareDerivedData();
|
||||||
const itemData = this.data;
|
const itemData = this.data;
|
||||||
const tplData = itemData.data;
|
|
||||||
if (RdDItem.getTypeObjetsEquipement().includes(itemData.type)) {
|
if (RdDItem.getTypeObjetsEquipement().includes(itemData.type)) {
|
||||||
const quantite = itemData.type == 'conteneur' ? 1 : (tplData.quantite ?? 0);
|
this._calculsEquipement(itemData);
|
||||||
if (tplData.encombrement != undefined) {
|
}
|
||||||
tplData.encTotal = Math.max(tplData.encombrement, 0) * quantite;
|
}
|
||||||
}
|
|
||||||
if (tplData.cout != undefined) {
|
_calculsEquipement(itemData) {
|
||||||
tplData.prixTotal = Math.max(tplData.cout, 0) * quantite;
|
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