Fix calendrier et potions enchantees
This commit is contained in:
parent
30b4881151
commit
b4778f7488
@ -382,7 +382,7 @@ export class RdDActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async verifierPotionsEnchantees() {
|
async verifierPotionsEnchantees() {
|
||||||
let potionsEnchantees = this.filterItemsData(it => it.type == 'potion' && it.data.magique);
|
let potionsEnchantees = this.filterItemsData(it => it.type == 'potion' && it.data.categorie.toLowerCase().includes('enchant') );
|
||||||
for (let potion of potionsEnchantees) {
|
for (let potion of potionsEnchantees) {
|
||||||
if (!potion.prpermanent) {
|
if (!potion.prpermanent) {
|
||||||
console.log(potion);
|
console.log(potion);
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async resetNombreAstraux() {
|
async resetNombreAstraux() {
|
||||||
game.system.rdd.calendrier.resetNombreAstral();
|
game.system.rdd.calendrier.resetNombreAstral();
|
||||||
await game.system.rdd.calendrier.rebuildListeNombreAstral();
|
await game.system.rdd.calendrier.rebuildListeNombreAstral( 'reset' );
|
||||||
|
|
||||||
game.system.rdd.calendrier.showAstrologieEditor();
|
game.system.rdd.calendrier.showAstrologieEditor();
|
||||||
}
|
}
|
||||||
|
@ -148,8 +148,8 @@ export class RdDCalendrier extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async ajouterNombreAstral(index) {
|
async ajouterNombreAstral(index, showdice = true) {
|
||||||
const nombreAstral = await RdDDice.rollTotal("1dh", { showDice: true, rollMode: "selfroll" });
|
const nombreAstral = await RdDDice.rollTotal("1dh", { showDice: showdice, rollMode: "selfroll" });
|
||||||
const dateFuture = this.getDateFromIndex(index);
|
const dateFuture = this.getDateFromIndex(index);
|
||||||
ChatMessage.create({
|
ChatMessage.create({
|
||||||
whisper: ChatMessage.getWhisperRecipients("GM"),
|
whisper: ChatMessage.getWhisperRecipients("GM"),
|
||||||
@ -182,21 +182,22 @@ export class RdDCalendrier extends Application {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getNombreAstral(indexDate) {
|
getNombreAstral(indexDate) {
|
||||||
if (this.listeNombreAstral == undefined) {
|
if (this.listeNombreAstral == undefined) {
|
||||||
this.listeNombreAstral = this._loadListNombreAstral();
|
this.listeNombreAstral = this._loadListNombreAstral() || [];
|
||||||
}
|
}
|
||||||
let liste = this.listeNombreAstral;
|
let liste = this.listeNombreAstral;
|
||||||
if (game.user.isGM) {
|
if ( game.user.isGM ) {
|
||||||
if (typeof (liste) != 'Array' || liste.length == 0) {
|
if ( typeof(liste) != 'Array' || liste.length == 0 ) {
|
||||||
this.rebuildListeNombreAstral();
|
this.rebuildListeNombreAstral();
|
||||||
liste = this.listeNombreAstral;
|
liste = this.listeNombreAstral;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let astralData = liste.find((nombreAstral, i) => nombreAstral.index == indexDate);
|
let astralData = liste.find((nombreAstral, i) => nombreAstral.index == indexDate);
|
||||||
|
|
||||||
return astralData?.nombreAstral;
|
return astralData?.nombreAstral;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async rebuildListeNombreAstral() {
|
async rebuildListeNombreAstral( raison = 'incjour') {
|
||||||
if (game.user.isGM) {
|
if (game.user.isGM) {
|
||||||
let jourCourant = this.getCurrentDayIndex();
|
let jourCourant = this.getCurrentDayIndex();
|
||||||
|
|
||||||
@ -207,7 +208,7 @@ export class RdDCalendrier extends Application {
|
|||||||
if (na) {
|
if (na) {
|
||||||
newList[i] = duplicate(na);
|
newList[i] = duplicate(na);
|
||||||
} else {
|
} else {
|
||||||
newList[i] = await this.ajouterNombreAstral(dayIndex);
|
newList[i] = await this.ajouterNombreAstral(dayIndex, raison == 'incjour' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log("SAVE list", newList, jourCourant);
|
console.log("SAVE list", newList, jourCourant);
|
||||||
@ -215,6 +216,7 @@ export class RdDCalendrier extends Application {
|
|||||||
game.settings.set("foundryvtt-reve-de-dragon", "liste-nombre-astral", this.listeNombreAstral);
|
game.settings.set("foundryvtt-reve-de-dragon", "liste-nombre-astral", this.listeNombreAstral);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async onCalendarButton(ev) {
|
async onCalendarButton(ev) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
@ -435,7 +437,7 @@ export class RdDCalendrier extends Application {
|
|||||||
this.calendrier.heureRdD = RdDCalendrier.getDefSigne(calendrierData.heureKey); // Index dans heuresList
|
this.calendrier.heureRdD = RdDCalendrier.getDefSigne(calendrierData.heureKey); // Index dans heuresList
|
||||||
game.settings.set("foundryvtt-reve-de-dragon", "calendrier", duplicate(this.calendrier));
|
game.settings.set("foundryvtt-reve-de-dragon", "calendrier", duplicate(this.calendrier));
|
||||||
|
|
||||||
await this.rebuildListeNombreAstral();
|
await this.rebuildListeNombreAstral( 'reset' );
|
||||||
|
|
||||||
game.socket.emit("system.foundryvtt-reve-de-dragon", {
|
game.socket.emit("system.foundryvtt-reve-de-dragon", {
|
||||||
msg: "msg_sync_time",
|
msg: "msg_sync_time",
|
||||||
|
Loading…
Reference in New Issue
Block a user