v10.5.3 #607
| @@ -210,15 +210,10 @@ export class RdDCalendrier extends Application { | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |  | ||||||
|   getCurrentNombreAstral() { |  | ||||||
|     return this.getNombreAstral(this.timestamp.indexDate); |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   resetNombreAstral() { |   resetNombreAstral() { | ||||||
|     this.listeNombreAstral = []; |     this.listeNombreAstral = []; | ||||||
|     game.settings.set(SYSTEM_RDD, "liste-nombre-astral", this.listeNombreAstral); |     game.settings.set(SYSTEM_RDD, "liste-nombre-astral", []); | ||||||
|  |  | ||||||
|     game.socket.emit(SYSTEM_SOCKET_ID, { |     game.socket.emit(SYSTEM_SOCKET_ID, { | ||||||
|       msg: "msg_reset_nombre_astral", |       msg: "msg_reset_nombre_astral", | ||||||
| @@ -227,10 +222,19 @@ export class RdDCalendrier extends Application { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   getNombreAstral(indexDate) { |   /** | ||||||
|  |    *  | ||||||
|  |    * @param {*} indexDate la date pour laquelle obtenir le nombre astral. Si undefined, on prend la date du jour | ||||||
|  |    * @returns le nombre astral pour la date, ou pour la date du jour si la date n'est pas fournie. | ||||||
|  |    *  Si aucun nombre astral n'est trouvé, retourne 0 (cas où l'on demanderait un nombre astral en dehors des 12 jours courant et à venir) | ||||||
|  |    */ | ||||||
|  |   getNombreAstral(indexDate = undefined) { | ||||||
|  |     if (indexDate == undefined) { | ||||||
|  |       indexDate = this.timestamp.indexDate; | ||||||
|  |     } | ||||||
|     const listNombreAstral = this.getListeNombreAstral(); |     const listNombreAstral = this.getListeNombreAstral(); | ||||||
|     let astralData = listNombreAstral.find((nombreAstral, i) => nombreAstral.index == indexDate); |     let astralData = listNombreAstral.find((nombreAstral, i) => nombreAstral.index == indexDate); | ||||||
|     return astralData?.nombreAstral; |     return astralData?.nombreAstral ?? 0; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
| @@ -289,7 +293,8 @@ export class RdDCalendrier extends Application { | |||||||
|     const indexDate = this.timestamp.indexDate; |     const indexDate = this.timestamp.indexDate; | ||||||
|     const addDay = this.timestamp.heure < heure ? 0 : 1; |     const addDay = this.timestamp.heure < heure ? 0 : 1; | ||||||
|     await this.setNewTimestamp(new RdDTimestamp({ |     await this.setNewTimestamp(new RdDTimestamp({ | ||||||
|        indexDate: indexDate + addDay, indexHeure: 0 }) |       indexDate: indexDate + addDay, indexHeure: 0 | ||||||
|  |     }) | ||||||
|       .addHeures(heure)) |       .addHeures(heure)) | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -358,38 +363,15 @@ export class RdDCalendrier extends Application { | |||||||
|     game.settings.set(SYSTEM_RDD, "liste-nombre-astral", this.listeNombreAstral); |     game.settings.set(SYSTEM_RDD, "liste-nombre-astral", this.listeNombreAstral); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   getHeureChance(heure) { |   static ecartHeureChance(heureNaissance, nombreAstral, heure) { | ||||||
|     return heure + (this.getCurrentNombreAstral() ?? 0); |     return (heureNaissance + nombreAstral - heure) % RDD_HEURES_PAR_JOUR; | ||||||
|   } |  | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |  | ||||||
|   getHeuresChanceMalchance(heureNaissance) { |  | ||||||
|     let defHeure = RdDTimestamp.findHeure(heureNaissance); |  | ||||||
|     if (defHeure) { |  | ||||||
|       const signe = h => h % RDD_HEURES_PAR_JOUR; |  | ||||||
|       const chance = this.getHeureChance(defHeure.heure); |  | ||||||
|       return [ |  | ||||||
|         { ajustement: "+4", heures: [signe(chance)] }, |  | ||||||
|         { ajustement: "+2", heures: [signe(chance + 4), signe(chance + 8)] }, |  | ||||||
|         { ajustement: "-4", heures: [signe(chance + 6)] }, |  | ||||||
|         { ajustement: "-2", heures: [signe(chance + 3), signe(chance + 9)] } |  | ||||||
|       ]; |  | ||||||
|     } |  | ||||||
|     return []; |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   getAjustementAstrologique(heureNaissance, name = undefined) { |   getAjustementAstrologique(heureNaissance, name = undefined) { | ||||||
|     let defHeure = RdDTimestamp.findHeure(heureNaissance); |     let defHeure = RdDTimestamp.findHeure(heureNaissance); | ||||||
|     if (defHeure) { |     if (defHeure) { | ||||||
|       const chance = this.getHeureChance(defHeure.heure); |       return RdDCalendrier.ajustementAstrologiqueHeure(defHeure.heure, this.getNombreAstral(), this.timestamp.heure); | ||||||
|       const ecartChance = (chance - this.timestamp.heure) % RDD_HEURES_PAR_JOUR; |  | ||||||
|       switch (ecartChance) { |  | ||||||
|         case 0: return 4; |  | ||||||
|         case 4: case 8: return 2; |  | ||||||
|         case 6: return -4; |  | ||||||
|         case 3: case 9: return -2; |  | ||||||
|       } |  | ||||||
|     } |     } | ||||||
|     else if (name) { |     else if (name) { | ||||||
|       ui.notifications.warn(name + " n'a pas d'heure de naissance, ou elle est incorrecte : " + heureNaissance); |       ui.notifications.warn(name + " n'a pas d'heure de naissance, ou elle est incorrecte : " + heureNaissance); | ||||||
| @@ -400,6 +382,16 @@ export class RdDCalendrier extends Application { | |||||||
|     return 0; |     return 0; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   static ajustementAstrologiqueHeure(hn, nbAstral, heure) { | ||||||
|  |     switch (RdDCalendrier.ecartHeureChance(hn, nbAstral, heure)) { | ||||||
|  |       case 0: return 4; | ||||||
|  |       case 4: case 8: return 2; | ||||||
|  |       case 6: return -4; | ||||||
|  |       case 3: case 9: return -2; | ||||||
|  |     } | ||||||
|  |     return 0; | ||||||
|  |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   getData() { |   getData() { | ||||||
|     let formData = super.getData(); |     let formData = super.getData(); | ||||||
| @@ -434,7 +426,7 @@ export class RdDCalendrier extends Application { | |||||||
|     // Rebuild text du calendrier |     // Rebuild text du calendrier | ||||||
|     let dateHTML = `${calendrier.jourDuMois} ${calendrier.mois.label} (${calendrier.mois.saison}) de l'année ${calendrier.annee}` |     let dateHTML = `${calendrier.jourDuMois} ${calendrier.mois.label} (${calendrier.mois.saison}) de l'année ${calendrier.annee}` | ||||||
|     if (game.user.isGM) { |     if (game.user.isGM) { | ||||||
|       dateHTML = dateHTML + "<br>Nombre Astral: " + (this.getCurrentNombreAstral() ?? "?"); |       dateHTML = dateHTML + "<br>Nombre Astral: " + (this.getNombreAstral() ?? "?"); | ||||||
|     } |     } | ||||||
|     for (let handle of document.getElementsByClassName("calendar-date-rdd")) { |     for (let handle of document.getElementsByClassName("calendar-date-rdd")) { | ||||||
|       handle.innerHTML = dateHTML; |       handle.innerHTML = dateHTML; | ||||||
| @@ -490,13 +482,21 @@ export class RdDCalendrier extends Application { | |||||||
|       return astro; |       return astro; | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     calendrierData.heuresParActeur = {}; |     const nbAstral = this.getNombreAstral() | ||||||
|     game.actors.filter(it => it.isPersonnage() && it.hasPlayerOwner).forEach(actor => { |     calendrierData.heures = Array.from(Array(RDD_HEURES_PAR_JOUR).keys()); | ||||||
|       let heureNaissance = actor.getHeureNaissance(); |     calendrierData.ajustementsActeur = game.actors.filter(it => it.isPersonnage() && it.hasPlayerOwner).map(actor => { | ||||||
|       if (heureNaissance) { |       return { | ||||||
|         calendrierData.heuresParActeur[actor.name] = this.getHeuresChanceMalchance(heureNaissance); |         actor, | ||||||
|  |         ajustements: calendrierData.heures.map(heure => { | ||||||
|  |           const hn = RdDTimestamp.findHeure(actor.getHeureNaissance())?.heure; | ||||||
|  |           return { | ||||||
|  |             heure, | ||||||
|  |             ajustement: RdDCalendrier.ajustementAstrologiqueHeure(hn, nbAstral, heure) | ||||||
|           } |           } | ||||||
|         }) |         }) | ||||||
|  |       } | ||||||
|  |     }); | ||||||
|  |  | ||||||
|     let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/calendar-astrologie-template.html', calendrierData); |     let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/calendar-astrologie-template.html', calendrierData); | ||||||
|     let astrologieEditeur = new RdDAstrologieEditeur(html, this, calendrierData) |     let astrologieEditeur = new RdDAstrologieEditeur(html, this, calendrierData) | ||||||
|     astrologieEditeur.updateData(calendrierData); |     astrologieEditeur.updateData(calendrierData); | ||||||
|   | |||||||
| @@ -482,6 +482,9 @@ input:is(.blessure-premiers_soins, .blessure-soins_complets) { | |||||||
|   max-height: 1.5em; |   max-height: 1.5em; | ||||||
|   border-width: 0; |   border-width: 0; | ||||||
| } | } | ||||||
|  | div.dimmed .img-signe-heure { | ||||||
|  |   opacity: 50%; | ||||||
|  | } | ||||||
| .button-effect-img { | .button-effect-img { | ||||||
|   vertical-align: baseline; |   vertical-align: baseline; | ||||||
|   max-width: 16px; |   max-width: 16px; | ||||||
| @@ -1199,15 +1202,25 @@ div.competence-column div.categorie-competence{ | |||||||
| } | } | ||||||
|  |  | ||||||
| /* ======================================== */ | /* ======================================== */ | ||||||
| .table-nombres-astraux { | table.table-nombres-astraux { | ||||||
|   border:1; |   border: 2px solid rgba(0, 0, 0, 0.8); | ||||||
|  | } | ||||||
|  | table.table-nombres-astraux th >td { | ||||||
|  |   font-size: 1rem; | ||||||
|  | } | ||||||
|  | table.table-nombres-astraux tr >td { | ||||||
|   font-size: 0.8rem; |   font-size: 0.8rem; | ||||||
| } | } | ||||||
| .table-nombres-astraux td { | table.table-nombres-astraux :is(tr, th, td) { | ||||||
|   border: 1px solid black; |   border-style: solid; | ||||||
|  |   border-width: 1px; | ||||||
|  |   border-color: rgba(102, 95, 122, 0.2); | ||||||
|   text-align: center; |   text-align: center; | ||||||
|   vertical-align: top; |   vertical-align: top; | ||||||
| } | } | ||||||
|  | table.table-nombres-astraux tr:hover { | ||||||
|  |   background-color: hsla(38, 20%, 50%, 0.5); | ||||||
|  | } | ||||||
|  |  | ||||||
| /* ======================================== */ | /* ======================================== */ | ||||||
| .tokenhudext { | .tokenhudext { | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| { | { | ||||||
|   "id": "foundryvtt-reve-de-dragon", |   "id": "foundryvtt-reve-de-dragon", | ||||||
|   "title": "Rêve de Dragon", |   "title": "Rêve de Dragon", | ||||||
|   "version": "10.5.2", |   "version": "10.5.3", | ||||||
|   "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.5.2.zip", |   "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.5.3.zip", | ||||||
|   "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json", |   "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json", | ||||||
|   "compatibility": { |   "compatibility": { | ||||||
|     "minimum": "10", |     "minimum": "10", | ||||||
|   | |||||||
| @@ -8,16 +8,16 @@ | |||||||
|   <section class="sheet-body"> |   <section class="sheet-body"> | ||||||
|     <div class="form-group"> |     <div class="form-group"> | ||||||
|       <table class='table-nombres-astraux'> |       <table class='table-nombres-astraux'> | ||||||
|         <tr class='table-nombres-astraux-td'> |         <tr> | ||||||
|           <th>Date</th> |           <th>Date</th> | ||||||
|           {{#each astrologieData as |nombreData key|}} |           {{#each astrologieData as |nombreData key|}} | ||||||
|           <td class='table-nombres-astraux-td'>{{nombreData.date.jour}}{{timestamp-imgSigneHeure nombreData.date.mois}}</td> |           <th>{{nombreData.date.jour}}{{timestamp-imgSigneHeure nombreData.date.mois}}</th> | ||||||
|           {{/each}} |           {{/each}} | ||||||
|         </tr> |         </tr> | ||||||
|         <tr class='table-nombres-astraux-td'> |         <tr> | ||||||
|           <th>Nombre astral</th> |           <th>Nombre astral</th> | ||||||
|           {{#each astrologieData as |nombreData key|}} |           {{#each astrologieData as |nombreData key|}} | ||||||
|           <td class='table-nombres-astraux-td'> |           <td> | ||||||
|             <ol> |             <ol> | ||||||
|             <b>{{nombreData.nombreAstral}}</b> |             <b>{{nombreData.nombreAstral}}</b> | ||||||
|             {{#each nombreData.valeursFausses as |fausseVal key|}} |             {{#each nombreData.valeursFausses as |fausseVal key|}} | ||||||
| @@ -30,24 +30,35 @@ | |||||||
|       </table> |       </table> | ||||||
|     </div> |     </div> | ||||||
|     <div> |     <div> | ||||||
|       <ul class="alterne-list"> |       <table class='table-nombres-astraux'> | ||||||
|         {{#each heuresParActeur as |heuresDef name|}}         |         <tr> | ||||||
|         <li class="list-item flexrow"> |           <th></th> | ||||||
|           <span><strong>{{name}}</strong>:</span> |           {{#each heures as |heure|}} | ||||||
|           <span class="flex-grow-2"> |           <th> | ||||||
|             |{{#each heuresDef as |ajustement|}} |  | ||||||
|             <span> |  | ||||||
|               <strong>{{ajustement.ajustement}}</strong> |  | ||||||
|               {{#each ajustement.heures as |heure|}} |  | ||||||
|             {{timestamp-imgSigneHeure heure}} |             {{timestamp-imgSigneHeure heure}} | ||||||
|  |           </th> | ||||||
|           {{/each}} |           {{/each}} | ||||||
|               | |         </tr> | ||||||
|             </span> |         {{#each ajustementsActeur as |ajustementActeur|}} | ||||||
|  |         <tr> | ||||||
|  |           <td> | ||||||
|  |             <img class="img-signe-heure" src="{{actor.img}}" title="{{actor.name}}" /> | ||||||
|  |             {{actor.name}} | ||||||
|  |           </td> | ||||||
|  |           {{#each ajustementActeur.ajustements as |ajustement|}} | ||||||
|  |           <td>{{#if (ne ajustement.ajustement 0)}} | ||||||
|  |             <strong> | ||||||
|  |               {{numberFormat ajustement.ajustement decimals=0 sign=true}} | ||||||
|  |             </strong> | ||||||
|  |             {{else}} | ||||||
|  |             <div class="dimmed"> | ||||||
|  |               {{timestamp-imgSigneHeure ajustement.heure}} | ||||||
|  |             </div> | ||||||
|  |             {{/if}}</td> | ||||||
|           {{/each}} |           {{/each}} | ||||||
|           </span> |         </tr> | ||||||
|         </li> |  | ||||||
|         {{/each}} |         {{/each}} | ||||||
|       </ul> |       </table> | ||||||
|     </div> |     </div> | ||||||
|   </section> |   </section> | ||||||
| </form> | </form> | ||||||
|   | |||||||
| @@ -1,8 +0,0 @@ | |||||||
| <div class="post-item"> |  | ||||||
|   {{#if img}} |  | ||||||
|   <img class="chat-icon" src="{{img}}" title="{{name}}" /> |  | ||||||
|   {{/if}} |  | ||||||
|   <p>{{> 'systems/foundryvtt-reve-de-dragon/templates/common/compendium-link.hbs' pack=pack id=id name=name docType=docType}}</p> |  | ||||||
|   <p class="card-content">{{{system.description}}}</p> |  | ||||||
|  |  | ||||||
| </div> |  | ||||||
		Reference in New Issue
	
	Block a user