diff --git a/changelog.md b/changelog.md
index 14472e4e..5de3a264 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,4 +1,13 @@
# 12.0
+## 12.0.38 - Les prévisions d'Astrobazzarh
+- Correction de modifications de personnages qui ne s'affichaient pas:
+ - changements d'endurance/vie/fatigue, transformé, ...
+- Migration des compétences "Ecriture" en "Écriture" dans les tâches, livres, oeuvres et méditations
+- Correction des jets de compétences de créatures
+- Premières préparations techniques pour le passage à Founry v13
+ - liste des impacts d'un jet de dés (expérience, points de tâche, ...)
+ - utilisation de l'extension hbs pour tous les fichiers handlebars
+
## 12.0.37 - Les enchantements d'Astrobazzarh
- les potions ont un état, seules les potions liquides sont enchantables
- les lancements de sorts du jour sont conservés jusqu'à chateau dormant
diff --git a/module/achat-vente/chat-vente.js b/module/achat-vente/chat-vente.js
index 604500f0..a921a356 100644
--- a/module/achat-vente/chat-vente.js
+++ b/module/achat-vente/chat-vente.js
@@ -44,13 +44,13 @@ export class ChatVente {
vente.nbLots = Math.max(0, vente.nbLots - quantite)
await chatMessage.setFlag(SYSTEM_RDD, NB_LOTS, vente.nbLots)
- const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-vente-item.html', vente);
+ const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-vente-item.hbs', vente);
chatMessage.update({ content: html });
chatMessage.render(true);
}
static async displayAchatVente(vente) {
- const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-vente-item.html', vente);
+ const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-vente-item.hbs', vente);
const chatMessage = await ChatMessage.create(RdDUtility.chatDataSetup(html))
await chatMessage.setFlag(SYSTEM_RDD, NB_LOTS, vente.nbLots)
await chatMessage.setFlag(SYSTEM_RDD, DETAIL_VENTE, {
diff --git a/module/achat-vente/dialog-item-achat.js b/module/achat-vente/dialog-item-achat.js
index 3e1814ea..58992d7e 100644
--- a/module/achat-vente/dialog-item-achat.js
+++ b/module/achat-vente/dialog-item-achat.js
@@ -29,7 +29,7 @@ export class DialogItemAchat extends Dialog {
}
DialogItemAchat.changeNombreLots(venteData, 1)
- const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/dialog-item-achat.html`, venteData)
+ const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/dialog-item-achat.hbs`, venteData)
new DialogItemAchat(html, venteData).render(true)
}
diff --git a/module/achat-vente/dialog-item-vente.js b/module/achat-vente/dialog-item-vente.js
index edcda255..64a2166e 100644
--- a/module/achat-vente/dialog-item-vente.js
+++ b/module/achat-vente/dialog-item-vente.js
@@ -20,7 +20,7 @@ export class DialogItemVente extends Dialog {
quantiteIllimite: item.isItemCommerce() ? quantiteMax == undefined : !item.parent,
isOwned: item.parent,
}
- const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/dialog-item-vente.html`, venteData);
+ const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/dialog-item-vente.hbs`, venteData);
return new DialogItemVente(venteData, html).render(true);
}
diff --git a/module/actor-sheet.js b/module/actor-sheet.js
index 447188b5..0359bc45 100644
--- a/module/actor-sheet.js
+++ b/module/actor-sheet.js
@@ -30,7 +30,7 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
/** @override */
static get defaultOptions() {
return foundry.utils.mergeObject(RdDBaseActorReveSheet.defaultOptions, {
- template: "systems/foundryvtt-reve-de-dragon/templates/actor-sheet.html",
+ template: "systems/foundryvtt-reve-de-dragon/templates/actor-sheet.hbs",
width: 550,
showCompNiveauBase: false,
vueArchetype: false,
@@ -126,77 +126,73 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
})
this.html.find('.show-hide-competences').click(async event => {
- this.options.showCompNiveauBase = !this.options.showCompNiveauBase;
- this.render(true);
+ this.options.showCompNiveauBase = !this.options.showCompNiveauBase
+ this.render(true)
});
- this.html.find('.button-tmr-visu').click(async event => this.actor.displayTMR("visu"))
+ this.html.find('.button-tmr-visu').click(async event => await this.actor.displayTMR("visu"))
// Everything below here is only needed if the sheet is editable
if (!this.options.editable) return;
this.html.find('.sheet-possession-attack').click(async event => {
const poss = RdDSheetUtility.getItem(event, this.actor)
- this.actor.conjurerPossession(poss)
+ await this.actor.conjurerPossession(poss)
})
this.html.find('.subacteur-coeur-toggle a').click(async event => {
const subActorIdactorId = RdDSheetUtility.getEventItemData(event, 'subactor-id')
const coeurNombre = $(event.currentTarget).data('numero-coeur')
- RdDCoeur.toggleSubActeurCoeur(this.actor.id, subActorIdactorId, coeurNombre)
+ await RdDCoeur.toggleSubActeurCoeur(this.actor.id, subActorIdactorId, coeurNombre)
})
this.html.find('.subacteur-tendre-moment').click(async event => {
const subActorId = RdDSheetUtility.getEventItemData(event, 'subactor-id')
- RdDCoeur.startSubActeurTendreMoment(this.actor.id, subActorId)
+ await RdDCoeur.startSubActeurTendreMoment(this.actor.id, subActorId)
})
this.html.find('.subacteur-delete').click(async event => {
const li = RdDSheetUtility.getEventElement(event);
const subActorId = li.data("subactor-id");
this.deleteSubActeur(subActorId, li);
})
- this.html.find("input.derivee-value[name='system.compteurs.stress.value']").change(async event => {
- this.actor.updateCompteurValue("stress", parseInt(event.target.value));
- });
- this.html.find("input.derivee-value[name='system.compteurs.experience.value']").change(async event => {
- this.actor.updateCompteurValue("experience", parseInt(event.target.value));
- });
+ this.html.find("input.derivee-value[name='system.compteurs.stress.value']").change(async event =>
+ await this.actor.updateCompteurValue("stress", parseInt(event.target.value))
+ );
+ this.html.find("input.derivee-value[name='system.compteurs.experience.value']").change(async event =>
+ await this.actor.updateCompteurValue("experience", parseInt(event.target.value))
+ );
- this.html.find('.creer-tache').click(async event => this.createEmptyTache());
- this.html.find('.creer-une-oeuvre').click(async event => this.selectTypeOeuvreToCreate());
- this.html.find('.creer-tache-blessure-legere').click(async event => RdDItemBlessure.createTacheSoinBlessure(this.actor, 2));
- this.html.find('.creer-tache-blessure-grave').click(async event => RdDItemBlessure.createTacheSoinBlessure(this.actor, 4));
- this.html.find('.creer-tache-blessure-critique').click(async event => RdDItemBlessure.createTacheSoinBlessure(this.actor, 6));
+ this.html.find('.creer-tache').click(async event => await this.createEmptyTache());
+ this.html.find('.creer-une-oeuvre').click(async event => await this.selectTypeOeuvreToCreate());
+ this.html.find('.creer-tache-blessure-legere').click(async event => await RdDItemBlessure.createTacheSoinBlessure(this.actor, 2));
+ this.html.find('.creer-tache-blessure-grave').click(async event => await RdDItemBlessure.createTacheSoinBlessure(this.actor, 4));
+ this.html.find('.creer-tache-blessure-critique').click(async event => await RdDItemBlessure.createTacheSoinBlessure(this.actor, 6));
this.html.find('.blessure-premierssoins-done').change(async event => {
- const blessure = this.getBlessure(event);
- await blessure?.setSoinsBlessure({ premierssoins: { done: event.currentTarget.checked } });
+ await this.getBlessure(event)?.setSoinsBlessure({ premierssoins: { done: event.currentTarget.checked } });
});
this.html.find('.blessure-soinscomplets-done').change(async event => {
- const blessure = this.getBlessure(event);
- await blessure?.setSoinsBlessure({ soinscomplets: { done: event.currentTarget.checked } })
+ await this.getBlessure(event)?.setSoinsBlessure({ soinscomplets: { done: event.currentTarget.checked } })
});
this.html.find('.blessure-premierssoins-bonus').change(async event => {
- const blessure = this.getBlessure(event);
- await blessure?.setSoinsBlessure({ premierssoins: { bonus: Number(event.currentTarget.value) } })
+ await this.getBlessure(event)?.setSoinsBlessure({ premierssoins: { bonus: Number(event.currentTarget.value) } })
});
this.html.find('.blessure-soinscomplets-bonus').change(async event => {
- const blessure = this.getBlessure(event);
- await blessure?.setSoinsBlessure({ soinscomplets: { bonus: Number(event.currentTarget.value) } })
+ await this.getBlessure(event)?.setSoinsBlessure({ soinscomplets: { bonus: Number(event.currentTarget.value) } })
});
- this.html.find('.roll-chance-actuelle').click(async event => this.actor.rollCarac('chance-actuelle'))
- this.html.find('.button-appel-chance').click(async event => this.actor.rollAppelChance())
+ this.html.find('.roll-chance-actuelle').click(async event => await this.actor.rollCarac('chance-actuelle'))
+ this.html.find('.button-appel-chance').click(async event => await this.actor.rollAppelChance())
- this.html.find('[name="jet-astrologie"]').click(async event => this.actor.astrologieNombresAstraux())
- this.html.find('.action-tache').click(async event => this.actor.rollTache(RdDSheetUtility.getItemId(event)))
- this.html.find('.meditation-label a').click(async event => this.actor.rollMeditation(RdDSheetUtility.getItemId(event)))
+ this.html.find('[name="jet-astrologie"]').click(async event => await this.actor.astrologieNombresAstraux())
+ this.html.find('.action-tache').click(async event => await this.actor.rollTache(RdDSheetUtility.getItemId(event)))
+ this.html.find('.meditation-label a').click(async event => await this.actor.rollMeditation(RdDSheetUtility.getItemId(event)))
- this.html.find('.action-chant').click(async event => this.actor.rollChant(RdDSheetUtility.getItemId(event)))
- this.html.find('.action-danse').click(async event => this.actor.rollDanse(RdDSheetUtility.getItemId(event)))
- this.html.find('.action-musique').click(async event => this.actor.rollMusique(RdDSheetUtility.getItemId(event)))
- this.html.find('.action-oeuvre').click(async event => this.actor.rollOeuvre(RdDSheetUtility.getItemId(event)))
- this.html.find('.action-jeu').click(async event => this.actor.rollJeu(RdDSheetUtility.getItemId(event)))
- this.html.find('.action-recettecuisine').click(async event => this.actor.rollRecetteCuisine(RdDSheetUtility.getItemId(event)))
+ this.html.find('.action-chant').click(async event => await this.actor.rollChant(RdDSheetUtility.getItemId(event)))
+ this.html.find('.action-danse').click(async event => await this.actor.rollDanse(RdDSheetUtility.getItemId(event)))
+ this.html.find('.action-musique').click(async event => await this.actor.rollMusique(RdDSheetUtility.getItemId(event)))
+ this.html.find('.action-oeuvre').click(async event => await this.actor.rollOeuvre(RdDSheetUtility.getItemId(event)))
+ this.html.find('.action-jeu').click(async event => await this.actor.rollJeu(RdDSheetUtility.getItemId(event)))
+ this.html.find('.action-recettecuisine').click(async event => await this.actor.rollRecetteCuisine(RdDSheetUtility.getItemId(event)))
this.html.find('.description-aleatoire').click(async event => new AppPersonnageAleatoire(this.actor).render(true))
if (game.user.isGM) {
@@ -212,16 +208,16 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
await this.actor.deleteExperienceLog(0, key + 1);
});
// Boutons spéciaux MJs
- this.html.find('.forcer-tmr-aleatoire').click(async event => this.actor.reinsertionAleatoire("Action MJ"))
- this.html.find('.don-de-haut-reve').click(async event => this.actor.addDonDeHautReve())
- this.html.find('.afficher-tmr').click(async event => this.actor.changeTMRVisible())
+ this.html.find('.forcer-tmr-aleatoire').click(async event => await this.actor.reinsertionAleatoire("Action MJ"))
+ this.html.find('.don-de-haut-reve').click(async event => await this.actor.addDonDeHautReve())
+ this.html.find('.afficher-tmr').click(async event => await this.actor.changeTMRVisible())
}
// Points de reve actuel
- this.html.find('.roll-reve-actuel').click(async event => this.actor.rollCarac('reve-actuel', {resistance:true}))
- this.html.find('.action-empoignade').click(async event => RdDEmpoignade.onAttaqueEmpoignadeFromItem(RdDSheetUtility.getItem(event, this.actor)))
+ this.html.find('.roll-reve-actuel').click(async event => await this.actor.rollCarac('reve-actuel', { resistance: true }))
+ this.html.find('.action-empoignade').click(async event => await RdDEmpoignade.onAttaqueEmpoignadeFromItem(RdDSheetUtility.getItem(event, this.actor)))
- this.html.find('.roll-arme').click(async event => this.actor.rollArme(foundry.utils.duplicate(this._getEventArmeCombat(event)), 'competence'))
+ this.html.find('.roll-arme').click(async event => await this.actor.rollArme(foundry.utils.duplicate(this._getEventArmeCombat(event)), 'competence'))
// Initiative pour l'arme
this.html.find('.roll-init-arme').click(async event => {
@@ -234,30 +230,30 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
})
// Display TMR
- this.html.find('.button-tmr').click(async event => this.actor.displayTMR("normal"))
- this.html.find('.button-tmr-rapide').click(async event => this.actor.displayTMR("rapide"))
+ this.html.find('.button-tmr').click(async event => await this.actor.displayTMR("normal"))
+ this.html.find('.button-tmr-rapide').click(async event => await this.actor.displayTMR("rapide"))
this.html.find('.button-repos').click(async event => await this.actor.repos())
- this.html.find('.carac-xp-augmenter').click(async event => this.actor.updateCaracXPAuto(event.currentTarget.name.replace("augmenter.", "")))
- this.html.find('.competence-xp-augmenter').click(async event => this.actor.updateCompetenceXPAuto(RdDSheetUtility.getItemId(event)))
- this.html.find('.competence-stress-augmenter').click(async event => this.actor.updateCompetenceStress(RdDSheetUtility.getItemId(event)))
+ this.html.find('.carac-xp-augmenter').click(async event => await this.actor.updateCaracXPAuto(event.currentTarget.name.replace("augmenter.", "")))
+ this.html.find('.competence-xp-augmenter').click(async event => await this.actor.updateCompetenceXPAuto(RdDSheetUtility.getItemId(event)))
+ this.html.find('.competence-stress-augmenter').click(async event => await this.actor.updateCompetenceStress(RdDSheetUtility.getItemId(event)))
if (this.options.vueDetaillee) {
// On carac change
this.html.find('input.carac-xp').change(async event => {
- let caracName = event.currentTarget.name.replace(".xp", "").replace("system.carac.", "");
- this.actor.updateCaracXP(caracName, parseInt(event.target.value));
- });
+ let caracName = event.currentTarget.name.replace(".xp", "").replace("system.carac.", "")
+ await this.actor.updateCaracXP(caracName, parseInt(event.target.value))
+ })
// On competence xp change
this.html.find('input.competence-xp').change(async event => {
- let compName = event.currentTarget.attributes.compname.value;
- this.actor.updateCompetenceXP(compName, parseInt(event.target.value));
- });
+ let compName = event.currentTarget.attributes.compname.value
+ await this.actor.updateCompetenceXP(compName, parseInt(event.target.value))
+ })
this.html.find('input.competence-xp-sort').change(async event => {
- let compName = event.currentTarget.attributes.compname.value;
- this.actor.updateCompetenceXPSort(compName, parseInt(event.target.value));
- });
+ let compName = event.currentTarget.attributes.compname.value
+ await this.actor.updateCompetenceXPSort(compName, parseInt(event.target.value))
+ })
this.html.find('.toggle-archetype').click(async event => {
this.options.vueArchetype = !this.options.vueArchetype;
@@ -266,27 +262,27 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
// On competence archetype change
this.html.find('.competence-archetype').change(async event => {
let compName = event.currentTarget.attributes.compname.value;
- this.actor.updateCompetenceArchetype(compName, parseInt(event.target.value));
+ await this.actor.updateCompetenceArchetype(compName, parseInt(event.target.value));
});
- this.html.find('.nouvelle-incarnation').click(async event => this.actor.nouvelleIncarnation())
+ this.html.find('.nouvelle-incarnation').click(async event => await this.actor.nouvelleIncarnation())
}
// On pts de reve change
- this.html.find('.pointsreve-value').change(async event => this.actor.update({ "system.reve.reve.value": event.currentTarget.value }))
- this.html.find('.seuil-reve-value').change(async event => this.actor.setPointsDeSeuil(event.currentTarget.value))
+ this.html.find('.pointsreve-value').change(async event => await this.actor.update({ "system.reve.reve.value": event.currentTarget.value }))
+ this.html.find('.seuil-reve-value').change(async event => await this.actor.setPointsDeSeuil(event.currentTarget.value))
- this.html.find('.stress-test').click(async event => this.actor.transformerStress())
- this.html.find('.moral-malheureux').click(async event => this.actor.jetDeMoral('malheureuse'))
- this.html.find('.moral-neutre').click(async event => this.actor.jetDeMoral('neutre'))
- this.html.find('.moral-heureux').click(async event => this.actor.jetDeMoral('heureuse'))
- this.html.find('.button-ethylisme').click(async event => this.actor.jetEthylisme())
+ this.html.find('.stress-test').click(async event => await this.actor.transformerStress())
+ this.html.find('.moral-malheureux').click(async event => await this.actor.jetDeMoral('malheureuse'))
+ this.html.find('.moral-neutre').click(async event => await this.actor.jetDeMoral('neutre'))
+ this.html.find('.moral-heureux').click(async event => await this.actor.jetDeMoral('heureuse'))
+ this.html.find('.button-ethylisme').click(async event => await this.actor.jetEthylisme())
- this.html.find('.ptreve-actuel-plus').click(async event => this.actor.reveActuelIncDec(1))
- this.html.find('.ptreve-actuel-moins').click(async event => this.actor.reveActuelIncDec(-1))
- this.html.find('.chance-actuelle-plus').click(async event => this.actor.chanceActuelleIncDec(1))
- this.html.find('.chance-actuelle-moins').click(async event => this.actor.chanceActuelleIncDec(-1))
- this.html.find('.fatigue-plus').click(async event => this.actor.santeIncDec("fatigue", 1))
- this.html.find('.fatigue-moins').click(async event => this.actor.santeIncDec("fatigue", -1))
+ this.html.find('.ptreve-actuel-plus').click(async event => await this.actor.reveActuelIncDec(1))
+ this.html.find('.ptreve-actuel-moins').click(async event => await this.actor.reveActuelIncDec(-1))
+ this.html.find('.chance-actuelle-plus').click(async event => await this.actor.chanceActuelleIncDec(1))
+ this.html.find('.chance-actuelle-moins').click(async event => await this.actor.chanceActuelleIncDec(-1))
+ this.html.find('.fatigue-plus').click(async event => await this.actor.santeIncDec("fatigue", 1))
+ this.html.find('.fatigue-moins').click(async event => await this.actor.santeIncDec("fatigue", -1))
}
getBlessure(event) {
diff --git a/module/actor.js b/module/actor.js
index c8dd832c..225c9c7c 100644
--- a/module/actor.js
+++ b/module/actor.js
@@ -42,6 +42,7 @@ import { RdDItemTete } from "./item/tete.js";
import { DialogSelect } from "./dialog-select.js";
import { PAS_DE_DRACONIC, POSSESSION_SANS_DRACONIC } from "./item/base-items.js";
import { RdDItemRace } from "./item/race.js";
+import { RdDRollResult } from "./rdd-roll-result.js";
export const MAINS_DIRECTRICES = ['Droitier', 'Gaucher', 'Ambidextre']
@@ -627,7 +628,7 @@ export class RdDActor extends RdDBaseActorSang {
rollData.competence.system.defaut_carac = 'reve-actuel';
const dialog = await RdDRoll.create(this, rollData,
- { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-reve-de-dragon.html' },
+ { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-reve-de-dragon.hbs' },
{
name: 'maitrise',
label: 'Maîtriser le Rêve de Dragon',
@@ -757,7 +758,7 @@ export class RdDActor extends RdDBaseActorSang {
expérience requise: ${xpRequis}
niveau : ${fromNiveau}
archétype : ${competence.system.niveau_archetype}`);
- return;
+ return
}
const xpUtilise = Math.max(0, Math.min(fromXpStress, xpRequis));
const gainNiveau = (xpUtilise >= xpRequis || xpRequis <= 0) ? 1 : 0;
@@ -810,7 +811,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(idOrName);
+ RdDUtility.checkThanatosXP(competence)
}
}
}
@@ -824,7 +825,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(idOrName);
+ RdDUtility.checkThanatosXP(competence)
}
}
}
@@ -1197,12 +1198,12 @@ export class RdDActor extends RdDBaseActorSang {
diffConditions: 0,
ajustementsForce: CONFIG.RDD.difficultesLibres
}
- let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-ethylisme.html', rollData);
+ let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-ethylisme.hbs', rollData);
new RdDRollDialogEthylisme(html, rollData, this, r => this.saouler(r.forceAlcool)).render(true);
}
- async mangerNourriture(item, onActionItem) {
- return (await DialogConsommer.create(this, item, onActionItem)).render(true);
+ async mangerNourriture(item) {
+ return (await DialogConsommer.create(this, item)).render(true);
}
async actionLire(item) {
@@ -1390,7 +1391,7 @@ export class RdDActor extends RdDBaseActorSang {
ethylismeData.doses = ethylisme.nb_doses;
await this.update({ 'system.compteurs.ethylisme': ethylisme });
- await RdDResolutionTable.displayRollData(ethylismeData, this, 'chat-resultat-ethylisme.html');
+ await RdDRollResult.displayRollData(ethylismeData, this, 'chat-resultat-ethylisme.hbs');
}
/* -------------------------------------------- */
@@ -1431,7 +1432,7 @@ export class RdDActor extends RdDBaseActorSang {
ChatMessage.create({
whisper: ChatUtility.getOwners(this),
- content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-resultat-transformer-stress.html`, stressRollData)
+ content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-resultat-transformer-stress.hbs`, stressRollData)
});
const toStress = Math.max(fromStress - stressRollData.perte - 1, 0);
@@ -1479,7 +1480,6 @@ export class RdDActor extends RdDBaseActorSang {
/* -------------------------------------------- */
createCallbackExperience() {
return {
- condition: r => r.rolled.isPart && r.finalLevel < 0 && game.settings.get("core", "rollMode") != 'selfroll',
action: r => this.appliquerAjoutExperience(r)
};
}
@@ -1487,7 +1487,6 @@ export class RdDActor extends RdDBaseActorSang {
/* -------------------------------------------- */
createCallbackAppelAuMoral() { /* Si l'appel au moral est utilisé, on l'affiche dans le chat et on diminue éventuellement le moral */
return {
- condition: r => r.use.appelAuMoral && game.settings.get("core", "rollMode") != 'selfroll',
action: r => this._appliquerAppelMoral(r)
};
}
@@ -1516,7 +1515,7 @@ export class RdDActor extends RdDBaseActorSang {
if (display) {
ChatMessage.create({
whisper: ChatUtility.getOwners(this),
- content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-carac-xp.html`, checkXp)
+ content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-carac-xp.hbs`, checkXp)
});
}
return checkXp;
@@ -1548,7 +1547,7 @@ export class RdDActor extends RdDBaseActorSang {
if (display) {
ChatMessage.create({
whisper: ChatUtility.getOwners(this),
- content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-competence-xp.html`, checkXp)
+ content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-competence-xp.hbs`, checkXp)
});
}
return checkXp;
@@ -1558,13 +1557,16 @@ export class RdDActor extends RdDBaseActorSang {
/* -------------------------------------------- */
async appliquerAjoutExperience(rollData, hideChatMessage = 'show') {
- if (!Misc.hasConnectedGM()) {
+ if (!rollData.rolled.isPart ||
+ rollData.finalLevel >= 0 ||
+ game.settings.get("core", "rollMode") == 'selfroll' ||
+ !Misc.hasConnectedGM()) {
return
}
hideChatMessage = hideChatMessage == 'hide' || (Misc.isRollModeHiddenToPlayer() && !game.user.isGM)
let xpData = await this._appliquerExperience(rollData.rolled, rollData.selectedCarac.label, rollData.competence, rollData.jetResistance);
if (xpData.length) {
- const content = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-gain-xp.html`, {
+ const content = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-gain-xp.hbs`, {
actor: this,
xpData
})
@@ -1582,7 +1584,9 @@ export class RdDActor extends RdDBaseActorSang {
/* -------------------------------------------- */
async _appliquerAppelMoral(rollData) {
- if (!rollData.use.moral) return;
+ if (!rollData.use.moral || game.settings.get("core", "rollMode") == 'selfroll'){
+ return
+ }
if (rollData.rolled.isEchec ||
(rollData.ajustements.diviseurSignificative && (rollData.rolled.roll * rollData.ajustements.diviseurSignificative > rollData.score))) {
rollData.perteMoralEchec = rollData.moral <= -3 ? 'dissolution' : 'perte';
@@ -1644,7 +1648,7 @@ export class RdDActor extends RdDBaseActorSang {
const dialog = await this.openRollDialog({
name: 'lancer-un-sort',
label: 'Lancer un sort',
- template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-sort.html',
+ template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-sort.hbs',
rollData: {
carac: { 'reve': reve },
forceCarac: { 'reve': reve },
@@ -1657,10 +1661,7 @@ export class RdDActor extends RdDBaseActorSang {
diffLibre: RdDItemSort.getDifficulte(sorts[0], -7), // Per default at startup
coutreve: Array(30).fill().map((item, index) => 1 + index),
},
- callbackAction: async r => {
- await this._rollUnSortResult(r);
- if (!r.isSortReserve) this.tmrApp?.close();
- }
+ callbacks: [{ action: r => this._rollUnSortResult(r) }]
});
this.tmrApp?.setTMRPendingAction(dialog);
}
@@ -1764,12 +1765,44 @@ export class RdDActor extends RdDBaseActorSang {
reveActuel = Math.max(reveActuel - rollData.depenseReve, 0);
await this.update({ "system.reve.reve.value": reveActuel });
- // Final chat message
- await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-sort.html');
+ 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 !" });
}
+ if (!rollData.isSortReserve) {
+ this.tmrApp?.close();
+ }
+ }
+
+ /**
+ * Méthode pour faire un jet prédéterminer sans ouvrir la fenêtre de dialogue
+ * @param {*} caracName
+ * @param {*} compName
+ * @param {*} diff
+ * @param {*} options
+ * @returns
+ */
+ async doRollCaracCompetence(caracName, compName, diff, options = { title: "" }) {
+ const carac = this.getCaracByName(caracName);
+ if (!carac) {
+ ui.notifications.warn(`${this.name} n'a pas de caractéristique correspondant à ${caracName}`)
+ return;
+ }
+ const competence = this.getCompetence(compName);
+ let rollData = {
+ alias: this.getAlias(),
+ caracValue: Number(carac.value),
+ selectedCarac: carac,
+ competence: competence,
+ diffLibre: diff,
+ show: { title: options?.title ?? '' }
+ };
+ RollDataAjustements.calcul(rollData, this);
+ await RdDResolutionTable.rollData(rollData);
+ this._gererExperience(rollData);
+ await RdDRollResult.displayRollData(rollData, this)
+ return rollData.rolled;
}
/* -------------------------------------------- */
@@ -1790,7 +1823,7 @@ export class RdDActor extends RdDBaseActorSang {
name: nomTache, type: 'tache',
system: {
carac: 'intellect',
- competence: 'Ecriture',
+ competence: 'Écriture',
difficulte: item.system.difficulte,
periodicite: "60 minutes",
fatigue: 2,
@@ -1823,6 +1856,27 @@ export class RdDActor extends RdDBaseActorSang {
return undefined;
}
+ async rollCaracCompetence(caracName, compName, diff, options = { title: "" }) {
+ RdDEmpoignade.checkEmpoignadeEnCours(this)
+ const competence = this.getCompetence(compName);
+ await this.openRollDialog({
+ name: 'jet-competence',
+ label: 'Jet ' + Grammar.apostrophe('de', competence.name),
+ template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.hbs',
+ rollData: {
+ alias: this.getAlias(),
+ carac: this.system.carac,
+ selectedCarac: this.getCaracByName(caracName),
+ selectedCaracName: caracName,
+ diffLibre: diff,
+ competence: competence,
+ show: { title: options?.title ?? '' }
+ },
+ // TODO:
+ callbacks: [{ action: r => this.$onRollCompetence(r, options) }]
+ });
+ }
+
/* -------------------------------------------- */
async rollTache(id, options = {}) {
RdDEmpoignade.checkEmpoignadeEnCours(this)
@@ -1831,9 +1885,9 @@ export class RdDActor extends RdDBaseActorSang {
compData.system.defaut_carac = tacheData.system.carac; // Patch !
await this.openRollDialog({
- name: 'jet-competence',
+ name: 'jet-competence',
label: 'Jet de Tâche ' + tacheData.name,
- template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.html',
+ template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.hbs',
rollData: {
competence: compData,
tache: tacheData,
@@ -1844,7 +1898,7 @@ export class RdDActor extends RdDBaseActorSang {
[tacheData.system.carac]: foundry.utils.duplicate(this.system.carac[tacheData.system.carac])
}
},
- callbackAction: r => this._tacheResult(r, options)
+ callbacks: [{ action: r => this._tacheResult(r, options) }]
});
}
@@ -1867,14 +1921,14 @@ export class RdDActor extends RdDBaseActorSang {
await this.updateEmbeddedDocuments('Item', [rollData.tache]);
await this.santeIncDec("fatigue", rollData.tache.system.fatigue);
- await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-tache.html');
+ await RdDRollResult.displayRollData(rollData, this, 'chat-resultat-tache.hbs');
if (options?.onRollAutomate) {
options.onRollAutomate(rollData);
}
}
/* -------------------------------------------- */
- async _rollArt(artData, selected, oeuvre, callbackAction = r => this._resultArt(r)) {
+ async _rollArt(artData, selected, oeuvre, callbackAction = async r => await this._resultArt(r)) {
oeuvre.system.niveau = oeuvre.system.niveau ?? 0;
foundry.utils.mergeObject(artData,
{
@@ -1894,12 +1948,12 @@ export class RdDActor extends RdDBaseActorSang {
}
await this.openRollDialog({
- name: `jet-${artData.art}`,
+ name: `jet-${artData.art}`,
label: `${artData.verbe} ${oeuvre.name}`,
- template: `systems/foundryvtt-reve-de-dragon/templates/dialog-roll-${oeuvre.type}.html`,
+ template: `systems/foundryvtt-reve-de-dragon/templates/dialog-roll-${oeuvre.type}.hbs`,
rollData: artData,
- callbackAction: callbackAction
- });
+ callbacks: [{ action: callbackAction }],
+ })
}
/* -------------------------------------------- */
@@ -1908,7 +1962,7 @@ export class RdDActor extends RdDBaseActorSang {
const baseQualite = (artData.rolled.isSuccess ? niveau : artData.competence.system.niveau);
artData.qualiteFinale = Math.min(baseQualite, niveau) + artData.rolled.ptQualite;
- await RdDResolutionTable.displayRollData(artData, this.name, `chat-resultat-${artData.art}.html`);
+ await RdDRollResult.displayRollData(artData, this.name, `chat-resultat-${artData.art}.hbs`);
}
/* -------------------------------------------- */
@@ -1985,7 +2039,7 @@ export class RdDActor extends RdDBaseActorSang {
ui.notifications.info(`${platCuisine.system.quantite} rations de ${platCuisine.name} ont été ajoutés à votre équipement`);
}
cuisine.platCuisine = platCuisine;
- await RdDResolutionTable.displayRollData(cuisine, this.name, `chat-resultat-${cuisine.art}.html`);
+ await RdDRollResult.displayRollData(cuisine, this.name, `chat-resultat-${cuisine.art}.hbs`);
}
async preparerNourriture(item) {
@@ -2059,7 +2113,7 @@ export class RdDActor extends RdDBaseActorSang {
};
const dialog = await RdDRoll.create(this, meditationData,
- { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-meditation.html' },
+ { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-meditation.hbs' },
{
name: 'jet-meditation',
label: "Jet de méditation",
@@ -2080,7 +2134,7 @@ export class RdDActor extends RdDBaseActorSang {
await this.createEmbeddedDocuments("Item", [RdDItemSigneDraconique.prepareSigneDraconiqueMeditation(meditationRoll.meditation, meditationRoll.rolled)]);
}
- await RdDResolutionTable.displayRollData(meditationRoll, this.name, 'chat-resultat-meditation.html');
+ await RdDRollResult.displayRollData(meditationRoll, this.name, 'chat-resultat-meditation.hbs');
}
/* -------------------------------------------- */
@@ -2132,7 +2186,7 @@ export class RdDActor extends RdDBaseActorSang {
const dialog = await RdDRoll.create(this, rollData,
{
- html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-signedraconique.html',
+ html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-signedraconique.hbs',
close: async html => await this._onCloseRollDialog(html)
},
{
@@ -2167,7 +2221,7 @@ export class RdDActor extends RdDBaseActorSang {
await ExperienceLog.add(this, XP_TOPIC.XPSORT, fromXp, toXp, `${rollData.competence.name} : signe draconique`);
}
await this.deleteEmbeddedDocuments("Item", [rollData.signe._id]);
- await RdDResolutionTable.displayRollData(rollData, this.name, 'chat-resultat-lecture-signedraconique.html');
+ await RdDRollResult.displayRollData(rollData, this.name, 'chat-resultat-lecture-signedraconique.hbs');
this.tmrApp.close();
}
@@ -2176,15 +2230,15 @@ export class RdDActor extends RdDBaseActorSang {
await this.openRollDialog({
name: 'appelChance',
label: 'Appel à la chance',
- template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html',
+ template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.hbs',
rollData: { selectedCarac: this.getCaracByName('chance-actuelle'), surprise: '' },
- callbackAction: r => this._appelChanceResult(r, onSuccess, onEchec)
+ callbacks: [{ action: r => this.$appelChanceResult(r, onSuccess, onEchec) }]
});
}
/* -------------------------------------------- */
- async _appelChanceResult(rollData, onSuccess, onEchec) {
- await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-appelchance.html')
+ async $appelChanceResult(rollData, onSuccess, onEchec) {
+ await RdDRollResult.displayRollData(rollData, this, 'chat-resultat-appelchance.hbs')
if (rollData.rolled.isSuccess) {
await this.setFlag(SYSTEM_RDD, 'utilisationChance', true);
await this.chanceActuelleIncDec(-1);
@@ -2637,7 +2691,7 @@ export class RdDActor extends RdDBaseActorSang {
rollData.competence.system.defaut_carac = caracTache;
const dialog = await RdDRoll.create(this, rollData,
- { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-alchimie.html' },
+ { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-alchimie.hbs' },
{
name: 'tache-alchimique',
label: 'Tache Alchimique',
@@ -2658,7 +2712,7 @@ export class RdDActor extends RdDBaseActorSang {
/* -------------------------------------------- */
async _alchimieResult(rollData) {
- await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-alchimie.html');
+ await RdDRollResult.displayRollData(rollData, this, 'chat-resultat-alchimie.hbs');
}
/* -------------------------------------------- */
@@ -2807,25 +2861,25 @@ export class RdDActor extends RdDBaseActorSang {
}
/* -------------------------------------------- */
- async consommerPotionSoin(potionData) {
- potionData.alias = this.name;
- potionData.supprimer = true;
+ async consommerPotionSoin(potion) {
+ potion.alias = this.name;
+ potion.supprimer = true;
- if (potionData.system.magique) {
+ if (potion.system.magique) {
// Gestion de la résistance:
- potionData.rolled = await RdDResolutionTable.roll(this.getReveActuel(), -8);
- if (potionData.rolled.isEchec) {
+ potion.rolled = await RdDResolutionTable.roll(this.getReveActuel(), -8);
+ if (potion.rolled.isEchec) {
await this.reveActuelIncDec(-1);
- potionData.guerisonData = await this.buildPotionGuerisonList(potionData.system.puissance);
- potionData.guerisonMinutes = potionData.guerisonData.pointsConsommes * 5;
+ potion.guerisonData = await this.buildPotionGuerisonList(potion.system.puissance);
+ potion.guerisonMinutes = potion.guerisonData.pointsConsommes * 5;
}
}
- if (!potionData.system.magique || potionData.rolled.isSuccess) {
- await this.setBonusPotionSoin(potionData.system.herbebonus);
+ if (!potion.system.magique || potion.rolled.isSuccess) {
+ await this.setBonusPotionSoin(potion.system.herbebonus);
}
ChatMessage.create({
whisper: ChatUtility.getOwners(this),
- content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-consommer-potion-soin.html`, potionData)
+ content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-consommer-potion-soin.hbs`, potion)
});
}
@@ -2834,35 +2888,35 @@ export class RdDActor extends RdDBaseActorSang {
}
/* -------------------------------------------- */
- async consommerPotionRepos(potionData) {
- potionData.alias = this.name;
- potionData.supprimer = true;
+ async consommerPotionRepos(potion) {
+ potion.alias = this.name;
+ potion.supprimer = true;
- if (potionData.system.magique) {
+ if (potion.system.magique) {
// Gestion de la résistance:
- potionData.rolled = await RdDResolutionTable.roll(this.getReveActuel(), -8);
- if (potionData.rolled.isEchec) {
+ potion.rolled = await RdDResolutionTable.roll(this.getReveActuel(), -8);
+ if (potion.rolled.isEchec) {
await this.reveActuelIncDec(-1);
let fatigueActuelle = this.getFatigueActuelle();
- potionData.caseFatigueReel = Math.min(fatigueActuelle, potionData.system.puissance);
- potionData.guerisonDureeUnite = (potionData.system.reposalchimique) ? "rounds" : "minutes";
- potionData.guerisonDureeValue = (potionData.system.reposalchimique) ? potionData.caseFatigueReel : potionData.caseFatigueReel * 5;
- potionData.aphasiePermanente = false;
- if (potionData.system.reposalchimique) {
+ potion.caseFatigueReel = Math.min(fatigueActuelle, potion.system.puissance);
+ potion.guerisonDureeUnite = (potion.system.reposalchimique) ? "rounds" : "minutes";
+ potion.guerisonDureeValue = (potion.system.reposalchimique) ? potion.caseFatigueReel : potion.caseFatigueReel * 5;
+ potion.aphasiePermanente = false;
+ if (potion.system.reposalchimique) {
let chanceAphasie = await RdDDice.rollTotal("1d100");
- if (chanceAphasie <= potionData.system.pr) {
- potionData.aphasiePermanente = true;
+ if (chanceAphasie <= potion.system.pr) {
+ potion.aphasiePermanente = true;
}
}
- await this.santeIncDec("fatigue", -potionData.caseFatigueReel);
+ await this.santeIncDec("fatigue", -potion.caseFatigueReel);
}
}
- if (!potionData.system.magique || potionData.rolled.isSuccess) {
- this.bonusRepos = potionData.system.herbebonus;
+ if (!potion.system.magique || potion.rolled.isSuccess) {
+ this.bonusRepos = potion.system.herbebonus;
}
ChatMessage.create({
whisper: ChatUtility.getOwners(this),
- content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-consommer-potion-repos.html`, potionData)
+ content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-consommer-potion-repos.hbs`, potion)
});
}
@@ -2887,7 +2941,7 @@ export class RdDActor extends RdDBaseActorSang {
ChatMessage.create({
whisper: ChatUtility.getOwners(this),
- content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-fabriquer-potion-base.html`, {
+ content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-fabriquer-potion-base.hbs`, {
alias: this.getAlias(),
nbBrinsReste: herbeData.system.quantite - herbeData.nbBrins,
potion: newPotion,
@@ -2902,35 +2956,32 @@ export class RdDActor extends RdDBaseActorSang {
}
/* -------------------------------------------- */
- async consommerPotionGenerique(potionData) {
- potionData.alias = this.name;
+ async consommerPotionGenerique(potion) {
+ potion.alias = this.name;
- if (potionData.system.magique) {
+ if (potion.system.magique) {
// Gestion de la résistance:
- potionData.rolled = await RdDResolutionTable.roll(this.getReveActuel(), -8);
- if (potionData.rolled.isEchec) {
+ potion.rolled = await RdDResolutionTable.roll(this.getReveActuel(), -8);
+ if (potion.rolled.isEchec) {
await this.reveActuelIncDec(-1);
}
}
ChatMessage.create({
whisper: ChatUtility.getOwners(this),
- content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-consommer-potion-generique.html`, potionData)
+ content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-consommer-potion-generique.hbs`, potion)
});
}
/* -------------------------------------------- */
- async consommerPotion(potion, onActionItem = async () => { }) {
- const potionData = potion
-
- if (potionData.system.categorie.includes('Soin')) {
- this.consommerPotionSoin(potionData);
- } else if (potionData.system.categorie.includes('Repos')) {
- this.consommerPotionRepos(potionData);
+ async consommerPotion(potion) {
+ if (potion.system.categorie.includes('Soin')) {
+ this.consommerPotionSoin(potion);
+ } else if (potion.system.categorie.includes('Repos')) {
+ this.consommerPotionRepos(potion);
} else {
- this.consommerPotionGenerique(potionData);
+ this.consommerPotionGenerique(potion);
}
- await this.diminuerQuantiteObjet(potion.id, 1, { supprimerSiZero: potionData.supprimer });
- await onActionItem()
+ await this.diminuerQuantiteObjet(potion.id, 1, { supprimerSiZero: potion.supprimer });
}
/* -------------------------------------------- */
diff --git a/module/actor/base-actor-reve-sheet.js b/module/actor/base-actor-reve-sheet.js
index a21a28fa..9003a3e2 100644
--- a/module/actor/base-actor-reve-sheet.js
+++ b/module/actor/base-actor-reve-sheet.js
@@ -26,16 +26,17 @@ export class RdDBaseActorReveSheet extends RdDBaseActorSheet {
// Everything below here is only needed if the sheet is editable
if (!this.options.editable) return;
- this.html.find('.button-encaissement').click(async event => this.actor.encaisser())
+ this.html.find('.button-encaissement').click(async event => await this.actor.encaisser())
this.html.find('.roll-carac').click(async event => {
- this.actor.rollCarac(Grammar.toLowerCaseNoAccent(event.currentTarget.attributes['data-carac-name'].value))})
- this.html.find('.roll-competence').click(async event => this.actor.rollCompetence(RdDSheetUtility.getItemId(event)));
- this.html.find('.endurance-plus').click(async event => this.actor.santeIncDec("endurance", 1));
- this.html.find('.endurance-moins').click(async event => this.actor.santeIncDec("endurance", -1));
+ await this.actor.rollCarac(Grammar.toLowerCaseNoAccent(event.currentTarget.attributes['data-carac-name'].value))
+ })
+ this.html.find('.roll-competence').click(async event => await this.actor.rollCompetence(RdDSheetUtility.getItemId(event)));
+ this.html.find('.endurance-plus').click(async event => await this.actor.santeIncDec("endurance", 1));
+ this.html.find('.endurance-moins').click(async event => await this.actor.santeIncDec("endurance", -1));
if (game.user.isGM) {
- this.html.find('.button-remise-a-neuf').click(async event => this.actor.remiseANeuf())
- this.html.find('.delete-active-effect').click(async event => this.actor.removeEffect(this.html.find(event.currentTarget).parents(".active-effect").data('effect')));
+ this.html.find('.button-remise-a-neuf').click(async event => await this.actor.remiseANeuf())
+ this.html.find('.delete-active-effect').click(async event => await this.actor.removeEffect(this.html.find(event.currentTarget).parents(".active-effect").data('effect')));
this.html.find('.enlever-tous-effets').click(async event => await this.actor.removeEffects());
}
this.html.find('.competence-add').click(async event =>
@@ -55,14 +56,13 @@ export class RdDBaseActorReveSheet extends RdDBaseActorSheet {
if (this.options.vueDetaillee) {
// On carac change
this.html.find('.carac-value').change(async event => {
- let caracName = event.currentTarget.name.replace(".value", "").replace("system.carac.", "");
- this.actor.updateCarac(caracName, parseInt(event.target.value));
+ let caracName = event.currentTarget.name.replace(".value", "").replace("system.carac.", "")
+ await this.actor.updateCarac(caracName, parseInt(event.target.value))
});
// On competence change
this.html.find('.competence-value').change(async event => {
- let compName = event.currentTarget.attributes.compname.value;
- //console.log("Competence changed :", compName);
- this.actor.updateCompetence(compName, parseInt(event.target.value));
+ let compName = event.currentTarget.attributes.compname.value
+ await this.actor.updateCompetence(compName, parseInt(event.target.value))
});
}
}
diff --git a/module/actor/base-actor-reve.js b/module/actor/base-actor-reve.js
index 268109bc..8daa183f 100644
--- a/module/actor/base-actor-reve.js
+++ b/module/actor/base-actor-reve.js
@@ -15,6 +15,7 @@ import { StatusEffects } from "../settings/status-effects.js";
import { Targets } from "../targets.js";
import { RdDConfirm } from "../rdd-confirm.js";
import { RdDCarac } from "../rdd-carac.js";
+import { RdDRollResult } from "../rdd-roll-result.js";
import { ChatUtility } from "../chat-utility.js";
import { DialogValidationEncaissement } from "../dialog-validation-encaissement.js";
@@ -268,19 +269,11 @@ export class RdDBaseActorReve extends RdDBaseActor {
}
/* -------------------------------------------- */
- async openRollDialog({ name, label, template, rollData, callbackAction }) {
+ async openRollDialog({ name, label, template, rollData, callbacks }) {
const dialog = await RdDRoll.create(this, rollData,
{ html: template, close: async html => await this._onCloseRollDialog(html) },
- {
- name: name,
- label: label,
- callbacks: [
- this.createCallbackExperience(),
- this.createCallbackAppelAuMoral(),
- { action: callbackAction }
- ]
- });
- dialog.render(true);
+ { name: name, label: label, callbacks: [this.createCallbackExperience(), this.createCallbackAppelAuMoral()].concat(callbacks) })
+ dialog.render(true)
return dialog
}
@@ -299,8 +292,8 @@ export class RdDBaseActorReve extends RdDBaseActor {
const competence = this.getCompetence(compName);
await this.openRollDialog({
name: 'jet-competence',
- label: competence? 'Jet ' + Grammar.apostrophe('de', competence.name) : `Jet sans compétence (${compName})`,
- template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.html',
+ label: competence ? 'Jet ' + Grammar.apostrophe('de', competence.name) : `Jet sans compétence (${compName})`,
+ template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.hbs',
rollData: {
alias: this.getAlias(),
carac: this.system.carac,
@@ -310,7 +303,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
competence: competence,
show: { title: options?.title ?? '' }
},
- callbackAction: r => this.$onRollCompetence(r, options)
+ callbacks: [async r => this.$onRollCompetence(r, options)]
});
}
/**
@@ -353,16 +346,14 @@ export class RdDBaseActorReve extends RdDBaseActor {
const selectedCaracName = ['apparence', 'perception', 'force', 'reve'].find(it => carac[it] != undefined)
await this.openRollDialog({
- name: `jet-${this.id}`,
- label: `Jet de ${this.getAlias()}`,
- template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll.html',
rollData: {
+ alias: this.getAlias(),
carac: carac,
selectedCarac: carac[selectedCaracName],
selectedCaracName: selectedCaracName,
competences: this.itemTypes['competence']
},
- callbackAction: r => this.$onRollCaracResult(r)
+ callbacks: [{ action: r => this.$onRollCaracResult(r) }]
})
}
/* -------------------------------------------- */
@@ -373,32 +364,38 @@ export class RdDBaseActorReve extends RdDBaseActor {
foundry.utils.mergeObject(options, { resistance: false, diff: 0 }, { overwrite: false })
RdDEmpoignade.checkEmpoignadeEnCours(this)
let selectedCarac = this.getCaracByName(caracName)
- console.log("selectedCarac", selectedCarac)
+ const title = 'Jet ' + Grammar.apostrophe('de', selectedCarac.label);
+ const jetResistance = options.resistance ? caracName : undefined;
await this.openRollDialog({
name: 'jet-' + caracName,
- label: 'Jet ' + Grammar.apostrophe('de', selectedCarac.label),
- template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html',
+ label: title,
+ template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.hbs',
rollData: {
+ alias: this.getAlias(),
selectedCarac: selectedCarac,
competences: this.itemTypes['competence'],
diffLibre: options.diff ?? 0,
- jetResistance: options.resistance ? caracName : undefined
+ jetResistance: jetResistance
},
- callbackAction: r => this.$onRollCaracResult(r)
+ callbacks: [{ action: r => this.$onRollCaracResult(r) }]
});
}
/* -------------------------------------------- */
async $onRollCaracResult(rollData) {
// Final chat message
- await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-general.html');
+ await RdDRollResult.displayRollData(rollData, this, 'chat-resultat-general.hbs');
}
/* -------------------------------------------- */
async rollCompetence(idOrName, options = { tryTarget: true, arme: undefined }) {
RdDEmpoignade.checkEmpoignadeEnCours(this)
const competence = this.getCompetence(idOrName);
- let rollData = { carac: this.system.carac, competence: competence, arme: options.arme }
+ let rollData = {
+ carac: this.system.carac,
+ competence: competence,
+ arme: options.arme
+ }
if (competence.type == ITEM_TYPES.competencecreature) {
const token = RdDUtility.getSelectedToken(this)
const arme = RdDItemCompetenceCreature.armeCreature(competence)
@@ -416,18 +413,18 @@ export class RdDBaseActorReve extends RdDBaseActor {
// Transformer la competence de créature
RdDItemCompetenceCreature.setRollDataCreature(rollData)
}
-
+ const dialogLabel = 'Jet ' + Grammar.apostrophe('de', competence.name);
await this.openRollDialog({
name: 'jet-competence',
- label: 'Jet ' + Grammar.apostrophe('de', competence.name),
- template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.html',
+ label: dialogLabel,
+ template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.hbs',
rollData: rollData,
- callbackAction: r => this.$onRollCompetence(r, options)
+ callbacks: [{ action: r => this.$onRollCompetence(r, options) }]
});
}
async $onRollCompetence(rollData, options) {
- await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-competence.html')
+ await RdDRollResult.displayRollData(rollData, this, 'chat-resultat-competence.hbs')
if (options?.onRollAutomate) {
options.onRollAutomate(rollData);
}
@@ -527,7 +524,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
await ChatUtility.createChatWithRollMode(
{
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.hbs', encaissement)
},
this
)
@@ -537,7 +534,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
encaissement.isGM = true
ChatMessage.create({
whisper: ChatUtility.getGMs(),
- 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.hbs', encaissement)
});
}
}
@@ -562,10 +559,8 @@ export class RdDBaseActorReve extends RdDBaseActor {
await entite.setEntiteReveAccordee(this);
}
- await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-accorder-cauchemar.html');
- if (rolled.isPart) {
- await this.appliquerAjoutExperience(rollData, true);
- }
+ await RdDRollResult.displayRollData(rollData, this, 'chat-resultat-accorder-cauchemar.hbs');
+ await this.appliquerAjoutExperience(rollData, true);
return rolled.isSuccess;
}
diff --git a/module/actor/base-actor-sang-sheet.js b/module/actor/base-actor-sang-sheet.js
index 2988c78b..89a0239d 100644
--- a/module/actor/base-actor-sang-sheet.js
+++ b/module/actor/base-actor-sang-sheet.js
@@ -17,20 +17,20 @@ export class RdDBaseActorSangSheet extends RdDBaseActorReveSheet {
// Everything below here is only needed if the sheet is editable
if (!this.options.editable) return;
- this.html.find('.creer-blessure-legere').click(async event => RdDItemBlessure.createBlessure(this.actor, 2));
- this.html.find('.creer-blessure-grave').click(async event => RdDItemBlessure.createBlessure(this.actor, 4));
- this.html.find('.creer-blessure-critique').click(async event => RdDItemBlessure.createBlessure(this.actor, 6));
+ this.html.find('.creer-blessure-legere').click(async event => await RdDItemBlessure.createBlessure(this.actor, 2));
+ this.html.find('.creer-blessure-grave').click(async event => await RdDItemBlessure.createBlessure(this.actor, 4));
+ this.html.find('.creer-blessure-critique').click(async event => await RdDItemBlessure.createBlessure(this.actor, 6));
- this.html.find('.subir-blessure-contusion').click(async event => RdDItemBlessure.applyFullBlessure(this.actor, 0));
- this.html.find('.subir-blessure-legere').click(async event => RdDItemBlessure.applyFullBlessure(this.actor, 2));
- this.html.find('.subir-blessure-grave').click(async event => RdDItemBlessure.applyFullBlessure(this.actor, 4));
- this.html.find('.subir-blessure-critique').click(async event => RdDItemBlessure.applyFullBlessure(this.actor, 6));
+ this.html.find('.subir-blessure-contusion').click(async event => await RdDItemBlessure.applyFullBlessure(this.actor, 0));
+ this.html.find('.subir-blessure-legere').click(async event => await RdDItemBlessure.applyFullBlessure(this.actor, 2));
+ this.html.find('.subir-blessure-grave').click(async event => await RdDItemBlessure.applyFullBlessure(this.actor, 4));
+ this.html.find('.subir-blessure-critique').click(async event => await RdDItemBlessure.applyFullBlessure(this.actor, 6));
- this.html.find('.jet-vie').click(async event => this.actor.jetDeVie())
+ this.html.find('.jet-vie').click(async event => await this.actor.jetDeVie())
this.html.find('.jet-endurance').click(async event => await this.jetEndurance())
- this.html.find('.vie-plus').click(async event => this.actor.santeIncDec("vie", 1))
- this.html.find('.vie-moins').click(async event => this.actor.santeIncDec("vie", -1))
+ this.html.find('.vie-plus').click(async event => await this.actor.santeIncDec("vie", 1))
+ this.html.find('.vie-moins').click(async event => await this.actor.santeIncDec("vie", -1))
}
async jetEndurance() {
diff --git a/module/actor/base-actor-sheet.js b/module/actor/base-actor-sheet.js
index 309e538f..9fbba716 100644
--- a/module/actor/base-actor-sheet.js
+++ b/module/actor/base-actor-sheet.js
@@ -85,14 +85,14 @@ export class RdDBaseActorSheet extends ActorSheet {
super.activateListeners(html);
this.html = html;
- this.html.find('.actionItem').click(event => ItemAction.onActionItem(event, this.actor, this.options))
- this.html.find('.item-edit').click(async event => this.itemActionEdit(event))
+ this.html.find('.actionItem').click(async event => await ItemAction.onActionItem(event, this.actor, this.options))
+ this.html.find('.item-edit').click(async event => await this.itemActionEdit(event))
this.html.find('.conteneur-name a').click(async event => {
RdDUtility.toggleAfficheContenu(this.getItemId(event))
this.render(true)
})
- this.html.find('.actor-montrer').click(async event => this.actor.postActorToChat());
+ this.html.find('.actor-montrer').click(async event => await this.actor.postActorToChat());
this.html.find('.recherche')
.each((index, field) => {
@@ -106,21 +106,17 @@ export class RdDBaseActorSheet extends ActorSheet {
// Everything below here is only needed if the sheet is editable
if (!this.options.editable) return;
- this.html.find('.item-equip-armure').click(async event => this.actor.equiperObjet(this.getItem(event)))
- this.html.find('.item-delete').click(async event => RdDUtility.confirmActorItemDelete(this.getItem(event), this.actor));
- this.html.find('.item-quantite-plus').click(async event => this.actor.itemQuantiteIncDec(this.getItemId(event), 1));
- this.html.find('.item-quantite-moins').click(async event => this.actor.itemQuantiteIncDec(this.getItemId(event), -1));
+ this.html.find('.item-equip-armure').click(async event => await this.actor.equiperObjet(this.getItem(event)))
+ this.html.find('.item-delete').click(async event => await RdDUtility.confirmActorItemDelete(this.getItem(event), this.actor));
+ this.html.find('.item-quantite-plus').click(async event => await this.actor.itemQuantiteIncDec(this.getItemId(event), 1));
+ this.html.find('.item-quantite-moins').click(async event => await this.actor.itemQuantiteIncDec(this.getItemId(event), -1));
- this.html.find('.creer-un-objet').click(async event => {
- this.selectObjetTypeToCreate();
- });
- this.html.find('.nettoyer-conteneurs').click(async event => {
- this.actor.nettoyerConteneurs();
- });
+ this.html.find('.creer-un-objet').click(async event => await this.selectObjetTypeToCreate())
+ this.html.find('.nettoyer-conteneurs').click(async event => await this.actor.nettoyerConteneurs())
this.html.find('.vue-detaillee').click(async event => {
- this.options.vueDetaillee = !this.options.vueDetaillee;
- this.render(true);
+ this.options.vueDetaillee = !this.options.vueDetaillee
+ this.render(true)
});
}
diff --git a/module/actor/base-actor.js b/module/actor/base-actor.js
index 2cdd2834..bda083dd 100644
--- a/module/actor/base-actor.js
+++ b/module/actor/base-actor.js
@@ -414,7 +414,7 @@ export class RdDBaseActor extends Actor {
user: achat.userId,
speaker: { alias: (acheteur ?? vendeur).getAlias() },
whisper: ChatUtility.getOwners(this),
- content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-achat-item.html', chatAchatItem)
+ content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-achat-item.hbs', chatAchatItem)
});
if (!achat.vente.quantiteIllimite) {
@@ -731,7 +731,7 @@ export class RdDBaseActor extends Actor {
name: this.getAlias(),
system: { description: this.system.description }
}
- renderTemplate('systems/foundryvtt-reve-de-dragon/templates/post-actor.html', chatData)
+ renderTemplate('systems/foundryvtt-reve-de-dragon/templates/post-actor.hbs', chatData)
.then(html => ChatMessage.create(RdDUtility.chatDataSetup(html, modeOverride)));
}
diff --git a/module/actor/commerce-sheet.js b/module/actor/commerce-sheet.js
index ca617fec..57644d2e 100644
--- a/module/actor/commerce-sheet.js
+++ b/module/actor/commerce-sheet.js
@@ -12,7 +12,7 @@ export class RdDCommerceSheet extends RdDBaseActorSheet {
/** @override */
static get defaultOptions() {
return foundry.utils.mergeObject(super.defaultOptions, {
- template: "systems/foundryvtt-reve-de-dragon/templates/actor/commerce-actor-sheet.html",
+ template: "systems/foundryvtt-reve-de-dragon/templates/actor/commerce-actor-sheet.hbs",
width: 600, height: 720,
tabs: []
}, { inplace: false })
diff --git a/module/actor/creature-sheet.js b/module/actor/creature-sheet.js
index 80ddb9a6..9ce58f80 100644
--- a/module/actor/creature-sheet.js
+++ b/module/actor/creature-sheet.js
@@ -10,7 +10,7 @@ export class RdDCreatureSheet extends RdDBaseActorSangSheet {
/** @override */
static get defaultOptions() {
return foundry.utils.mergeObject(RdDBaseActorSangSheet.defaultOptions, {
- template: "systems/foundryvtt-reve-de-dragon/templates/actor-creature-sheet.html",
+ template: "systems/foundryvtt-reve-de-dragon/templates/actor-creature-sheet.hbs",
width: 640, height: 720
}, { inplace: false })
}
@@ -26,15 +26,15 @@ export class RdDCreatureSheet extends RdDBaseActorSangSheet {
// On competence change
this.html.find('.creature-carac').change(async event => {
let compName = event.currentTarget.attributes.compname.value;
- this.actor.updateCreatureCompetence(compName, "carac_value", parseInt(event.target.value));
+ await this.actor.updateCreatureCompetence(compName, "carac_value", parseInt(event.target.value));
});
this.html.find('.creature-niveau').change(async event => {
let compName = event.currentTarget.attributes.compname.value;
- this.actor.updateCreatureCompetence(compName, "niveau", parseInt(event.target.value));
+ await this.actor.updateCreatureCompetence(compName, "niveau", parseInt(event.target.value));
});
this.html.find('.creature-dommages').change(async event => {
let compName = event.currentTarget.attributes.compname.value;
- this.actor.updateCreatureCompetence(compName, "dommages", parseInt(event.target.value));
+ await this.actor.updateCreatureCompetence(compName, "dommages", parseInt(event.target.value));
});
}
}
diff --git a/module/actor/entite-sheet.js b/module/actor/entite-sheet.js
index 4f213768..70303215 100644
--- a/module/actor/entite-sheet.js
+++ b/module/actor/entite-sheet.js
@@ -8,7 +8,7 @@ export class RdDActorEntiteSheet extends RdDBaseActorReveSheet {
/** @override */
static get defaultOptions() {
return foundry.utils.mergeObject(RdDBaseActorReveSheet.defaultOptions, {
- template: "systems/foundryvtt-reve-de-dragon/templates/actor-entite-sheet.html",
+ template: "systems/foundryvtt-reve-de-dragon/templates/actor-entite-sheet.hbs",
width: 640, height: 720,
}, { inplace: false })
}
@@ -33,15 +33,15 @@ export class RdDActorEntiteSheet extends RdDBaseActorReveSheet {
// On competence change
this.html.find('.creature-carac').change(async event => {
let compName = event.currentTarget.attributes.compname.value;
- this.actor.updateCreatureCompetence(compName, "carac_value", parseInt(event.target.value));
+ await this.actor.updateCreatureCompetence(compName, "carac_value", parseInt(event.target.value));
});
this.html.find('.creature-dommages').change(async event => {
let compName = event.currentTarget.attributes.compname.value;
- this.actor.updateCreatureCompetence(compName, "dommages", parseInt(event.target.value));
+ await this.actor.updateCreatureCompetence(compName, "dommages", parseInt(event.target.value));
})
this.html.find('.resonance-add').click(async event =>
- DialogSelect.select({
+ await DialogSelect.select({
label: "Choisir un acteur à accorder",
list: game.actors.filter(it => it.isPersonnage() && it.prototypeToken.actorLink)
},
diff --git a/module/actor/export-scriptarium/actor-encart-sheet.js b/module/actor/export-scriptarium/actor-encart-sheet.js
index a43cc6c8..9a978216 100644
--- a/module/actor/export-scriptarium/actor-encart-sheet.js
+++ b/module/actor/export-scriptarium/actor-encart-sheet.js
@@ -104,13 +104,12 @@ export class RdDActorExportSheet extends RdDActorSheet {
this.html.find('.click-blessure-add').click(async event =>
await this.actor.ajouterBlessure({
gravite: this.html.find(event.currentTarget).data('gravite')
- // event.currentTarget.attributes['data-gravite'].value
})
)
- this.html.find('.button-export').click(async event => {
+ this.html.find('.button-export').click(async event => await
ExportScriptarium.INSTANCE.exportActors([this.actor],
`${this.actor.uuid}-${this.actor.name}`
)
- })
+ )
}
}
diff --git a/module/actor/vehicule-sheet.js b/module/actor/vehicule-sheet.js
index fb38f1b6..20f2ae80 100644
--- a/module/actor/vehicule-sheet.js
+++ b/module/actor/vehicule-sheet.js
@@ -7,7 +7,7 @@ export class RdDActorVehiculeSheet extends RdDBaseActorSheet {
/** @override */
static get defaultOptions() {
return foundry.utils.mergeObject(RdDBaseActorSheet.defaultOptions, {
- template: "systems/foundryvtt-reve-de-dragon/templates/actor-vehicule-sheet.html",
+ template: "systems/foundryvtt-reve-de-dragon/templates/actor-vehicule-sheet.hbs",
width: 640, height: 720,
}, { inplace: false })
}
@@ -32,18 +32,10 @@ export class RdDActorVehiculeSheet extends RdDBaseActorSheet {
super.activateListeners(html);
if (!this.options.editable) return;
- this.html.find('.resistance-moins').click(async event => {
- this.actor.vehicleIncDec("resistance", -1);
- });
- this.html.find('.resistance-plus').click(async event => {
- this.actor.vehicleIncDec("resistance", 1);
- });
- this.html.find('.structure-moins').click(async event => {
- this.actor.vehicleIncDec("structure", -1);
- });
- this.html.find('.structure-plus').click(async event => {
- this.actor.vehicleIncDec("structure", 1);
- });
+ this.html.find('.resistance-moins').click(async event => await this.actor.vehicleIncDec("resistance", -1))
+ this.html.find('.resistance-plus').click(async event => await this.actor.vehicleIncDec("resistance", 1))
+ this.html.find('.structure-moins').click(async event => await this.actor.vehicleIncDec("structure", -1))
+ this.html.find('.structure-plus').click(async event => await this.actor.vehicleIncDec("structure", 1))
}
}
diff --git a/module/dialog-choix-xp-carac.js b/module/dialog-choix-xp-carac.js
index 583ba872..9afdda88 100644
--- a/module/dialog-choix-xp-carac.js
+++ b/module/dialog-choix-xp-carac.js
@@ -27,7 +27,7 @@ export class DialogChoixXpCarac extends Dialog {
dialogData = foundry.utils.mergeObject(dialogData, {
default: 'appliquer',
buttons: {
- 'appliquer': { icon:'', label: "Ajouter la répartition", callback: it => this.appliquerSelection() }
+ 'appliquer': { icon: '', label: "Ajouter la répartition", callback: it => this.appliquerSelection() }
}
})
super(dialogData, dialogOptions)
@@ -37,18 +37,13 @@ export class DialogChoixXpCarac extends Dialog {
}
activateListeners(html) {
- //TODO
super.activateListeners(html)
this.html = html
- this.html.find("li.xpCarac-option .xpCarac-moins").click(event =>
- this.ajouterXp(event, -1)
- )
- this.html.find("li.xpCarac-option .xpCarac-plus").click(event =>
- this.ajouterXp(event, 1)
- )
+ this.html.find("li.xpCarac-option .xpCarac-moins").click(event => this.ajouterXp(event, -1))
+ this.html.find("li.xpCarac-option .xpCarac-plus").click(event => this.ajouterXp(event, 1))
}
- async ajouterXp(event, delta) {
+ ajouterXp(event, delta) {
const liCarac = this.html.find(event.currentTarget)?.parents("li.xpCarac-option")
const label = liCarac?.data("carac-label")
const carac = this.caracs.find(c => c.label == label)
diff --git a/module/dialog-chronologie.js b/module/dialog-chronologie.js
index 5168870d..f67e7793 100644
--- a/module/dialog-chronologie.js
+++ b/module/dialog-chronologie.js
@@ -27,7 +27,7 @@ export class DialogChronologie extends Dialog {
timestamp: game.system.rdd.calendrier.timestamp,
dateReel: game.system.rdd.calendrier.dateReel()
};
- const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/dialog-chronologie.html", dialogData);
+ const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/dialog-chronologie.hbs", dialogData);
const dialog = new DialogChronologie(html, dialogData);
dialog.render(true);
}
@@ -100,7 +100,7 @@ export class DialogChronologie extends Dialog {
}
async prepareChronologieEntry(journalParameters) {
- return await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/chronologie-entry.html", journalParameters);
+ return await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/chronologie-entry.hbs", journalParameters);
}
extractJournalParameters() {
diff --git a/module/dialog-create-signedraconique.js b/module/dialog-create-signedraconique.js
index 40f90988..60b67b01 100644
--- a/module/dialog-create-signedraconique.js
+++ b/module/dialog-create-signedraconique.js
@@ -18,7 +18,7 @@ export class DialogCreateSigneDraconique extends Dialog {
}))
};
- const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/dialog-create-signedraconique.html", dialogData);
+ const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/dialog-create-signedraconique.hbs", dialogData);
new DialogCreateSigneDraconique(dialogData, html)
.render(true);
}
@@ -49,7 +49,7 @@ export class DialogCreateSigneDraconique extends Dialog {
actor.createEmbeddedDocuments("Item", [signe]);
ChatMessage.create({
whisper: ChatUtility.getOwners(actor),
- content: await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/chat-signe-draconique-actor.html", {
+ content: await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/chat-signe-draconique-actor.hbs", {
signe: signe,
alias: actor.getAlias()
})
diff --git a/module/dialog-fabriquer-potion.js b/module/dialog-fabriquer-potion.js
index 43b39fac..24a157d9 100644
--- a/module/dialog-fabriquer-potion.js
+++ b/module/dialog-fabriquer-potion.js
@@ -12,7 +12,7 @@ export class DialogFabriquerPotion extends Dialog {
}
const potionData = DialogFabriquerPotion.prepareData(item, brinsMinimum)
const options = { classes: ["dialogfabriquerpotion"], width: 600, height: 160, 'z-index': 99999 }
- const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-fabriquer-potion-base.html', potionData)
+ const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-fabriquer-potion-base.hbs', potionData)
new DialogFabriquerPotion(actor, potionData, html, options).render(true)
}
diff --git a/module/dialog-item-consommer.js b/module/dialog-item-consommer.js
index f8ee974e..a71ffaeb 100644
--- a/module/dialog-item-consommer.js
+++ b/module/dialog-item-consommer.js
@@ -2,13 +2,13 @@ import { Misc } from "./misc.js";
export class DialogConsommer extends Dialog {
- static async create(actor, item, onActionItem = async () => { }) {
+ static async create(actor, item) {
const consommerData = DialogConsommer.prepareData(actor, item);
- const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-item-consommer.html', consommerData);
- return new DialogConsommer(actor, item, consommerData, html, onActionItem)
+ const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-item-consommer.hbs', consommerData);
+ return new DialogConsommer(actor, item, consommerData, html)
}
- constructor(actor, item, consommerData, html, onActionItem = async () => { }) {
+ constructor(actor, item, consommerData, html) {
const options = { classes: ["dialogconsommer"], width: 350, height: 'fit-content', 'z-index': 99999 };
let conf = {
title: consommerData.title,
@@ -16,10 +16,7 @@ export class DialogConsommer extends Dialog {
default: consommerData.buttonName,
buttons: {
[consommerData.buttonName]: {
- label: consommerData.buttonName, callback: async it => {
- await this.onConsommer();
- await onActionItem();
- }
+ label: consommerData.buttonName, callback: async it => await this.onConsommer()
}
}
};
diff --git a/module/dialog-select.js b/module/dialog-select.js
index 0623ca55..4107d5c0 100644
--- a/module/dialog-select.js
+++ b/module/dialog-select.js
@@ -3,7 +3,7 @@ export class DialogSelect extends Dialog {
static extractIdNameImg(it) { return { id: it.id, name: it.name, img: it.img } }
static async select(selectionData, onSelectChoice) {
- const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/dialog-select.html", selectionData)
+ const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/dialog-select.hbs", selectionData)
const dialogData = {
title: selectionData.title ?? selectionData.label,
diff --git a/module/dialog-split-item.js b/module/dialog-split-item.js
index 20247353..79c5404c 100644
--- a/module/dialog-split-item.js
+++ b/module/dialog-split-item.js
@@ -7,7 +7,7 @@ export class DialogSplitItem extends Dialog {
item: item,
choix: { quantite: 1, max: item.system.quantite - 1 }
};
- const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/dialog-item-split.html`, splitData);
+ const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/dialog-item-split.hbs`, splitData);
return new DialogSplitItem(item, splitData, html, callback)
}
diff --git a/module/dialog-validation-encaissement.js b/module/dialog-validation-encaissement.js
index c0a74d85..55daa7a3 100644
--- a/module/dialog-validation-encaissement.js
+++ b/module/dialog-validation-encaissement.js
@@ -9,7 +9,7 @@ export class DialogValidationEncaissement extends Dialog {
static async validerEncaissement(actor, rollData, armure, onEncaisser) {
const encaissement = await RdDUtility.jetEncaissement(actor, rollData, armure, { showDice: HIDE_DICE });
- const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-validation-encaissement.html', {
+ const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-validation-encaissement.hbs', {
actor: actor,
rollData: rollData,
encaissement: encaissement
diff --git a/module/item-competencecreature.js b/module/item-competencecreature.js
index d0a19f25..53d510f6 100644
--- a/module/item-competencecreature.js
+++ b/module/item-competencecreature.js
@@ -1,5 +1,6 @@
import { ITEM_TYPES } from "./constants.js";
+import { Grammar } from "./grammar.js";
import { RdDCombatManager } from "./rdd-combat.js";
export const CATEGORIES_COMPETENCES_CREATURES = {
@@ -17,9 +18,11 @@ export class RdDItemCompetenceCreature extends Item {
/* -------------------------------------------- */
static setRollDataCreature(rollData) {
- rollData.carac = { "carac_creature": { label: rollData.competence.name, value: rollData.competence.system.carac_value } }
- rollData.competence.system.defaut_carac = "carac_creature"
- rollData.selectedCarac = rollData.carac.carac_creature
+ const code = Grammar.toLowerCaseNoAccentNoSpace(rollData.competence.name);
+ const selectedCarac = { code: code, label: rollData.competence.name, value: rollData.competence.system.carac_value };
+ rollData.carac = { [code]: selectedCarac }
+ rollData.competence.system.defaut_carac = code
+ rollData.selectedCarac = selectedCarac
rollData.arme = RdDItemCompetenceCreature.armeCreature(rollData.competence);
}
@@ -29,20 +32,20 @@ export class RdDItemCompetenceCreature extends Item {
if (categorieAttaque != undefined) {
// cloner pour ne pas modifier la compétence
return foundry.utils.mergeObject(item, {
- action: item.isCompetencePossession() ? 'possession' : 'attaque',
- system: {
- competence: item.name,
- cac: categorieAttaque == "naturelle" ? "naturelle" : "",
- niveau: item.system.niveau,
- initiative: RdDCombatManager.calculInitiative(item.system.niveau, item.system.carac_value),
- equipe: true,
- resistance: 100,
- dommagesReels: item.system.dommages,
- penetration: 0,
- force: 0,
- rapide: true,
- }
- }, { inplace: false, });
+ action: item.isCompetencePossession() ? 'possession' : 'attaque',
+ system: {
+ competence: item.name,
+ cac: categorieAttaque == "naturelle" ? "naturelle" : "",
+ niveau: item.system.niveau,
+ initiative: RdDCombatManager.calculInitiative(item.system.niveau, item.system.carac_value),
+ equipe: true,
+ resistance: 100,
+ dommagesReels: item.system.dommages,
+ penetration: 0,
+ force: 0,
+ rapide: true,
+ }
+ }, { inplace: false, });
}
return undefined;
}
diff --git a/module/item-sheet.js b/module/item-sheet.js
index cedec032..e9f615eb 100644
--- a/module/item-sheet.js
+++ b/module/item-sheet.js
@@ -159,23 +159,19 @@ export class RdDItemSheet extends ItemSheet {
HtmlUtility.showControlWhen(this.html.find(".item-cout"), ReglesOptionnelles.isUsing('afficher-prix-joueurs')
|| game.user.isGM
- || !this.item.isOwned);
- HtmlUtility.showControlWhen(this.html.find(".item-magique"), this.item.isMagique);
+ || !this.item.isOwned)
+ HtmlUtility.showControlWhen(this.html.find(".item-magique"), this.item.isMagique)
// Everything below here is only needed if the sheet is editable
- if (!this.options.editable) return;
+ if (!this.options.editable) return
- this.form.ondragstart = (event) => this._onDragStart(event);
- this.form.ondrop = (event) => this._onDrop(event);
+ this.form.ondragstart = async event => await this._onDragStart(event)
+ this.form.ondrop = async event => await this._onDrop(event)
// Select competence categorie
- this.html.find(".categorie").change(event => this._onSelectCategorie(event));
+ this.html.find(".categorie").change(async event => await this._onSelectCategorie(event))
- this.html.find('.sheet-competence-xp').change((event) => {
- if (this.item.isCompetencePersonnage()) {
- RdDUtility.checkThanatosXP(this.item.name);
- }
- });
+ this.html.find('.sheet-competence-xp').change(event => RdDUtility.checkThanatosXP(this.item))
this.html.find(".item-cout input[name='system.cout']").change(event => {
if (this.item.isMonnaie()) {
const value = event.currentTarget.value;
@@ -184,42 +180,41 @@ export class RdDItemSheet extends ItemSheet {
}
}
})
- this.html.find('.delete-bonus-case').click((event) => {
- this.supprimerBonusCase(event.currentTarget.attributes['data-deleteCoord'].value)
- })
-
- this.html.find('.creer-tache-livre').click((event) => this._getEventActor(event).creerTacheDepuisLivre(this.item));
- this.html.find('.creer-potion-base').click((event) => this._getEventActor(event).fabriquerDecoctionHerbe(this.item))
- this.html.find('input[name="system.cacher_points_de_tache"]').change(async event => await this.item.update({ 'system.cacher_points_de_tache': event.currentTarget.checked }));
+ this.html.find('.delete-bonus-case').click(async event => await this.supprimerBonusCase(event.currentTarget.attributes['data-deleteCoord'].value))
+ this.html.find('.creer-tache-livre').click(async event => await this._getEventActor(event).creerTacheDepuisLivre(this.item))
+ this.html.find('.creer-potion-base').click(async event => await this._getEventActor(event).fabriquerDecoctionHerbe(this.item))
+ this.html.find('input[name="system.cacher_points_de_tache"]').change(async event =>
+ await this.item.update({ 'system.cacher_points_de_tache': event.currentTarget.checked })
+ )
this.html.find('.roll-text').click(async event => await RdDTextEditor.rollText(event, this.actor))
this.html.find('.chat-roll-text').click(async event => await RdDTextEditor.chatRollText(event))
if (this.actor) {
- this.html.find('.actionItem').click(event => ItemAction.onActionItem(event, this.actor, this.options))
-
+ this.html.find('.actionItem').click(async event => await ItemAction.onActionItem(event, this.actor, this.options))
+
// TODO: utiliser un itemAction?
- this.html.find('.item-potion-consommer').click(event => this.itemActionConsommer(event))
+ this.html.find('.item-potion-consommer').click(async event => await this.itemActionConsommer(event))
this.html.find('.item-quantite-plus').click(async event => {
await this.actor.itemQuantiteIncDec(RdDSheetUtility.getItemId(event), 1)
- this.render()
+ //this.render()
})
this.html.find('.item-quantite-moins').click(async event => {
await this.actor.itemQuantiteIncDec(RdDSheetUtility.getItemId(event), -1)
- this.render()
+ //this.render()
})
}
const updateItemTimestamp = (path, timestamp) => this.item.update({ [path]: foundry.utils.duplicate(timestamp) })
- RdDTimestamp.handleTimestampEditor(this.html, 'system.temporel.debut', updateItemTimestamp);
- RdDTimestamp.handleTimestampEditor(this.html, 'system.temporel.fin', updateItemTimestamp);
+ RdDTimestamp.handleTimestampEditor(this.html, 'system.temporel.debut', updateItemTimestamp)
+ RdDTimestamp.handleTimestampEditor(this.html, 'system.temporel.fin', updateItemTimestamp)
}
- itemActionDelete(event) {
+ async itemActionDelete(event) {
const item = RdDSheetUtility.getItem(event, this.actor)
- return RdDUtility.confirmActorItemDelete(item, this.actor)
+ return await RdDUtility.confirmActorItemDelete(item, this.actor)
}
async itemActionConsommer(event) {
@@ -238,12 +233,7 @@ export class RdDItemSheet extends ItemSheet {
}
}
- _getEventActor(event) {
- let actorId = event.currentTarget.attributes['data-actor-id'].value;
- let actor = game.actors.get(actorId);
- return actor;
- }
-
+ _getEventActor(event) { return game.actors.get(event.currentTarget.attributes['data-actor-id'].value) }
/* -------------------------------------------- */
async _onSelectCategorie(event) {
@@ -285,7 +275,7 @@ export class RdDItemSheet extends ItemSheet {
break
}
- return this.item.update(formData);
+ return this.item.update(formData)
}
/* -------------------------------------------- */
@@ -318,8 +308,9 @@ export class RdDItemSheet extends ItemSheet {
}
/* -------------------------------------------- */
- async _onDragStart(event) {
- }
+ async _onDragStart(event) { }
+ async _onDropItem(event, dragData) { }
+ async _onDropActor(event, dragData) { }
async _onDrop(event) {
// Try to extract the dragData
@@ -345,13 +336,7 @@ export class RdDItemSheet extends ItemSheet {
return JSON.parse(eventData);
}
} catch (err) { }
- return undefined;
- }
-
- async _onDropItem(event, dragData) {
- }
-
- async _onDropActor(event, dragData) {
+ return undefined
}
}
diff --git a/module/item.js b/module/item.js
index 3c1859ee..0d8ab863 100644
--- a/module/item.js
+++ b/module/item.js
@@ -591,7 +591,7 @@ export class RdDItem extends Item {
}
getChatItemTemplate() {
- return 'systems/foundryvtt-reve-de-dragon/templates/post-item.html';
+ return 'systems/foundryvtt-reve-de-dragon/templates/post-item.hbs';
}
static propertyIfDefined(name, val, condition = true) {
diff --git a/module/item/item-actions.js b/module/item/item-actions.js
index f61d13fd..b4ce6d9a 100644
--- a/module/item/item-actions.js
+++ b/module/item/item-actions.js
@@ -135,12 +135,12 @@ export class ItemAction {
return undefined
}
- static onActionItem(event, actor, options) {
+ static async onActionItem(event, actor, options) {
const item = RdDSheetUtility.getItem(event, actor)
const code = $(event.currentTarget).data('code')
const action = item?.itemActions().find(it => it.code == code)
if (action && (!action.optionsFilter || action.optionsFilter(options))) {
- action.action(item, actor)
+ await action.action(item, actor)
}
}
}
diff --git a/module/item/sheet-base-inventaire.js b/module/item/sheet-base-inventaire.js
index 014bc4ea..61367fb4 100644
--- a/module/item/sheet-base-inventaire.js
+++ b/module/item/sheet-base-inventaire.js
@@ -34,8 +34,8 @@ export class RdDItemInventaireSheet extends RdDItemSheet {
HtmlUtility.showControlWhen(this.html.find("div.description-milieu"), TYPE_ITEMS_NATURELS.includes(this.item.type));
if (!this.options.editable) return;
- this.html.find("a.preparer-nourriture").click(event => this.preparerNourriture(event));
- this.html.find("a.manger-nourriture").click(event => this.mangerNourriture(event));
+ this.html.find("a.preparer-nourriture").click(async event => await this.preparerNourriture(event));
+ this.html.find("a.manger-nourriture").click(async event => await this.mangerNourriture(event));
this.html.find("input.input-selection-milieu").keypress(event => {
if (event.keyCode == '13') {
@@ -43,11 +43,11 @@ export class RdDItemInventaireSheet extends RdDItemSheet {
}
event.stopPropagation();
})
- this.html.find("a.milieu-add").click(event => this.onAddMilieu(event));
- this.html.find("div.environnement-milieu a.milieu-delete").click(event => this.onDeleteMilieu(event));
- this.html.find("div.environnement-milieu select.environnement-rarete").change(event => this.onChange(event,
+ this.html.find("a.milieu-add").click(async event => await this.onAddMilieu(event));
+ this.html.find("div.environnement-milieu a.milieu-delete").click(async event => await this.onDeleteMilieu(event));
+ this.html.find("div.environnement-milieu select.environnement-rarete").change(async event => await this.onChange(event,
updated => this.$changeRarete(event, updated)));
- this.html.find("div.environnement-milieu input[name='environnement-frequence']").change(event => this.onChange(event,
+ this.html.find("div.environnement-milieu input[name='environnement-frequence']").change(async event => await this.onChange(event,
updated => this.$changeFrequence(event, updated)));
diff --git a/module/item/sheet-blessure.js b/module/item/sheet-blessure.js
index cbab7ad8..8ce5eaae 100644
--- a/module/item/sheet-blessure.js
+++ b/module/item/sheet-blessure.js
@@ -15,15 +15,15 @@ export class RdDBlessureItemSheet extends RdDItemSheet {
if (!this.options.editable) return;
- this.html.find('[name="premierssoins-done"]').change(async event => {
- await this.item.setSoinsBlessure({ premierssoins: { done: event.currentTarget.checked } });
- });
- this.html.find('[name="soinscomplets-done"]').change(async event => {
+ this.html.find('[name="premierssoins-done"]').change(async event =>
+ await this.item.setSoinsBlessure({ premierssoins: { done: event.currentTarget.checked } })
+ )
+ this.html.find('[name="soinscomplets-done"]').change(async event =>
await this.item.setSoinsBlessure({ soinscomplets: { done: event.currentTarget.checked } })
- });
+ )
this.html.find('[name="system-gravite"]').change(async event => {
const gravite = Number(event.currentTarget.value)
await this.item.setSoinsBlessure({ gravite: gravite, difficulte: - gravite })
- });
+ })
}
}
diff --git a/module/item/sheet-faune.js b/module/item/sheet-faune.js
index de22340c..fc351b57 100644
--- a/module/item/sheet-faune.js
+++ b/module/item/sheet-faune.js
@@ -9,7 +9,7 @@ export class RdDFauneItemSheet extends RdDItemInventaireSheet {
if (!this.options.editable) return;
- html.find("a.linked-actor-delete").click(event => this.onDeleteLinkedActor());
+ html.find("a.linked-actor-delete").click(async event => await this.onDeleteLinkedActor());
}
async _onDropActor(event, dragData) {
diff --git a/module/item/sheet-rencontre.js b/module/item/sheet-rencontre.js
index bfd55b7a..551c4149 100644
--- a/module/item/sheet-rencontre.js
+++ b/module/item/sheet-rencontre.js
@@ -44,8 +44,8 @@ export class RdDRencontreItemSheet extends RdDItemSheet {
activateListeners(html) {
super.activateListeners(html);
if (!this.options.editable) return;
- this.html.find("a.effet-add").click(event => this.onAddEffet(event));
- this.html.find("a.effet-delete").click(event => this.onDeleteEffet(event));
+ this.html.find("a.effet-add").click(async event => await this.onAddEffet(event));
+ this.html.find("a.effet-delete").click(async event => await this.onDeleteEffet(event));
}
async onAddEffet(event) {
diff --git a/module/item/sheet-signedraconique.js b/module/item/sheet-signedraconique.js
index 894c1227..79128959 100644
--- a/module/item/sheet-signedraconique.js
+++ b/module/item/sheet-signedraconique.js
@@ -36,9 +36,9 @@ export class RdDSigneDraconiqueItemSheet extends RdDItemSheet {
if (!this.options.editable) return;
- html.find(".signe-aleatoire").click(event => this.setSigneAleatoire());
- html.find("input.select-tmr").change(event => this.onSelectTmr(event));
- html.find(".signe-xp-sort").change(event => this.onValeurXpSort(event.currentTarget.attributes['data-typereussite']?.value, Number(event.currentTarget.value)));
+ html.find(".signe-aleatoire").click(async event => await this.setSigneAleatoire());
+ html.find("input.select-tmr").change(async event => await this.onSelectTmr(event));
+ html.find(".signe-xp-sort").change(async event => await this.onValeurXpSort(event.currentTarget.attributes['data-typereussite']?.value, Number(event.currentTarget.value)));
}
async setSigneAleatoire() {
diff --git a/module/migrations.js b/module/migrations.js
index 6ea83ac3..6bde358b 100644
--- a/module/migrations.js
+++ b/module/migrations.js
@@ -614,7 +614,7 @@ class _12_0_37_MigrationAlchimieEtat extends Migration {
return ['Alchimie', 'Repos', 'Soin', 'Autre'].includes(categorie) ? 'Liquide' : 'Autre'
}
- async migratePotion(potion) {
+ migratePotion(potion) {
const newCategorie = this.mappingCategorie(potion.system.categorie)
return {
_id: potion.id,
@@ -625,6 +625,19 @@ class _12_0_37_MigrationAlchimieEtat extends Migration {
}
}
+class _12_0_38_TachesEcriture extends Migration {
+ get code() { return "migration-tache-ecriture" }
+ get version() { return "12.0.38" }
+
+ async migrate() {
+ await this.applyItemsUpdates(items => items
+ .filter(it => [ITEM_TYPES.tache, ITEM_TYPES.livre, ITEM_TYPES.oeuvre, ITEM_TYPES.meditation].includes(it.type) )
+ .filter(it => it.system.competence == 'Ecriture')
+ .map(it => { return { _id: it.id, 'system.competence': 'Écriture' } })
+ )
+ }
+}
+
export class Migrations {
static getMigrations() {
return [
@@ -647,6 +660,7 @@ export class Migrations {
new _12_0_26_MigrationVoieSorts(),
new _12_0_32_MigrationRaces(),
new _12_0_37_MigrationAlchimieEtat(),
+ new _12_0_38_TachesEcriture()
];
}
diff --git a/module/rdd-carac.js b/module/rdd-carac.js
index f5ad6b31..a8c2dcd8 100644
--- a/module/rdd-carac.js
+++ b/module/rdd-carac.js
@@ -57,7 +57,7 @@ export const LIST_CARAC_PERSONNAGE = {
}
export const LIST_CARAC_AUTRES = {
- 'perception': { code: 'perception', label: 'Perception', path: 'system.carac.perception.value' },
+ 'perception': { code: 'perception', label: 'Perception', path: 'system.carac.perception.value' },
}
const LIST_CARAC_DERIVEE = {
@@ -75,12 +75,12 @@ const LIST_CARAC_ROLL = Object.values(LIST_CARAC_PERSONNAGE).filter(it => it.isC
export class RdDCarac {
- static caracDetails(name) {
+ static caracDetails(name, options = { onMessage: undefined }) {
let entry = Misc.findFirstLike(name, LIST_CARAC_ROLL, { mapper: it => it.code, description: 'caractéristique', onMessage: m => { } })
if (entry) {
return entry
}
- return Misc.findFirstLike(name, LIST_CARAC_ROLL, { mapper: it => it.label, description: 'caractéristique' })
+ return Misc.findFirstLike(name, LIST_CARAC_ROLL, { mapper: it => it.label, description: 'caractéristique', onMessage: options.onMessage })
}
static carac(code) {
diff --git a/module/rdd-combat.js b/module/rdd-combat.js
index f0301131..231bf7a8 100644
--- a/module/rdd-combat.js
+++ b/module/rdd-combat.js
@@ -13,6 +13,7 @@ import { ReglesOptionnelles } from "./settings/regles-optionnelles.js";
import { STATUSES } from "./settings/status-effects.js";
import { Targets } from "./targets.js";
import { RdDEmpoignade } from "./rdd-empoignade.js";
+import { RdDRollResult } from "./rdd-roll-result.js";
/* -------------------------------------------- */
const premierRoundInit = [
@@ -361,7 +362,7 @@ export class RdDCombatManager extends Combat {
}
/* -------------------------------------------- */
- static listActionsActorCombatant( actor) {
+ static listActionsActorCombatant(actor) {
const possessions = actor.listActionsPossessions()
const actions = possessions.length > 0
? possessions
@@ -667,7 +668,7 @@ export class RdDCombat {
const activite = this._ajustementMouvement(this.defender)
const total = [portee, taille, activite].map(it => it.diff).filter(d => !Number.isNaN(d)).reduce(Misc.sum(), 0)
ChatMessage.create({
- content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-info-distance.html', {
+ content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-info-distance.hbs', {
rollData: rollData,
attacker: _token,
isVisible: isVisible,
@@ -734,7 +735,7 @@ export class RdDCombat {
await this.proposerAjustementTirLancer(rollData)
const dialog = await RdDRoll.create(this.attacker, rollData,
- { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.html' },
+ { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.hbs' },
{
name: 'jet-attaque',
label: 'Attaque: ' + (arme?.name ?? competence.name),
@@ -742,16 +743,23 @@ export class RdDCombat {
this.attacker.createCallbackExperience(),
this.attacker.createCallbackAppelAuMoral(),
{ action: r => this.removeChatMessageActionsPasseArme(r.passeArme) },
- { condition: r => arme && !RdDCombat.isParticuliere(r), action: r => this.attacker.incDecItemUse(arme._id) },
- { condition: r => (RdDCombat.isReussite(r) && !RdDCombat.isParticuliere(r)), action: r => this._onAttaqueNormale(r) },
- { condition: RdDCombat.isParticuliere, action: r => this._onAttaqueParticuliere(r) },
- { condition: RdDCombat.isEchec, action: r => this._onAttaqueEchec(r) },
- { condition: RdDCombat.isEchecTotal, action: r => this._onAttaqueEchecTotal(r) },
+ { action: r => this._increaseItemUse(r, arme) },
+ { action: r => this._onAttaqueNormale(r) },
+ { action: r => this._onAttaqueParticuliere(r) },
+ { action: r => this._onAttaqueEchec(r) },
+ { action: r => this._onAttaqueEchecTotal(r) },
]
});
dialog.render(true);
}
+ _increaseItemUse(rollData, arme) {
+ if (!arme || RdDCombat.isParticuliere(rollData)) {
+ return
+ }
+ this.attacker.incDecItemUse(arme._id)
+ }
+
/* -------------------------------------------- */
_prepareAttaque(competence, arme) {
let rollData = {
@@ -768,7 +776,7 @@ export class RdDCombat {
if (this.attacker.isCreatureEntite()) {
RdDItemCompetenceCreature.setRollDataCreature(rollData);
- }
+ }
else if (arme) {
// Usual competence
rollData.arme = RdDItemArme.armeUneOuDeuxMains(arme, RdDItemCompetence.isArmeUneMain(competence));
@@ -784,7 +792,9 @@ export class RdDCombat {
/* -------------------------------------------- */
async _onAttaqueParticuliere(rollData) {
-
+ if (!RdDCombat.isParticuliere(rollData)) {
+ return
+ }
const isMeleeDiffNegative = (rollData.competence.type == 'competencecreature' || rollData.selectedCarac.label == "Mêlée") && rollData.diffLibre < 0;
// force toujours, sauf empoignade
// finesse seulement en mélée, pour l'empoignade, ou si la difficulté libre est de -1 minimum
@@ -806,7 +816,7 @@ export class RdDCombat {
const choixParticuliere = await ChatMessage.create({
alias: this.attacker.getAlias(),
whisper: ChatUtility.getOwners(this.attacker),
- content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-demande-attaque-particuliere.html', {
+ content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-demande-attaque-particuliere.hbs', {
alias: this.attacker.getAlias(),
attackerId: this.attackerId,
attackerToken: this.attackerToken,
@@ -822,6 +832,9 @@ export class RdDCombat {
/* -------------------------------------------- */
async _onAttaqueNormale(attackerRoll) {
+ if (!RdDCombat.isReussite(attackerRoll) || RdDCombat.isParticuliere(attackerRoll)) {
+ return
+ }
console.log("RdDCombat.onAttaqueNormale >>>", attackerRoll);
attackerRoll.dmg = RdDBonus.dmg(attackerRoll, this.attacker, this.defender.isEntite());
@@ -830,7 +843,7 @@ export class RdDCombat {
cible: this.defender?.getAlias() ?? 'la cible',
isRecul: (attackerRoll.particuliere == 'force' || attackerRoll.tactique == 'charge')
}
- await RdDResolutionTable.displayRollData(attackerRoll, this.attacker, 'chat-resultat-attaque.html');
+ await RdDRollResult.displayRollData(attackerRoll, this.attacker, 'chat-resultat-attaque.hbs');
if (!await this.attacker.accorder(this.defender, 'avant-defense')) {
return;
@@ -895,7 +908,7 @@ export class RdDCombat {
speaker: ChatMessage.getSpeaker(this.defender, canvas.tokens.get(this.defenderTokenId)),
alias: this.attacker?.getAlias(),
whisper: ChatUtility.getOwners(this.defender),
- content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-demande-defense.html', paramDemandeDefense),
+ content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-demande-defense.hbs', paramDemandeDefense),
});
// flag pour garder les jets d'attaque/defense
ChatUtility.setMessageData(choixDefense, 'defender-roll', defenderRoll);
@@ -938,9 +951,12 @@ export class RdDCombat {
/* -------------------------------------------- */
async _onAttaqueEchecTotal(attackerRoll) {
+ if (!RdDCombat.isEchecTotal(attackerRoll)) {
+ return
+ }
const choixEchecTotal = await ChatMessage.create({
whisper: ChatUtility.getOwners(this.attacker),
- content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-demande-attaque-etotal.html', {
+ content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-demande-attaque-etotal.hbs', {
attackerId: this.attackerId,
attacker: this.attacker,
attackerToken: this.attackerToken,
@@ -965,8 +981,12 @@ export class RdDCombat {
/* -------------------------------------------- */
async _onAttaqueEchec(rollData) {
+ if (!RdDCombat.isEchec(rollData)) {
+ return
+ }
console.log("RdDCombat.onAttaqueEchec >>>", rollData);
- await RdDResolutionTable.displayRollData(rollData, this.attacker, 'chat-resultat-attaque.html');
+ await RdDRollResult.displayRollData(rollData, this.attacker, 'chat-resultat-attaque.hbs');
+
}
/* -------------------------------------------- */
@@ -995,7 +1015,7 @@ export class RdDCombat {
let rollData = this._prepareParade(attackerRoll, arme, competence);
const dialog = await RdDRoll.create(this.defender, rollData,
- { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.html' },
+ { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.hbs' },
{
name: 'jet-parade',
label: 'Parade: ' + (arme ? arme.name : rollData.competence.name),
@@ -1054,7 +1074,7 @@ export class RdDCombat {
await this.computeRecul(defenderRoll);
await this.computeDeteriorationArme(defenderRoll);
- await RdDResolutionTable.displayRollData(defenderRoll, this.defender, 'chat-resultat-parade.html');
+ await RdDRollResult.displayRollData(defenderRoll, this.defender, 'chat-resultat-parade.hbs');
this.removeChatMessageActionsPasseArme(defenderRoll.passeArme);
}
@@ -1062,7 +1082,7 @@ export class RdDCombat {
async _onParadeEchec(defenderRoll) {
console.log("RdDCombat._onParadeEchec >>>", defenderRoll);
- await RdDResolutionTable.displayRollData(defenderRoll, this.defender, 'chat-resultat-parade.html');
+ await RdDRollResult.displayRollData(defenderRoll, this.defender, 'chat-resultat-parade.hbs');
this.removeChatMessageActionsPasseArme(defenderRoll.passeArme);
this._sendMessageDefense(defenderRoll.attackerRoll, defenderRoll, { defense: true });
@@ -1079,7 +1099,7 @@ export class RdDCombat {
let rollData = this._prepareEsquive(attackerRoll, esquive);
const dialog = await RdDRoll.create(this.defender, rollData,
- { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.html' },
+ { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.hbs' },
{
name: 'jet-esquive',
label: 'Esquiver',
@@ -1129,7 +1149,7 @@ export class RdDCombat {
/* -------------------------------------------- */
async _onEsquiveNormale(defenderRoll) {
console.log("RdDCombat._onEsquiveNormal >>>", defenderRoll);
- await RdDResolutionTable.displayRollData(defenderRoll, this.defender, 'chat-resultat-esquive.html');
+ await RdDRollResult.displayRollData(defenderRoll, this.defender, 'chat-resultat-esquive.hbs');
this.removeChatMessageActionsPasseArme(defenderRoll.passeArme);
}
@@ -1137,7 +1157,7 @@ export class RdDCombat {
async _onEsquiveEchec(defenderRoll) {
console.log("RdDCombat._onEsquiveEchec >>>", defenderRoll);
- await RdDResolutionTable.displayRollData(defenderRoll, this.defender, 'chat-resultat-esquive.html');
+ await RdDRollResult.displayRollData(defenderRoll, this.defender, 'chat-resultat-esquive.hbs');
this.removeChatMessageActionsPasseArme(defenderRoll.passeArme);
this._sendMessageDefense(defenderRoll.attackerRoll, defenderRoll, { defense: true })
diff --git a/module/rdd-commands.js b/module/rdd-commands.js
index 8968afcb..5345f9f0 100644
--- a/module/rdd-commands.js
+++ b/module/rdd-commands.js
@@ -18,6 +18,7 @@ import { FenetreRechercheTirage } from "./tirage/fenetre-recherche-tirage.js";
import { TMRUtility } from "./tmr-utility.js";
import { DialogFatigueVoyage } from "./voyage/dialog-fatigue-voyage.js";
import { ChatUtility } from "./chat-utility.js";
+import { RdDRollResult } from "./rdd-roll-result.js";
const rddRollNumeric = /^(\d+)\s*([\+\-]?\d+)?\s*(s)?/;
@@ -256,7 +257,7 @@ export class RdDCommands {
let commands = []
this._buildSubTableHelp(commands, table ?? this.commandsTable);
- let html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/settings/dialog-aide-commands.html", { commands: commands });
+ let html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/settings/dialog-aide-commands.hbs", { commands: commands });
let d = new Dialog(
{
title: "Commandes disponibles dans le tchat",
@@ -349,7 +350,7 @@ export class RdDCommands {
show: { title: "Table de résolution" }
};
await RdDResolutionTable.rollData(rollData);
- return RdDCommands._chatAnswer(msg, await RdDResolutionTable.buildRollDataHtml(rollData));
+ return RdDCommands._chatAnswer(msg, await RdDRollResult.buildRollDataHtml(rollData));
}
/* -------------------------------------------- */
diff --git a/module/rdd-empoignade.js b/module/rdd-empoignade.js
index cd49d881..42e8fdd9 100644
--- a/module/rdd-empoignade.js
+++ b/module/rdd-empoignade.js
@@ -1,12 +1,10 @@
/* -------------------------------------------- */
-import { RdDResolutionTable } from "./rdd-resolution-table.js";
import { RdDRoll } from "./rdd-roll.js";
import { RdDItemCompetenceCreature } from "./item-competencecreature.js";
import { ChatUtility } from "./chat-utility.js";
import { STATUSES } from "./settings/status-effects.js";
import { ITEM_TYPES } from "./constants.js";
-
-/* -------------------------------------------- */
+import { RdDRollResult } from "./rdd-roll-result.js";
/* -------------------------------------------- */
export class RdDEmpoignade {
@@ -159,7 +157,7 @@ export class RdDEmpoignade {
if ((isNouvelle || empoignade.system.pointsemp == 0) && defender.hasArmeeMeleeEquipee()) {
ChatUtility.createChatWithRollMode(
{
- content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-empoignade-valider.html`, { attacker: attacker, defender: defender })
+ content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-empoignade-valider.hbs`, { attacker: attacker, defender: defender })
},
attacker
)
@@ -192,7 +190,7 @@ export class RdDEmpoignade {
}
if (empoignade.system.pointsemp >= 2) {
if (!empoignade.system.ausol) {
- let msg = await RdDResolutionTable.displayRollData(rollData, attacker, 'chat-empoignade-entrainer.html');
+ let msg = await RdDRollResult.displayRollData(rollData, attacker, 'chat-empoignade-entrainer.hbs');
RdDEmpoignade.$storeRollEmpoignade(msg, rollData);
}
} else {
@@ -216,7 +214,7 @@ export class RdDEmpoignade {
}
const msg = await ChatMessage.create({
whisper: ChatUtility.getOwners(attacker),
- content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-empoignade-immobilise.html`, rollData)
+ content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-empoignade-immobilise.hbs`, rollData)
})
RdDEmpoignade.$storeRollEmpoignade(msg, rollData);
}
@@ -224,7 +222,7 @@ export class RdDEmpoignade {
/* -------------------------------------------- */
static async $rollAttaqueEmpoignade(attacker, rollData, isNouvelle = false) {
const dialog = await RdDRoll.create(attacker, rollData,
- { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.html' },
+ { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.hbs' },
{
name: 'jet-empoignade',
label: 'Empoigner',
@@ -250,7 +248,7 @@ export class RdDEmpoignade {
if (rollData.rolled.isPart) {
rollData.particuliere = "finesse";
}
- let msg = await RdDResolutionTable.displayRollData(rollData, defender, 'chat-empoignade-resultat.html');
+ let msg = await RdDRollResult.displayRollData(rollData, defender, 'chat-empoignade-resultat.hbs');
RdDEmpoignade.$storeRollEmpoignade(msg, rollData);
}
@@ -287,7 +285,7 @@ export class RdDEmpoignade {
/* -------------------------------------------- */
static async $rollDefenseEmpoignade(defender, defenderRoll) {
const dialog = await RdDRoll.create(defender, defenderRoll,
- { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-defense-empoignade.html' },
+ { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-defense-empoignade.hbs' },
{
name: 'empoignade',
label: 'Contrer',
@@ -312,9 +310,9 @@ export class RdDEmpoignade {
RdDEmpoignade.$updateEtatEmpoignade(empoignade)
}
- await RdDResolutionTable.displayRollData(rollData, rollData.defender, 'chat-empoignade-resultat.html')
+ await RdDRollResult.displayRollData(rollData, rollData.defender, 'chat-empoignade-resultat.hbs')
if (empoignade.system.pointsemp >= 2) {
- let msg = await RdDResolutionTable.displayRollData(rollData, rollData.attacker, 'chat-empoignade-entrainer.html');
+ let msg = await RdDRollResult.displayRollData(rollData, rollData.attacker, 'chat-empoignade-entrainer.hbs');
RdDEmpoignade.$storeRollEmpoignade(msg, rollData);
}
}
@@ -358,7 +356,7 @@ export class RdDEmpoignade {
await attacker.setEffect(STATUSES.StatusProne, true);
await defender.setEffect(STATUSES.StatusProne, true);
- let msg = await RdDResolutionTable.displayRollData(rollData, attacker, 'chat-empoignade-entrainer-sol.html');
+ let msg = await RdDRollResult.displayRollData(rollData, attacker, 'chat-empoignade-entrainer-sol.hbs');
RdDEmpoignade.$storeRollEmpoignade(msg, rollData);
}
@@ -374,7 +372,7 @@ export class RdDEmpoignade {
await defender.setEffect(STATUSES.StatusProne, true);
await this.$deleteEmpoignade(empoignade)
- let msg = await RdDResolutionTable.displayRollData(rollData, attacker, 'chat-empoignade-projeter-sol.html');
+ let msg = await RdDRollResult.displayRollData(rollData, attacker, 'chat-empoignade-projeter-sol.hbs');
RdDEmpoignade.$storeRollEmpoignade(msg, rollData);
}
@@ -401,7 +399,7 @@ export class RdDEmpoignade {
if (perteMode == "endquart") {
await defender.santeIncDec("endurance", -(3 * Math.floor(endValue / 4)));
}
- let msg = await RdDResolutionTable.displayRollData(rollData, attacker, 'chat-empoignade-perte-endurance.html');
+ let msg = await RdDRollResult.displayRollData(rollData, attacker, 'chat-empoignade-perte-endurance.hbs');
RdDEmpoignade.$storeRollEmpoignade(msg, rollData);
}
diff --git a/module/rdd-meteo.js b/module/rdd-meteo.js
index 6b4266b3..e3512f22 100644
--- a/module/rdd-meteo.js
+++ b/module/rdd-meteo.js
@@ -117,7 +117,7 @@ export class RdDMeteo {
meteo.pluie.description = RdDMeteo.pluie(meteo.pluie.force);
ChatMessage.create({
- content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-resultat-meteo.html', meteo),
+ content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-resultat-meteo.hbs', meteo),
whisper: ChatUtility.getGMs()
});
}
diff --git a/module/rdd-namegen.js b/module/rdd-namegen.js
index a5f27067..f0768cf7 100644
--- a/module/rdd-namegen.js
+++ b/module/rdd-namegen.js
@@ -13,7 +13,7 @@ const words = ['pore', 'pre', 'flor', 'lane', 'turlu', 'pin', 'a', 'alph', 'i',
export class RdDNameGen {
static async proposeName(msg, params) {
- const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-command-nom.html`, {
+ const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-command-nom.hbs`, {
nom: await RdDNameGen.generate()
});
ChatMessage.create({ content: html, whisper: ChatUtility.getGMs() });
diff --git a/module/rdd-possession.js b/module/rdd-possession.js
index 483a9603..6b7d1f89 100644
--- a/module/rdd-possession.js
+++ b/module/rdd-possession.js
@@ -1,9 +1,9 @@
-/* -------------------------------------------- */
-import { RdDResolutionTable } from "./rdd-resolution-table.js";
import { RdDRoll } from "./rdd-roll.js";
import { RdDItemCompetenceCreature } from "./item-competencecreature.js";
import { Targets } from "./targets.js";
import { ITEM_TYPES } from "./constants.js";
+import { RdDRollResult } from "./rdd-roll-result.js";
+import { Grammar } from "./grammar.js";
/* -------------------------------------------- */
/* On part du principe qu'une entité démarre tjs
@@ -91,14 +91,17 @@ export class RdDPossession {
}
RdDPossession.selectCompetenceDraconicOuPossession(rollData, defender)
rollData.diffLibre = RdDPossession.getInfoAttaque(rollData).diffLibre
-
+
await RdDPossession.$rollDefensePossession(defender, rollData);
}
-
+
static selectCompetenceDraconicOuPossession(rollData, rollingActor) {
rollData.competence = rollingActor.getDraconicOuPossession();
if (rollingActor.isCreatureEntite()) {
- RdDItemCompetenceCreature.setRollDataCreature(rollData)
+ const carac = rollingActor.system.carac
+ rollData.carac = carac
+ rollData.competence.system.defaut_carac = 'reve'
+ rollData.selectedCarac = carac.reve
}
else {
rollData.selectedCarac = rollingActor.system.carac.reve
@@ -110,7 +113,7 @@ export class RdDPossession {
/* -------------------------------------------- */
static async $rollAttaquePossession(attacker, rollData, isNouvelle = false) {
const dialog = await RdDRoll.create(attacker, rollData,
- { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.html' },
+ { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.hbs' },
{
name: 'jet-possession',
label: rollData.isECNIDefender ? 'Conjurer la possession' : 'Possession',
@@ -131,13 +134,13 @@ export class RdDPossession {
}
const possession = (rollData.isECNIDefender ? rollData.attacker : rollData.defender).getPossession(rollData.possession.system.possessionid)
RdDPossession.storePossessionAttaque(possession, rollData)
- await RdDResolutionTable.displayRollData(rollData, rollData.defender, 'chat-resultat-possession.html');
+ await RdDRollResult.displayRollData(rollData, rollData.defender, 'chat-resultat-possession.hbs');
}
/* -------------------------------------------- */
static async $rollDefensePossession(defender, rollData) {
const dialog = await RdDRoll.create(defender, rollData,
- { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-defense-possession.html' },
+ { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-defense-possession.hbs' },
{
name: 'possession',
label: 'Conjurer une Possession',
@@ -171,7 +174,7 @@ export class RdDPossession {
rollData.possession = possession
RdDPossession.$updateEtatPossession(rollData.possession)
- await RdDResolutionTable.displayRollData(rollData, rollData.attacker, 'chat-resultat-possession.html')
+ await RdDRollResult.displayRollData(rollData, rollData.attacker, 'chat-resultat-possession.hbs')
if (rollData.possession.isPosseder || rollData.possession.isConjurer) {
// conjuration
await victime.deleteEmbeddedDocuments("Item", [rollData.possession._id])
diff --git a/module/rdd-resolution-table.js b/module/rdd-resolution-table.js
index d231370c..c78b42ef 100644
--- a/module/rdd-resolution-table.js
+++ b/module/rdd-resolution-table.js
@@ -54,7 +54,6 @@ export class RdDResolutionTable {
return this._computeCell(level, percentage);
}
-
/* -------------------------------------------- */
static _computeRow(caracValue) {
let dataRow = [
@@ -89,24 +88,10 @@ export class RdDResolutionTable {
return resultat;
}
- /* -------------------------------------------- */
- static async displayRollData(rollData, actor = undefined, template = 'chat-resultat-general.html') {
- return await ChatUtility.createChatWithRollMode(
- { content: await RdDResolutionTable.buildRollDataHtml(rollData, template) },
- actor
- )
- }
-
static actorChatName(actor) {
return actor ?? game.user.name;
}
- /* -------------------------------------------- */
- static async buildRollDataHtml(rollData, template = 'chat-resultat-general.html') {
- rollData.show = rollData.show || {};
- return await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/${template}`, rollData);
- }
-
/* -------------------------------------------- */
static async rollData(rollData) {
rollData.rolled = await this.roll(rollData.caracValue, rollData.finalLevel, rollData);
@@ -284,7 +269,7 @@ export class RdDResolutionTable {
maxCarac = Math.min(maxCarac, minCarac + 20);
minLevel = Math.max(minLevel, -10);
maxLevel = Math.max(Math.min(maxLevel, 30), minLevel + colonnes);
- return await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/resolution-table.html', {
+ return await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/resolution-table.hbs', {
carac: carac,
difficulte: level,
min: minLevel,
diff --git a/module/rdd-roll-encaisser.js b/module/rdd-roll-encaisser.js
index 14748a6e..9b5728bc 100644
--- a/module/rdd-roll-encaisser.js
+++ b/module/rdd-roll-encaisser.js
@@ -8,7 +8,7 @@ import { RdDUtility } from "./rdd-utility.js";
export class RdDEncaisser extends Dialog {
static async encaisser(actor) {
- let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-encaisser.html',
+ let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-encaisser.hbs',
{ ajustementsEncaissement: RdDUtility.getAjustementsEncaissement() }
);
new RdDEncaisser(html, actor).render(true);
diff --git a/module/rdd-roll-resolution-table.js b/module/rdd-roll-resolution-table.js
index 74c8655b..f82cb9df 100644
--- a/module/rdd-roll-resolution-table.js
+++ b/module/rdd-roll-resolution-table.js
@@ -15,7 +15,7 @@ export class RdDRollResolutionTable extends Dialog {
if (RdDRollResolutionTable.resolutionTable == undefined) {
const rollData = {}
RdDRollResolutionTable._setDefaultOptions(rollData);
- let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-resolution.html', rollData);
+ let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-resolution.hbs', rollData);
RdDRollResolutionTable.resolutionTable = new RdDRollResolutionTable(rollData, html);
RdDRollResolutionTable.resolutionTable.render(true);
}
diff --git a/module/rdd-roll-result.js b/module/rdd-roll-result.js
new file mode 100644
index 00000000..eabc5f92
--- /dev/null
+++ b/module/rdd-roll-result.js
@@ -0,0 +1,17 @@
+import { ChatUtility } from "./chat-utility.js";
+
+export class RdDRollResult {
+
+ static async displayRollData(rollData, actor = undefined, template = 'chat-resultat-general.hbs') {
+ const chatMessage = await ChatUtility.createChatWithRollMode(
+ { content: await RdDRollResult.buildRollDataHtml(rollData, template) },
+ actor
+ )
+ return chatMessage
+ }
+
+ static async buildRollDataHtml(rollData, template = 'chat-resultat-general.hbs') {
+ rollData.show = rollData.show || {};
+ return await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/${template}`, rollData);
+ }
+}
diff --git a/module/rdd-roll.js b/module/rdd-roll.js
index 6c88cd8e..128a7a8e 100644
--- a/module/rdd-roll.js
+++ b/module/rdd-roll.js
@@ -138,9 +138,9 @@ export class RdDRoll extends Dialog {
}
if (this.rollData.selectedCarac) {
this.html.find("[name='carac']").val(
- this.actor?.type == ACTOR_TYPES.personnage
- ? RdDCarac.caracDetails(this.rollData.selectedCarac.label).code
- : this.rollData.selectedCarac.label
+ RdDCarac.caracDetails(this.rollData.selectedCarac.label, { onMessage: m => { } })?.code
+ ?? this.rollData.selectedCarac.code
+ ?? Grammar.toLowerCaseNoAccentNoSpace(this.rollData.selectedCarac.label)
)
}
if (this.rollData.selectedSort) {
@@ -269,15 +269,12 @@ export class RdDRoll extends Dialog {
}
async onAction(action) {
- this.rollData.forceDiceResult = Number.parseInt(this.html.find("[name='force-dice-result']").val()) ?? -1;
- await RdDResolutionTable.rollData(this.rollData);
- console.log("RdDRoll -=>", this.rollData, this.rollData.rolled);
- if (action.callbacks)
- for (let callback of action.callbacks) {
- if (callback.condition == undefined || callback.condition(this.rollData)) {
- await callback.action(this.rollData);
- }
- }
+ this.rollData.forceDiceResult = Number.parseInt(this.html.find("[name='force-dice-result']").val()) ?? -1
+ await RdDResolutionTable.rollData(this.rollData)
+
+ for (let callback of action.callbacks) {
+ await callback.action(this.rollData)
+ }
}
async setSelectedSort(sort) {
@@ -286,7 +283,7 @@ export class RdDRoll extends Dialog {
this.rollData.bonus = RdDItemSort.getCaseBonus(sort, this.rollData.tmr.coord);
this.rollData.diffLibre = RdDItemSort.getDifficulte(sort, -7);
RdDItemSort.setCoutReveReel(sort);
- const htmlSortDescription = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/partial-description-sort.html", { sort: sort });
+ const htmlSortDescription = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/partial-description-sort.hbs", { sort: sort });
this.html.find(".sort-ou-rituel").text(sort.system.isrituel ? "rituel" : "sort");
this.html.find(".bonus-case").text(`${this.rollData.bonus}%`);
this.html.find(".placeholder-description-sort").children().remove();
@@ -347,7 +344,7 @@ export class RdDRoll extends Dialog {
/* -------------------------------------------- */
async buildAjustements(rollData) {
- return await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/partial-roll-ajustements.html`, rollData);
+ return await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/partial-roll-ajustements.hbs`, rollData);
}
/* -------------------------------------------- */
diff --git a/module/rdd-tmr-dialog.js b/module/rdd-tmr-dialog.js
index 221fc278..7fa15384 100644
--- a/module/rdd-tmr-dialog.js
+++ b/module/rdd-tmr-dialog.js
@@ -48,7 +48,7 @@ export class RdDTMRDialog extends Dialog {
static async create(actor, tmrData) {
await PixiTMR.init()
- let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-tmr.html', tmrData);
+ let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-tmr.hbs', tmrData);
if (tmrData.mode != 'visu' && !game.user.isGM) {
ChatMessage.create({ content: actor.name + " est monté dans les TMR en mode : " + tmrData.mode, whisper: ChatUtility.getGMs() });
}
@@ -497,7 +497,7 @@ export class RdDTMRDialog extends Dialog {
ChatMessage.create({
whisper: ChatUtility.getOwners(this.actor),
- content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-rencontre-tmr.html`, rencData)
+ content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-rencontre-tmr.hbs`, rencData)
});
this.updateValuesDisplay();
@@ -724,7 +724,7 @@ export class RdDTMRDialog extends Dialog {
rollData.poesie = await Poetique.getExtrait();
ChatMessage.create({
whisper: ChatUtility.getOwners(this.actor),
- content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-resultat-maitrise-tmr.html`, rollData)
+ content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-resultat-maitrise-tmr.hbs`, rollData)
});
if (rollData.rolled.isEchec) {
await this.close();
@@ -841,7 +841,7 @@ export class RdDTMRDialog extends Dialog {
rollData.poesie = await Poetique.getExtrait();
ChatMessage.create({
whisper: ChatUtility.getOwners(this.actor),
- content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-resultat-maitrise-tmr.html`, rollData)
+ content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-resultat-maitrise-tmr.hbs`, rollData)
});
if (rollData.rolled.isEchec) {
options.onConqueteEchec(rollData, options.effetDraconique);
@@ -857,7 +857,7 @@ export class RdDTMRDialog extends Dialog {
rollData.isTMRCache = rollData.actor.isTMRCache();
const dialog = await RdDRoll.create(this.actor, rollData,
{
- html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-maitrise-tmr.html',
+ html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-maitrise-tmr.hbs',
},
{
name: rollData.maitrise.verbe, label: rollData.maitrise.action,
@@ -1098,7 +1098,7 @@ export class RdDTMRDialog extends Dialog {
if (!this.viewOnly && this.actor.isResonanceSigneDraconique(coord)) {
ChatMessage.create({
whisper: ChatUtility.getOwners(this.actor),
- content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-signe-draconique-resonance.html`, {
+ content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-signe-draconique-resonance.hbs`, {
alias: this.actor.getAlias(),
typeTMR: TMRUtility.getTMRType(coord)
})
diff --git a/module/rdd-token-hud.js b/module/rdd-token-hud.js
index e7639743..ee8369a4 100644
--- a/module/rdd-token-hud.js
+++ b/module/rdd-token-hud.js
@@ -52,7 +52,7 @@ export class RdDTokenHud {
};
const controlIconCombat = html.find('.control-icon[data-action=combat]');
await RdDTokenHud._configureSubMenu(controlIconCombat,
- 'systems/foundryvtt-reve-de-dragon/templates/hud-actor-init.html',
+ 'systems/foundryvtt-reve-de-dragon/templates/hud-actor-init.hbs',
hudData,
(event) => {
let initCommand = event.currentTarget.attributes['data-command']?.value;
@@ -70,7 +70,7 @@ export class RdDTokenHud {
static async addExtensionHudCombat(html, combatant, token, actions) {
const hudData = { combatant, token, actions, commandes: [] };
const controlIconTarget = html.find('.control-icon[data-action=target]');
- await RdDTokenHud._configureSubMenu(controlIconTarget, 'systems/foundryvtt-reve-de-dragon/templates/hud-actor-attaque.html', hudData,
+ await RdDTokenHud._configureSubMenu(controlIconTarget, 'systems/foundryvtt-reve-de-dragon/templates/hud-actor-attaque.hbs', hudData,
(event) => {
const actionIndex = event.currentTarget.attributes['data-action-index']?.value;
const action = hudData.actions[actionIndex];
diff --git a/module/rdd-utility.js b/module/rdd-utility.js
index 42c7f96b..a15daf61 100644
--- a/module/rdd-utility.js
+++ b/module/rdd-utility.js
@@ -112,34 +112,34 @@ export class RdDUtility {
static preloadHandlebarsTemplates() {
const templatePaths = [
//Character Sheets
- 'systems/foundryvtt-reve-de-dragon/templates/actor-sheet.html',
- 'systems/foundryvtt-reve-de-dragon/templates/actor-creature-sheet.html',
- 'systems/foundryvtt-reve-de-dragon/templates/actor-entite-sheet.html',
- 'systems/foundryvtt-reve-de-dragon/templates/actor-vehicule-sheet.html',
+ 'systems/foundryvtt-reve-de-dragon/templates/actor-sheet.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/actor-creature-sheet.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/actor-entite-sheet.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/actor-vehicule-sheet.hbs',
// sous-parties de feuilles de personnages
'systems/foundryvtt-reve-de-dragon/templates/actor/item-action-controls.hbs',
- 'systems/foundryvtt-reve-de-dragon/templates/actor/header-buttons.html',
- 'systems/foundryvtt-reve-de-dragon/templates/actor/header-etat.html',
- 'systems/foundryvtt-reve-de-dragon/templates/actor/header-compteurs.html',
- 'systems/foundryvtt-reve-de-dragon/templates/actor/header-compteurs-creature.html',
- 'systems/foundryvtt-reve-de-dragon/templates/actor/header-compteurs-entitee.html',
- 'systems/foundryvtt-reve-de-dragon/templates/actor/header-effects.html',
- 'systems/foundryvtt-reve-de-dragon/templates/actor/header-hautreve.html',
+ 'systems/foundryvtt-reve-de-dragon/templates/actor/header-buttons.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/actor/header-etat.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/actor/header-compteurs.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/actor/header-compteurs-creature.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/actor/header-compteurs-entitee.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/actor/header-effects.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/actor/header-hautreve.hbs',
'systems/foundryvtt-reve-de-dragon/templates/actor/archetype.hbs',
- 'systems/foundryvtt-reve-de-dragon/templates/actor/vue-detaillee.html',
+ 'systems/foundryvtt-reve-de-dragon/templates/actor/vue-detaillee.hbs',
'systems/foundryvtt-reve-de-dragon/templates/actor/armures.hbs',
- 'systems/foundryvtt-reve-de-dragon/templates/actor/carac-main.html',
- 'systems/foundryvtt-reve-de-dragon/templates/actor/carac-derivee.html',
- 'systems/foundryvtt-reve-de-dragon/templates/actor/carac-creature.html',
- 'systems/foundryvtt-reve-de-dragon/templates/actor/carac-entitee.html',
+ 'systems/foundryvtt-reve-de-dragon/templates/actor/carac-main.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/actor/carac-derivee.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/actor/carac-creature.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/actor/carac-entitee.hbs',
'systems/foundryvtt-reve-de-dragon/templates/actor/comp-creature.hbs',
'systems/foundryvtt-reve-de-dragon/templates/actor/comp-possession.hbs',
- 'systems/foundryvtt-reve-de-dragon/templates/actor/carac-total.html',
+ 'systems/foundryvtt-reve-de-dragon/templates/actor/carac-total.hbs',
'systems/foundryvtt-reve-de-dragon/templates/actor/competence.hbs',
- 'systems/foundryvtt-reve-de-dragon/templates/actor/competence-categorie.html',
- 'systems/foundryvtt-reve-de-dragon/templates/actor/xp-competences.html',
- 'systems/foundryvtt-reve-de-dragon/templates/actor/combat.html',
- 'systems/foundryvtt-reve-de-dragon/templates/actor/blessures.html',
+ 'systems/foundryvtt-reve-de-dragon/templates/actor/competence-categorie.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/actor/xp-competences.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/actor/combat.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/actor/blessures.hbs',
'systems/foundryvtt-reve-de-dragon/templates/actor/blessure.hbs',
'systems/foundryvtt-reve-de-dragon/templates/actor/maladies-poisons.hbs',
'systems/foundryvtt-reve-de-dragon/templates/actor/possessions.hbs',
@@ -149,11 +149,11 @@ export class RdDUtility {
'systems/foundryvtt-reve-de-dragon/templates/actor/oeuvre.hbs',
'systems/foundryvtt-reve-de-dragon/templates/actor/jeus.hbs',
'systems/foundryvtt-reve-de-dragon/templates/actor/alchimie.hbs',
- 'systems/foundryvtt-reve-de-dragon/templates/actor/astrologie.html',
+ 'systems/foundryvtt-reve-de-dragon/templates/actor/astrologie.hbs',
'systems/foundryvtt-reve-de-dragon/templates/actor/chirurgie.hbs',
'systems/foundryvtt-reve-de-dragon/templates/actor/non-haut-revant.hbs',
'systems/foundryvtt-reve-de-dragon/templates/actor/haut-revant.hbs',
- 'systems/foundryvtt-reve-de-dragon/templates/actor/dragon-queues.html',
+ 'systems/foundryvtt-reve-de-dragon/templates/actor/dragon-queues.hbs',
'systems/foundryvtt-reve-de-dragon/templates/actor/dragon-queue.hbs',
'systems/foundryvtt-reve-de-dragon/templates/actor/dragon-souffles.hbs',
'systems/foundryvtt-reve-de-dragon/templates/actor/dragon-tetes.hbs',
@@ -163,9 +163,9 @@ export class RdDUtility {
'systems/foundryvtt-reve-de-dragon/templates/actor/hr-sorts-reserve.hbs',
'systems/foundryvtt-reve-de-dragon/templates/actor/hr-meditations.hbs',
'systems/foundryvtt-reve-de-dragon/templates/actor/hr-casetmrs.hbs',
- 'systems/foundryvtt-reve-de-dragon/templates/actor/xp-journal.html',
- 'systems/foundryvtt-reve-de-dragon/templates/actor/editor-notes-mj.html',
- 'systems/foundryvtt-reve-de-dragon/templates/actor/inventaire.html',
+ 'systems/foundryvtt-reve-de-dragon/templates/actor/xp-journal.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/actor/editor-notes-mj.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/actor/inventaire.hbs',
'systems/foundryvtt-reve-de-dragon/templates/actor/inventaire-item.hbs',
"systems/foundryvtt-reve-de-dragon/templates/actor/inventaire-monnaie.hbs",
'systems/foundryvtt-reve-de-dragon/templates/actor/liens-animaux.hbs',
@@ -176,36 +176,36 @@ export class RdDUtility {
//Items
'systems/foundryvtt-reve-de-dragon/templates/scripts/autocomplete-script.hbs',
'systems/foundryvtt-reve-de-dragon/templates/scripts/autocomplete.hbs',
- 'systems/foundryvtt-reve-de-dragon/templates/item/boutons-comestible.html',
+ 'systems/foundryvtt-reve-de-dragon/templates/item/boutons-comestible.hbs',
'systems/foundryvtt-reve-de-dragon/templates/item/icon-arme-broken.hbs',
'systems/foundryvtt-reve-de-dragon/templates/item/temporel.hbs',
- 'systems/foundryvtt-reve-de-dragon/templates/item/partial-inventaire.html',
- 'systems/foundryvtt-reve-de-dragon/templates/item/partial-environnement.html',
- 'systems/foundryvtt-reve-de-dragon/templates/item/partial-tab-environnement.html',
- 'systems/foundryvtt-reve-de-dragon/templates/header-item.html',
+ 'systems/foundryvtt-reve-de-dragon/templates/item/partial-inventaire.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/item/partial-environnement.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/item/partial-tab-environnement.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/header-item.hbs',
'systems/foundryvtt-reve-de-dragon/templates/item/queue-sheet.hbs',
// partial enums
- 'systems/foundryvtt-reve-de-dragon/templates/enum-aspect-tarot.html',
- 'systems/foundryvtt-reve-de-dragon/templates/enum-base-competence.html',
- 'systems/foundryvtt-reve-de-dragon/templates/enum-caracteristiques.html',
- 'systems/foundryvtt-reve-de-dragon/templates/enum-categories.html',
- 'systems/foundryvtt-reve-de-dragon/templates/enum-categorie-ingredient.html',
- 'systems/foundryvtt-reve-de-dragon/templates/enum-categorie-parade.html',
+ 'systems/foundryvtt-reve-de-dragon/templates/enum-aspect-tarot.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/enum-base-competence.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/enum-caracteristiques.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/enum-categories.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/enum-categorie-ingredient.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/enum-categorie-parade.hbs',
'systems/foundryvtt-reve-de-dragon/templates/item/enum-categorie-alchimie.hbs',
'systems/foundryvtt-reve-de-dragon/templates/item/enum-etat-alchimie.hbs',
- 'systems/foundryvtt-reve-de-dragon/templates/enum-categorie-queue.html',
- 'systems/foundryvtt-reve-de-dragon/templates/enum-categorie-vehicule.html',
- 'systems/foundryvtt-reve-de-dragon/templates/enum-competence.html',
- 'systems/foundryvtt-reve-de-dragon/templates/enum-draconic.html',
- 'systems/foundryvtt-reve-de-dragon/templates/enum-heures.html',
- 'systems/foundryvtt-reve-de-dragon/templates/enum-initpremierround.html',
- 'systems/foundryvtt-reve-de-dragon/templates/enum-mortalite.html',
- 'systems/foundryvtt-reve-de-dragon/templates/enum-niveau-ethylisme.html',
- 'systems/foundryvtt-reve-de-dragon/templates/enum-periode.html',
- 'systems/foundryvtt-reve-de-dragon/templates/enum-rarete.html',
- 'systems/foundryvtt-reve-de-dragon/templates/enum-tmr-effet.html',
- 'systems/foundryvtt-reve-de-dragon/templates/enum-tmr-type.html',
+ 'systems/foundryvtt-reve-de-dragon/templates/enum-categorie-queue.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/enum-categorie-vehicule.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/enum-competence.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/enum-draconic.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/enum-heures.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/enum-initpremierround.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/enum-mortalite.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/enum-niveau-ethylisme.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/enum-periode.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/enum-rarete.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/enum-tmr-effet.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/enum-tmr-type.hbs',
// Partials
'systems/foundryvtt-reve-de-dragon/templates/enchantement/partial-enchantement.hbs',
'systems/foundryvtt-reve-de-dragon/templates/coeur/chat-effet-tendre-moment.hbs',
@@ -219,53 +219,53 @@ export class RdDUtility {
'systems/foundryvtt-reve-de-dragon/templates/common/periodicite.hbs',
'systems/foundryvtt-reve-de-dragon/templates/common/enum-duree.hbs',
'systems/foundryvtt-reve-de-dragon/templates/common/compendium-link.hbs',
- 'systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.html',
- 'systems/foundryvtt-reve-de-dragon/templates/partial-description-sort.html',
- 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-ajustements.html',
+ 'systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/partial-description-sort.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-ajustements.hbs',
'systems/foundryvtt-reve-de-dragon/templates/partial-roll-astrologique.hbs',
'systems/foundryvtt-reve-de-dragon/templates/partial-roll-coeur.hbs',
- 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-competences.html',
- 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffLibre.html',
- 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffFixe.html',
- 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html',
- 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-enctotal.html',
- 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html',
- 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html',
- 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-surenc.html',
- 'systems/foundryvtt-reve-de-dragon/templates/partial-select-carac.html',
- 'systems/foundryvtt-reve-de-dragon/templates/partial-item-hautrevant.html',
- 'systems/foundryvtt-reve-de-dragon/templates/partial-item-frequence.html',
- 'systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html',
+ 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-competences.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffLibre.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffFixe.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-enctotal.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-surenc.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/partial-select-carac.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/partial-item-hautrevant.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/partial-item-frequence.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/partial-item-description.hbs',
'systems/foundryvtt-reve-de-dragon/templates/roll/explain.hbs',
- 'systems/foundryvtt-reve-de-dragon/templates/resolution-table.html',
+ 'systems/foundryvtt-reve-de-dragon/templates/resolution-table.hbs',
// Dialogs
- 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-resolution.html',
- 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.html',
- 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html',
- 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-sort.html',
- 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-encaisser.html',
- 'systems/foundryvtt-reve-de-dragon/templates/dialog-validation-encaissement.html',
- 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-meditation.html',
- 'systems/foundryvtt-reve-de-dragon/templates/dialog-tmr.html',
- 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-alchimie.html',
+ 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-resolution.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-sort.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-encaisser.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/dialog-validation-encaissement.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-meditation.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/dialog-tmr.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-alchimie.hbs',
'systems/foundryvtt-reve-de-dragon/templates/sommeil/sommeil-actor-moral.hbs',
'systems/foundryvtt-reve-de-dragon/templates/sommeil/astrologie-gardien.hbs',
'systems/foundryvtt-reve-de-dragon/templates/sommeil/astrologie-joueur.hbs',
'systems/foundryvtt-reve-de-dragon/templates/sommeil/astrologie-theme.hbs',
// HUD
- 'systems/foundryvtt-reve-de-dragon/templates/hud-actor-init.html',
- 'systems/foundryvtt-reve-de-dragon/templates/hud-actor-attaque.html',
+ 'systems/foundryvtt-reve-de-dragon/templates/hud-actor-init.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/hud-actor-attaque.hbs',
// messages tchat
- 'systems/foundryvtt-reve-de-dragon/templates/chat-infojet.html',
- 'systems/foundryvtt-reve-de-dragon/templates/chat-description.html',
- 'systems/foundryvtt-reve-de-dragon/templates/chat-info-appel-au-moral.html',
- 'systems/foundryvtt-reve-de-dragon/templates/chat-info-distance.html',
+ 'systems/foundryvtt-reve-de-dragon/templates/chat-infojet.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/chat-description.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/chat-info-appel-au-moral.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/chat-info-distance.hbs',
'systems/foundryvtt-reve-de-dragon/templates/chat-actor-turn-acteur.hbs',
'systems/foundryvtt-reve-de-dragon/templates/chat-actor-turn-sante.hbs',
- 'systems/foundryvtt-reve-de-dragon/templates/chat-actor-competence-xp.html',
- 'systems/foundryvtt-reve-de-dragon/templates/chat-actor-carac-xp.html',
- 'systems/foundryvtt-reve-de-dragon/templates/chat-fabriquer-potion-base.html',
- 'systems/foundryvtt-reve-de-dragon/templates/chat-signe-draconique-actor.html'
+ 'systems/foundryvtt-reve-de-dragon/templates/chat-actor-competence-xp.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/chat-actor-carac-xp.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/chat-fabriquer-potion-base.hbs',
+ 'systems/foundryvtt-reve-de-dragon/templates/chat-signe-draconique-actor.hbs'
];
// foundry et options
@@ -964,8 +964,8 @@ export class RdDUtility {
}
/*-------------------------------------------- */
- static checkThanatosXP(compName) {
- if (compName.includes('Thanatos')) {
+ static checkThanatosXP(item) {
+ if (item.isCompetencePersonnage() && item.name.includes('Thanatos')) {
let message = "Vous avez mis des points d'Expérience en Thanatos !
Vous devez réduire manuellement d'un même montant d'XP une autre compétence Draconique.";
ChatMessage.create({
whisper: ChatUtility.getUserAndGMs(),
diff --git a/module/settings/status-effects.js b/module/settings/status-effects.js
index 7caeda8a..3a22d2b3 100644
--- a/module/settings/status-effects.js
+++ b/module/settings/status-effects.js
@@ -112,7 +112,7 @@ export class StatusEffects extends FormApplication {
const options = super.defaultOptions;
foundry.utils.mergeObject(options, {
id: "status-effects",
- template: "systems/foundryvtt-reve-de-dragon/templates/settings/status-effects.html",
+ template: "systems/foundryvtt-reve-de-dragon/templates/settings/status-effects.hbs",
height: 800,
width: 350,
minimizable: false,
diff --git a/module/settings/system-compendiums.js b/module/settings/system-compendiums.js
index 82dd64ec..c1524a20 100644
--- a/module/settings/system-compendiums.js
+++ b/module/settings/system-compendiums.js
@@ -157,7 +157,7 @@ export class SystemCompendiums extends FormApplication {
const options = super.defaultOptions;
foundry.utils.mergeObject(options, {
id: "system-compendiums",
- template: "systems/foundryvtt-reve-de-dragon/templates/settings/system-compendiums.html",
+ template: "systems/foundryvtt-reve-de-dragon/templates/settings/system-compendiums.hbs",
height: 'fit-content',
width: 600,
minimizable: false,
diff --git a/module/sommeil/dialog-repos.js b/module/sommeil/dialog-repos.js
index 406914c8..7374a520 100644
--- a/module/sommeil/dialog-repos.js
+++ b/module/sommeil/dialog-repos.js
@@ -15,7 +15,7 @@ export class DialogRepos extends Dialog {
"heures": 4
}
}
- const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/sommeil/dialog-repos.html", actor);
+ const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/sommeil/dialog-repos.hbs", actor);
const dialog = new DialogRepos(html, actor);
dialog.render(true);
}
diff --git a/module/sommeil/dialog-stress.js b/module/sommeil/dialog-stress.js
index 1a6502f2..0b30c323 100644
--- a/module/sommeil/dialog-stress.js
+++ b/module/sommeil/dialog-stress.js
@@ -15,7 +15,7 @@ export class DialogStress extends Dialog {
)
};
- const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/sommeil/dialog-stress.html", dialogData);
+ const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/sommeil/dialog-stress.hbs", dialogData);
new DialogStress(dialogData, html)
.render(true);
}
diff --git a/module/tmr/effets-rencontres.js b/module/tmr/effets-rencontres.js
index 898877c7..183c876c 100644
--- a/module/tmr/effets-rencontres.js
+++ b/module/tmr/effets-rencontres.js
@@ -113,7 +113,7 @@ export class EffetsRencontre {
})
ChatMessage.create({
whisper: ChatUtility.getOwners(context.actor),
- content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-resultat-reve-de-dragon.html`, context)
+ content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-resultat-reve-de-dragon.hbs`, context)
});
}
@@ -128,7 +128,7 @@ export class EffetsRencontre {
ChatMessage.create({
whisper: ChatUtility.getOwners(context.actor),
- content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-resultat-reve-de-dragon.html`, context)
+ content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-resultat-reve-de-dragon.hbs`, context)
});
}
diff --git a/system.json b/system.json
index 2efde2a1..0e911d57 100644
--- a/system.json
+++ b/system.json
@@ -1,9 +1,9 @@
{
"id": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon",
- "version": "12.0.35",
- "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download/12.0.35/rddsystem.zip",
- "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download/12.0.35/system.json",
+ "version": "12.0.38",
+ "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download/12.0.38/rddsystem.zip",
+ "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download/12.0.38/system.json",
"changelog": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/branch/v11/changelog.md",
"compatibility": {
"minimum": "11",
diff --git a/templates/actor-creature-sheet.html b/templates/actor-creature-sheet.hbs
similarity index 94%
rename from templates/actor-creature-sheet.html
rename to templates/actor-creature-sheet.hbs
index 83d39de4..80ca5a26 100644
--- a/templates/actor-creature-sheet.html
+++ b/templates/actor-creature-sheet.hbs
@@ -16,12 +16,12 @@