diff --git a/module/actor-sheet.js b/module/actor-sheet.js
index 1549246e..f2fcf31c 100644
--- a/module/actor-sheet.js
+++ b/module/actor-sheet.js
@@ -207,172 +207,165 @@ export class RdDActorSheet extends ActorSheet {
HtmlUtility._showControlWhen($(".gm-only"), game.user.isGM);
HtmlUtility._showControlWhen($(".appliquerFatigue"), ReglesOptionelles.isUsing("appliquer-fatigue"));
- html.find('#show-hide-competences').click((event) => {
- this.options.showCompNiveauBase = !this.options.showCompNiveauBase;
- this.render(true);
- });
-
// Everything below here is only needed if the sheet is editable
if (!this.options.editable) return;
- html.find('.item-split').click(ev => {
- const li = $(ev.currentTarget).parents(".item");
+ html.find('.item-split').click(async event => {
+ const li = $(event.currentTarget).parents(".item");
const item = this.actor.items.get(li.data("item-id"));
this.splitItem(item);
});
- html.find('.item-edit').click(ev => {
- const li = $(ev.currentTarget).parents(".item");
+ html.find('.item-edit').click(async event => {
+ const li = $(event.currentTarget).parents(".item");
const item = this.actor.items.get(li.data("item-id"));
item.sheet.render(true);
});
- html.find('.display-label a').click((event) => {
+ html.find('.display-label a').click(async event => {
let myID = event.currentTarget.attributes['data-item-id'].value;
const item = this.actor.getEmbeddedDocument('Item', myID);
item.sheet.render(true);
});
- html.find('.rencontre-delete').click(ev => {
- const li = $(ev.currentTarget).parents(".item");
+ html.find('.rencontre-delete').click(async event => {
+ const li = $(event.currentTarget).parents(".item");
const rencontreKey = li.data("item-id");
this.actor.deleteTMRRencontre(rencontreKey);
});
- html.find('.item-delete').click(ev => {
- const li = $(ev.currentTarget).parents(".item");
+ html.find('.item-delete').click(async event => {
+ const li = $(event.currentTarget).parents(".item");
RdDUtility.confirmerSuppression(this, li);
});
- html.find('.item-vendre').click(ev => {
- const li = $(ev.currentTarget).parents(".item");
+ html.find('.item-vendre').click(async event => {
+ const li = $(event.currentTarget).parents(".item");
const itemId = li.data("item-id");
const item = this.actor.getObjet(itemId);
item?.proposerVente();
});
- html.find('.item-action').click(ev => {
- const li = $(ev.currentTarget).parents(".item");
+ html.find('.item-action').click(async event => {
+ const li = $(event.currentTarget).parents(".item");
const itemId = li.data("item-id");
const item = this.actor.getObjet(itemId);
this.actor.actionItem(item);
});
- html.find('.subacteur-delete').click(ev => {
- const li = $(ev.currentTarget).parents(".item");
+ html.find('.subacteur-delete').click(async event => {
+ const li = $(event.currentTarget).parents(".item");
RdDUtility.confirmerSuppressionSubacteur(this, li);
});
- html.find('.encaisser-direct').click(ev => {
+ html.find('.encaisser-direct').click(async event => {
this.actor.encaisser();
});
- html.find('.remise-a-neuf').click(ev => {
+ html.find('.remise-a-neuf').click(async event => {
if (game.user.isGM) {
this.actor.remiseANeuf();
- ev.preventDefault();
}
});
- html.find('.creer-tache').click(ev => {
+ html.find('.creer-tache').click(async event => {
this.createEmptyTache();
});
- html.find('.creer-un-objet').click(ev => {
+ html.find('.creer-un-objet').click(async event => {
this.selectObjetType();
});
- html.find('.creer-une-oeuvre').click(ev => {
+ html.find('.creer-une-oeuvre').click(async event => {
this.selectTypeOeuvre();
});
- html.find('#nettoyer-conteneurs').click(ev => {
+ html.find('#nettoyer-conteneurs').click(async event => {
this.actor.nettoyerConteneurs();
});
// Blessure control
- html.find('.blessure-control').click(ev => {
- const li = $(ev.currentTarget).parents(".item");
- let btype = li.data("blessure-type");
- let index = li.data('blessure-index');
- let active = $(ev.currentTarget).data('blessure-active');
+ html.find('.blessure-control').click(async event => {
+ const tr = $(event.currentTarget).parents(".item");
+ let btype = tr.data("blessure-type");
+ let index = tr.data('blessure-index');
+ let active = $(event.currentTarget).data('blessure-active');
//console.log(btype, index, active);
- this.actor.manageBlessureFromSheet(btype, index, active).then(this.render(true));
+ await this.actor.manageBlessureFromSheet(btype, index, active);
});
// Blessure data
- html.find('.blessures-soins').change(ev => {
- const li = $(ev.currentTarget).parents(".item");
- let btype = li.data('blessure-type');
- let index = li.data('blessure-index');
- let psoins = li.find('input[name=premiers_soins]').val();
- let pcomplets = li.find('input[name=soins_complets]').val();
- let jours = li.find('input[name=jours]').val();
- let loc = li.find('input[name=localisation]').val();
+ html.find('.blessures-soins').change(async event => {
+ const tr = $(event.currentTarget).parents(".item");
+ let btype = tr.data('blessure-type');
+ let index = tr.data('blessure-index');
+ let psoins = tr.find('.blessure-premiers_soins').val();
+ let pcomplets = tr.find('.blessure-soins_complets').val();
+ let jours = tr.find('.blessure-jours').val();
+ let loc = tr.find('.blessure-localisation').val();
//console.log(btype, index, psoins, pcomplets, jours, loc);
- this.actor.setDataBlessureFromSheet(btype, index, psoins, pcomplets, jours, loc).then(this.render(true));
+ await this.actor.setDataBlessureFromSheet(btype, index, psoins, pcomplets, jours, loc);
});
// Equip Inventory Item
- html.find('.item-equip').click(ev => {
- const li = $(ev.currentTarget).parents(".item");
+ html.find('.item-equip').click(async event => {
+ const li = $(event.currentTarget).parents(".item");
this.actor.equiperObjet(li.data("item-id"));
- this.render(true);
});
// Roll Carac
- html.find('.carac-label a').click((event) => {
+ html.find('.carac-label a').click(async event => {
let caracName = event.currentTarget.attributes.name.value;
this.actor.rollCarac(caracName.toLowerCase());
});
- html.find('.chance-actuelle').click((event) => {
+ html.find('.chance-actuelle').click(async event => {
this.actor.rollCarac('chance-actuelle');
});
- html.find('.chance-appel').click((event) => {
+ html.find('.chance-appel').click(async event => {
this.actor.rollAppelChance();
});
- html.find('#jet-astrologie').click((event) => {
+ html.find('#jet-astrologie').click(async event => {
this.actor.astrologieNombresAstraux();
});
// Roll Skill
- html.find('a.competence-label').click((event) => {
+ html.find('a.competence-label').click(async event => {
let compName = event.currentTarget.name;
this.actor.rollCompetence(compName);
});
- html.find('.tache-label a').click((event) => {
+ html.find('.tache-label a').click(async event => {
const li = $(event.currentTarget).parents(".item");
let tacheId = li.data('item-id');
this.actor.rollTache(tacheId);
});
- html.find('.meditation-label a').click((event) => {
+ html.find('.meditation-label a').click(async event => {
const li = $(event.currentTarget).parents(".item");
let meditationId = li.data('item-id');
this.actor.rollMeditation(meditationId);
});
- html.find('.chant-label a').click((event) => {
+ html.find('.chant-label a').click(async event => {
const li = $(event.currentTarget).parents(".item");
let chantId = li.data('item-id');
this.actor.rollChant(chantId);
});
- html.find('.danse-label a').click((event) => {
+ html.find('.danse-label a').click(async event => {
const li = $(event.currentTarget).parents(".item");
let danseId = li.data('item-id');
this.actor.rollDanse(danseId);
});
- html.find('.musique-label a').click((event) => {
+ html.find('.musique-label a').click(async event => {
const li = $(event.currentTarget).parents(".item");
let musiqueId = li.data('item-id');
this.actor.rollMusique(musiqueId);
});
- html.find('.oeuvre-label a').click((event) => {
+ html.find('.oeuvre-label a').click(async event => {
const li = $(event.currentTarget).parents(".item");
let oeuvreId = li.data('item-id');
this.actor.rollOeuvre(oeuvreId);
});
- html.find('.jeu-label a').click((event) => {
+ html.find('.jeu-label a').click(async event => {
const li = $(event.currentTarget).parents(".item");
let jeuId = li.data('item-id');
this.actor.rollJeu(jeuId);
});
- html.find('.recettecuisine-label a').click((event) => {
+ html.find('.recettecuisine-label a').click(async event => {
const li = $(event.currentTarget).parents(".item");
let recetteId = li.data('item-id');
this.actor.rollRecetteCuisine(recetteId);
});
- html.find('.subacteur-label a').click((event) => {
+ html.find('.subacteur-label a').click(async event => {
const li = $(event.currentTarget).parents(".item");
let actorId = li.data('actor-id');
let actor = game.actors.get(actorId);
@@ -382,26 +375,26 @@ export class RdDActorSheet extends ActorSheet {
});
// Boutons spéciaux MJs
- html.find('.forcer-tmr-aleatoire').click((event) => {
+ html.find('.forcer-tmr-aleatoire').click(async event => {
this.actor.cacheTMRetMessage();
});
- html.find('.afficher-tmr').click((event) => {
+ html.find('.afficher-tmr').click(async event => {
this.actor.afficheTMRetMessage();
});
// Points de reve actuel
- html.find('.ptreve-actuel a').click((event) => {
+ html.find('.ptreve-actuel a').click(async event => {
this.actor.rollCarac('reve-actuel');
});
// Roll Weapon1
- html.find('.arme-label a').click((event) => {
+ html.find('.arme-label a').click(async event => {
let armeName = event.currentTarget.text;
let competenceName = event.currentTarget.attributes['data-competence-name'].value;
this.actor.rollArme(competenceName, armeName);
});
// Initiative pour l'arme
- html.find('.arme-initiative a').click((event) => {
+ html.find('.arme-initiative a').click(async event => {
let combatant = game.combat.data.combatants.find(c => c.actor.data._id == this.actor.data._id);
if (combatant) {
let armeName = event.currentTarget.attributes['data-arme-name'].value;
@@ -412,193 +405,178 @@ export class RdDActorSheet extends ActorSheet {
}
});
// Display TMR, visuualisation
- html.find('.visu-tmr').click((event) => {
+ html.find('.visu-tmr').click(async event => {
this.actor.displayTMR("visu");
});
// Display TMR, normal
- html.find('.monte-tmr').click((event) => {
+ html.find('.monte-tmr').click(async event => {
this.actor.displayTMR("normal");
});
// Display TMR, fast
- html.find('.monte-tmr-rapide').click((event) => {
+ html.find('.monte-tmr-rapide').click(async event => {
this.actor.displayTMR("rapide");
});
- html.find('.dormir-une-heure').click((event) => {
+ html.find('.dormir-une-heure').click(async event => {
this.actor.dormir(1);
});
- html.find('.dormir-chateau-dormant').click((event) => {
+ html.find('.dormir-chateau-dormant').click(async event => {
this.actor.dormirChateauDormant();
});
- html.find('.enlever-tous-effets').click((event) => {
+ html.find('.enlever-tous-effets').click(async event => {
this.actor.enleverTousLesEffets();
});
- html.find('.conteneur-name a').click((event) => {
+ html.find('.conteneur-name a').click(async event => {
let myID = event.currentTarget.attributes['data-item-id'].value;
RdDUtility.toggleAfficheContenu(myID);
this.render(true);
});
- html.find('.carac-xp-augmenter').click((event) => {
+ html.find('.carac-xp-augmenter').click(async event => {
let caracName = event.currentTarget.name.replace("augmenter.", "");
this.actor.updateCaracXPAuto(caracName);
});
- html.find('.competence-xp-augmenter').click((event) => {
+ html.find('.competence-xp-augmenter').click(async event => {
let compName = event.currentTarget.attributes.compname.value;
this.actor.updateCompetenceXPAuto(compName);
});
if (this.options.editCaracComp) {
// On carac change
- html.find('.carac-value').change((event) => {
+ html.find('.carac-value').change(async event => {
let caracName = event.currentTarget.name.replace(".value", "").replace("data.carac.", "");
//console.log("Value changed :", event, caracName);
this.actor.updateCarac(caracName, parseInt(event.target.value));
});
- html.find('.carac-xp').change((event) => {
+ html.find('.carac-xp').change(async event => {
let caracName = event.currentTarget.name.replace(".xp", "").replace("data.carac.", "");
//console.log("Value changed :", event, caracName);
this.actor.updateCaracXP(caracName, parseInt(event.target.value));
});
// On competence change
- html.find('.competence-value').change((event) => {
+ 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));
});
// On competence xp change
- html.find('.competence-xp').change((event) => {
+ html.find('.competence-xp').change(async event => {
let compName = event.currentTarget.attributes.compname.value;
this.actor.updateCompetenceXP(compName, parseInt(event.target.value));
});
// On competence xp change
- html.find('.competence-xp-sort').change((event) => {
+ html.find('.competence-xp-sort').change(async event => {
let compName = event.currentTarget.attributes.compname.value;
this.actor.updateCompetenceXPSort(compName, parseInt(event.target.value));
});
// On competence archetype change
- html.find('.competence-archetype').change((event) => {
+ html.find('.competence-archetype').change(async event => {
let compName = event.currentTarget.attributes.compname.value;
this.actor.updateCompetenceArchetype(compName, parseInt(event.target.value));
});
}
-
- // Gestion du bouton lock/unlock
- html.find('.lock-unlock-sheet').click((event) => {
+
+ html.find('#show-hide-competences').click(async event => {
+ this.options.showCompNiveauBase = !this.options.showCompNiveauBase;
+ this.render(true);
+ });
+ html.find('.lock-unlock-sheet').click(async event => {
this.options.editCaracComp = !this.options.editCaracComp;
this.render(true);
});
- html.find('#show-hide-archetype').click((event) => {
+ html.find('#show-hide-archetype').click(async event => {
this.options.montrerArchetype = !this.options.montrerArchetype;
this.render(true);
});
- html.find('.lock-unlock-controls').click((event) => {console.log("CONTROLS",this.options.hideControls)
+ html.find('.lock-unlock-controls').click(async event => {
this.options.hideControls = !this.options.hideControls;
this.render(true);
});
// On pts de reve change
- html.find('.pointsreve-value').change((event) => {
+ html.find('.pointsreve-value').change(async event => {
let reveValue = event.currentTarget.value;
this.actor.update({ "data.reve.reve.value": reveValue });
});
// On seuil de reve change
- html.find('.seuil-reve-value').change((event) => {
+ html.find('.seuil-reve-value').change(async event => {
console.log("seuil-reve-value", event.currentTarget)
this.actor.setPointsDeSeuil(event.currentTarget.value);
});
- html.find('#attribut-protection-edit').change((event) => {
+ html.find('#attribut-protection-edit').change(async event => {
this.actor.updateAttributeValue(event.currentTarget.attributes.name.value, parseInt(event.target.value));
});
// On stress change
- html.find('.compteur-edit').change((event) => {
+ html.find('.compteur-edit').change(async event => {
let fieldName = event.currentTarget.attributes.name.value;
this.actor.updateCompteurValue(fieldName, parseInt(event.target.value));
});
- html.find('#ethylisme').change((event) => {
+ html.find('#ethylisme').change(async event => {
this.actor.setEthylisme(parseInt(event.target.value));
});
- html.find('.stress-test').click((event) => {
+ html.find('.stress-test').click(async event => {
this.actor.transformerStress();
- this.render(true);
});
- html.find('.moral-malheureux').click((event) => {
+ html.find('.moral-malheureux').click(async event => {
this.actor.jetDeMoral('malheureuse');
- this.render(true);
});
- html.find('.moral-neutre').click((event) => {
+ html.find('.moral-neutre').click(async event => {
this.actor.jetDeMoral('neutre');
- this.render(true);
});
- html.find('.moral-heureux').click((event) => {
+ html.find('.moral-heureux').click(async event => {
this.actor.jetDeMoral('heureuse');
- this.render(true);
});
- html.find('#ethylisme-test').click((event) => {
+ html.find('#ethylisme-test').click(async event => {
this.actor.jetEthylisme();
- this.render(true);
});
- html.find('#jet-vie').click((event) => {
+ html.find('#jet-vie').click(async event => {
this.actor.jetVie();
- this.render(true);
});
- html.find('#jet-endurance').click((event) => {
+ html.find('#jet-endurance').click(async event => {
this.actor.jetEndurance();
- this.render(true);
});
- html.find('.monnaie-plus').click((event) => {
+ html.find('.monnaie-plus').click(async event => {
const li = $(event.currentTarget).parents(".item");
this.actor.monnaieIncDec(li.data("item-id"), 1);
- this.render(true);
});
- html.find('.monnaie-moins').click((event) => {
+ html.find('.monnaie-moins').click(async event => {
const li = $(event.currentTarget).parents(".item");
this.actor.monnaieIncDec(li.data("item-id"), -1);
- this.render(true);
});
- html.find('#vie-plus').click((event) => {
+ html.find('#vie-plus').click(async event => {
this.actor.santeIncDec("vie", 1);
- this.render(true);
});
- html.find('#vie-moins').click((event) => {
+ html.find('#vie-moins').click(async event => {
this.actor.santeIncDec("vie", -1);
- this.render(true);
});
- html.find('#endurance-plus').click((event) => {
+ html.find('#endurance-plus').click(async event => {
this.actor.santeIncDec("endurance", 1);
- this.render(true);
});
- html.find('#endurance-moins').click((event) => {
+ html.find('#endurance-moins').click(async event => {
this.actor.santeIncDec("endurance", -1);
- this.render(true);
});
- html.find('.data-sante-sonne').click((event) => {
+ html.find('.data-sante-sonne').click(async event => {
this.actor.setSonne(event.currentTarget.checked);
- this.render(true);
});
- html.find('#ptreve-actuel-plus').click((event) => {
+ html.find('#ptreve-actuel-plus').click(async event => {
this.actor.reveActuelIncDec(1);
- this.render(true);
});
- html.find('#ptreve-actuel-moins').click((event) => {
+ html.find('#ptreve-actuel-moins').click(async event => {
this.actor.reveActuelIncDec(-1);
- this.render(true);
});
- html.find('#fatigue-plus').click((event) => {
+ html.find('#fatigue-plus').click(async event => {
this.actor.santeIncDec("fatigue", 1);
- this.render(true);
});
- html.find('#fatigue-moins').click((event) => {
+ html.find('#fatigue-moins').click(async event => {
this.actor.santeIncDec("fatigue", -1);
- this.render(true);
});
}
diff --git a/module/actor.js b/module/actor.js
index ac1d7df3..76e5c85b 100644
--- a/module/actor.js
+++ b/module/actor.js
@@ -447,6 +447,7 @@ export class RdDActor extends Actor {
await this.verifierPotionsEnchantees();
message.content = `A la fin Chateau Dormant, ${message.content}
Un nouveau jour se lève`;
ChatMessage.create(message);
+ this.sheet.render(true);
}
/* -------------------------------------------- */
@@ -576,6 +577,7 @@ export class RdDActor extends Actor {
}
}
ChatMessage.create(message);
+ this.sheet.render(true);
}
/* -------------------------------------------- */
@@ -594,6 +596,7 @@ export class RdDActor extends Actor {
}
}
ChatMessage.create(message);
+ this.sheet.render(true);
}
/* -------------------------------------------- */
@@ -3163,7 +3166,6 @@ export class RdDActor extends Actor {
const perteEndurance = await this.santeIncDec("endurance", -encaissement.endurance, { critiques: encaissement.critiques > 0 });
this.computeEtatGeneral();
- this.sheet.render(false);
const actorData = Misc.data(this);
mergeObject(encaissement, {
diff --git a/templates/actor-blessure-partial.html b/templates/actor-blessure-partial.html
index 8bd827d1..cd639c59 100644
--- a/templates/actor-blessure-partial.html
+++ b/templates/actor-blessure-partial.html
@@ -1,21 +1,21 @@