Rename herbeData (creer potion d'herbe)
This commit is contained in:
		| @@ -3363,33 +3363,34 @@ export class RdDActor extends Actor { | ||||
|   } | ||||
|  | ||||
|   /* -------------------------------------------- */ | ||||
|   async fabriquerPotion(potionData) { | ||||
|   async fabriquerPotion(herbeData) { | ||||
|     let newPotion = { | ||||
|       name: `Potion de ${potionData.data.categorie} (${potionData.name})`, type: 'potion', | ||||
|       name: `Potion de ${herbeData.data.categorie} (${herbeData.name})`, type: 'potion', | ||||
|       img: "systems/foundryvtt-reve-de-dragon/icons/objets/fiole_verre.webp", | ||||
|       data: { | ||||
|         quantite: 1, valeur_deniers: 1, encombrement: 0.01, | ||||
|         categorie: potionData.data.categorie, | ||||
|         herbe: potionData.name, | ||||
|         rarete: potionData.data.rarete, | ||||
|         herbebrins: potionData.nbBrins, | ||||
|         categorie: herbeData.data.categorie, | ||||
|         herbe: herbeData.name, | ||||
|         rarete: herbeData.data.rarete, | ||||
|         herbebrins: herbeData.nbBrins, | ||||
|         description: "" | ||||
|       } | ||||
|     } | ||||
|     await this.createEmbeddedDocuments('Item', [newPotion], { renderSheet: true }); | ||||
|  | ||||
|     let newQuantite = potionData.data.quantite - potionData.nbBrins; | ||||
|     let newQuantite = herbeData.data.quantite - herbeData.nbBrins; | ||||
|     let messageData = { | ||||
|       alias: this.name, | ||||
|       categorie: potionData.data.categorie, | ||||
|       herbe: potionData.name, | ||||
|       nbBrinsPotion: potionData.nbBrins, | ||||
|       categorie: herbeData.data.categorie, | ||||
|       herbe: herbeData.name, | ||||
|       nbBrinsPotion: herbeData.nbBrins, | ||||
|       nbBrinsReste: newQuantite | ||||
|     } | ||||
|     // TODO:  | ||||
|     if (newQuantite == 0) { | ||||
|       await this.deleteEmbeddedDocuments('Item', [potionData._id]); | ||||
|       await this.deleteEmbeddedDocuments('Item', [herbeData._id]); | ||||
|     } else { | ||||
|       let update = { _id: potionData._id, 'data.quantite': newQuantite }; | ||||
|       let update = { _id: herbeData._id, 'data.quantite': newQuantite }; | ||||
|       await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity   | ||||
|     } | ||||
|     ChatMessage.create({ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user