Correction XP competence/sort/carac et chiffres astro
This commit is contained in:
parent
7ddc50ab86
commit
7eada123c8
@ -810,7 +810,8 @@ export class RdDActor extends Actor {
|
||||
if (caracName == 'Taille') {
|
||||
return;
|
||||
}
|
||||
await this.update({ [`data.carac.${caracName}.xp`]: caracXP ?? 0 });
|
||||
// if ( isNaN(caracXP) || typeof(caracXP) != 'number') caracXP = 0;
|
||||
//await this.update({ [`data.carac.${caracName}.xp`]: caracXP });
|
||||
this.checkCaracXP(caracName);
|
||||
}
|
||||
|
||||
@ -896,7 +897,7 @@ export class RdDActor extends Actor {
|
||||
async updateCompetenceXP(compName, newXp) {
|
||||
let comp = this.getCompetence(compName);
|
||||
if (comp) {
|
||||
newXp = newXp ?? 0;
|
||||
if ( isNaN(newXp) || typeof(newXp) != 'number') newXp = 0;
|
||||
this.checkCompetenceXP(compName, newXp);
|
||||
const update = { _id: comp.id, 'data.xp': newXp };
|
||||
await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity
|
||||
@ -911,7 +912,7 @@ export class RdDActor extends Actor {
|
||||
async updateCompetenceXPSort(compName, compValue) {
|
||||
let comp = this.getCompetence(compName);
|
||||
if (comp) {
|
||||
compValue = compValue ?? 0;
|
||||
if ( isNaN(compValue) || typeof(compValue) != 'number') compValue = 0;
|
||||
const update = { _id: comp.id, 'data.xp_sort': compValue };
|
||||
await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity
|
||||
this.updateExperienceLog("XP Sort", compValue, "XP modifié en sort de " + compName);
|
||||
|
@ -187,20 +187,18 @@ export class RdDCalendrier extends Application {
|
||||
async rebuildListeNombreAstral() {
|
||||
if (game.user.isGM) {
|
||||
let jourCourant = this.getCurrentDayIndex();
|
||||
let jourFin = jourCourant + 12;
|
||||
|
||||
let newList = [];
|
||||
for (const na of this.listeNombreAstral) {
|
||||
let index = na?.index;
|
||||
if (index && index >= jourCourant && index < jourFin) {
|
||||
newList[index - jourCourant] = na;
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < 12; i++) {
|
||||
if (newList[i] == undefined) {
|
||||
newList[i] = await this.ajouterNombreAstral(jourCourant + i);
|
||||
let dayIndex = jourCourant + i;
|
||||
let na = this.listeNombreAstral.find( n => n.index == dayIndex);
|
||||
if ( na ) {
|
||||
newList[i] = duplicate(na);
|
||||
} else {
|
||||
newList[i] = await this.ajouterNombreAstral(dayIndex);
|
||||
}
|
||||
}
|
||||
console.log("SAVE list", newList, jourCourant);
|
||||
this.listeNombreAstral = newList;
|
||||
game.settings.set("foundryvtt-reve-de-dragon", "liste-nombre-astral", this.listeNombreAstral);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user