Corrections v10

Il y en avait partout dans des dialogues, des options,
le drag&drop d'acteur sur acteur, l'empilage d'objet...
This commit is contained in:
Vincent Vandemeulebrouck
2022-09-07 00:09:17 +02:00
parent 59613c3bf8
commit 67b0555b11
28 changed files with 107 additions and 105 deletions

View File

@ -117,7 +117,7 @@ export class RdDItem extends Item {
if (this.isPotion()) {
this.prepareDataPotion()
}
this.actionPrincipale = this.getActionPrincipale({ warnIfNot: false });
this.system.actionPrincipale = this.getActionPrincipale({ warnIfNot: false });
}
}
@ -192,22 +192,28 @@ export class RdDItem extends Item {
/* -------------------------------------------- */
// détermine si deux équipements sont similaires: de même type, et avec les même champs hormis la quantité
isEquipementSimilaire(other) {
const itemData = this
const otherData = other
const tplData = this
const otherTplData = other
if (!this.isEquipement()) return false;
if (itemData.type != otherData.type) return false;
if (itemData.name != otherData.name) return false;
if (tplData.quantite == undefined) return false;
const differences = Object.entries(tplData).filter(([key, value]) => !['quantite', 'encTotal', 'prixTotal', 'cout'].includes(key))
.filter(([key, value]) => value != otherTplData[key]);
if (differences.length > 0) {
let message = `Impossible de regrouper les ${itemData.type} ${itemData.name}: `;
for (const [key, value] of differences) {
message += `<br>${key}: ${value} vs ${otherTplData[key]}`;
let message = undefined;
if (this.type != other.type) {
message = `Impossible de regrouper ${this.type} avec ${other.type}`;
}
else if (this.name != other.name) {
message = `Impossible de regrouper ${this.name} avec ${other.name}`;
}
else if (this.system.quantite == undefined) {
message = `Impossible de regrouper des ${this.type}, ils ne sont pas empilables`;
}
else {
const differences = Object.entries(this.system)
.filter(([key, value]) => !['quantite', 'encTotal', 'prixTotal', 'cout'].includes(key) && value != other.system[key]);
if (differences.length > 0) {
message = `Impossible de regrouper les ${this.type} ${this.name}: `;
for (const [key, value] of differences) {
message += `<br>${key}: ${value} vs ${other.system[key]}`;
}
}
}
if (message){
ui.notifications.info(message)
return false;
}