diff --git a/module/actor.js b/module/actor.js
index 7858b80c..5dadbc8c 100644
--- a/module/actor.js
+++ b/module/actor.js
@@ -256,7 +256,7 @@ export class RdDActor extends RdDBaseActorSang {
console.log('perte de rêve des enchantements', toUpdate)
const messageUpdates = await Promise.all(
toUpdate.map(async it => await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-pertereve-enchantement-chateaudormant.hbs`, it)))
- ChatMessage.create({
+ await ChatMessage.create({
whisper: ChatUtility.getOwners(this),
content: messageUpdates.reduce(Misc.joining('
'))
})
@@ -322,8 +322,7 @@ export class RdDActor extends RdDBaseActorSang {
await this.setBonusPotionSoin(0);
}
await this.resetInfoSommeil()
- ChatMessage.create(message);
- setTimeout(() => this.sheet.render(), 20)
+ await ChatMessage.create(message)
}
async _recuperationSante(message) {
@@ -364,7 +363,7 @@ export class RdDActor extends RdDBaseActorSang {
const message = {
whisper: ChatUtility.getOwners(this),
content: ""
- };
+ }
await this._recuperationSante(message)
await this._recupereMoralChateauDormant(message)
@@ -375,12 +374,12 @@ export class RdDActor extends RdDBaseActorSang {
await this.retourSust(message)
await this.$perteReveEnchantementsChateauDormants()
await this.$suppressionLancementsSort()
- await RdDCoeur.applyCoeurChateauDormant(this, message);
+ await RdDCoeur.applyCoeurChateauDormant(this, message)
if (message.content != "") {
- message.content = `A la fin Chateau Dormant, ${message.content}
Un nouveau jour se lève`;
- ChatMessage.create(message);
+ message.content = `A la fin Chateau Dormant, ${message.content}
Un nouveau jour se lève`
+ await ChatMessage.create(message)
}
- await this.resetInfoSommeil();
+ await this.resetInfoSommeil()
}
async resetInfoSommeil() {
@@ -536,37 +535,36 @@ export class RdDActor extends RdDBaseActorSang {
}
if (!options.grisReve) {
- ChatMessage.create(message);
+ await ChatMessage.create(message)
}
if (options.chateauDormant) {
- await this.$dormirChateauDormant();
+ await this.$dormirChateauDormant()
}
- setTimeout(() => this.sheet.render(), 20)
}
async reveilReveDeDragon(message, heures) {
const restant = Math.max(this.system.sommeil?.heures - heures, 0)
if (restant > 0) {
- await this.update({ 'system.sommeil': { heures: restant } });
+ await this.update({ 'system.sommeil': { heures: restant } })
}
}
async $dormirDesHeures(message, heures, options) {
const dormi = { heures: 0, etat: 'dort', jetsReve: [] };
for (; dormi.heures < heures && dormi.etat == 'dort'; dormi.heures++) {
- await this.$recupererEthylisme(message);
+ await this.$recupererEthylisme(message)
if (options.grisReve) {
- await this.$recupererFatigue(message);
+ await this.$recupererFatigue(message)
}
else if (!this.system.sommeil?.insomnie) {
- await this.$recupererFatigue(message);
- await this.$jetRecuperationReve(dormi, message);
+ await this.$recupererFatigue(message)
+ await this.$jetRecuperationReve(dormi, message)
if (dormi.etat == 'dort' && EffetsDraconiques.isDonDoubleReve(this)) {
- await this.$jetRecuperationReve(dormi, message);
+ await this.$jetRecuperationReve(dormi, message)
}
}
}
- return dormi;
+ return dormi
}
/* -------------------------------------------- */
@@ -583,7 +581,7 @@ export class RdDActor extends RdDBaseActorSang {
}
else {
if (!ReglesOptionnelles.isUsing("recuperation-reve")) {
- ChatMessage.create({
+ await ChatMessage.create({
whisper: ChatUtility.getOwners(this),
content: `Pas de récupération de rêve (${reve} points ignorés)`
})
@@ -891,7 +889,7 @@ export class RdDActor extends RdDBaseActorSang {
await competence.update({ 'system.xp': toXp })
await ExperienceLog.add(this, XP_TOPIC.XP, fromXp, toXp, competence.name, true)
if (toXp > fromXp) {
- RdDUtility.checkThanatosXP(competence)
+ await RdDUtility.checkThanatosXP(competence)
}
}
}
@@ -907,7 +905,7 @@ export class RdDActor extends RdDBaseActorSang {
await competence.update({ 'system.xp_sort': toXpSort })
await ExperienceLog.add(this, XP_TOPIC.XPSORT, fromXpSort, toXpSort, competence.name, true)
if (toXpSort > fromXpSort) {
- RdDUtility.checkThanatosXP(competence)
+ await RdDUtility.checkThanatosXP(competence)
}
}
}
@@ -997,7 +995,7 @@ export class RdDActor extends RdDBaseActorSang {
await this.update({ "system.reve.refoulement.value": 0 })
await this.ajouterSouffle({ chat: true })
}
- else{
+ else {
await this.update({ "system.reve.refoulement.value": refoulement })
}
return roll
@@ -1009,7 +1007,7 @@ export class RdDActor extends RdDBaseActorSang {
//souffle.id = undefined; //TBC
await this.createEmbeddedDocuments('Item', [souffle])
if (options.chat) {
- ChatMessage.create({
+ await ChatMessage.create({
whisper: ChatUtility.getOwners(this),
content: this.name + " subit un Souffle de Dragon : " + souffle.name
})
@@ -1019,22 +1017,19 @@ export class RdDActor extends RdDBaseActorSang {
/* -------------------------------------------- */
async ajouterQueue(options = { chat: false }) {
- let queue;
- if (this.system.reve.reve.thanatosused) {
- queue = await RdDRollTables.getOmbre();
+ const thanatos = this.system.reve.reve.thanatosused;
+ const queue = (thanatos ? await RdDRollTables.getOmbre() : await RdDRollTables.getQueue())
+ if (thanatos) {
await this.update({ "system.reve.reve.thanatosused": false })
}
- else {
- queue = await RdDRollTables.getQueue();
- }
- await this.createEmbeddedDocuments('Item', [queue]);
+ await this.createEmbeddedDocuments('Item', [queue])
if (options.chat) {
- ChatMessage.create({
+ await ChatMessage.create({
whisper: ChatUtility.getOwners(this),
content: this.name + " subit une Queue de Dragon : " + queue.name
})
}
- return queue;
+ return queue
}
/* -------------------------------------------- */
@@ -1098,14 +1093,14 @@ export class RdDActor extends RdDBaseActorSang {
}
/* -------------------------------------------- */
async reinsertionAleatoire(raison, accessible = tmr => true) {
- const innaccessible = this.buildTMRInnaccessible();
- let tmr = await TMRUtility.getTMRAleatoire(tmr => accessible(tmr) && !innaccessible.includes(tmr.coord));
- ChatMessage.create({
+ const innaccessible = this.buildTMRInnaccessible()
+ let tmr = await TMRUtility.getTMRAleatoire(tmr => accessible(tmr) && !innaccessible.includes(tmr.coord))
+ await ChatMessage.create({
content: `${raison} : ré-insertion aléatoire.`,
whisper: ChatUtility.getOwners(this)
- });
- await this.forcerPositionTMRInconnue(tmr);
- return tmr;
+ })
+ await this.forcerPositionTMRInconnue(tmr)
+ return tmr
}
async forcerPositionTMRInconnue(tmr) {
@@ -1169,7 +1164,7 @@ export class RdDActor extends RdDBaseActorSang {
async jetEndurance(resteEndurance = undefined) {
const result = super.jetEndurance(resteEndurance);
if (result.jetEndurance == 1) {
- ChatMessage.create({ content: await this._gainXpConstitutionJetEndurance() });
+ await ChatMessage.create({ content: await this._gainXpConstitutionJetEndurance() })
}
return result;
}
@@ -1190,7 +1185,7 @@ export class RdDActor extends RdDBaseActorSang {
}
const jetMoral = await this._jetDeMoral(situation, bonmoment)
const finMessage = (jetMoral.ajustement == 0 ? "Vous gardez votre moral" : jetMoral.ajustement > 0 ? "Vous gagnez du moral" : "Vous perdez du moral");
- ChatMessage.create({
+ await ChatMessage.create({
whisper: ChatUtility.getOwners(this),
content: `${finMessage} - jet ${jetMoral.succes ? "réussi" : "manqué"} en situation ${SITUATION_MORAL[situation] ?? situation} (${jetMoral.jet}/${jetMoral.difficulte}).`
})
@@ -1494,7 +1489,7 @@ export class RdDActor extends RdDBaseActorSang {
exaltation: exaltation
};
- ChatMessage.create({
+ await ChatMessage.create({
whisper: ChatUtility.getOwners(this),
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-resultat-transformer-stress.hbs`, stressRollData)
});
@@ -1561,7 +1556,7 @@ export class RdDActor extends RdDBaseActorSang {
xp: carac.xp
}
if (display) {
- ChatMessage.create({
+ await ChatMessage.create({
whisper: ChatUtility.getOwners(this),
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-carac-xp.hbs`, checkXp)
});
@@ -1596,7 +1591,7 @@ export class RdDActor extends RdDBaseActorSang {
ChatUtility.blindMessageToGM({ content: content })
}
else {
- ChatMessage.create({
+ await ChatMessage.create({
whisper: ChatUtility.getOwners(this),
content: content
});
@@ -1700,22 +1695,22 @@ export class RdDActor extends RdDBaseActorSang {
}
/* -------------------------------------------- */
- isMauvaiseRencontre() { // Gestion queue/souffle 'Mauvaise Rencontre en Perpective'
- let addMsg = "";
- let rencSpecial = EffetsDraconiques.mauvaiseRencontre(this);
+ async isMauvaiseRencontre() { // Gestion queue/souffle 'Mauvaise Rencontre en Perpective'
+ let addMsg = ""
+ let rencSpecial = EffetsDraconiques.mauvaiseRencontre(this)
if (rencSpecial) {
if (rencSpecial.type != 'souffle') {
- this.deleteEmbeddedDocuments('Item', [rencSpecial.id]); // Suppression dans la liste des queues
- addMsg = " La queue a été supprimée de votre fiche automatiquement";
+ await this.deleteEmbeddedDocuments('Item', [rencSpecial.id]) // Suppression dans la liste des queues
+ addMsg = " La queue a été supprimée de votre fiche automatiquement"
} else {
- addMsg = " Vous devez gérer manuellement le décompte de mauvaises rencontres.";
+ addMsg = " Vous devez gérer manuellement le décompte de mauvaises rencontres."
}
- ChatMessage.create({
+ await ChatMessage.create({
content: "Vous êtes sous le coup d'une Mauvaise Rencontre en Persective." + addMsg,
whisper: ChatUtility.getOwners(this)
- });
+ })
}
- return rencSpecial;
+ return rencSpecial
}
/* -------------------------------------------- */
@@ -1725,7 +1720,7 @@ export class RdDActor extends RdDBaseActorSang {
ChatMessage.create({
content: `Vous êtes sous le coup d'Inertie Draconique : vous perdrez ${countInertieDraconique + 1} cases de Fatigue par déplacement au lieu d'une.`,
whisper: ChatUtility.getOwners(this)
- });
+ })
}
return countInertieDraconique + 1;
}
@@ -1733,11 +1728,11 @@ export class RdDActor extends RdDBaseActorSang {
/* -------------------------------------------- */
async checkSoufflePeage(tmr) {
if ((tmr.type == 'pont' || tmr.type == 'cite') && EffetsDraconiques.isPeage(this)) {
- await this.reveActuelIncDec(-1);
- ChatMessage.create({
+ await this.reveActuelIncDec(-1)
+ await ChatMessage.create({
content: "Vous êtes sous le coup d'un Péage : l'entrée sur cette case vous a coûté 1 Point de Rêve (déduit automatiquement).",
whisper: ChatUtility.getOwners(this)
- });
+ })
}
}
@@ -1763,7 +1758,7 @@ export class RdDActor extends RdDBaseActorSang {
}
if (reveActuel > rollData.depenseReve) {
// Incrémenter/gére le bonus de case
- RdDItemSort.incrementBonusCase(this, selectedSort, rollData.tmr.coord)
+ await RdDItemSort.incrementBonusCase(this, selectedSort, rollData.tmr.coord)
if (rollData.isSortReserve) {
await this.sortMisEnReserve(selectedSort, rollData.competence, rollData.tmr.coord, Number(selectedSort.system.ptreve_reel))
@@ -1796,7 +1791,7 @@ export class RdDActor extends RdDBaseActorSang {
await RdDRollResult.displayRollData(rollData, this, 'chat-resultat-sort.hbs')
if (reveActuel == 0) { // 0 points de reve
- ChatMessage.create({ content: this.name + " est réduit à 0 Points de Rêve, et tombe endormi !" })
+ await ChatMessage.create({ content: this.name + " est réduit à 0 Points de Rêve, et tombe endormi !" })
}
if (!rollData.isSortReserve || !rolled.isSuccess) {
this.tmrApp?.close()
@@ -2159,7 +2154,7 @@ export class RdDActor extends RdDBaseActorSang {
async appelDestinee(onSuccess = () => { }, onEchec = () => { }) {
let destinee = this.system.compteurs.destinee?.value ?? 0;
if (destinee > 0) {
- ChatMessage.create({ content: `${this.name} a fait appel à la Destinée !` });
+ await ChatMessage.create({ content: `${this.name} a fait appel à la Destinée !` });
await this.update({ 'system.compteurs.destinee.value ': destinee - 1 })
onSuccess()
}
@@ -2194,10 +2189,10 @@ export class RdDActor extends RdDBaseActorSang {
}
if (this.checkDesirLancinant()) {
// Cas de désir lancinant, pas d'expérience sur particulière
- ChatMessage.create({
+ await ChatMessage.create({
content: `Vous souffrez au moins d'un Désir Lancinant, vous ne pouvez pas gagner d'expérience sur une Particulière tant que le désir n'est pas assouvi`,
whisper: ChatUtility.getOwners(this)
- });
+ })
return []
}
@@ -2325,15 +2320,15 @@ export class RdDActor extends RdDBaseActorSang {
}
/* -------------------------------------------- */
- countMonteeLaborieuse() { // Return +1 par queue/ombre/souffle Montée Laborieuse présente
+ async countMonteeLaborieuse() { // Return +1 par queue/ombre/souffle Montée Laborieuse présente
let countMonteeLaborieuse = EffetsDraconiques.countMonteeLaborieuse(this);
if (countMonteeLaborieuse > 0) {
- ChatMessage.create({
+ await ChatMessage.create({
content: `Vous êtes sous le coup d'une Montée Laborieuse : vos montées en TMR coûtent ${countMonteeLaborieuse} Point de Rêve de plus.`,
whisper: ChatUtility.getOwners(this)
});
}
- return countMonteeLaborieuse;
+ return countMonteeLaborieuse
}
/* -------------------------------------------- */
@@ -2376,9 +2371,9 @@ export class RdDActor extends RdDBaseActorSang {
async _doDisplayTMR(mode) {
let isRapide = mode == "rapide";
if (mode != "visu") {
- let minReveValue = (isRapide && !EffetsDraconiques.isDeplacementAccelere(this) ? 3 : 2) + this.countMonteeLaborieuse();
+ let minReveValue = (isRapide && !EffetsDraconiques.isDeplacementAccelere(this) ? 3 : 2) + (await this.countMonteeLaborieuse())
if (this.getReveActuel() < minReveValue) {
- ChatMessage.create({
+ await ChatMessage.create({
content: `Vous n'avez les ${minReveValue} Points de Reve nécessaires pour monter dans les Terres Médianes`,
whisper: ChatUtility.getOwners(this)
});
@@ -2420,15 +2415,16 @@ export class RdDActor extends RdDBaseActorSang {
if (!viewOnly) {
await this.supprimerSignesDraconiques(it => it.system.ephemere && it.system.duree == '1 round', { render: false })
await this.setEffect(STATUSES.StatusDemiReve, false)
- ChatUtility.tellToUserAndGM(message)
+ await ChatUtility.tellToUserAndGM(message)
}
}
}
async supprimerSignesDraconiques(filter = it => true, options = { render: true }) {
- const signes = this.itemTypes[ITEM_TYPES.signedraconique].filter(filter)
- if (signes.length > 0) {
- this.deleteEmbeddedDocuments("Item", signes.map(item => item.id), options)
+ const ids = this.itemTypes[ITEM_TYPES.signedraconique].filter(filter)
+ .map(it => it.id)
+ if (ids.length > 0) {
+ await this.deleteEmbeddedDocuments("Item", ids, options)
}
}
@@ -2466,9 +2462,9 @@ export class RdDActor extends RdDBaseActorSang {
}
/* -------------------------------------------- */
- verifierForceMin(item) {
+ async verifierForceMin(item) {
if (item.type == 'arme' && item.system.force > parseInt(this.system.carac.force.value)) {
- ChatMessage.create({
+ await ChatMessage.create({
content: `${this.name} s'est équipé(e) de l'arme ${item.name}, mais n'a pas une force suffisante pour l'utiliser normalement
(${item.system.force} nécessaire pour une Force de ${this.system.carac.force.value})`
});
@@ -2482,7 +2478,7 @@ export class RdDActor extends RdDBaseActorSang {
await item.update({ "system.equipe": isEquipe })
this.computeEncTotal()
if (isEquipe)
- this.verifierForceMin(item)
+ await this.verifierForceMin(item)
}
}
@@ -2744,25 +2740,25 @@ export class RdDActor extends RdDBaseActorSang {
/* -------------------------------------------- */
async consommerPotionSoin(potion) {
- potion.alias = this.name;
- potion.supprimer = true;
+ potion.alias = this.name
+ potion.supprimer = true
if (potion.system.magique) {
// Gestion de la résistance:
- potion.rolled = await RdDResolutionTable.roll(this.getReveActuel(), -8);
+ potion.rolled = await RdDResolutionTable.roll(this.getReveActuel(), -8)
if (potion.rolled.isEchec) {
await this.reveActuelIncDec(-1);
- potion.guerisonData = await this.buildPotionGuerisonList(potion.system.puissance);
- potion.guerisonMinutes = potion.guerisonData.pointsConsommes * 5;
+ potion.guerisonData = await this.buildPotionGuerisonList(potion.system.puissance)
+ potion.guerisonMinutes = potion.guerisonData.pointsConsommes * 5
}
}
if (!potion.system.magique || potion.rolled.isSuccess) {
- await this.setBonusPotionSoin(potion.system.herbebonus);
+ await this.setBonusPotionSoin(potion.system.herbebonus)
}
- ChatMessage.create({
+ await ChatMessage.create({
whisper: ChatUtility.getOwners(this),
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-consommer-potion-soin.hbs`, potion)
- });
+ })
}
async setBonusPotionSoin(bonus) {
@@ -2796,10 +2792,10 @@ export class RdDActor extends RdDBaseActorSang {
if (!potion.system.magique || potion.rolled.isSuccess) {
this.bonusRepos = potion.system.herbebonus;
}
- ChatMessage.create({
+ await ChatMessage.create({
whisper: ChatUtility.getOwners(this),
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-consommer-potion-repos.hbs`, potion)
- });
+ })
}
/* -------------------------------------------- */
@@ -2821,7 +2817,7 @@ export class RdDActor extends RdDBaseActorSang {
await this.createEmbeddedDocuments('Item', [newPotion])
await this.diminuerQuantiteObjet(herbeData._id, herbeData.nbBrins)
- ChatMessage.create({
+ await ChatMessage.create({
whisper: ChatUtility.getOwners(this),
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-fabriquer-potion-base.hbs`, {
alias: this.getAlias(),
@@ -2839,19 +2835,19 @@ export class RdDActor extends RdDBaseActorSang {
/* -------------------------------------------- */
async consommerPotionGenerique(potion) {
- potion.alias = this.name;
+ potion.alias = this.name
if (potion.system.magique) {
// Gestion de la résistance:
potion.rolled = await RdDResolutionTable.roll(this.getReveActuel(), -8);
if (potion.rolled.isEchec) {
- await this.reveActuelIncDec(-1);
+ await this.reveActuelIncDec(-1)
}
}
- ChatMessage.create({
+ await ChatMessage.create({
whisper: ChatUtility.getOwners(this),
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-consommer-potion-generique.hbs`, potion)
- });
+ })
}
/* -------------------------------------------- */
@@ -2914,7 +2910,7 @@ export class RdDActor extends RdDBaseActorSang {
let draconique = Draconique.all().find(it => it.match(item));
if (draconique) {
await draconique.onActorCreateOwned(this, item)
- this.notifyGestionTeteSouffleQueue(item, draconique.manualMessage());
+ await this.notifyGestionTeteSouffleQueue(item, draconique.manualMessage());
}
await this.setInfoSommeilInsomnie();
}
@@ -2970,8 +2966,8 @@ export class RdDActor extends RdDBaseActorSang {
}
/* -------------------------------------------- */
- notifyGestionTeteSouffleQueue(item, manualMessage = true) {
- ChatMessage.create({
+ async notifyGestionTeteSouffleQueue(item, manualMessage = true) {
+ await ChatMessage.create({
whisper: ChatUtility.getOwners(this),
content: `${this.name} a reçu un/une ${item.type}: ${item.name}, qui ${manualMessage ? "n'est pas" : "est"} géré(e) automatiquement. ${manualMessage ? manualMessage : ''}`
});
diff --git a/module/actor/base-actor-reve.js b/module/actor/base-actor-reve.js
index 29d07c1a..990a68b8 100644
--- a/module/actor/base-actor-reve.js
+++ b/module/actor/base-actor-reve.js
@@ -169,10 +169,11 @@ export class RdDBaseActorReve extends RdDBaseActor {
}
async finDeRoundSuppressionEffetsTermines(options) {
- for (let effect of this.getEffects()) {
+ const effects = this.getEffects();
+ for (let effect of effects) {
if (effect.duration.type !== 'none' && (effect.duration.remaining <= 0 || options.terminer)) {
- await effect.delete();
- ChatMessage.create({ content: `${this.getAlias()} n'est plus ${Misc.lowerFirst(game.i18n.localize(effect.system.label))} !` });
+ await effect.delete()
+ await ChatMessage.create({ content: `${this.getAlias()} n'est plus ${Misc.lowerFirst(game.i18n.localize(effect.system.label))} !` })
}
}
}
@@ -615,7 +616,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
RdDPossessionV2.rollAttaquePossession(this)
}
- verifierForceMin(item) { }
+ async verifierForceMin(item) { }
/* -------------------------------------------- */
async encaisser() { await RdDEncaisser.encaisser(this) }
@@ -675,10 +676,10 @@ export class RdDBaseActorReve extends RdDBaseActor {
if (!encaissement.hasPlayerOwner && encaissement.endurance != 0) {
encaissement = foundry.utils.duplicate(encaissement)
encaissement.isGM = true
- ChatMessage.create({
+ await ChatMessage.create({
whisper: ChatUtility.getGMs(),
content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-resultat-encaissement.hbs', encaissement)
- });
+ })
}
}
diff --git a/module/actor/base-actor-sang-sheet.js b/module/actor/base-actor-sang-sheet.js
index 89a0239d..650d9114 100644
--- a/module/actor/base-actor-sang-sheet.js
+++ b/module/actor/base-actor-sang-sheet.js
@@ -36,7 +36,7 @@ export class RdDBaseActorSangSheet extends RdDBaseActorReveSheet {
async jetEndurance() {
const endurance = this.actor.getEnduranceActuelle()
const result = await this.actor.jetEndurance(endurance);
- ChatMessage.create({
+ await ChatMessage.create({
content: `Jet d'Endurance : ${result.jetEndurance} / ${endurance}
${this.actor.name} a ${result.sonne ? 'échoué' : 'réussi'} son Jet d'Endurance ${result.sonne ? 'et devient Sonné' : ''}`,
whisper: ChatUtility.getOwners(this.actor)
diff --git a/module/actor/base-actor-sang.js b/module/actor/base-actor-sang.js
index f95fad7f..b08fa547 100644
--- a/module/actor/base-actor-sang.js
+++ b/module/actor/base-actor-sang.js
@@ -351,11 +351,10 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
/* -------------------------------------------- */
async jetDeVie() {
if (this.isDead()) {
- ChatMessage.create({
+ return await ChatMessage.create({
content: `Jet de Vie: ${this.getAlias()} est déjà mort, ce n'est pas la peine d'en rajouter !!!!!`,
whisper: ChatUtility.getOwners(this)
})
- return
}
const jetDeVie = await RdDDice.roll("1d20");
const sConst = this.getSConst();
@@ -380,7 +379,7 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
else if (prochainJet > 0) {
msgText += `
Prochain jet de vie dans ${prochainJet} ${isCritique ? 'round' : 'minute'}${prochainJet > 1 ? 's' : ''} ${isCritique ? '(état critique)' : '(état grave)'}`
}
- ChatMessage.create({
+ return await ChatMessage.create({
content: msgText,
whisper: ChatUtility.getOwners(this)
})
diff --git a/module/actor/base-actor.js b/module/actor/base-actor.js
index 25b2a1af..0bb16333 100644
--- a/module/actor/base-actor.js
+++ b/module/actor/base-actor.js
@@ -450,7 +450,7 @@ export class RdDBaseActor extends Actor {
msg = "Vous n'avez pas assez d'argent pour payer cette somme !";
}
- ChatMessage.create({
+ await ChatMessage.create({
whisper: ChatUtility.getOwners(this),
content: msg
})
@@ -494,7 +494,7 @@ export class RdDBaseActor extends Actor {
await Monnaie.optimiserFortune(this, sols + this.getFortune());
RdDAudio.PlayContextAudio("argent"); // Petit son
- ChatMessage.create({
+ await ChatMessage.create({
whisper: ChatUtility.getOwners(this),
content: `Vous avez reçu ${sols} Sols ${fromActor ? " de " + fromActor.name : ''}, qui ont été ajoutés à votre argent.`
})
@@ -548,7 +548,7 @@ export class RdDBaseActor extends Actor {
}
const chatAchatItem = foundry.utils.duplicate(achat.vente);
chatAchatItem.quantiteTotal = quantite;
- ChatMessage.create({
+ await ChatMessage.create({
user: achat.userId,
speaker: { alias: (acheteur ?? vendeur).getAlias() },
whisper: ChatUtility.getOwners(this),
@@ -893,7 +893,7 @@ export class RdDBaseActor extends Actor {
system: { description: this.system.description }
}
renderTemplate('systems/foundryvtt-reve-de-dragon/templates/post-actor.hbs', chatData)
- .then(html => ChatMessage.create(RdDUtility.chatDataSetup(html, modeOverride)));
+ .then(async html => await ChatMessage.create(RdDUtility.chatDataSetup(html, modeOverride)));
}
actionImpossible(action) {
diff --git a/module/apps/rdd-text-roll-editor.js b/module/apps/rdd-text-roll-editor.js
index 98774a26..e93d9a20 100644
--- a/module/apps/rdd-text-roll-editor.js
+++ b/module/apps/rdd-text-roll-editor.js
@@ -16,7 +16,7 @@ export class RdDTextEditor {
$(html).on("click", '.roll-text', async event => await RdDTextEditor.rollText(event))
}
- static async enrichHTML(text, object, options = {showlink:true}) {
+ static async enrichHTML(text, object, options = { showlink: true }) {
const context = {
text,
object,
@@ -70,9 +70,7 @@ export class RdDTextEditor {
options: { showLink: false }
},
param)
- ChatMessage.create({
- content: text
- })
+ await ChatMessage.create({ content: text })
}
}
}
\ No newline at end of file
diff --git a/module/chat-utility.js b/module/chat-utility.js
index 3fe713cb..bdcf17bb 100644
--- a/module/chat-utility.js
+++ b/module/chat-utility.js
@@ -116,20 +116,20 @@ export class ChatUtility {
return messageData
}
- static tellToUser(message) {
- ChatMessage.create({ content: message, user: game.user.id, whisper: [game.user.id] });
+ static async tellToUser(message) {
+ await ChatMessage.create({ content: message, user: game.user.id, whisper: [game.user.id] });
}
- static tellToGM(message) {
- ChatMessage.create({
+ static async tellToGM(message) {
+ await ChatMessage.create({
user: game.user.id,
content: message,
whisper: ChatUtility.getGMs()
- });
+ })
}
- static tellToUserAndGM(message) {
- ChatMessage.create({
+ static async tellToUserAndGM(message) {
+ await ChatMessage.create({
user: game.user.id,
content: message,
whisper: ChatUtility.getUserAndGMs()
diff --git a/module/dialog-create-signedraconique.js b/module/dialog-create-signedraconique.js
index 92a5e873..f30346c8 100644
--- a/module/dialog-create-signedraconique.js
+++ b/module/dialog-create-signedraconique.js
@@ -7,7 +7,7 @@ import { TMRUtility } from "./tmr-utility.js";
export class DialogCreateSigneDraconique extends Dialog {
static async createSigneForActors() {
- const signe = await RdDItemSigneDraconique.randomSigneDraconique({ephemere: true});
+ const signe = await RdDItemSigneDraconique.randomSigneDraconique({ ephemere: true });
let dialogData = {
signe: signe,
tmrs: TMRUtility.buildSelectionTypesTMR(signe.system.typesTMR),
@@ -36,25 +36,25 @@ export class DialogCreateSigneDraconique extends Dialog {
super(conf, options);
this.dialogData = dialogData;
}
-
+
async _onCreerSigneActeurs() {
- await this.html.find("[name='signe.system.ephemere']").change();
- await this.html.find(".signe-xp-sort").change();
- this.validerSigne();
- this.dialogData.actors.filter(it => it.selected)
- .map(it => game.actors.get(it.id))
- .forEach(actor => this._createSigneForActor(actor, this.dialogData.signe));
+ await this.html.find("[name='signe.system.ephemere']").change()
+ await this.html.find(".signe-xp-sort").change()
+ this.validerSigne()
+ await Promise.all(this.dialogData.actors.filter(it => it.selected)
+ .map(it => game.actors.get(it.id))
+ .map(async actor => await this._createSigneForActor(actor, this.dialogData.signe)))
}
-
+
async _createSigneForActor(actor, signe) {
- actor.createEmbeddedDocuments("Item", [signe]);
- ChatMessage.create({
+ await actor.createEmbeddedDocuments("Item", [signe]);
+ await ChatMessage.createChatMessage.create({
whisper: ChatUtility.getOwners(actor),
content: await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/chat-signe-draconique-actor.hbs", {
signe: signe,
alias: actor.getAlias()
})
- });
+ })
}
validerSigne() {
@@ -67,7 +67,7 @@ export class DialogCreateSigneDraconique extends Dialog {
this.dialogData.signe.system.duree = this.html.find("[name='signe.system.duree']").val();
this.dialogData.signe.system.typesTMR = TMRUtility.buildListTypesTMRSelection(this.dialogData.tmrs);
}
-
+
/* -------------------------------------------- */
activateListeners(html) {
super.activateListeners(html);
@@ -81,7 +81,7 @@ export class DialogCreateSigneDraconique extends Dialog {
}
async setSigneAleatoire() {
- const newSigne = await RdDItemSigneDraconique.randomSigneDraconique({ephemere: true});
+ const newSigne = await RdDItemSigneDraconique.randomSigneDraconique({ ephemere: true });
this.html.find("[name='signe.name']").val(newSigne.name);
this.html.find("[name='signe.system.valeur.norm']").val(newSigne.system.valeur.norm);
@@ -92,7 +92,7 @@ export class DialogCreateSigneDraconique extends Dialog {
this.html.find("[name='signe.system.ephemere']").prop("checked", newSigne.system.ephemere);
this.dialogData.tmrs = TMRUtility.buildSelectionTypesTMR(newSigne.system.typesTMR);
this.dialogData.tmrs.forEach(t => {
- this.html.find(`[data-tmr-name='${t.name}']`).prop( "checked", t.selected);
+ this.html.find(`[data-tmr-name='${t.name}']`).prop("checked", t.selected);
})
this.setEphemere(newSigne.system.ephemere);
}
@@ -113,7 +113,7 @@ export class DialogCreateSigneDraconique extends Dialog {
onSelectTmr(event) {
const tmrName = this.html.find(event.currentTarget)?.data("tmr-name");
const onTmr = this.dialogData.tmrs.find(it => it.name == tmrName);
- if (onTmr){
+ if (onTmr) {
onTmr.selected = event.currentTarget.checked;
}
}
diff --git a/module/item-competence.js b/module/item-competence.js
index b36dae7a..741673e1 100644
--- a/module/item-competence.js
+++ b/module/item-competence.js
@@ -91,7 +91,7 @@ export class RdDItemCompetence extends RdDItem {
archetypeWarning: newNiv > this.system.niveau_archetype
}
if (display) {
- ChatMessage.create({
+ await ChatMessage.create({
whisper: ChatUtility.getOwners(this.actor),
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-competence-xp.hbs`, xpData)
})
diff --git a/module/item-sort.js b/module/item-sort.js
index 89232156..9f2efbfc 100644
--- a/module/item-sort.js
+++ b/module/item-sort.js
@@ -153,10 +153,10 @@ export class RdDItemSort extends RdDItem {
}
/* -------------------------------------------- */
- static incrementBonusCase(actor, sort, coord) {
+ static async incrementBonusCase(actor, sort, coord) {
let bonuscase = RdDItemSort.calculBonuscase(sort, coord)
- actor.updateEmbeddedDocuments('Item', [{ _id: sort._id, 'system.bonuscase': bonuscase }]);
+ await actor.updateEmbeddedDocuments('Item', [{ _id: sort._id, 'system.bonuscase': bonuscase }]);
}
diff --git a/module/item.js b/module/item.js
index aaa927c5..735b6647 100644
--- a/module/item.js
+++ b/module/item.js
@@ -627,14 +627,14 @@ export class RdDItem extends Item {
system: { description: this.system.description },
properties: this.getProprietes(),
}
- renderTemplate(this.getChatItemTemplate(), chatData).then(html => {
+ renderTemplate(this.getChatItemTemplate(), chatData).then(async html => {
let chatOptions = RdDUtility.chatDataSetup(html, modeOverride);
- ChatMessage.create(chatOptions)
- });
+ await ChatMessage.create(chatOptions)
+ })
}
getChatItemTemplate() {
- return 'systems/foundryvtt-reve-de-dragon/templates/post-item.hbs';
+ return 'systems/foundryvtt-reve-de-dragon/templates/post-item.hbs'
}
static propertyIfDefined(name, val, condition = true) {
diff --git a/module/item/armure.js b/module/item/armure.js
index 03f011ec..76582653 100644
--- a/module/item/armure.js
+++ b/module/item/armure.js
@@ -21,7 +21,7 @@ export class RdDItemArmure extends RdDItem {
if (deterioration >= 10) {
deterioration -= 10;
protection = this.calculProtectionDeterioree();
- ChatMessage.create({ content: `Votre armure ${this.name} s'est détériorée, elle protège maintenant de ${protection}` });
+ await ChatMessage.create({ content: `Votre armure ${this.name} s'est détériorée, elle protège maintenant de ${protection}` });
}
await this.update({
'system.deterioration': deterioration,
diff --git a/module/item/blessure.js b/module/item/blessure.js
index 1a796ebd..03330979 100644
--- a/module/item/blessure.js
+++ b/module/item/blessure.js
@@ -54,7 +54,7 @@ export class RdDItemBlessure extends RdDItem {
}
await this.createBlessure(actor, gravite)
- ChatMessage.create({
+ await ChatMessage.create({
//TODO: hbs
content: `Blessure ${definition.label} appliquée à ${actor.name}
Perte d'endurance : ${lostEndurance} (${definition.endurance})
Perte de Vie : ${definition.vie}`,
whisper: ChatUtility.getOwners(actor)
diff --git a/module/item/maladie.js b/module/item/maladie.js
index 40c85c42..ceed302c 100644
--- a/module/item/maladie.js
+++ b/module/item/maladie.js
@@ -22,7 +22,7 @@ export class RdDItemMaladie extends RdDItem {
const souffrance = mal.system.identifie
? `de ${mal.name}`
: `d'un mal inconnu`
- ChatMessage.create({
+ await ChatMessage.create({
whisper: ChatUtility.getOwners(mal.actor),
content: `${mal.actor.name} souffre ${souffrance} (${Misc.typeName('Item', mal.type)}): vérifiez que les effets ne se sont pas aggravés !`
})
diff --git a/module/migrations.js b/module/migrations.js
index 4a617030..860d3bf0 100644
--- a/module/migrations.js
+++ b/module/migrations.js
@@ -354,7 +354,7 @@ class _10_4_6_ServicesEnCommerces extends Migration {
}
async transformInventaireCommerce(service) {
const serviceItems = (service.system.items ?? []);
- const commerceItems = await Promise.all(serviceItems.map(async (it) => { return await this.transformToItemBoutique(it); }));
+ const commerceItems = await Promise.all(serviceItems.map((it) => this.transformToItemBoutique(it)))
return commerceItems.concat(Monnaie.monnaiesStandard());
}
@@ -434,7 +434,7 @@ class _10_7_0_MigrationBlessures extends Migration {
'system.blessures.graves.liste': [],
'system.blessures.critiques.liste': []
})
- }));
+ }))
}
creerBlessure(gravite, graviteTexte, blessure, timestamp) {
const dateBlessure = timestamp.addJours(-blessure.jours);
diff --git a/module/moral/apprecier.mjs b/module/moral/apprecier.mjs
index 88801d62..fa1f0ace 100644
--- a/module/moral/apprecier.mjs
+++ b/module/moral/apprecier.mjs
@@ -168,7 +168,7 @@ export class Apprecier {
async rollMoral(moral = undefined) {
if (this.raisons.length > 0) {
- ChatMessage.create({
+ await ChatMessage.create({
whisper: ChatUtility.getOwners(this.actor),
content: 'Pas de jet de moral:' + Misc.concat(this.raisons.map(r => `
- ${r}`))
})
@@ -176,7 +176,6 @@ export class Apprecier {
}
moral = moral ?? this.appreciation.moral
- // TODO: jet de moral
await this.actor.jetDeMoral(moral, this.appreciation.bonmoment)
}
}
\ No newline at end of file
diff --git a/module/rdd-combat.js b/module/rdd-combat.js
index a606ead7..2d6ae28c 100644
--- a/module/rdd-combat.js
+++ b/module/rdd-combat.js
@@ -199,8 +199,8 @@ export class RdDCombatManager extends Combat {
Etes vous certain de vouloir supprimer: ${item.name}?
`, title: `Supprimer ${item.name}`, buttonLabel: "Supprimer", - onAction: () => { + onAction: async () => { console.log('Delete : ', itemId); - actor.deleteEmbeddedDocuments('Item', [itemId], { renderSheet: false }); + await actor.deleteEmbeddedDocuments('Item', [itemId], { renderSheet: false }); } }; if (item.isConteneurNonVide()) { @@ -957,9 +957,9 @@ export class RdDUtility { 'deleteall': { icon: '', label: "Supprimer conteneur et contenu", - callback: () => { + callback: async () => { console.log("Delete : ", itemId); - actor.deleteAllConteneur(itemId, { renderSheet: false }); + await actor.deleteAllConteneur(itemId, { renderSheet: false }); } } }); @@ -997,10 +997,10 @@ export class RdDUtility { } /*-------------------------------------------- */ - static checkThanatosXP(item) { + static async checkThanatosXP(item) { if (item.isCompetencePersonnage() && item.name.includes('Thanatos')) { let message = "Vous avez mis des points d'Expérience en Thanatos !