Amélioration chat-message

- utilisation de partial template
- fixes mineurs (this sur static)
- singulier/pluriel pour points de rêve/points de tâche
This commit is contained in:
Vincent Vandemeulebrouck
2021-01-02 14:10:43 +01:00
parent f2aff6b234
commit d6c65ee3a5
17 changed files with 87 additions and 221 deletions

View File

@ -1331,6 +1331,7 @@ export class RdDActor extends Actor {
ui.notifications.info("Aucun sort disponible!");
return;
}
if ( this.currentTMR) this.currentTMR.minimize(); // Hide
let rollData = {
selectedCarac: this.data.data.carac.reve,
@ -1344,7 +1345,6 @@ export class RdDActor extends Actor {
coutreve: Array(20).fill().map((item, index) => 1 + index)
}
if ( this.currentTMR) this.currentTMR.minimize(); // Hide
const dialog = await RdDRoll.create(this, rollData,
{ html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-sort.html',
close: html => { this.currentTMR.maximize() } // Re-display TMR
@ -1528,10 +1528,7 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */
async rollCarac( caracName ) {
let rollData = {
selectedCarac: this.getCaracByName(caracName),
diviseur : this.getDiviseurSignificative()
};
let rollData = { selectedCarac: this.getCaracByName(caracName) };
const dialog = await RdDRoll.create(this, rollData,
{html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html'},
@ -1550,15 +1547,12 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */
async _onRollCaracResult(rollData) {
// Final chat message
await RdDResolutionTable.displayRollData(rollData, this.name);
await RdDResolutionTable.displayRollData(rollData, this.name, 'chat-resultat-general.html');
}
/* -------------------------------------------- */
async rollCompetence( name ) {
let rollData = {
competence: this.getCompetence(name),
diviseur : this.getDiviseurSignificative()
}
let rollData = { competence: this.getCompetence(name) }
if (rollData.competence.type == 'competencecreature') {
// Fake competence pour créature
@ -1610,17 +1604,15 @@ export class RdDActor extends Actor {
competence.data.defaut_carac = tache.data.carac; // Patch !
let rollData = {
competence: competence,
diviseur : this.getDiviseurSignificative(),
tache: tache,
diffConditions: tache.data.difficulte,
editLibre: false,
editConditions: false,
actor: this
}
rollData.carac = {};
carac : { }
};
rollData.carac[tache.data.carac] = duplicate(this.data.data.carac[tache.data.carac]); // Single carac
console.log("rollTache !!!", duplicate(rollData));
console.log("rollTache !!!", rollData);
const dialog = await RdDRoll.create(this, rollData, {html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-competence.html'}, {
name: 'jet-competence',
@ -1658,7 +1650,7 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */
async rollAppelChance( )
{
let rollData = { selectedCarac: this.getCaracByName('chance-actuelle') };
let rollData = { selectedCarac: this.getCaracByName('chance-actuelle'), surprise: '' };
const dialog = await RdDRoll.create(this, rollData,
{ html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html'},
@ -1676,18 +1668,9 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */
async _appelChanceResult(rollData) {
// TODO:
const message = {
user: game.user._id,
alias: this.name,
content: this.name + " fait appel à la chance" + RdDResolutionTable.explain(rollData.rolled)
};
if (rollData.rolled.isSuccess) {
message.content += "<br>Un point de chance est dépensée, l'action peut être retentée"
await this.chanceActuelleIncDec(-1)
}
ChatMessage.create(message);
RdDResolutionTable.displayRollData(rollData, this.name, 'chat-resultat-appelchance.html')
}