#52 Gestion astrologie
This commit is contained in:
@ -11,12 +11,12 @@ export class RdDAstrologieJoueur extends Dialog {
|
||||
/* -------------------------------------------- */
|
||||
static async create(actor, dialogConfig) {
|
||||
|
||||
let data = { nombres: actor.data.items.filter( (item) => item.type == 'nombreastral') ,
|
||||
let data = { nombres: this.organizeNombres( actor),
|
||||
dates: game.system.rdd.calendrier.getJoursSuivants( 10 ),
|
||||
etat: actor.data.data.compteurs.etat.value,
|
||||
ajustementsConditions: CONFIG.RDD.ajustementsConditions,
|
||||
astrologie: RdDUtility.findCompetence( actor.data.items, 'Astrologie')
|
||||
}
|
||||
console.log("DATA", data);
|
||||
const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-astrologie-joueur.html', data);
|
||||
let options = { classes: ["rdddialog"], width: 600, height: 500, 'z-index': 99999 };
|
||||
if (dialogConfig.options) {
|
||||
@ -42,10 +42,28 @@ export class RdDAstrologieJoueur extends Dialog {
|
||||
this.dataNombreAstral = duplicate(data);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static organizeNombres(actor) {
|
||||
let itemNombres = actor.data.items.filter( (item) => item.type == 'nombreastral');
|
||||
let itemFiltered = {};
|
||||
for ( let item of itemNombres) {
|
||||
if ( itemFiltered[item.data.jourindex] ) {
|
||||
itemFiltered[item.data.jourindex].listValues.push(item.data.value);
|
||||
} else {
|
||||
itemFiltered[item.data.jourindex] = {
|
||||
listValues: [ item.data.value ],
|
||||
jourlabel: item.data.jourlabel
|
||||
}
|
||||
}
|
||||
}
|
||||
return itemFiltered;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
requestJetAstrologie( ) {
|
||||
let data = { id: this.actor.data._id,
|
||||
carac_vue: this.actor.data.data.carac['vue'].value,
|
||||
etat: this.dataNombreAstral.etat,
|
||||
astrologie: this.dataNombreAstral.astrologie,
|
||||
conditions: $("#diffConditions").val(),
|
||||
date: $("#joursAstrologie").val()
|
||||
@ -58,6 +76,7 @@ export class RdDAstrologieJoueur extends Dialog {
|
||||
data: data
|
||||
} );
|
||||
}
|
||||
this.close();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -69,6 +88,10 @@ export class RdDAstrologieJoueur extends Dialog {
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
$(function () {
|
||||
$("#diffConditions").val(0);
|
||||
});
|
||||
|
||||
html.find('#jet-astrologie').click((event) => {
|
||||
this.requestJetAstrologie();
|
||||
});
|
||||
|
Reference in New Issue
Block a user