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 !
|
this.currentTMR.close(); // Close TMR !
|
||||||
}
|
}
|
||||||
// Final chat message
|
// 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
|
if (reveActuel == 0) { // 0 points de reve
|
||||||
ChatMessage.create({ content: this.name + " est réduit à 0 Points de Rêve, et tombe endormi !" });
|
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) {
|
async _onRollCaracResult(rollData) {
|
||||||
// Final chat message
|
// 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 }) {
|
async rollCaracCompetence(caracName, compName, diff, options = { title: "", apprecier: false }) {
|
||||||
@ -2516,7 +2516,7 @@ export class RdDActor extends Actor {
|
|||||||
RollDataAjustements.calcul(rollData, this);
|
RollDataAjustements.calcul(rollData, this);
|
||||||
await RdDResolutionTable.rollData(rollData);
|
await RdDResolutionTable.rollData(rollData);
|
||||||
this._appliquerExperienceRollData(rollData);
|
this._appliquerExperienceRollData(rollData);
|
||||||
RdDResolutionTable.displayRollData(rollData, this)
|
await RdDResolutionTable.displayRollData(rollData, this)
|
||||||
return rollData.rolled;
|
return rollData.rolled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2562,7 +2562,7 @@ export class RdDActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async _competenceResult(rollData) {
|
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.updateEmbeddedDocuments('Item', [rollData.tache]);
|
||||||
this.santeIncDec("fatigue", rollData.tache.data.fatigue);
|
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);
|
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;
|
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`);
|
ui.notifications.info(`${platCuisine.data.quantite} rations de ${platCuisine.name} ont été ajoutés à votre équipement`);
|
||||||
}
|
}
|
||||||
artData.platCuisine = platCuisine;
|
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]);
|
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.updateExperienceLog("XP Sort", rollData.xpSort, "Signe draconique en " + rollData.competence.name);
|
||||||
}
|
}
|
||||||
await this.deleteEmbeddedDocuments("Item", [rollData.signe._id]);
|
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();
|
this.currentTMR.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3339,7 +3339,7 @@ export class RdDActor extends Actor {
|
|||||||
show: defenderRoll?.show ?? {}
|
show: defenderRoll?.show ?? {}
|
||||||
});
|
});
|
||||||
|
|
||||||
ChatUtility.createChatWithRollMode(this.name, {
|
await ChatUtility.createChatWithRollMode(this.name, {
|
||||||
roll: encaissement.roll,
|
roll: encaissement.roll,
|
||||||
content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-resultat-encaissement.html', encaissement)
|
content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-resultat-encaissement.html', encaissement)
|
||||||
});
|
});
|
||||||
@ -3821,7 +3821,7 @@ export class RdDActor extends Actor {
|
|||||||
callbacks: [
|
callbacks: [
|
||||||
this.createCallbackExperience(),
|
this.createCallbackExperience(),
|
||||||
this.createCallbackAppelAuMoral(),
|
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) {
|
async _alchimieResult(rollData) {
|
||||||
RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-alchimie.html');
|
await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-alchimie.html');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@ -66,7 +66,7 @@ export class ChatUtility {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
static removeMessages(data) {
|
static removeMessages(data) {
|
||||||
if (Misc.isUniqueConnectedGM()){
|
if (Misc.isUniqueConnectedGM()) {
|
||||||
ChatUtility.onRemoveMessages(data);
|
ChatUtility.onRemoveMessages(data);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -86,12 +86,12 @@ export class ChatUtility {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static createChatWithRollMode(name, chatOptions) {
|
static async createChatWithRollMode(name, chatOptions) {
|
||||||
ChatUtility.createChatMessage(name, game.settings.get("core", "rollMode"), 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) {
|
switch (rollMode) {
|
||||||
case "blindroll": // GM only
|
case "blindroll": // GM only
|
||||||
if (!game.user.isGM) {
|
if (!game.user.isGM) {
|
||||||
@ -109,7 +109,7 @@ export class ChatUtility {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
chatOptions.alias = chatOptions.alias || name;
|
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);
|
console.log("RollData!!!", rollData);
|
||||||
if ( !rollData.rolled.isSuccess ) {
|
if ( !rollData.rolled.isSuccess ) {
|
||||||
rollData.possession.data.compteur++;
|
rollData.possession.data.compteur++;
|
||||||
}
|
}
|
||||||
this.updateEtatPossession(rollData.possession);
|
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',
|
name: 'conjurer',
|
||||||
label: 'Conjurer une Possession',
|
label: 'Conjurer une Possession',
|
||||||
callbacks: [
|
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;
|
let possession = rollData.possession;
|
||||||
possession.isSuccess = isSuccess;
|
possession.isSuccess = isSuccess;
|
||||||
this.updateEtatPossession( possession);
|
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',
|
name: 'jet-possession',
|
||||||
label: 'Possession: ',
|
label: 'Possession: ',
|
||||||
callbacks: [
|
callbacks: [
|
||||||
{ condition: r => (r.rolled.isSuccess), action: r => this._onRollPossession(r, true) },
|
{ condition: r => (r.rolled.isSuccess), action: async r => await this._onRollPossession(r, true) },
|
||||||
{ condition: r => (r.rolled.isEchec), action: r => this._onRollPossession(r, false) },
|
{ condition: r => (r.rolled.isEchec), action: async r => await this._onRollPossession(r, false) },
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
dialog.render(true);
|
dialog.render(true);
|
||||||
|
@ -64,7 +64,7 @@ export class RdDResolutionTable {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static async displayRollData(rollData, actor = undefined, template = 'chat-resultat-general.html') {
|
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)
|
content: await RdDResolutionTable.buildRollDataHtml(rollData, actor, template)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user