This commit is contained in:
2022-09-07 09:01:23 +02:00
parent 5a32cf26dc
commit 336767c19e
25 changed files with 75 additions and 76 deletions

View File

@ -182,7 +182,7 @@ export class RdDActor extends Actor {
async cleanupConteneurs() {
let updates = this.listItemsData('conteneur')
.filter(c => c.system.contenu.filter(id => this.getObjet(id) == undefined).length > 0)
.map(c => { return { _id: c._id, 'data.contenu': c.system.contenu.filter(id => this.getObjet(id) != undefined) } });
.map(c => { return { _id: c._id, 'system.contenu': c.system.contenu.filter(id => this.getObjet(id) != undefined) } });
if (updates.length > 0) {
await this.updateEmbeddedDocuments("Item", updates)
}
@ -402,7 +402,7 @@ export class RdDActor extends Actor {
if (!potion.system.prpermanent) {
console.log(potion);
let newPr = (potion.system.pr > 0) ? potion.system.pr - 1 : 0;
let update = { _id: potion._id, 'data.pr': newPr };
let update = { _id: potion._id, 'system.pr': newPr };
const updated = await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity
let messageData = {
@ -1003,7 +1003,7 @@ export class RdDActor extends Actor {
if (competence) {
if (isNaN(newXp) || typeof (newXp) != 'number') newXp = 0;
this.checkCompetenceXP(idOrName, newXp);
const update = { _id: competence.id, 'data.xp': newXp };
const update = { _id: competence.id, 'system.xp': newXp };
await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity
this.updateExperienceLog("XP", newXp, "XP modifié en " + competence.name);
} else {
@ -2841,7 +2841,7 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */
_meditationEPart(meditationRoll) {
this.updateEmbeddedDocuments('Item', [{ _id: meditationRoll.meditation._id, 'data.malus': meditationRoll.meditation.system.malus - 1 }]);
this.updateEmbeddedDocuments('Item', [{ _id: meditationRoll.meditation._id, 'system.malus': meditationRoll.meditation.system.malus - 1 }]);
}