#52 Gestion astrologie

This commit is contained in:
2020-12-13 23:11:58 +01:00
parent e07120aa23
commit 5aba029da9
7 changed files with 83 additions and 22 deletions

View File

@ -1514,12 +1514,28 @@ export class RdDActor extends Actor {
// selon l'heure de naissance...
return game.system.rdd.calendrier.getAjustementAstrologique(this.data.data.heure);
}
/* -------------------------------------------- */
async ajouteNombreAstral( data ) {
// Ajout du nombre astral
const item = {name: "Nombre Astral", type: "nombreastral", data:
{ value: data.nbAstral, istrue: data.isvalid, jourindex: Number(data.date), jourlabel: game.system.rdd.calendrier.getDateFromIndex( Number(data.date) ) } };
await this.createEmbeddedEntity("OwnedItem", item);
// Suppression des anciens nombres astraux
let toDelete = this.data.items.filter( (item) => item.data.jourindex < game.system.rdd.calendrier.getCurrentDayIndex() );
const deletions = toDelete.map(i => i._id);
await this.deleteEmbeddedEntity("OwnedItem", deletions);
// Affichage Dialog
this.astrologieNombresAstraux();
}
/* -------------------------------------------- */
async astrologieNombresAstraux( ) {
// Afficher l'interface spéciale
const myDialog = await RdDAstrologieJoueur.create( this, {} );
myDialog.render(true);
const astrologieDialog = await RdDAstrologieJoueur.create( this, {} );
astrologieDialog.render(true);
}
/* -------------------------------------------- */