Cleanup - preparation Coeur

Simplification de code:
- des Méthodes simples sur une ligne
- utilisation de item.update au lieu de updateEmbeddedDocuments
  quand possibe
- renommage des templates SubActeur
- déplacement de logs quand compétence non trouvée
This commit is contained in:
2023-11-21 16:03:26 +01:00
parent bfb7b9b6bf
commit b5db2a9ef3
27 changed files with 375 additions and 388 deletions

View File

@ -99,7 +99,8 @@ const definitionsEncaissement = {
/* -------------------------------------------- */
export class RdDUtility {
// persistent handling of conteneur show/hide
static afficheContenu = {}
/* -------------------------------------------- */
static async init() {
Hooks.on("renderChatMessage", async (app, html, msg) => RdDUtility.onRenderChatMessage(app, html, msg));
@ -165,9 +166,9 @@ export class RdDUtility {
'systems/foundryvtt-reve-de-dragon/templates/actor/inventaire.html',
'systems/foundryvtt-reve-de-dragon/templates/actor/inventaire-item.html',
"systems/foundryvtt-reve-de-dragon/templates/actor/inventaire-monnaie.html",
'systems/foundryvtt-reve-de-dragon/templates/actor/liens-animaux.html',
'systems/foundryvtt-reve-de-dragon/templates/actor/liens-suivants.html',
'systems/foundryvtt-reve-de-dragon/templates/actor/liens-vehicules.html',
'systems/foundryvtt-reve-de-dragon/templates/actor/liens-animaux.hbs',
'systems/foundryvtt-reve-de-dragon/templates/actor/liens-suivants.hbs',
'systems/foundryvtt-reve-de-dragon/templates/actor/liens-vehicules.hbs',
'systems/foundryvtt-reve-de-dragon/templates/actor/commerce-inventaire.html',
'systems/foundryvtt-reve-de-dragon/templates/actor/commerce-inventaire-item.html',
//Items
@ -323,24 +324,16 @@ export class RdDUtility {
}
/* -------------------------------------------- */
static getNomEthylisme(niveauEthylisme) {
let index = -niveauEthylisme;
return index < 0 ? 'Aucun' : nomEthylisme[index];
}
static getNomEthylisme(niveauEthylisme) { return niveauEthylisme > 0 ? 'Aucun' : nomEthylisme[-niveauEthylisme] }
/* -------------------------------------------- */
static initAfficheContenu() { // persistent handling of conteneur show/hide
if (!this.afficheContenu)
this.afficheContenu = {};
}
/* -------------------------------------------- */
static toggleAfficheContenu(conteneurId) {
this.afficheContenu[conteneurId] = !this.afficheContenu[conteneurId];
RdDUtility.afficheContenu[conteneurId] = !RdDUtility.afficheContenu[conteneurId];
}
/* -------------------------------------------- */
static getAfficheContenu(conteneurId) {
if (conteneurId)
return this.afficheContenu[conteneurId];
return RdDUtility.afficheContenu[conteneurId];
return undefined;
}
@ -651,8 +644,8 @@ export class RdDUtility {
/* -------------------------------------------- */
static async chatListeners(html) {
RdDCombat.registerChatCallbacks(html);
RdDEmpoignade.registerChatCallbacks(html);
RdDCombat.registerChatCallbacks(html)
RdDEmpoignade.registerChatCallbacks(html)
// Gestion spécifique message passeurs
html.on("click", '.tmr-passeur-coord a', event => {
@ -811,7 +804,7 @@ export class RdDUtility {
}
/* -------------------------------------------- */
static confirmerSuppressionSubacteur(sheet, subActor, htmlToDelete, onSuppression = ()=>{}) {
static confirmSubActeurDelete(sheet, subActor, htmlToDelete, onSuppression = ()=>{}) {
RdDConfirm.confirmer({
settingConfirmer: "confirmation-supprimer-lien-acteur",
content: `<p>Etes vous certain de vouloir supprimer le lien vers ${subActor.name} ?</p>`,