Fix astrologie joueur
This commit is contained in:
@ -3073,32 +3073,30 @@ export class RdDActor extends RdDBaseActor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async ajouteNombreAstral(callData) {
|
||||
// Gestion expérience (si existante)
|
||||
callData.competence = this.getCompetence("astrologie")
|
||||
callData.selectedCarac = this.system.carac["vue"];
|
||||
this.appliquerAjoutExperience(callData, 'hide');
|
||||
|
||||
// Ajout du nombre astral
|
||||
const item = {
|
||||
name: "Nombre Astral", type: "nombreastral", system:
|
||||
{ value: callData.nbAstral, istrue: callData.isvalid, jourindex: Number(callData.date), jourlabel: game.system.rdd.calendrier.getDateFromIndex(Number(callData.date)) }
|
||||
};
|
||||
await this.createEmbeddedDocuments("Item", [item]);
|
||||
|
||||
// Suppression des anciens nombres astraux
|
||||
let toDelete = this.listItems('nombreastral').filter(it => it.system.jourindex < game.system.rdd.calendrier.getCurrentDayIndex());
|
||||
const deletions = toDelete.map(it => it._id);
|
||||
await this.deleteEmbeddedDocuments("Item", deletions);
|
||||
|
||||
// Affichage Dialog
|
||||
this.astrologieNombresAstraux();
|
||||
}
|
||||
|
||||
async supprimerAnciensNombresAstraux() {
|
||||
const toDelete = this.listItems('nombreastral')
|
||||
.filter(it => it.system.jourindex < game.system.rdd.calendrier.getCurrentDayIndex())
|
||||
.map(it => it._id);
|
||||
await this.deleteEmbeddedDocuments("Item", toDelete);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async astrologieNombresAstraux() {
|
||||
// Suppression des anciens nombres astraux
|
||||
await this.supprimerAnciensNombresAstraux();
|
||||
|
||||
// Afficher l'interface spéciale
|
||||
const astrologieDialog = await RdDAstrologieJoueur.create(this, {});
|
||||
astrologieDialog.render(true);
|
||||
await RdDAstrologieJoueur.create(this);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
Reference in New Issue
Block a user