Ajout async sur displayRollData
Préparation pour récupérer le message affiché et lui ajouter des flags
This commit is contained in:
parent
c0b5bb3f35
commit
3ae3003be3
@ -2458,7 +2458,7 @@ export class RdDActor extends Actor {
|
||||
this.currentTMR.close(); // Close TMR !
|
||||
}
|
||||
// Final chat message
|
||||
RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-sort.html');
|
||||
await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-sort.html');
|
||||
|
||||
if (reveActuel == 0) { // 0 points de reve
|
||||
ChatMessage.create({ content: this.name + " est réduit à 0 Points de Rêve, et tombe endormi !" });
|
||||
@ -2488,7 +2488,7 @@ export class RdDActor extends Actor {
|
||||
/* -------------------------------------------- */
|
||||
async _onRollCaracResult(rollData) {
|
||||
// Final chat message
|
||||
RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-general.html');
|
||||
await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-general.html');
|
||||
}
|
||||
|
||||
async rollCaracCompetence(caracName, compName, diff, options = { title: "", apprecier: false }) {
|
||||
@ -2516,7 +2516,7 @@ export class RdDActor extends Actor {
|
||||
RollDataAjustements.calcul(rollData, this);
|
||||
await RdDResolutionTable.rollData(rollData);
|
||||
this._appliquerExperienceRollData(rollData);
|
||||
RdDResolutionTable.displayRollData(rollData, this)
|
||||
await RdDResolutionTable.displayRollData(rollData, this)
|
||||
return rollData.rolled;
|
||||
}
|
||||
|
||||
@ -2562,7 +2562,7 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _competenceResult(rollData) {
|
||||
RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-competence.html')
|
||||
await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-competence.html')
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -2641,7 +2641,7 @@ export class RdDActor extends Actor {
|
||||
this.updateEmbeddedDocuments('Item', [rollData.tache]);
|
||||
this.santeIncDec("fatigue", rollData.tache.data.fatigue);
|
||||
|
||||
RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-tache.html');
|
||||
await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-tache.html');
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -2688,7 +2688,7 @@ export class RdDActor extends Actor {
|
||||
const baseQualite = (artData.rolled.isSuccess ? artData.oeuvre.data.niveau : artData.competence.data.niveau);
|
||||
artData.qualiteFinale = Math.min(baseQualite, artData.oeuvre.data.niveau) + artData.rolled.ptQualite;
|
||||
|
||||
RdDResolutionTable.displayRollData(artData, this.name, `chat-resultat-${artData.art}.html`);
|
||||
await RdDResolutionTable.displayRollData(artData, this.name, `chat-resultat-${artData.art}.html`);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -2766,7 +2766,7 @@ export class RdDActor extends Actor {
|
||||
ui.notifications.info(`${platCuisine.data.quantite} rations de ${platCuisine.name} ont été ajoutés à votre équipement`);
|
||||
}
|
||||
artData.platCuisine = platCuisine;
|
||||
RdDResolutionTable.displayRollData(artData, this.name, `chat-resultat-${artData.art}.html`);
|
||||
await RdDResolutionTable.displayRollData(artData, this.name, `chat-resultat-${artData.art}.html`);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -2834,7 +2834,7 @@ export class RdDActor extends Actor {
|
||||
await this.createEmbeddedDocuments("Item", [signeData]);
|
||||
}
|
||||
|
||||
RdDResolutionTable.displayRollData(meditationData, this.name, 'chat-resultat-meditation.html');
|
||||
await RdDResolutionTable.displayRollData(meditationData, this.name, 'chat-resultat-meditation.html');
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -2914,7 +2914,7 @@ export class RdDActor extends Actor {
|
||||
await this.updateExperienceLog("XP Sort", rollData.xpSort, "Signe draconique en " + rollData.competence.name);
|
||||
}
|
||||
await this.deleteEmbeddedDocuments("Item", [rollData.signe._id]);
|
||||
RdDResolutionTable.displayRollData(rollData, this.name, 'chat-resultat-lecture-signedraconique.html');
|
||||
await RdDResolutionTable.displayRollData(rollData, this.name, 'chat-resultat-lecture-signedraconique.html');
|
||||
this.currentTMR.close();
|
||||
}
|
||||
|
||||
@ -3339,7 +3339,7 @@ export class RdDActor extends Actor {
|
||||
show: defenderRoll?.show ?? {}
|
||||
});
|
||||
|
||||
ChatUtility.createChatWithRollMode(this.name, {
|
||||
await ChatUtility.createChatWithRollMode(this.name, {
|
||||
roll: encaissement.roll,
|
||||
content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-resultat-encaissement.html', encaissement)
|
||||
});
|
||||
@ -3821,7 +3821,7 @@ export class RdDActor extends Actor {
|
||||
callbacks: [
|
||||
this.createCallbackExperience(),
|
||||
this.createCallbackAppelAuMoral(),
|
||||
{ action: r => this._alchimieResult(r, false) }
|
||||
{ action: async r => await this._alchimieResult(r, false) }
|
||||
]
|
||||
}
|
||||
);
|
||||
@ -3834,8 +3834,8 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_alchimieResult(rollData) {
|
||||
RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-alchimie.html');
|
||||
async _alchimieResult(rollData) {
|
||||
await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-alchimie.html');
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
@ -66,7 +66,7 @@ export class ChatUtility {
|
||||
/* -------------------------------------------- */
|
||||
|
||||
static removeMessages(data) {
|
||||
if (Misc.isUniqueConnectedGM()){
|
||||
if (Misc.isUniqueConnectedGM()) {
|
||||
ChatUtility.onRemoveMessages(data);
|
||||
}
|
||||
else {
|
||||
@ -86,12 +86,12 @@ export class ChatUtility {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static createChatWithRollMode(name, chatOptions) {
|
||||
ChatUtility.createChatMessage(name, game.settings.get("core", "rollMode"), chatOptions);
|
||||
static async createChatWithRollMode(name, chatOptions) {
|
||||
return await ChatUtility.createChatMessage(name, game.settings.get("core", "rollMode"), chatOptions);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static createChatMessage(name, rollMode, chatOptions) {
|
||||
static async createChatMessage(name, rollMode, chatOptions) {
|
||||
switch (rollMode) {
|
||||
case "blindroll": // GM only
|
||||
if (!game.user.isGM) {
|
||||
@ -109,7 +109,7 @@ export class ChatUtility {
|
||||
break;
|
||||
}
|
||||
chatOptions.alias = chatOptions.alias || name;
|
||||
ChatMessage.create(chatOptions);
|
||||
return await ChatMessage.create(chatOptions);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
@ -50,13 +50,13 @@ export class RdDPossession {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static resultConjuration( rollData) {
|
||||
static async resultConjuration( rollData) {
|
||||
console.log("RollData!!!", rollData);
|
||||
if ( !rollData.rolled.isSuccess ) {
|
||||
rollData.possession.data.compteur++;
|
||||
}
|
||||
this.updateEtatPossession(rollData.possession);
|
||||
RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-possession.html');
|
||||
await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-possession.html');
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -86,7 +86,7 @@ export class RdDPossession {
|
||||
name: 'conjurer',
|
||||
label: 'Conjurer une Possession',
|
||||
callbacks: [
|
||||
{ action: async r => this.resultConjuration(r) }
|
||||
{ action: async r => await this.resultConjuration(r) }
|
||||
]
|
||||
}
|
||||
);
|
||||
@ -94,11 +94,11 @@ export class RdDPossession {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static _onRollPossession( rollData, isSuccess ) {
|
||||
static async _onRollPossession( rollData, isSuccess ) {
|
||||
let possession = rollData.possession;
|
||||
possession.isSuccess = isSuccess;
|
||||
this.updateEtatPossession( possession);
|
||||
RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-possession.html');
|
||||
await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-possession.html');
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -141,8 +141,8 @@ export class RdDPossession {
|
||||
name: 'jet-possession',
|
||||
label: 'Possession: ',
|
||||
callbacks: [
|
||||
{ condition: r => (r.rolled.isSuccess), action: r => this._onRollPossession(r, true) },
|
||||
{ condition: r => (r.rolled.isEchec), action: r => this._onRollPossession(r, false) },
|
||||
{ condition: r => (r.rolled.isSuccess), action: async r => await this._onRollPossession(r, true) },
|
||||
{ condition: r => (r.rolled.isEchec), action: async r => await this._onRollPossession(r, false) },
|
||||
]
|
||||
});
|
||||
dialog.render(true);
|
||||
|
@ -64,7 +64,7 @@ export class RdDResolutionTable {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async displayRollData(rollData, actor = undefined, template = 'chat-resultat-general.html') {
|
||||
ChatUtility.createChatWithRollMode(actor?.userName ?? game.user.name, {
|
||||
return await ChatUtility.createChatWithRollMode(actor?.userName ?? game.user.name, {
|
||||
content: await RdDResolutionTable.buildRollDataHtml(rollData, actor, template)
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user