forked from public/foundryvtt-reve-de-dragon
		
	Compare commits
	
		
			12 Commits
		
	
	
		
			foundryvtt
			...
			foundryvtt
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 61eee66ebe | |||
| c75d10f69b | |||
| 333bb051c1 | |||
| 1bf247db33 | |||
| 49fc2c9b0a | |||
| 9013376096 | |||
| 972459a08d | |||
| 1607629365 | |||
| 8f7efdad87 | |||
| 2dbe0dea4a | |||
| 5fc455fbad | |||
| 8a7e4d3a9e | 
							
								
								
									
										11
									
								
								changelog.md
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								changelog.md
									
									
									
									
									
								
							| @@ -1,6 +1,17 @@ | |||||||
|  ---  |  ---  | ||||||
| # v10.7 - L'os de Semolosse | # v10.7 - L'os de Semolosse | ||||||
|  |  | ||||||
|  | ## v10.7.16 - la morsure de Semolosse | ||||||
|  | - correction de l'affichage des objets suite à confusion | ||||||
|  | - correction de liens dans la liste des équipements | ||||||
|  |  | ||||||
|  | ## v10.7.14 - l'expérience de Semolosse | ||||||
|  | - Affichage des personnages accordés sur les fiches des entités | ||||||
|  | - Refonte du journal d'expérience | ||||||
|  |   - disponible pour les personnages des joueurs | ||||||
|  |   - explication "comptable" des changements (dépense ou ajout, changements de niveaux, ...) | ||||||
|  | - tri alphabétique des différentes listes (sorts, recettes, oeuvres, ...) | ||||||
|  |  | ||||||
| ## v10.7.13 - l'armure de Semolosse | ## v10.7.13 - l'armure de Semolosse | ||||||
| - Fix: en cas d'armure variable, la détérioration diminue le dé d'armure | - Fix: en cas d'armure variable, la détérioration diminue le dé d'armure | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,4 +1,6 @@ | |||||||
| import { RdDActorSheet } from "./actor-sheet.js"; | import { RdDActorSheet } from "./actor-sheet.js"; | ||||||
|  | import { RdDSheetUtility } from "./rdd-sheet-utility.js"; | ||||||
|  | import { RdDUtility } from "./rdd-utility.js"; | ||||||
|  |  | ||||||
| export class RdDActorEntiteSheet extends RdDActorSheet { | export class RdDActorEntiteSheet extends RdDActorSheet { | ||||||
|  |  | ||||||
| @@ -13,6 +15,12 @@ export class RdDActorEntiteSheet extends RdDActorSheet { | |||||||
|       dragDrop: [{ dragSelector: ".item-list .item", dropSelector: undefined }] |       dragDrop: [{ dragSelector: ".item-list .item", dropSelector: undefined }] | ||||||
|     }); |     }); | ||||||
|   } |   } | ||||||
|  |   async getData() { | ||||||
|  |     let formData = await super.getData(); | ||||||
|  |     formData.resonances = this.actor.system.sante.resonnance.actors.map(actorId => game.actors.get(actorId)) | ||||||
|  |       .map(actor => { return { id: actor.id, name: actor.name, img: actor.img } }) | ||||||
|  |     return formData | ||||||
|  |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   /** @override */ |   /** @override */ | ||||||
| @@ -35,6 +43,23 @@ export class RdDActorEntiteSheet extends RdDActorSheet { | |||||||
|       let compName = event.currentTarget.attributes.compname.value; |       let compName = event.currentTarget.attributes.compname.value; | ||||||
|       this.actor.updateCreatureCompetence(compName, "dommages", parseInt(event.target.value)); |       this.actor.updateCreatureCompetence(compName, "dommages", parseInt(event.target.value)); | ||||||
|     }); |     }); | ||||||
|  |     this.html.find('.resonance-delete').click(async event => { | ||||||
|  |       const li = RdDSheetUtility.getEventElement(event); | ||||||
|  |       const actorId = li.data("actor-id"); | ||||||
|  |       if (actorId) { | ||||||
|  |         const actorResonance = game.actors.get(actorId); | ||||||
|  |         RdDUtility.confirmerSuppressionSubacteur(this, actorResonance, li, () => { | ||||||
|  |           console.log('Delete : ', actorId); | ||||||
|  |           this.removeSubacteur(actorId); | ||||||
|  |           RdDUtility.slideOnDelete(this, li); | ||||||
|  |         }); | ||||||
|  |       } | ||||||
|  |     }); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   async removeSubacteur(actorId) { | ||||||
|  |     let newResonances = this.actor.system.sante.resonnance.actors.filter(id => id != actorId); | ||||||
|  |     await this.actor.update({ 'system.sante.resonnance.actors': newResonances }, { renderSheet: false }); | ||||||
|   } |   } | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -129,7 +129,11 @@ export class RdDActorSheet extends RdDBaseActorSheet { | |||||||
|       const actorId = li.data("actor-id"); |       const actorId = li.data("actor-id"); | ||||||
|       if (actorId) { |       if (actorId) { | ||||||
|         const subActor = game.actors.get(actorId); |         const subActor = game.actors.get(actorId); | ||||||
|         RdDUtility.confirmerSuppressionSubacteur(this, subActor, li); |         RdDUtility.confirmerSuppressionSubacteur(this, subActor, li, () => { | ||||||
|  |           console.log('Delete : ', subActor.id); | ||||||
|  |           this.actor.removeSubacteur(subActor.id); | ||||||
|  |           RdDUtility.slideOnDelete(this, li); | ||||||
|  |         }); | ||||||
|       } |       } | ||||||
|     }); |     }); | ||||||
|     this.html.find('.experiencelog-delete').click(async event => { |     this.html.find('.experiencelog-delete').click(async event => { | ||||||
| @@ -142,6 +146,13 @@ export class RdDActorSheet extends RdDBaseActorSheet { | |||||||
|       const key = Number(li.data("key") ?? -1); |       const key = Number(li.data("key") ?? -1); | ||||||
|       await this.actor.deleteExperienceLog(0, key + 1); |       await this.actor.deleteExperienceLog(0, key + 1); | ||||||
|     }); |     }); | ||||||
|  |     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('.encaisser-direct').click(async event => { |     this.html.find('.encaisser-direct').click(async event => { | ||||||
|       this.actor.encaisser(); |       this.actor.encaisser(); | ||||||
|     }) |     }) | ||||||
| @@ -445,9 +456,9 @@ export class RdDActorSheet extends RdDBaseActorSheet { | |||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   async selectTypeOeuvreToCreate() { |   async selectTypeOeuvreToCreate() { | ||||||
|     let typeObjets = RdDItem.getTypesOeuvres(); |     let types = RdDItem.getTypesOeuvres(); | ||||||
|     let content = `<span class="competence-label">Selectionnez le type d'oeuvre</span><select class="item-type">`; |     let content = `<span class="competence-label">Selectionnez le type d'oeuvre</span><select class="item-type">`; | ||||||
|     for (let typeName of typeObjets) { |     for (let typeName of types) { | ||||||
|       content += `<option value="${typeName}">${Misc.typeName('Item', typeName)}</option>` |       content += `<option value="${typeName}">${Misc.typeName('Item', typeName)}</option>` | ||||||
|     } |     } | ||||||
|     content += '</select>'; |     content += '</select>'; | ||||||
|   | |||||||
							
								
								
									
										247
									
								
								module/actor.js
									
									
									
									
									
								
							
							
						
						
									
										247
									
								
								module/actor.js
									
									
									
									
									
								
							| @@ -37,6 +37,7 @@ import { RdDTimestamp } from "./time/rdd-timestamp.js"; | |||||||
| import { RdDItemBlessure } from "./item/blessure.js"; | import { RdDItemBlessure } from "./item/blessure.js"; | ||||||
| import { AppAstrologie } from "./sommeil/app-astrologie.js"; | import { AppAstrologie } from "./sommeil/app-astrologie.js"; | ||||||
| import { RdDEmpoignade } from "./rdd-empoignade.js"; | import { RdDEmpoignade } from "./rdd-empoignade.js"; | ||||||
|  | import { ExperienceLog, XP_TOPIC } from "./actor/experience-log.js"; | ||||||
|  |  | ||||||
| const POSSESSION_SANS_DRACONIC = { | const POSSESSION_SANS_DRACONIC = { | ||||||
|   img: 'systems/foundryvtt-reve-de-dragon/icons/entites/possession.webp', |   img: 'systems/foundryvtt-reve-de-dragon/icons/entites/possession.webp', | ||||||
| @@ -821,31 +822,40 @@ export class RdDActor extends RdDBaseActor { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   async updateCarac(caracName, caracValue) { |   async updateCarac(caracName, to) { | ||||||
|     if (caracName == "force") { |     if (caracName == "force") { | ||||||
|       if (Number(caracValue) > this.getTaille() + 4) { |       if (Number(to) > this.getTaille() + 4) { | ||||||
|         ui.notifications.warn("Votre FORCE doit être au maximum de TAILLE+4"); |         ui.notifications.warn("Votre FORCE doit être au maximum de TAILLE+4"); | ||||||
|         return; |         return; | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     if (caracName == "reve") { |     if (caracName == "reve") { | ||||||
|       if (caracValue > Misc.toInt(this.system.reve.seuil.value)) { |       if (to > Misc.toInt(this.system.reve.seuil.value)) { | ||||||
|         this.setPointsDeSeuil(caracValue); |         this.setPointsDeSeuil(to); | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     if (caracName == "chance") { |     if (caracName == "chance") { | ||||||
|       if (caracValue > Misc.toInt(this.system.compteurs.chance.value)) { |       if (to > Misc.toInt(this.system.compteurs.chance.value)) { | ||||||
|         this.setPointsDeChance(caracValue); |         this.setPointsDeChance(to); | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     await this.update({ [`system.carac.${caracName}.value`]: caracValue }); |     let selectedCarac = RdDActor._findCaracByName(this.system.carac, caracName); | ||||||
|  |     const from = selectedCarac.value | ||||||
|  |     await this.update({ [`system.carac.${caracName}.value`]: to }); | ||||||
|  |     await ExperienceLog.add(this, XP_TOPIC.CARAC, from, to, caracName); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   async updateCaracXP(caracName, caracXP) { |   async updateCaracXP(caracName, to) { | ||||||
|     if (caracName == 'Taille') { |     if (caracName == 'Taille') { | ||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|  |     let selectedCarac = RdDActor._findCaracByName(this.system.carac, caracName); | ||||||
|  |     if (!selectedCarac.derivee) { | ||||||
|  |       const from = Number(selectedCarac.xp); | ||||||
|  |       await this.update({ [`system.carac.${caracName}.xp`]: to }); | ||||||
|  |       await ExperienceLog.add(this, XP_TOPIC.XPCARAC, from, to, caracName); | ||||||
|  |     } | ||||||
|     this.checkCaracXP(caracName); |     this.checkCaracXP(caracName); | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -857,16 +867,19 @@ export class RdDActor extends RdDBaseActor { | |||||||
|     let carac = RdDActor._findCaracByName(this.system.carac, caracName); |     let carac = RdDActor._findCaracByName(this.system.carac, caracName); | ||||||
|     if (carac) { |     if (carac) { | ||||||
|       carac = duplicate(carac); |       carac = duplicate(carac); | ||||||
|       let xp = Number(carac.xp); |       const fromXp = Number(carac.xp); | ||||||
|       let value = Number(carac.value); |       const fromValue = Number(carac.value); | ||||||
|       while (xp >= RdDCarac.getCaracNextXp(value) && xp > 0) { |       let toXp = fromXp; | ||||||
|         xp -= RdDCarac.getCaracNextXp(value); |       let toValue = fromValue; | ||||||
|         value++; |       while (toXp >= RdDCarac.getCaracNextXp(toValue) && toXp > 0) { | ||||||
|  |         toXp -= RdDCarac.getCaracNextXp(toValue); | ||||||
|  |         toValue++; | ||||||
|       } |       } | ||||||
|       carac.xp = xp; |       carac.xp = toXp; | ||||||
|       carac.value = value; |       carac.value = toValue; | ||||||
|       await this.update({ [`system.carac.${caracName}`]: carac }); |       await this.update({ [`system.carac.${caracName}`]: carac }); | ||||||
|       this.updateExperienceLog("Carac +", xp, caracName + " passée à " + value); |       await ExperienceLog.add(this, XP_TOPIC.XPCARAC, fromXp, toXp, caracName); | ||||||
|  |       await ExperienceLog.add(this, XP_TOPIC.CARAC, fromValue, toValue, caracName); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -874,17 +887,20 @@ export class RdDActor extends RdDBaseActor { | |||||||
|   async updateCompetenceXPAuto(idOrName) { |   async updateCompetenceXPAuto(idOrName) { | ||||||
|     let competence = this.getCompetence(idOrName); |     let competence = this.getCompetence(idOrName); | ||||||
|     if (competence) { |     if (competence) { | ||||||
|       let xp = Number(competence.system.xp); |       const fromXp = Number(competence.system.xp); | ||||||
|       let niveau = Number(competence.system.niveau); |       const fromNiveau = Number(competence.system.niveau); | ||||||
|       while (xp >= RdDItemCompetence.getCompetenceNextXp(niveau) && xp > 0) { |       let toXp = fromXp; | ||||||
|         xp -= RdDItemCompetence.getCompetenceNextXp(niveau); |       let toNiveau = fromNiveau; | ||||||
|         niveau++; |       while (toXp >= RdDItemCompetence.getCompetenceNextXp(toNiveau) && toXp > 0) { | ||||||
|  |         toXp -= RdDItemCompetence.getCompetenceNextXp(toNiveau); | ||||||
|  |         toNiveau++; | ||||||
|       } |       } | ||||||
|       await competence.update({ |       await competence.update({ | ||||||
|         "system.xp": xp, |         "system.xp": toXp, | ||||||
|         "system.niveau": niveau, |         "system.niveau": toNiveau, | ||||||
|       }); |       }); | ||||||
|       this.updateExperienceLog("Compétence +", xp, competence.name + " passée à " + niveau); |       await ExperienceLog.add(this, XP_TOPIC.XP, fromXp, toXp, competence.name); | ||||||
|  |       await ExperienceLog.add(this, XP_TOPIC.NIVEAU, fromNiveau, toNiveau, competence.name); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -893,29 +909,33 @@ export class RdDActor extends RdDBaseActor { | |||||||
|     if (!competence) { |     if (!competence) { | ||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|     const stress = this.system.compteurs.experience.value; |     const fromXp = competence.system.xp; | ||||||
|     const niveau = Number(competence.system.niveau); |     const fromXpStress = this.system.compteurs.experience.value; | ||||||
|     const xpSuivant = RdDItemCompetence.getCompetenceNextXp(niveau); |     const fromNiveau = Number(competence.system.niveau); | ||||||
|     const xpRequis = xpSuivant - competence.system.xp; |     const xpSuivant = RdDItemCompetence.getCompetenceNextXp(fromNiveau); | ||||||
|     if (stress <= 0 || niveau >= competence.system.niveau_archetype) { |     const xpRequis = xpSuivant - fromXp; | ||||||
|  |     if (fromXpStress <= 0 || fromNiveau >= competence.system.niveau_archetype) { | ||||||
|       ui.notifications.info(`La compétence ne peut pas augmenter! |       ui.notifications.info(`La compétence ne peut pas augmenter! | ||||||
|           stress disponible: ${stress} |           stress disponible: ${fromXpStress} | ||||||
|           expérience requise: ${xpRequis} |           expérience requise: ${xpRequis} | ||||||
|           niveau : ${niveau} |           niveau : ${fromNiveau} | ||||||
|           archétype : ${competence.system.niveau_archetype}`); |           archétype : ${competence.system.niveau_archetype}`); | ||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|     const xpUtilise = Math.max(0, Math.min(stress, xpRequis)); |     const xpUtilise = Math.max(0, Math.min(fromXpStress, xpRequis)); | ||||||
|     const gainNiveau = (xpUtilise >= xpRequis || xpRequis <= 0) ? 1 : 0; |     const gainNiveau = (xpUtilise >= xpRequis || xpRequis <= 0) ? 1 : 0; | ||||||
|     const nouveauNiveau = niveau + gainNiveau; |     const toNiveau = fromNiveau + gainNiveau; | ||||||
|     const nouveauXp = gainNiveau > 0 ? Math.max(competence.system.xp - xpSuivant, 0) : (competence.system.xp + xpUtilise); |     const newXp = gainNiveau > 0 ? Math.max(fromXp - xpSuivant, 0) : (fromXp + xpUtilise); | ||||||
|     await competence.update({ |     await competence.update({ | ||||||
|       "system.xp": nouveauXp, |       "system.xp": newXp, | ||||||
|       "system.niveau": nouveauNiveau, |       "system.niveau": toNiveau, | ||||||
|     }); |     }); | ||||||
|     const stressTransformeRestant = Math.max(0, stress - xpUtilise); |     const toXpStress = Math.max(0, fromXpStress - xpUtilise); | ||||||
|     await this.update({ "system.compteurs.experience.value": stressTransformeRestant }); |     await this.update({ "system.compteurs.experience.value": toXpStress }); | ||||||
|     this.updateExperienceLog('Dépense stress', xpUtilise, `Stress en ${competence.name} ${gainNiveau ? "pour passer à " + nouveauNiveau : ""}`); |  | ||||||
|  |     await ExperienceLog.add(this, XP_TOPIC.TRANSFORM, fromXpStress, toXpStress, `Dépense stress`); | ||||||
|  |     await ExperienceLog.add(this, XP_TOPIC.XP, fromXp, newXp, competence.name); | ||||||
|  |     await ExperienceLog.add(this, XP_TOPIC.NIVEAU, fromNiveau, toNiveau, competence.name); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
| @@ -941,49 +961,57 @@ export class RdDActor extends RdDBaseActor { | |||||||
|   async updateCompetence(idOrName, compValue) { |   async updateCompetence(idOrName, compValue) { | ||||||
|     let competence = this.getCompetence(idOrName); |     let competence = this.getCompetence(idOrName); | ||||||
|     if (competence) { |     if (competence) { | ||||||
|       let nouveauNiveau = compValue ?? RdDItemCompetence.getNiveauBase(competence.system.categorie); |       let toNiveau = compValue ?? RdDItemCompetence.getNiveauBase(competence.system.categorie); | ||||||
|       const tronc = RdDItemCompetence.getListTronc(competence.name).filter(it => { |       this.notifyCompetencesTronc(competence, toNiveau); | ||||||
|         const comp = this.getCompetence(it); |       const fromNiveau = competence.system.niveau; | ||||||
|         const niveauTr = competence ? competence.system.niveau : 0; |       await this.updateEmbeddedDocuments('Item', [{ _id: competence.id, 'system.niveau': toNiveau }]); | ||||||
|         return niveauTr < 0 && niveauTr < nouveauNiveau; |       await ExperienceLog.add(this, XP_TOPIC.NIVEAU, fromNiveau, toNiveau, competence.name, true); | ||||||
|       }); |  | ||||||
|       if (tronc.length > 0) { |  | ||||||
|         let message = "Vous avez modifié une compétence 'tronc'. Vérifiez que les compétences suivantes évoluent ensemble jusqu'au niveau 0 : "; |  | ||||||
|         for (let troncName of tronc) { |  | ||||||
|           message += "<br>" + troncName; |  | ||||||
|         } |  | ||||||
|         ui.notifications.info(message); |  | ||||||
|       } |  | ||||||
|       const update = { _id: competence.id, 'system.niveau': nouveauNiveau }; |  | ||||||
|       await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity |  | ||||||
|     } else { |     } else { | ||||||
|       console.log("Competence not found", idOrName); |       console.log("Competence not found", idOrName); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   notifyCompetencesTronc(competence, toNiveau) { | ||||||
|  |     const listTronc = RdDItemCompetence.getListTronc(competence.name).filter(it => { | ||||||
|  |       const autreComp = this.getCompetence(it); | ||||||
|  |       const niveauTr = autreComp?.system.niveau ?? 0; | ||||||
|  |       return niveauTr < 0 && niveauTr < toNiveau; | ||||||
|  |     }); | ||||||
|  |     if (listTronc.length > 0) { | ||||||
|  |       ui.notifications.info( | ||||||
|  |         "Vous avez modifié une compétence 'tronc'. Vérifiez que les compétences suivantes évoluent ensemble jusqu'au niveau 0 : <br>" | ||||||
|  |         + Misc.join(listTronc, '<br>')); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   async updateCompetenceXP(idOrName, newXp) { |   async updateCompetenceXP(idOrName, toXp) { | ||||||
|     let competence = this.getCompetence(idOrName); |     let competence = this.getCompetence(idOrName); | ||||||
|     if (competence) { |     if (competence) { | ||||||
|       if (isNaN(newXp) || typeof (newXp) != 'number') newXp = 0; |       if (isNaN(toXp) || typeof (toXp) != 'number') toXp = 0; | ||||||
|       this.checkCompetenceXP(idOrName, newXp); |       const fromXp = competence.system.xp; | ||||||
|       const update = { _id: competence.id, 'system.xp': newXp }; |       this.checkCompetenceXP(idOrName, toXp); | ||||||
|       await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity |       await this.updateEmbeddedDocuments('Item', [{ _id: competence.id, 'system.xp': toXp }]); | ||||||
|       this.updateExperienceLog("XP", newXp, "XP modifié en " + competence.name); |       await ExperienceLog.add(this, XP_TOPIC.XP, fromXp, toXp, competence.name, true); | ||||||
|     } else { |       if (toXp > fromXp) { | ||||||
|       console.log("Competence not found", idOrName); |  | ||||||
|     } |  | ||||||
|         RdDUtility.checkThanatosXP(idOrName); |         RdDUtility.checkThanatosXP(idOrName); | ||||||
|       } |       } | ||||||
|  |     } else { | ||||||
|  |       console.log("Competence not found", idOrName); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   async updateCompetenceXPSort(idOrName, compValue) { |   async updateCompetenceXPSort(idOrName, toXpSort) { | ||||||
|     let competence = this.getCompetence(idOrName); |     let competence = this.getCompetence(idOrName); | ||||||
|     if (competence) { |     if (competence) { | ||||||
|       if (isNaN(compValue) || typeof (compValue) != 'number') compValue = 0; |       if (isNaN(toXpSort) || typeof (toXpSort) != 'number') toXpSort = 0; | ||||||
|       const update = { _id: competence.id, 'system.xp_sort': compValue }; |       const fromXpSort = competence.system.xp_sort; | ||||||
|       await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity |       await this.updateEmbeddedDocuments('Item', [{ _id: competence.id, 'system.xp_sort': toXpSort }]); | ||||||
|       this.updateExperienceLog("XP Sort", compValue, "XP modifié en sort de " + competence.name); |       await ExperienceLog.add(this, XP_TOPIC.XPSORT, fromXpSort, toXpSort, competence.name, true); | ||||||
|  |       if (toXpSort > fromXpSort) { | ||||||
|  |         RdDUtility.checkThanatosXP(idOrName); | ||||||
|  |       } | ||||||
|     } else { |     } else { | ||||||
|       console.log("Competence not found", idOrName); |       console.log("Competence not found", idOrName); | ||||||
|     } |     } | ||||||
| @@ -993,26 +1021,12 @@ export class RdDActor extends RdDBaseActor { | |||||||
|   async updateCompetenceArchetype(idOrName, compValue) { |   async updateCompetenceArchetype(idOrName, compValue) { | ||||||
|     let competence = this.getCompetence(idOrName); |     let competence = this.getCompetence(idOrName); | ||||||
|     if (competence) { |     if (competence) { | ||||||
|       compValue = compValue ?? 0; |       await this.updateEmbeddedDocuments('Item', [{ _id: competence.id, 'system.niveau_archetype': Math.max(compValue ?? 0, 0) }]); | ||||||
|       const update = { _id: competence.id, 'system.niveau_archetype': compValue }; |  | ||||||
|       await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity |  | ||||||
|     } else { |     } else { | ||||||
|       console.log("Competence not found", idOrName); |       console.log("Competence not found", idOrName); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |  | ||||||
|   async updateExperienceLog(modeXP, valeurXP, raisonXP = 'Inconnue') { |  | ||||||
|     let d = new Date(); |  | ||||||
|     let expLog = duplicate(this.system.experiencelog); |  | ||||||
|     expLog.push({ |  | ||||||
|       mode: Misc.upperFirst(modeXP), valeur: valeurXP, raison: Misc.upperFirst(raisonXP), |  | ||||||
|       daterdd: game.system.rdd.calendrier.dateCourante(), |  | ||||||
|       datereel: `${d.getDate()}/${d.getMonth() + 1}/${d.getFullYear()}` |  | ||||||
|     }); |  | ||||||
|     await this.update({ [`system.experiencelog`]: expLog }); |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   async deleteExperienceLog(from, count) { |   async deleteExperienceLog(from, count) { | ||||||
|     if (from >= 0 && count > 0) { |     if (from >= 0 && count > 0) { | ||||||
|       let expLog = duplicate(this.system.experiencelog); |       let expLog = duplicate(this.system.experiencelog); | ||||||
| @@ -1021,24 +1035,27 @@ export class RdDActor extends RdDBaseActor { | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   async updateCompteurValue(fieldName, fieldValue, raison = 'Inconnue') { |   async updateCompteurValue(fieldName, to) { | ||||||
|     await this.update({ [`system.compteurs.${fieldName}.value`]: fieldValue }); |     const from = this.system.compteurs[fieldName].value | ||||||
|     await this.addStressExperienceLog(fieldName, fieldValue, 'forcé: ' + raison); |     await this.update({ [`system.compteurs.${fieldName}.value`]: to }); | ||||||
|  |     await this.addStressExperienceLog(fieldName, from, to, fieldName, true); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   async addCompteurValue(fieldName, fieldValue, raison = 'Inconnue') { |   async addCompteurValue(fieldName, add, raison) { | ||||||
|     let oldValue = this.system.compteurs[fieldName].value; |     let from = this.system.compteurs[fieldName].value; | ||||||
|     await this.update({ [`system.compteurs.${fieldName}.value`]: Number(oldValue) + Number(fieldValue) }); |     const to = Number(from) + Number(add); | ||||||
|     await this.addStressExperienceLog(fieldName, fieldValue, raison); |     await this.update({ [`system.compteurs.${fieldName}.value`]: to }); | ||||||
|  |     await this.addStressExperienceLog(fieldName, from, to, raison); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   async addStressExperienceLog(fieldName, fieldValue, raison) { |   async addStressExperienceLog(topic, from, to, raison, manuel) { | ||||||
|     switch (fieldName) { |     switch (topic) { | ||||||
|       case 'stress': case 'experience': |       case 'stress': | ||||||
|         await this.updateExperienceLog(fieldName, fieldValue, raison); |         return await ExperienceLog.add(this, XP_TOPIC.STRESS, from, to, raison, manuel) | ||||||
|  |       case 'experience': | ||||||
|  |         return await ExperienceLog.add(this, XP_TOPIC.TRANSFORM, from, to, raison, manuel) | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -1843,14 +1860,14 @@ export class RdDActor extends RdDBaseActor { | |||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   async transformerStress() { |   async transformerStress() { | ||||||
|     const stress = Number(this.system.compteurs.stress.value); |     const fromStress = Number(this.system.compteurs.stress.value); | ||||||
|     if (this.system.sommeil?.insomnie || stress <= 0) { |     if (this.system.sommeil?.insomnie || fromStress <= 0) { | ||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     const stressRoll = await this._stressRoll(this.getReveActuel()); |     const stressRoll = await this._stressRoll(this.getReveActuel()); | ||||||
|  |  | ||||||
|     const conversion = Math.floor(stress * stressRoll.factor / 100); |     const conversion = Math.floor(fromStress * stressRoll.factor / 100); | ||||||
|     let dissolution = Math.max(0, Number(this.system.compteurs.dissolution.value)); |     let dissolution = Math.max(0, Number(this.system.compteurs.dissolution.value)); | ||||||
|     let exaltation = Math.max(0, Number(this.system.compteurs.exaltation.value)); |     let exaltation = Math.max(0, Number(this.system.compteurs.exaltation.value)); | ||||||
|     const annule = Math.min(dissolution, exaltation); |     const annule = Math.min(dissolution, exaltation); | ||||||
| @@ -1862,8 +1879,8 @@ export class RdDActor extends RdDBaseActor { | |||||||
|       alias: this.name, |       alias: this.name, | ||||||
|       selectedCarac: this.system.carac.reve, |       selectedCarac: this.system.carac.reve, | ||||||
|       rolled: stressRoll, |       rolled: stressRoll, | ||||||
|       stress: stress, |       stress: fromStress, | ||||||
|       perte: Math.min(conversion, stress), |       perte: Math.min(conversion, fromStress), | ||||||
|       convertis: conversion - perteDissolution, |       convertis: conversion - perteDissolution, | ||||||
|       xp: conversion - perteDissolution + exaltation, |       xp: conversion - perteDissolution + exaltation, | ||||||
|       dissolution: dissolution, |       dissolution: dissolution, | ||||||
| @@ -1875,15 +1892,18 @@ export class RdDActor extends RdDBaseActor { | |||||||
|       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.html`, stressRollData) | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|  |     const toStress = Math.max(fromStress - stressRollData.perte - 1, 0); | ||||||
|  |     const fromXpSress = Number(this.system.compteurs.experience.value); | ||||||
|  |     const toXpStress = fromXpSress + Number(stressRollData.xp); | ||||||
|     const updates = { |     const updates = { | ||||||
|       "system.compteurs.stress.value": Math.max(stress - stressRollData.perte - 1, 0), |       "system.compteurs.stress.value": toStress, | ||||||
|       "system.compteurs.experience.value": Number(this.system.compteurs.experience.value) + Number(stressRollData.xp), |       "system.compteurs.experience.value": toXpStress, | ||||||
|       "system.compteurs.dissolution.value": dissolution - perteDissolution, |       "system.compteurs.dissolution.value": dissolution - perteDissolution, | ||||||
|       "system.compteurs.exaltation.value": 0 |       "system.compteurs.exaltation.value": 0 | ||||||
|     } |     } | ||||||
|     await this.update(updates); |     await this.update(updates); | ||||||
|  |     await ExperienceLog.add(this, XP_TOPIC.STRESS, fromStress, toStress, 'Transformation') | ||||||
|     this.updateExperienceLog('XP', stressRollData.xp, "Transformation du stress"); |     await ExperienceLog.add(this, XP_TOPIC.TRANSFORM, fromXpSress, toXpStress, 'Transformation') | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
| @@ -2709,8 +2729,10 @@ export class RdDActor extends RdDBaseActor { | |||||||
|     } |     } | ||||||
|     rollData.xpSort = RdDItemSigneDraconique.getXpSortSigneDraconique(rollData.rolled.code, rollData.signe); |     rollData.xpSort = RdDItemSigneDraconique.getXpSortSigneDraconique(rollData.rolled.code, rollData.signe); | ||||||
|     if (rollData.xpSort > 0) { |     if (rollData.xpSort > 0) { | ||||||
|       await this.updateEmbeddedDocuments("Item", [{ _id: compData._id, 'system.xp_sort': Misc.toInt(compData.system.xp_sort) + rollData.xpSort }]); |       const fromXp = Number(compData.system.xp_sort); | ||||||
|       await this.updateExperienceLog("XP Sort", rollData.xpSort, "Signe draconique en " + rollData.competence.name); |       const toXp = fromXp + rollData.xpSort; | ||||||
|  |       await this.updateEmbeddedDocuments("Item", [{ _id: compData._id, 'system.xp_sort': toXp }]); | ||||||
|  |       await ExperienceLog.add(this, XP_TOPIC.XPSORT, fromXp, toXp, `${rollData.competence.name} : signe draconique`); | ||||||
|     } |     } | ||||||
|     await this.deleteEmbeddedDocuments("Item", [rollData.signe._id]); |     await this.deleteEmbeddedDocuments("Item", [rollData.signe._id]); | ||||||
|     await RdDResolutionTable.displayRollData(rollData, this.name, 'chat-resultat-lecture-signedraconique.html'); |     await RdDResolutionTable.displayRollData(rollData, this.name, 'chat-resultat-lecture-signedraconique.html'); | ||||||
| @@ -2824,11 +2846,12 @@ export class RdDActor extends RdDBaseActor { | |||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   async _xpCompetence(xpData) { |   async _xpCompetence(xpData) { | ||||||
|     if (xpData.competence) { |     if (xpData.competence) { | ||||||
|       const newXp = Misc.toInt(xpData.competence.system.xp) + xpData.xpCompetence; |       const from = Number(xpData.competence.system.xp); | ||||||
|       let update = { _id: xpData.competence._id, 'system.xp': newXp }; |       const to = from + xpData.xpCompetence; | ||||||
|  |       let update = { _id: xpData.competence._id, 'system.xp': to }; | ||||||
|       await this.updateEmbeddedDocuments('Item', [update]); |       await this.updateEmbeddedDocuments('Item', [update]); | ||||||
|       xpData.checkComp = await this.checkCompetenceXP(xpData.competence.name, undefined, false); |       xpData.checkComp = await this.checkCompetenceXP(xpData.competence.name, undefined, false); | ||||||
|       this.updateExperienceLog("XP", xpData.xpCompetence, "XP gagné en " + xpData.competence.name); |       await ExperienceLog.add(this, XP_TOPIC.XP, from, to, xpData.competence.name); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -2838,10 +2861,12 @@ export class RdDActor extends RdDBaseActor { | |||||||
|       let carac = duplicate(this.system.carac); |       let carac = duplicate(this.system.carac); | ||||||
|       let selectedCarac = RdDActor._findCaracByName(carac, xpData.caracName); |       let selectedCarac = RdDActor._findCaracByName(carac, xpData.caracName); | ||||||
|       if (!selectedCarac.derivee) { |       if (!selectedCarac.derivee) { | ||||||
|         selectedCarac.xp = Misc.toInt(selectedCarac.xp) + xpData.xpCarac; |         const from = Number(selectedCarac.xp); | ||||||
|  |         const to = from + xpData.xpCarac; | ||||||
|  |         selectedCarac.xp = to; | ||||||
|         await this.update({ "system.carac": carac }); |         await this.update({ "system.carac": carac }); | ||||||
|         xpData.checkCarac = await this.checkCaracXP(selectedCarac.label, false); |         xpData.checkCarac = await this.checkCaracXP(selectedCarac.label, false); | ||||||
|         this.updateExperienceLog("XP", xpData.xpCarac, "XP gagné en " + xpData.caracName); |         await ExperienceLog.add(this, XP_TOPIC.XPCARAC, from, to, xpData.caracName); | ||||||
|       } else { |       } else { | ||||||
|         xpData.caracRepartitionManuelle = true; |         xpData.caracRepartitionManuelle = true; | ||||||
|       } |       } | ||||||
|   | |||||||
| @@ -50,16 +50,16 @@ export class RdDBaseActorSheet extends ActorSheet { | |||||||
|       encTotal: await this.actor.computeEncTotal(), |       encTotal: await this.actor.computeEncTotal(), | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     this.objetVersConteneur = RdDUtility.buildArbreDeConteneurs(formData.conteneurs, formData.objets); |     this.objetVersConteneur = RdDUtility.buildArbreDeConteneurs(formData.conteneurs, formData.inventaires); | ||||||
|     this._appliquerRechercheObjets(formData.objets, formData.conteneurs); |     this._appliquerRechercheObjets(formData.conteneurs, formData.inventaires); | ||||||
|     formData.conteneurs = RdDUtility.conteneursRacine(formData.conteneurs); |     formData.conteneurs = RdDUtility.conteneursRacine(formData.conteneurs); | ||||||
|     return formData; |     return formData; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   _appliquerRechercheObjets(objets, conteneurs) { |   _appliquerRechercheObjets(conteneurs, inventaires) { | ||||||
|     if (this.options.recherche?.text) { |     if (this.options.recherche?.text) { | ||||||
|       const recherche = this.options.recherche; |       const recherche = this.options.recherche; | ||||||
|       const allVisible = objets.filter(it => it.isNomTypeLike(recherche.text)).map(it => it.id); |       const allVisible = inventaires.filter(it => it.isNomTypeLike(recherche.text)).map(it => it.id); | ||||||
|       let addVisible = conteneurs.filter(it => it.isNomTypeLike(recherche.text)).map(it => it.id) |       let addVisible = conteneurs.filter(it => it.isNomTypeLike(recherche.text)).map(it => it.id) | ||||||
|       do { |       do { | ||||||
|         allVisible.push(...addVisible) |         allVisible.push(...addVisible) | ||||||
| @@ -67,11 +67,11 @@ export class RdDBaseActorSheet extends ActorSheet { | |||||||
|         addVisible = parentsIds.filter(id => !allVisible.includes(id)) |         addVisible = parentsIds.filter(id => !allVisible.includes(id)) | ||||||
|       } |       } | ||||||
|       while (addVisible.length > 0) |       while (addVisible.length > 0) | ||||||
|       objets.forEach(it => it.system.isHidden = !allVisible.includes(it.id)) |       inventaires.forEach(it => it.system.isHidden = !allVisible.includes(it.id)) | ||||||
|       conteneurs.forEach(it => it.system.isHidden = !allVisible.includes(it.id)) |       conteneurs.forEach(it => it.system.isHidden = !allVisible.includes(it.id)) | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
|       objets.forEach(it => it.system.isHidden = false) |       inventaires.forEach(it => it.system.isHidden = false) | ||||||
|       conteneurs.forEach(it => it.system.isHidden = false) |       conteneurs.forEach(it => it.system.isHidden = false) | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| @@ -118,9 +118,10 @@ export class RdDBaseActorSheet extends ActorSheet { | |||||||
|     formData.herbes = Misc.arrayOrEmpty(itemTypes['herbe']); |     formData.herbes = Misc.arrayOrEmpty(itemTypes['herbe']); | ||||||
|     formData.nourritureboissons = Misc.arrayOrEmpty(itemTypes['nourritureboisson']); |     formData.nourritureboissons = Misc.arrayOrEmpty(itemTypes['nourritureboisson']); | ||||||
|     formData.gemmes = Misc.arrayOrEmpty(itemTypes['gemme']); |     formData.gemmes = Misc.arrayOrEmpty(itemTypes['gemme']); | ||||||
|     formData.monnaie = Misc.arrayOrEmpty(itemTypes['monnaie']).sort(Monnaie.triValeurEntiere()); |     formData.monnaies = Misc.arrayOrEmpty(itemTypes['monnaie']).sort(Monnaie.triValeurEntiere()); | ||||||
|  |     formData.objets = Misc.arrayOrEmpty(itemTypes['objet']) | ||||||
|  |  | ||||||
|     formData.objets = RdDItem.getItemTypesInventaire('all') |     formData.inventaires = RdDItem.getItemTypesInventaire('all') | ||||||
|       .map(t => Misc.arrayOrEmpty(itemTypes[t])) |       .map(t => Misc.arrayOrEmpty(itemTypes[t])) | ||||||
|       .reduce((a, b) => a.concat(b), []) |       .reduce((a, b) => a.concat(b), []) | ||||||
|       .sort(Misc.ascending(it => it.name)); |       .sort(Misc.ascending(it => it.name)); | ||||||
| @@ -230,9 +231,9 @@ export class RdDBaseActorSheet extends ActorSheet { | |||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   async selectObjetTypeToCreate() { |   async selectObjetTypeToCreate() { | ||||||
|     let typeObjets = this.getTypesInventaire().sort(Misc.ascending(type => Misc.typeName('Item', type))); |     let types = this.getTypesInventaire().sort(Misc.ascending(type => Misc.typeName('Item', type))); | ||||||
|     let content = `<span class="competence-label">Selectionnez le type d'équipement</span><select class="item-type">`; |     let content = `<span class="competence-label">Selectionnez le type d'équipement</span><select class="item-type">`; | ||||||
|     for (let typeName of typeObjets) { |     for (let typeName of types) { | ||||||
|       content += `<option value="${typeName}">${Misc.typeName('Item', typeName)}</option>` |       content += `<option value="${typeName}">${Misc.typeName('Item', typeName)}</option>` | ||||||
|     } |     } | ||||||
|     content += '</select>'; |     content += '</select>'; | ||||||
|   | |||||||
							
								
								
									
										39
									
								
								module/actor/experience-log.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								module/actor/experience-log.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,39 @@ | |||||||
|  |  | ||||||
|  | export const XP_TOPIC = { | ||||||
|  |   XP: { code: 'xp', label: 'xp' }, | ||||||
|  |   XPSORT: { code: 'xpsort', label: 'xp sort' }, | ||||||
|  |   NIVEAU: { code: 'niveau', label: 'Niveau' }, | ||||||
|  |   XPCARAC: { code: 'xpcarac', label: 'xp carac' }, | ||||||
|  |   CARAC: { code: 'carac', label: 'Carac' }, | ||||||
|  |   STRESS: { code: 'stress', label: 'Stress' }, | ||||||
|  |   TRANSFORM: { code: 'xps', label: 'Transformé' }, | ||||||
|  | } | ||||||
|  |  | ||||||
|  | export class ExperienceLog { | ||||||
|  |  | ||||||
|  |   static async add(actor, topic, from, to, raison, manuel = false) { | ||||||
|  |     if (!actor.hasPlayerOwner || !actor.isPersonnage()) { | ||||||
|  |       return | ||||||
|  |     } | ||||||
|  |     if (from == to) { | ||||||
|  |       return | ||||||
|  |     } | ||||||
|  |     const newXpLog = { | ||||||
|  |       mode: topic?.code ?? topic, | ||||||
|  |       raison: (manuel ? '(manuel) ' : '') + raison, | ||||||
|  |       from: from, | ||||||
|  |       to: to, | ||||||
|  |       valeur: to - from, | ||||||
|  |       daterdd: game.system.rdd.calendrier.dateCourante(), | ||||||
|  |       datereel: game.system.rdd.calendrier.dateReel().replace('T', ' ') | ||||||
|  |     }; | ||||||
|  |     console.log('ExperienceLog.add', newXpLog) | ||||||
|  |     const newExperienceLog = (actor.system.experiencelog ?? []).concat([newXpLog]); | ||||||
|  |     await actor.update({ [`system.experiencelog`]: newExperienceLog }); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   static labelTopic(topic) { | ||||||
|  |     const xpt = Object.values(XP_TOPIC).find(it => it.code == topic); | ||||||
|  |     return xpt?.label ?? xpt?.code ?? topic; | ||||||
|  |   } | ||||||
|  | } | ||||||
| @@ -25,23 +25,13 @@ export class DialogChronologie extends Dialog { | |||||||
|       journalId: game.settings.get(SYSTEM_RDD, LATEST_USED_JOURNAL_ID), |       journalId: game.settings.get(SYSTEM_RDD, LATEST_USED_JOURNAL_ID), | ||||||
|       journaux: game.journal.filter(it => it.testUserPermission(game.user, CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER)), |       journaux: game.journal.filter(it => it.testUserPermission(game.user, CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER)), | ||||||
|       timestamp: game.system.rdd.calendrier.timestamp, |       timestamp: game.system.rdd.calendrier.timestamp, | ||||||
|       dateReel: DialogChronologie.getCurrentDateTime() |       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.html", dialogData); | ||||||
|     const dialog = new DialogChronologie(html, dialogData); |     const dialog = new DialogChronologie(html, dialogData); | ||||||
|     dialog.render(true); |     dialog.render(true); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   static getCurrentDateTime() { |  | ||||||
|     return new Date().toLocaleString("sv-SE", { |  | ||||||
|       year: "numeric", |  | ||||||
|       month: "2-digit", |  | ||||||
|       day: "2-digit", |  | ||||||
|       hour: "2-digit", |  | ||||||
|       minute: "2-digit" |  | ||||||
|     }).replace(" ", "T"); |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   constructor(html, dialogData) { |   constructor(html, dialogData) { | ||||||
|     const options = { |     const options = { | ||||||
|       classes: ["DialogChronologie"], |       classes: ["DialogChronologie"], | ||||||
| @@ -124,7 +114,7 @@ export class DialogChronologie extends Dialog { | |||||||
|         heure: RdDTimestamp.definition(this.html.find("form.rdddialogchrono :input[name='chronologie.heure']").val()), |         heure: RdDTimestamp.definition(this.html.find("form.rdddialogchrono :input[name='chronologie.heure']").val()), | ||||||
|         minute: this.html.find("form.rdddialogchrono :input[name='chronologie.minute']").val(), |         minute: this.html.find("form.rdddialogchrono :input[name='chronologie.minute']").val(), | ||||||
|       }, |       }, | ||||||
|       dateReel: this.html.find("form.rdddialogchrono :input[name='dateReel']").val().replace('T', ' ') |       dateReel: this.html.find("form.rdddialogchrono :input[name='dateReel']").val() | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -15,6 +15,7 @@ export const TYPES = { | |||||||
|   conteneur: 'conteneur', |   conteneur: 'conteneur', | ||||||
|   sort: 'sort', |   sort: 'sort', | ||||||
|   herbe: 'herbe', |   herbe: 'herbe', | ||||||
|  |   plante: 'plante', | ||||||
|   faune: 'faune', |   faune: 'faune', | ||||||
|   ingredient: 'ingredient', |   ingredient: 'ingredient', | ||||||
|   livre: 'livre', |   livre: 'livre', | ||||||
| @@ -34,6 +35,8 @@ export const TYPES = { | |||||||
|   maladie: 'maladie', |   maladie: 'maladie', | ||||||
|   poison: 'poison', |   poison: 'poison', | ||||||
|   oeuvre: 'oeuvre', |   oeuvre: 'oeuvre', | ||||||
|  |   monnaie: 'monnaie', | ||||||
|  |   munition: 'munition', | ||||||
|   nourritureboisson: 'nourritureboisson', |   nourritureboisson: 'nourritureboisson', | ||||||
|   service: 'service', |   service: 'service', | ||||||
|   signedraconique: 'signedraconique', |   signedraconique: 'signedraconique', | ||||||
| @@ -42,7 +45,8 @@ export const TYPES = { | |||||||
|   sortreserve: 'sortreserve', |   sortreserve: 'sortreserve', | ||||||
|   extraitpoetique: 'extraitpoetique', |   extraitpoetique: 'extraitpoetique', | ||||||
|   tarot: 'tarot', |   tarot: 'tarot', | ||||||
|   empoignade: 'empoignade' |   empoignade: 'empoignade', | ||||||
|  |   objet: 'objet' | ||||||
| } | } | ||||||
| const typesInventaireMateriel = [ | const typesInventaireMateriel = [ | ||||||
|   TYPES.arme, |   TYPES.arme, | ||||||
|   | |||||||
| @@ -29,7 +29,7 @@ export class RdDConteneurItemSheet extends RdDItemInventaireSheet { | |||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   prepareConteneurData(formData) { |   prepareConteneurData(formData) { | ||||||
|     RdDBaseActorSheet.filterItemsPerTypeForSheet(formData, this.actor.itemTypes); |     RdDBaseActorSheet.filterItemsPerTypeForSheet(formData, this.actor.itemTypes); | ||||||
|     this.objetVersConteneur = RdDUtility.buildArbreDeConteneurs(formData.conteneurs, formData.objets); |     this.objetVersConteneur = RdDUtility.buildArbreDeConteneurs(formData.conteneurs, formData.inventaires); | ||||||
|     formData.subItems = formData.conteneurs.find(it => it._id == this.item.id)?.subItems; |     formData.subItems = formData.conteneurs.find(it => it._id == this.item.id)?.subItems; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -16,6 +16,7 @@ import { RdDResolutionTable } from "./rdd-resolution-table.js"; | |||||||
| import { RdDTimestamp } from "./time/rdd-timestamp.js"; | import { RdDTimestamp } from "./time/rdd-timestamp.js"; | ||||||
| import { RdDRaretes } from "./item/raretes.js"; | import { RdDRaretes } from "./item/raretes.js"; | ||||||
| import { RdDEmpoignade } from "./rdd-empoignade.js"; | import { RdDEmpoignade } from "./rdd-empoignade.js"; | ||||||
|  | import { ExperienceLog } from "./actor/experience-log.js"; | ||||||
|  |  | ||||||
| /* -------------------------------------------- */ | /* -------------------------------------------- */ | ||||||
| // This table starts at 0 -> niveau -10 | // This table starts at 0 -> niveau -10 | ||||||
| @@ -136,6 +137,7 @@ export class RdDUtility { | |||||||
|       'systems/foundryvtt-reve-de-dragon/templates/actor/blessure.hbs', |       'systems/foundryvtt-reve-de-dragon/templates/actor/blessure.hbs', | ||||||
|       'systems/foundryvtt-reve-de-dragon/templates/actor/maladies-poisons.html', |       'systems/foundryvtt-reve-de-dragon/templates/actor/maladies-poisons.html', | ||||||
|       'systems/foundryvtt-reve-de-dragon/templates/actor/possessions.html', |       'systems/foundryvtt-reve-de-dragon/templates/actor/possessions.html', | ||||||
|  |       'systems/foundryvtt-reve-de-dragon/templates/actor/resonances.hbs', | ||||||
|       'systems/foundryvtt-reve-de-dragon/templates/actor/taches.html', |       'systems/foundryvtt-reve-de-dragon/templates/actor/taches.html', | ||||||
|       'systems/foundryvtt-reve-de-dragon/templates/actor/taches.html', |       'systems/foundryvtt-reve-de-dragon/templates/actor/taches.html', | ||||||
|       'systems/foundryvtt-reve-de-dragon/templates/actor/oeuvres.html', |       'systems/foundryvtt-reve-de-dragon/templates/actor/oeuvres.html', | ||||||
| @@ -283,6 +285,9 @@ export class RdDUtility { | |||||||
|     Handlebars.registerHelper('uniteQuantite', (itemId, actorId) => RdDUtility.getItem(itemId, actorId)?.getUniteQuantite()); |     Handlebars.registerHelper('uniteQuantite', (itemId, actorId) => RdDUtility.getItem(itemId, actorId)?.getUniteQuantite()); | ||||||
|     Handlebars.registerHelper('isFieldInventaireModifiable', (type, field) => RdDItem.isFieldInventaireModifiable(type, field)); |     Handlebars.registerHelper('isFieldInventaireModifiable', (type, field) => RdDItem.isFieldInventaireModifiable(type, field)); | ||||||
|     Handlebars.registerHelper('rarete-getChamp', (rarete, field) => RdDRaretes.getChamp(rarete, field)); |     Handlebars.registerHelper('rarete-getChamp', (rarete, field) => RdDRaretes.getChamp(rarete, field)); | ||||||
|  |  | ||||||
|  |     Handlebars.registerHelper('experienceLog-topic', topic => ExperienceLog.labelTopic(topic)); | ||||||
|  |  | ||||||
|     return loadTemplates(templatePaths); |     return loadTemplates(templatePaths); | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -334,13 +339,13 @@ export class RdDUtility { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   static buildArbreDeConteneurs(conteneurs, objets) { |   static buildArbreDeConteneurs(conteneurs, inventaires) { | ||||||
|     let objetVersConteneur = {}; |     let objetVersConteneur = {}; | ||||||
|     // Attribution des objets aux conteneurs |     // Attribution des objets aux conteneurs | ||||||
|     for (let conteneur of conteneurs) { |     for (let conteneur of conteneurs) { | ||||||
|       conteneur.subItems = []; |       conteneur.subItems = []; | ||||||
|       for (let id of conteneur.system.contenu ?? []) { |       for (let id of conteneur.system.contenu ?? []) { | ||||||
|         let objet = objets.find(objet => (id == objet._id)); |         let objet = inventaires.find(objet => (id == objet._id)); | ||||||
|         if (objet) { |         if (objet) { | ||||||
|           objet.estContenu = true; // Permet de filtrer ce qui est porté dans le template |           objet.estContenu = true; // Permet de filtrer ce qui est porté dans le template | ||||||
|           objetVersConteneur[id] = conteneur._id; |           objetVersConteneur[id] = conteneur._id; | ||||||
| @@ -349,20 +354,20 @@ export class RdDUtility { | |||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     for (let conteneur of conteneurs) { |     for (let conteneur of conteneurs) { | ||||||
|       conteneur.system.encTotal = RdDUtility.calculEncContenu(conteneur, objets); |       conteneur.system.encTotal = RdDUtility.calculEncContenu(conteneur, inventaires); | ||||||
|     } |     } | ||||||
|     return objetVersConteneur; |     return objetVersConteneur; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   static calculEncContenu(conteneur, objets) { |   static calculEncContenu(conteneur, inventaires) { | ||||||
|     const contenus = (conteneur.system.contenu ?? []).filter(id => id != undefined) |     const contenus = (conteneur.system.contenu ?? []).filter(id => id != undefined) | ||||||
|       .map(id => objets.find(it => (id == it.id))) |       .map(id => inventaires.find(it => (id == it.id))) | ||||||
|       .filter(it => it); |       .filter(it => it); | ||||||
|     let enc = Number(conteneur.system.encombrement ?? 0) * Number(conteneur.system.quantite ?? 1); |     let enc = Number(conteneur.system.encombrement ?? 0) * Number(conteneur.system.quantite ?? 1); | ||||||
|     for (let contenu of contenus) { |     for (let contenu of contenus) { | ||||||
|       if (contenu.type == 'conteneur') { |       if (contenu.type == 'conteneur') { | ||||||
|         enc += RdDUtility.calculEncContenu(contenu, objets); |         enc += RdDUtility.calculEncContenu(contenu, inventaires); | ||||||
|       } |       } | ||||||
|       else { |       else { | ||||||
|         enc += Number(contenu.system.encombrement ?? 0) * Number(contenu.system.quantite ?? 1) |         enc += Number(contenu.system.encombrement ?? 0) * Number(contenu.system.quantite ?? 1) | ||||||
| @@ -859,17 +864,13 @@ export class RdDUtility { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   static confirmerSuppressionSubacteur(sheet, subActor, htmlToDelete) { |   static confirmerSuppressionSubacteur(sheet, subActor, htmlToDelete, onSuppression = ()=>{}) { | ||||||
|     RdDConfirm.confirmer({ |     RdDConfirm.confirmer({ | ||||||
|       settingConfirmer: "confirmation-supprimer-lien-acteur", |       settingConfirmer: "confirmation-supprimer-lien-acteur", | ||||||
|       content: `<p>Etes vous certain de vouloir supprimer le lien vers ${subActor.name} ?</p>`, |       content: `<p>Etes vous certain de vouloir supprimer le lien vers ${subActor.name} ?</p>`, | ||||||
|       title: 'Confirmer la suppression', |       title: 'Confirmer la suppression', | ||||||
|       buttonLabel: 'Supprimer le lien', |       buttonLabel: 'Supprimer le lien', | ||||||
|       onAction: () => { |       onAction: onSuppression | ||||||
|         console.log('Delete : ', subActor.id); |  | ||||||
|         sheet.actor.removeSubacteur(subActor.id); |  | ||||||
|         RdDUtility.slideOnDelete(sheet, htmlToDelete); |  | ||||||
|       } |  | ||||||
|     }) |     }) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -182,6 +182,16 @@ export class RdDCalendrier extends Application { | |||||||
|     return this.timestamp.formatDate(); |     return this.timestamp.formatDate(); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   dateReel() { | ||||||
|  |     return new Date().toLocaleString("sv-SE", { | ||||||
|  |       year: "numeric", | ||||||
|  |       month: "2-digit", | ||||||
|  |       day: "2-digit", | ||||||
|  |       hour: "2-digit", | ||||||
|  |       minute: "2-digit" | ||||||
|  |     }); | ||||||
|  |   } | ||||||
|  |  | ||||||
|   isAfterIndexDate(indexDate) { |   isAfterIndexDate(indexDate) { | ||||||
|     // TODO: standardize |     // TODO: standardize | ||||||
|     return indexDate < this.timestamp.indexDate; |     return indexDate < this.timestamp.indexDate; | ||||||
|   | |||||||
| @@ -1,3 +1,4 @@ | |||||||
|  | import { ExperienceLog, XP_TOPIC } from "../actor/experience-log.js"; | ||||||
| import { ChatUtility } from "../chat-utility.js"; | import { ChatUtility } from "../chat-utility.js"; | ||||||
| import { Poetique } from "../poetique.js"; | import { Poetique } from "../poetique.js"; | ||||||
| import { RdDDice } from "../rdd-dice.js"; | import { RdDDice } from "../rdd-dice.js"; | ||||||
| @@ -53,9 +54,10 @@ export class EffetsRencontre { | |||||||
|   static xp_sort_force = async (dialog, context) => {  |   static xp_sort_force = async (dialog, context) => {  | ||||||
|     let competence = context.competence; |     let competence = context.competence; | ||||||
|     if (competence) { |     if (competence) { | ||||||
|       const xpSort = Misc.toInt(competence.system.xp_sort) + context.rencontre.system.force; |       const fromXpSort = Number(competence.system.xp_sort); | ||||||
|       await this.updateEmbeddedDocuments("Item", [{ _id: compData._id, 'system.xp_sort': xpSort }]); |       const toXpSort = fromXpSort + context.rencontre.system.force; | ||||||
|       await this.updateExperienceLog("XP Sort", xpSort, `Rencontre d'un ${context.rencontre.name} en TMR`); |       await this.updateEmbeddedDocuments("Item", [{ _id: compData._id, 'system.xp_sort': toXpSort }]); | ||||||
|  |       await ExperienceLog.add(this, XP_TOPIC.XPSORT, fromXpSort, toXpSort, `${competence.name} - ${context.rencontre.name} en TMR`); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|    |    | ||||||
|   | |||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @@ -1,12 +1,13 @@ | |||||||
| { | { | ||||||
|   "id": "foundryvtt-reve-de-dragon", |   "id": "foundryvtt-reve-de-dragon", | ||||||
|   "title": "Rêve de Dragon", |   "title": "Rêve de Dragon", | ||||||
|   "version": "10.7.13", |   "version": "10.7.16", | ||||||
|   "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.7.13.zip", |   "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.7.16.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", | ||||||
|     "verified": "10" |     "verified": "10", | ||||||
|  |     "maximum": "10" | ||||||
|   }, |   }, | ||||||
|   "description": "Rêve de Dragon RPG for FoundryVTT", |   "description": "Rêve de Dragon RPG for FoundryVTT", | ||||||
|   "authors": [ |   "authors": [ | ||||||
|   | |||||||
| @@ -41,6 +41,9 @@ | |||||||
|             {{>"systems/foundryvtt-reve-de-dragon/templates/actor/comp-creature.html"}} |             {{>"systems/foundryvtt-reve-de-dragon/templates/actor/comp-creature.html"}} | ||||||
|             {{>"systems/foundryvtt-reve-de-dragon/templates/actor/comp-possession.html"}} |             {{>"systems/foundryvtt-reve-de-dragon/templates/actor/comp-possession.html"}} | ||||||
|           </div> |           </div> | ||||||
|  |           <div> | ||||||
|  |             {{>"systems/foundryvtt-reve-de-dragon/templates/actor/resonances.hbs"}} | ||||||
|  |           </div> | ||||||
|         </div> |         </div> | ||||||
|       </div> |       </div> | ||||||
|       <div class="form-group large-editor"> |       <div class="form-group large-editor"> | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| {{#if recettesAlchimiques.length}} | {{#if recettesAlchimiques.length}} | ||||||
| <h3>Recettes Alchimiques</h3> | <h3>Recettes Alchimiques</h3> | ||||||
| <ul class="item-list alterne-list"> | <ul class="item-list alterne-list"> | ||||||
|   {{#each recettesAlchimiques as |recette id|}} |   {{#each (trier recettesAlchimiques) as |recette id|}} | ||||||
|   <li class="item flexrow list-item" data-item-id="{{recette._id}}"><span class="competence-title recette-label item-edit"><a>{{recette.name}}</a></span> |   <li class="item flexrow list-item" data-item-id="{{recette._id}}"><span class="competence-title recette-label item-edit"><a>{{recette.name}}</a></span> | ||||||
|     <div class="item-controls flex-shrink"> |     <div class="item-controls flex-shrink"> | ||||||
|       <a class="item-edit" title="Edit Item"><i class="fas fa-edit"></i></a> |       <a class="item-edit" title="Edit Item"><i class="fas fa-edit"></i></a> | ||||||
|   | |||||||
| @@ -61,7 +61,7 @@ | |||||||
|               {{/unless}} |               {{/unless}} | ||||||
|             </label> |             </label> | ||||||
|           </li> |           </li> | ||||||
|           {{#each system.services as |service key|}} |           {{#each (trier system.services) as |service key|}} | ||||||
|           <li class="item flexrow list-item" data-key="{{key}}"> |           <li class="item flexrow list-item" data-key="{{key}}"> | ||||||
|             <input {{@root.disabled}} type="text" name="services[{{key}}].name" value="{{service.name}}" data-dtype="String" /> |             <input {{@root.disabled}} type="text" name="services[{{key}}].name" value="{{service.name}}" data-dtype="String" /> | ||||||
|             <input {{@root.disabled}} type="checkbox" name="services[{{key}}].system.moral" {{#if service.system.moral}}checked{{/if}} /> |             <input {{@root.disabled}} type="checkbox" name="services[{{key}}].system.moral" {{#if service.system.moral}}checked{{/if}} /> | ||||||
|   | |||||||
| @@ -25,14 +25,14 @@ | |||||||
|     <span class="equipement-detail">Prix (sols)</span> |     <span class="equipement-detail">Prix (sols)</span> | ||||||
|     <span class="equipement-actions">Actions</span> |     <span class="equipement-actions">Actions</span> | ||||||
|   </li> |   </li> | ||||||
|   {{#each objets as |item id|}} |   {{#each (trier inventaires) as |item id|}} | ||||||
|     {{#unless item.estContenu}} |     {{#unless item.estContenu}} | ||||||
|       {{#if (ne item.type 'conteneur')}} |       {{#if (ne item.type 'conteneur')}} | ||||||
|         {{buildLigneInventaire item ../options}} |         {{buildLigneInventaire item ../options}} | ||||||
|       {{/if}} |       {{/if}} | ||||||
|     {{/unless}} |     {{/unless}} | ||||||
|   {{/each}} |   {{/each}} | ||||||
|   {{#each conteneurs as |conteneur id|}} |   {{#each (trier conteneurs) as |conteneur id|}} | ||||||
|     {{buildLigneInventaire conteneur ../options}} |     {{buildLigneInventaire conteneur ../options}} | ||||||
|   {{/each}} |   {{/each}} | ||||||
| </ul> | </ul> | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| {{#if meditations.length}} | {{#if meditations.length}} | ||||||
| <h3>Méditations</h3> | <h3>Méditations</h3> | ||||||
| <ul class="item-list"> | <ul class="item-list"> | ||||||
|   {{#each meditations as |meditation key|}} |   {{#each (trier meditations) as |meditation key|}} | ||||||
|   <li class="item flexrow" data-item-id="{{meditation._id}}" data-attribute="{{key}}"> |   <li class="item flexrow" data-item-id="{{meditation._id}}" data-attribute="{{key}}"> | ||||||
|     <img class="sheet-competence-img" src="{{meditation.img}}" /> |     <img class="sheet-competence-img" src="{{meditation.img}}" /> | ||||||
|     <span class="meditation-label flex-grow"><a data-item-id="{{meditation._id}}">{{meditation.name}} - {{meditation.system.competence}}</a></span>  |     <span class="meditation-label flex-grow"><a data-item-id="{{meditation._id}}">{{meditation.name}} - {{meditation.system.competence}}</a></span>  | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| {{#if sortsReserve.length}} | {{#if sortsReserve.length}} | ||||||
| <h3>Sorts en Réserve</h3> | <h3>Sorts en Réserve</h3> | ||||||
| <ul class="item-list alterne-list"> | <ul class="item-list alterne-list"> | ||||||
|   {{#each sortsReserve as |sort key|}} |   {{#each (trier sortsReserve) as |sort key|}} | ||||||
|   <li class="item list-item flexrow" data-item-id="{{sort._id}}" data-attribute="{{key}}"> |   <li class="item list-item flexrow" data-item-id="{{sort._id}}" data-attribute="{{key}}"> | ||||||
|     <img class="sheet-competence-img" src="{{sort.img}}" /> |     <img class="sheet-competence-img" src="{{sort.img}}" /> | ||||||
|     <span class="item-edit"><a>{{#if sort.system.echectotal}}Echec total: {{/if}}{{sort.name}} r{{sort.system.ptreve}}</a></span>  |     <span class="item-edit"><a>{{#if sort.system.echectotal}}Echec total: {{/if}}{{sort.name}} r{{sort.system.ptreve}}</a></span>  | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| {{#if sorts.length}} | {{#if sorts.length}} | ||||||
| <h3>Sorts</h3> | <h3>Sorts</h3> | ||||||
| <ul class="item-list alterne-list"> | <ul class="item-list alterne-list"> | ||||||
|   {{#each sorts as |sort key|}} |   {{#each (trier sorts) as |sort key|}} | ||||||
|   <li class="item list-item flexrow" data-item-id="{{sort._id}}" data-attribute="{{key}}"> |   <li class="item list-item flexrow" data-item-id="{{sort._id}}" data-attribute="{{key}}"> | ||||||
|     <img class="sheet-competence-img" src="{{sort.img}}" /> |     <img class="sheet-competence-img" src="{{sort.img}}" /> | ||||||
|     <span class="item-edit flex-grow-2"> |     <span class="item-edit flex-grow-2"> | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| {{#if @root.options.isObserver}} | {{#if @root.options.isObserver}} | ||||||
| <span class="item-name"><h4>Argent et Monnaies (fortune: {{calc.fortune.sols}} sols {{calc.fortune.deniers}} deniers)</h4></span> | <span class="item-name"><h4>Argent et Monnaies (fortune: {{calc.fortune.sols}} sols {{calc.fortune.deniers}} deniers)</h4></span> | ||||||
| <ul class="item-list alterne-list"> | <ul class="item-list alterne-list"> | ||||||
|   {{#each monnaie as |piece id|}} |   {{#each monnaies as |piece id|}} | ||||||
|   <li class="item flexrow list-item" data-item-id="{{piece._id}}"> |   <li class="item flexrow list-item" data-item-id="{{piece._id}}"> | ||||||
|     <img class="sheet-competence-img" src="{{piece.img}}" title="{{piece.name}}"/> |     <img class="sheet-competence-img" src="{{piece.img}}" title="{{piece.name}}"/> | ||||||
|     <span class="equipement-nom">{{piece.name}}</span> |     <span class="equipement-nom">{{piece.name}}</span> | ||||||
|   | |||||||
| @@ -22,7 +22,7 @@ | |||||||
|     <span class="equipement-detail">Enc.</span> |     <span class="equipement-detail">Enc.</span> | ||||||
|     <span class="equipement-actions">Actions</span> |     <span class="equipement-actions">Actions</span> | ||||||
|   </li> |   </li> | ||||||
|   {{#each objets as |item id|}} |   {{#each inventaires as |item id|}} | ||||||
|     {{#unless item.estContenu}} |     {{#unless item.estContenu}} | ||||||
|     {{#if (ne item.type 'conteneur')}} |     {{#if (ne item.type 'conteneur')}} | ||||||
|       {{buildLigneInventaire item @root.options}} |       {{buildLigneInventaire item @root.options}} | ||||||
|   | |||||||
| @@ -1,18 +1,18 @@ | |||||||
| <h3>Oeuvres diverses</h3><a class="chat-card-button creer-une-oeuvre">Créer une oeuvre</a> | <h3>Oeuvres diverses</h3><a class="chat-card-button creer-une-oeuvre">Créer une oeuvre</a> | ||||||
| <ul class="item-list alterne-list"> | <ul class="item-list alterne-list"> | ||||||
|   {{#each chants as |chant id|}} |   {{#each (trier chants) as |chant id|}} | ||||||
|   {{> "systems/foundryvtt-reve-de-dragon/templates/actor/oeuvre.html" oeuvre=chant typeOeuvre="Chant" classOeuvre="chant-label"}} |   {{> "systems/foundryvtt-reve-de-dragon/templates/actor/oeuvre.html" oeuvre=chant typeOeuvre="Chant" classOeuvre="chant-label"}} | ||||||
|   {{/each}} |   {{/each}} | ||||||
|   {{#each musiques as |musique id|}} |   {{#each (trier musiques) as |musique id|}} | ||||||
|   {{> "systems/foundryvtt-reve-de-dragon/templates/actor/oeuvre.html" oeuvre=musique typeOeuvre="Musique" classOeuvre="musique-label"}} |   {{> "systems/foundryvtt-reve-de-dragon/templates/actor/oeuvre.html" oeuvre=musique typeOeuvre="Musique" classOeuvre="musique-label"}} | ||||||
|   {{/each}} |   {{/each}} | ||||||
|   {{#each danses as |danse id|}} |   {{#each (trier danses) as |danse id|}} | ||||||
|   {{> "systems/foundryvtt-reve-de-dragon/templates/actor/oeuvre.html" oeuvre=danse typeOeuvre="Danse" classOeuvre="danse-label"}} |   {{> "systems/foundryvtt-reve-de-dragon/templates/actor/oeuvre.html" oeuvre=danse typeOeuvre="Danse" classOeuvre="danse-label"}} | ||||||
|   {{/each}} |   {{/each}} | ||||||
|   {{#each oeuvres as |oeuvre id|}} |   {{#each (trier oeuvres) as |oeuvre id|}} | ||||||
|   {{> "systems/foundryvtt-reve-de-dragon/templates/actor/oeuvre.html" oeuvre=oeuvre typeOeuvre=oeuvre.system.competence classOeuvre="oeuvre-label"}} |   {{> "systems/foundryvtt-reve-de-dragon/templates/actor/oeuvre.html" oeuvre=oeuvre typeOeuvre=oeuvre.system.competence classOeuvre="oeuvre-label"}} | ||||||
|   {{/each}} |   {{/each}} | ||||||
|   {{#each recettescuisine as |recette id|}} |   {{#each (trier recettescuisine) as |recette id|}} | ||||||
|   {{> "systems/foundryvtt-reve-de-dragon/templates/actor/oeuvre.html" oeuvre=recette typeOeuvre="Recette de cuisine" classOeuvre="recettecuisine-label"}} |   {{> "systems/foundryvtt-reve-de-dragon/templates/actor/oeuvre.html" oeuvre=recette typeOeuvre="Recette de cuisine" classOeuvre="recettecuisine-label"}} | ||||||
|   {{/each}} |   {{/each}} | ||||||
| </ul> | </ul> | ||||||
|   | |||||||
							
								
								
									
										12
									
								
								templates/actor/resonances.hbs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								templates/actor/resonances.hbs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | |||||||
|  | <span class="item-name"><h4>Personnages accordés</h4></span> | ||||||
|  | <ul class="item-list alterne-list"> | ||||||
|  |   {{#each resonances as |actor|}} | ||||||
|  |   <li class="item flexrow list-item" data-actor-id="{{actor.id}}"> | ||||||
|  |     <img class="sheet-competence-img" src="{{actor.img}}" title="{{actor.name}}"/> | ||||||
|  |     <span class="subacteur-label"><a>{{actor.name}}</a></span> | ||||||
|  |     <div class="flex-shrink"> | ||||||
|  |       <a class="resonance-delete" title="Supprimer"><i class="fas fa-trash"></i></a> | ||||||
|  |   </div> | ||||||
|  |   </li> | ||||||
|  |   {{/each}} | ||||||
|  | </ul> | ||||||
| @@ -3,7 +3,7 @@ | |||||||
|     <li class="item flexrow"> |     <li class="item flexrow"> | ||||||
|       <label class="derivee-label" for="system.compteurs.experience.value">Stress transformé</label> |       <label class="derivee-label" for="system.compteurs.experience.value">Stress transformé</label> | ||||||
|       {{#if options.vueDetaillee}} |       {{#if options.vueDetaillee}} | ||||||
|       <input type="number" name="system.compteurs.experience.value" value="{{system.compteurs.experience.value}}" data-dtype="number" size="3"/> |       <input class="derivee-value" type="number" name="system.compteurs.experience.value" value="{{system.compteurs.experience.value}}" data-dtype="number" size="3"/> | ||||||
|       {{else}} |       {{else}} | ||||||
|       <label name="system.compteurs.experience.value">{{system.compteurs.experience.value}}</label> |       <label name="system.compteurs.experience.value">{{system.compteurs.experience.value}}</label> | ||||||
|       {{/if}} |       {{/if}} | ||||||
|   | |||||||
| @@ -1,14 +1,18 @@ | |||||||
| <h3>Journal d'Experience</h3> | <h3>Journal d'Experience</h3> | ||||||
| <div class="form-group large-editor"> | <div class="form-group large-editor"> | ||||||
|   <ul class="item-list alterne-list"> |   <ul class="item-list alterne-list"> | ||||||
|   {{#each system.experiencelog as |xp key|}} |   {{#each system.experiencelog as |xplog key|}} | ||||||
|     <li class="experiencelog flexrow list-item" data-key="{{key}}"> |     <li class="experiencelog flexrow list-item" data-key="{{key}}"> | ||||||
|       <label class="flex-grow">{{xp.valeur}} {{xp.raison}}</label> |       <label class="flex-shrink">{{xplog.valeur}} {{experienceLog-topic xplog.mode}} </label> | ||||||
|       <label class="flex-shrink">{{xp.mode}}</label> |       {{#if (or xplog.from xplog.to)}} | ||||||
|       <label class="flex-shrink">{{xp.daterdd}}</label> |       <label class="flex-grow">{{xplog.raison}}: de {{xplog.from}} à {{xplog.to}}</label> | ||||||
|       <label class="flex-shrink">{{xp.datereel}}</label> |       {{else}} | ||||||
|  |       <label class="flex-grow">{{xplog.raison}}</label> | ||||||
|  |       {{/if}} | ||||||
|  |       <label class="flex-shrink">{{xplog.daterdd}}</label> | ||||||
|  |       <label class="flex-shrink">{{xplog.datereel}}</label> | ||||||
|       {{#if @root.options.isGM}} |       {{#if @root.options.isGM}} | ||||||
|       <span> |       <span class="flex-shrink"> | ||||||
|         <a class="experiencelog-delete" title="Supprimer"> |         <a class="experiencelog-delete" title="Supprimer"> | ||||||
|           <i class="fas fa-trash"></i> |           <i class="fas fa-trash"></i> | ||||||
|         </a> |         </a> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user