Compare commits
	
		
			66 Commits
		
	
	
		
			9fc21e6d97
			...
			13.0.1
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| a0f42204d5 | |||
| c25320755a | |||
| aa5f159a91 | |||
| bb80391a47 | |||
| 1abb757b6b | |||
| 84c44d1f6d | |||
| ccb939207d | |||
| cd38a197cc | |||
| 6b053b189b | |||
| cc4cbbc771 | |||
| 0850789ed7 | |||
| 7a6ccac7fa | |||
| ed64d823ac | |||
| 3162264afa | |||
| e53eda5b42 | |||
| 47a7564a1c | |||
| f7a6fee51d | |||
| 0b3f08ef29 | |||
| 8df9c8ddf5 | |||
| 4cbe652a91 | |||
| 3eb1179c40 | |||
| cf185844af | |||
| 250b936fae | |||
| cd8268f569 | |||
| c04e0cec78 | |||
| 1d5fe1af71 | |||
| e96a627c37 | |||
| 06c3d2f80a | |||
| d07f5a41e7 | |||
| 856d038dc9 | |||
| 791593ad38 | |||
| 42179dab1d | |||
| 83631cd366 | |||
| 01cf47ad55 | |||
| d492b37a45 | |||
| ecdcdb69d5 | |||
| 8479fdda8a | |||
| 83e57fbbc7 | |||
| 2d256b1217 | |||
| 526d38d32e | |||
| 2ff3dfef89 | |||
| f1b6c01cd7 | |||
| 675fe5838e | |||
| bafdec9924 | |||
| 069fef4720 | |||
| e32a7d7540 | |||
| 0773493851 | |||
| da982678b7 | |||
| c1066d70f6 | |||
| 5085ba5b54 | |||
| f37483a61d | |||
| 5357e53a5f | |||
| 764dde6296 | |||
| 681fbc3177 | |||
| 70e3e63001 | |||
| 7ed9a4a12b | |||
| acfab362a0 | |||
| 3d49a3de11 | |||
| 24518642a7 | |||
| d917f80e88 | |||
| b29027c61a | |||
| 6083dd41fa | |||
| 8969d5e0ed | |||
| 7d135a214f | |||
| 9d66a479c4 | |||
| 800b4a2f32 | 
@@ -12,6 +12,8 @@ jobs:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    #- uses: actions/checkout@v3
 | 
					    #- uses: actions/checkout@v3
 | 
				
			||||||
    - uses: RouxAntoine/checkout@v3.5.4
 | 
					    - uses: RouxAntoine/checkout@v3.5.4
 | 
				
			||||||
 | 
					      with:
 | 
				
			||||||
 | 
					        ref: 'v13'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # get part of the tag after the `v`
 | 
					    # get part of the tag after the `v`
 | 
				
			||||||
    - name: Extract tag version number
 | 
					    - name: Extract tag version number
 | 
				
			||||||
@@ -46,7 +48,7 @@ jobs:
 | 
				
			|||||||
         apt update -y
 | 
					         apt update -y
 | 
				
			||||||
         apt install -y zip
 | 
					         apt install -y zip
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    - run: zip -r ./rddsystem.zip system.json template.json README.md LICENSE.txt assets/ fonts/ icons lang/ module/ packs/ pic/ sounds/ styles/ templates/ 
 | 
					    - run: zip -r ./rddsystem.zip system.json template.json README.md LICENSE.txt assets/ css/ fonts/ icons lang/ module/ packs/ pic/ sounds/ styles/ templates/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    - name: setup go
 | 
					    - name: setup go
 | 
				
			||||||
      uses: actions/setup-go@v3
 | 
					      uses: actions/setup-go@v3
 | 
				
			||||||
@@ -62,13 +64,13 @@ jobs:
 | 
				
			|||||||
          system.json
 | 
					          system.json
 | 
				
			||||||
        api_key: '${{secrets.ALLOW_PUSH_RELEASE}}'
 | 
					        api_key: '${{secrets.ALLOW_PUSH_RELEASE}}'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    - name: Publish to Foundry server  
 | 
					    #- name: Publish to Foundry server
 | 
				
			||||||
      uses: djlechuck/foundryvtt-publish-package-action@v1
 | 
					    #  uses: djlechuck/foundryvtt-publish-package-action@v1
 | 
				
			||||||
      with:
 | 
					    #  with:
 | 
				
			||||||
        token: ${{ secrets.FOUNDRYVTT_RELEASE_TOKEN }}
 | 
					    #    token: ${{ secrets.FOUNDRYVTT_RELEASE_TOKEN }}
 | 
				
			||||||
        id: 'foundryvtt-reve-de-dragon'
 | 
					    #    id: 'foundryvtt-reve-de-dragon'
 | 
				
			||||||
        version: ${{github.event.release.tag_name}}
 | 
					    #    version: ${{github.event.release.tag_name}}
 | 
				
			||||||
        manifest: 'https://www.uberwald.me/gitea/${{gitea.repository}}/releases/download/${{github.event.release.tag_name}}/system.json'
 | 
					    #    manifest: 'https://www.uberwald.me/gitea/${{gitea.repository}}/releases/download/${{github.event.release.tag_name}}/system.json'
 | 
				
			||||||
        notes: 'https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/branch/v11/changelog.md'
 | 
					    #    notes: 'https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/branch/v13/changelog.md'
 | 
				
			||||||
        compatibility-minimum: '12'
 | 
					    #    compatibility-minimum: '13'
 | 
				
			||||||
        compatibility-verified: '12'
 | 
					    #    compatibility-verified: '13'
 | 
				
			||||||
@@ -1,14 +0,0 @@
 | 
				
			|||||||
Pour que le bug soit traité, merci de préciser quelques détails.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Environment
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
> Indiquez quelques éléments de votre installation
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
* Foundry VTT Version: (Example 0.5.4)
 | 
					 | 
				
			||||||
* OS: [Windows, MacOS, Linux (which distro)]
 | 
					 | 
				
			||||||
* Modules ?: Liste des modules utilisés
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Description du problème
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/label ~Bug ~Nonrepro
 | 
					 | 
				
			||||||
@@ -1,14 +0,0 @@
 | 
				
			|||||||
 | 
					 | 
				
			||||||
### Résumé de la fonctionnalité
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
> Décrivez de manière simple et concise la fonction que vous voulez voir ajoutée.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Expérience Utilisateur
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
> Indiquez ce que l'utilisateur aura comme bénéfice avec cette fonction.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Priority/Importance
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
> Selon vous, quelle est l'importance de cette fonctionnalité.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/label ~Feature
 | 
					 | 
				
			||||||
| 
		 Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB  | 
| 
		 Before Width: | Height: | Size: 193 KiB After Width: | Height: | Size: 193 KiB  | 
| 
		 Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB  | 
| 
		 Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB  | 
| 
		 Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB  | 
| 
		 Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 60 KiB  | 
| 
		 Before Width: | Height: | Size: 163 KiB After Width: | Height: | Size: 163 KiB  | 
| 
		 Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 103 KiB  | 
| 
		 Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB  | 
| 
		 Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.2 KiB  | 
| 
		 Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB  | 
| 
		 Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB  | 
| 
		 Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB  | 
| 
		 Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB  | 
| 
		 Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB  | 
| 
		 Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB  | 
| 
		 Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB  | 
| 
		 Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB  | 
| 
		 Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB  | 
| 
		 Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB  | 
| 
		 Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB  | 
| 
		 Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB  | 
| 
		 Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB  | 
| 
		 Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB  | 
| 
		 Before Width: | Height: | Size: 716 KiB After Width: | Height: | Size: 716 KiB  | 
| 
		 Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.6 KiB  | 
| 
		 Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB  | 
| 
		 Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB  | 
| 
		 Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB  | 
| 
		 Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB  | 
| 
		 Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB  | 
| 
		 Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB  | 
| 
		 Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB  | 
| 
		 Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB  | 
| 
		 Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB  | 
| 
		 Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB  | 
| 
		 Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB  | 
| 
		 Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB  | 
| 
		 Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB  | 
| 
		 Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB  | 
| 
		 Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB  | 
| 
		 Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB  | 
| 
		 Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 9.5 KiB  | 
| 
		 Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB  | 
| 
		 Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB  | 
| 
		 Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB  | 
| 
		 Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB  | 
| 
		 Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB  | 
| 
		 Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB  | 
| 
		 Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB  | 
| 
		 Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 56 KiB  | 
| 
		 Before Width: | Height: | Size: 188 B After Width: | Height: | Size: 188 B  | 
| 
		 Before Width: | Height: | Size: 162 B After Width: | Height: | Size: 162 B  | 
| 
		 Before Width: | Height: | Size: 634 KiB After Width: | Height: | Size: 634 KiB  | 
| 
		 Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 1.0 MiB  | 
| 
		 Before Width: | Height: | Size: 637 KiB After Width: | Height: | Size: 637 KiB  | 
							
								
								
									
										97
									
								
								changelog.md
									
									
									
									
									
								
							
							
						
						@@ -1,6 +1,98 @@
 | 
				
			|||||||
 | 
					# 13.0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 13.0.0 - Le début de l'errance d'Illysis
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- Migration vers la version 13 de Foundry
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# 12.0
 | 
					# 12.0
 | 
				
			||||||
## 12.0.36 - La cartte d'Astrobazzarh
 | 
					## 12.0.50 - Le sommeil d'Astrobazzarh
 | 
				
			||||||
- Fix: la commande /tmra fonctionne correctement sans paramètres
 | 
					- Le don de double rêve n'interrompt plus le sommeil toutes les heures
 | 
				
			||||||
 | 
					- la perte de fatigue à la descente des TMR est visible immédiatement
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 12.0.49 - La deuxième lame d'Astrobazzarh
 | 
				
			||||||
 | 
					- Corrections
 | 
				
			||||||
 | 
					  - les défenses particulières sont correctement affichées
 | 
				
			||||||
 | 
					  - les vieux boucliers (sans catégorie de parade car créés il y a longtemps) peuvent parer...
 | 
				
			||||||
 | 
					  - Les attaques à distance n'ont pas de difficulté libre
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 12.0.48 - La chèvre d'Astrobazzarh
 | 
				
			||||||
 | 
					- le Bandersnatch a une protection de 10
 | 
				
			||||||
 | 
					- la consistance chèvre est maintenant possible dans les recettes
 | 
				
			||||||
 | 
					  alchimiques (et toutes les consistances avec accents)
 | 
				
			||||||
 | 
					- un échec au lancement d'un sort pour le mettre en réserve brise
 | 
				
			||||||
 | 
					  la concentration du haut-rêvant
 | 
				
			||||||
 | 
					- Correction: les réussites particulières fonctionnent avec les caractéristiques dérivées
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 12.0.47
 | 
				
			||||||
 | 
					- Correction sur les mise à jour en cascade -
 | 
				
			||||||
 | 
					- Correction sur le force rendering après un changement de competence
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 12.0.46 - Le double demi d'Astrobazzarh
 | 
				
			||||||
 | 
					- correction des raffraîchissement lors du sommeil qui empêchait de dormir
 | 
				
			||||||
 | 
					  plusieurs heures
 | 
				
			||||||
 | 
					- Si la fatigue n'est pas utilisée, les rounds dans les TMR font perdre de l'endurance (au lieu d'en gagner)
 | 
				
			||||||
 | 
					- les TMRs se ferment correctement quand la fatigue maximale est dépassée
 | 
				
			||||||
 | 
					- le message de lancement de sort en réserve donne la description du sort
 | 
				
			||||||
 | 
					- suppression de double-messages lors de la fermeture des TMR
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 12.0.45 - Les errements d'Astrobazzarh, encore
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- La difficulté des méditations n'augmente plus en cas de réussite et d'échec normal
 | 
				
			||||||
 | 
					- Renommage du Bouton pour révéler/masquer le demi-rêve
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 12.0.44 - Les errements d'Astrobazzarh, suite
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- on peut de nouveau dormir et se réveiller reposé
 | 
				
			||||||
 | 
					- les possessions utilisent maintenant correctement le rêve actuel
 | 
				
			||||||
 | 
					- les sorts variables ne causent plus de soucis de voie pour le lancement de sorts
 | 
				
			||||||
 | 
					- les acteurs ayant un sort avec un coût de rêve entier ne sont plus considérés
 | 
				
			||||||
 | 
					  comme pouvant avoir un rêve variable
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 12.0.42 - Les errements d'Astrobazzarh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- Correction de différentes automatisations de combat incorrectes
 | 
				
			||||||
 | 
					- Correction des jets `@roll[vue/-2]` qui tentaient de chercher une compétence -2 (à cause des armes à 1/2 mains)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 12.0.41 - La loupe d'Astrobazzarh
 | 
				
			||||||
 | 
					- On peut de nouveau effectuer des tirages cachés
 | 
				
			||||||
 | 
					- Le stress transformé est bien diminué lorsqu'on met le stress dans une compétence
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 12.0.40 - Les mains d'Astrobazzarh
 | 
				
			||||||
 | 
					- correction des attaques particulières en combat
 | 
				
			||||||
 | 
					- correction de message sur les min/max liés aux modificateurs de races (s'applique uniquement sur la taille)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 12.0.39 - Les mains d'Astrobazzarh
 | 
				
			||||||
 | 
					- les armes à 1 ou 2 mains fonctionnent dans les liens de jets de dés
 | 
				
			||||||
 | 
					- commande `/jet` pour poster une demande de jet de dés
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 12.0.38 - Les prévisions d'Astrobazzarh
 | 
				
			||||||
 | 
					- Correction de modifications de personnages qui ne s'affichaient pas:
 | 
				
			||||||
 | 
					  - changements d'endurance/vie/fatigue, transformé, ...
 | 
				
			||||||
 | 
					- Migration des compétences "Ecriture" en "Écriture" dans les tâches, livres, oeuvres et méditations
 | 
				
			||||||
 | 
					- Correction des jets de compétences de créatures
 | 
				
			||||||
 | 
					- Premières préparations techniques pour le passage à Founry v13
 | 
				
			||||||
 | 
					  - liste des impacts d'un jet de dés (expérience, points de tâche, ...)
 | 
				
			||||||
 | 
					  - utilisation de l'extension hbs pour tous les fichiers handlebars
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 12.0.37 - Les enchantements d'Astrobazzarh
 | 
				
			||||||
 | 
					- les potions ont un état, seules les potions liquides sont enchantables
 | 
				
			||||||
 | 
					- les lancements de sorts du jour sont conservés jusqu'à chateau dormant
 | 
				
			||||||
 | 
					- lorsqu'un joueur souhaite enchanter une potion, les sorts d'enchantements/purification/permanence doivent avoir été lancés auparavant
 | 
				
			||||||
 | 
					- on peut enchanter des gemmes exactement comme des potions
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 12.0.36 - L'alchimie d'Astrobazzarh
 | 
				
			||||||
 | 
					- Nouveautés
 | 
				
			||||||
 | 
					  - ajout d'un bouton pour enchanter les potions
 | 
				
			||||||
 | 
					  - standardisation des boutons d'actions sur les items
 | 
				
			||||||
 | 
					  - utilisations d'icones pour les actions de l'inventaire
 | 
				
			||||||
 | 
					- Corrections:
 | 
				
			||||||
 | 
					  - la commande /tmra sans paramètres fonctionne
 | 
				
			||||||
 | 
					  - les jets d'encaissement depuis le tchat fonctionnent
 | 
				
			||||||
 | 
					  - affichage de la vie/endurance en cas de blessures et remise à neuf
 | 
				
			||||||
 | 
					  - les queues durant 12 heures ajoutées début Vaisseau ne durent plus 24 heures
 | 
				
			||||||
 | 
					- Compendiums
 | 
				
			||||||
 | 
					  - Corrections des remedes enchantables
 | 
				
			||||||
 | 
					  - Corrections de descriptions pour proposer les jet de dés
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## 12.0.35 - La Solution d'Astrobazzarh
 | 
					## 12.0.35 - La Solution d'Astrobazzarh
 | 
				
			||||||
- Fix problème d'initialisation des feuilles d'items
 | 
					- Fix problème d'initialisation des feuilles d'items
 | 
				
			||||||
@@ -516,4 +608,3 @@ Vu qu'elles ne peuvent pas être utilisées, permet de savoir pourquoi
 | 
				
			|||||||
- correction des achats par le MJ sans acteur sélectionné
 | 
					- correction des achats par le MJ sans acteur sélectionné
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Cf branche v10 pour l'historique des versions 10
 | 
					Cf branche v10 pour l'historique des versions 10
 | 
				
			||||||
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2464
									
								
								css/foundryvtt-reve-de-dragon.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										37
									
								
								gulpfile.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,37 @@
 | 
				
			|||||||
 | 
					const gulp = require('gulp');
 | 
				
			||||||
 | 
					const less = require('gulp-less');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function onError(err) {
 | 
				
			||||||
 | 
					  util.log(util.colors.red.bold('[ERROR LESS]:'),util.colors.bgRed(err.message));
 | 
				
			||||||
 | 
					  this.emit('end');
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* ----------------------------------------- */
 | 
				
			||||||
 | 
					/*  Compile LESS
 | 
				
			||||||
 | 
					/* ----------------------------------------- */
 | 
				
			||||||
 | 
					function compileLESS() {
 | 
				
			||||||
 | 
					  return gulp.src("less/foundryvtt-reve-de-dragon.less")
 | 
				
			||||||
 | 
					      .pipe(less()).on('error',console.log.bind(console))
 | 
				
			||||||
 | 
					      .pipe(gulp.dest("./css"))
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					const css = gulp.series(compileLESS);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* ----------------------------------------- */
 | 
				
			||||||
 | 
					/*  Watch Updates
 | 
				
			||||||
 | 
					/* ----------------------------------------- */
 | 
				
			||||||
 | 
					const SIMPLE_LESS = ["less/*.less", "less/item/*.less"];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function watchUpdates() {
 | 
				
			||||||
 | 
					  gulp.watch(SIMPLE_LESS, css);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* ----------------------------------------- */
 | 
				
			||||||
 | 
					/*  Export Tasks
 | 
				
			||||||
 | 
					/* ----------------------------------------- */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					exports.default = gulp.series(
 | 
				
			||||||
 | 
					    gulp.parallel(css),
 | 
				
			||||||
 | 
					    watchUpdates
 | 
				
			||||||
 | 
					);
 | 
				
			||||||
 | 
					exports.css = css;
 | 
				
			||||||
 | 
					exports.watchUpdates = watchUpdates;
 | 
				
			||||||
							
								
								
									
										50
									
								
								less/colors.less
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,50 @@
 | 
				
			|||||||
 | 
					:root {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /* =================== 2. DEBUGGING HIGHLIGHTERS ============ */
 | 
				
			||||||
 | 
					    // --debug-background-color-red: #ff000054;
 | 
				
			||||||
 | 
					    // --debug-background-color-blue: #1d00ff54;
 | 
				
			||||||
 | 
					    // --debug-background-color-green: #54ff0054;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // --debug-box-shadow-red: inset 0 0 2px red;
 | 
				
			||||||
 | 
					    // --debug-box-shadow-blue: inset 0 0 2px blue;
 | 
				
			||||||
 | 
					    // --debug-box-shadow-green: inset 0 0 2px green;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /* =================== 3. some constants ============ */
 | 
				
			||||||
 | 
					    --fieldset-background: url(/ui/parchment.jpg);
 | 
				
			||||||
 | 
					    --rdd-color-text-primary: rgba(10, 10, 10, 0.9);
 | 
				
			||||||
 | 
					    --rdd-input-background:rgba(0, 0, 0, 0.05);
 | 
				
			||||||
 | 
					    --rdd-color-border-input: rgba(0, 0, 0, 0.2);
 | 
				
			||||||
 | 
					    --rdd-bg-input: rgba(255, 255, 255, 0.1);
 | 
				
			||||||
 | 
					    --color-controls:rgba(0, 0, 0, 0.9);
 | 
				
			||||||
 | 
					    --color-controls-light:hsla(0, 0%, 20%, 0.8);
 | 
				
			||||||
 | 
					    --color-controls-hover:hsla(60, 100%, 75%, 0.7);
 | 
				
			||||||
 | 
					    --color-control-border-hover:rgba(255, 128, 0, 0.8);
 | 
				
			||||||
 | 
					    --color-gold: rgba(191, 149, 63, 0.8);
 | 
				
			||||||
 | 
					    --gradient-gold: linear-gradient(30deg, rgba(191, 149, 63, 0.3), rgba(252, 246, 186, 0.3), rgba(179, 135, 40, 0.3), rgba(251, 245, 183, 0.3), rgba(170, 119, 28, 0.3));
 | 
				
			||||||
 | 
					    --gradient-silver: linear-gradient(30deg, rgba(61, 55, 93, 0.3), rgba(178, 179, 196, 0.3), rgba(59, 62, 63, 0.6), rgba(206, 204, 199, 0.3), rgba(61, 46, 49, 0.3));
 | 
				
			||||||
 | 
					    --gradient-green: linear-gradient(30deg, rgba(7, 76, 0, 0.3), rgba(66, 163, 65, 0.2), rgba(184, 226, 163, 0.1), rgba(66, 163, 65, 0.2), rgba(184, 226, 163, 0.3));
 | 
				
			||||||
 | 
					    --gradient-red: linear-gradient(150deg, rgba(255, 0, 0, 0.3), rgba(255, 200, 128, 0.05),rgba(255, 200, 128, 0.1), rgba(255,10,0,0.3));
 | 
				
			||||||
 | 
					    --gradient-violet: linear-gradient(150deg, rgba(100, 45, 124, 0.6), rgba(216, 157, 192, 0.3), rgba(177, 157, 216, 0.5), rgba(107, 62, 121, 0.3), rgba(100, 45, 124, 0.6));
 | 
				
			||||||
 | 
					    --gradient-purple-black: linear-gradient(150deg,  rgba(0, 0, 0, 0.7), rgba(100, 45, 124, 0.4), rgba(82, 17, 131, 0.3),rgba(100, 45, 124, 0.4), rgba(0, 0, 0, 0.7));
 | 
				
			||||||
 | 
					    --gradient-silver-light: linear-gradient(30deg, rgba(61, 55, 93, 0.2), rgba(178, 179, 196, 0.1), rgba(59, 62, 63, 0.2), rgba(206, 204, 199, 0.1), rgba(61, 46, 49, 0.2));
 | 
				
			||||||
 | 
					    --gradient-daylight: conic-gradient(
 | 
				
			||||||
 | 
					      from 0deg,
 | 
				
			||||||
 | 
					      hsla(50, 100%, 80%, 0.7),
 | 
				
			||||||
 | 
					      hsla(30, 30%, 40%, 0.1) 25%,
 | 
				
			||||||
 | 
					      hsla(250, 50%, 40%, 0.1) 25%,
 | 
				
			||||||
 | 
					      hsla(250, 30%, 30%, 0.7) 50%,
 | 
				
			||||||
 | 
					      hsla(250, 50%, 40%, 0.1) 75%,
 | 
				
			||||||
 | 
					      hsla(30, 30%, 40%, 0.1) 75%,
 | 
				
			||||||
 | 
					      hsla(50, 100%, 80%, 0.7)
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    --background-custom-button: linear-gradient(to bottom, rgba(33, 55, 74, 0.988) 5%, rgba(21, 40, 51, 0.671) 100%);
 | 
				
			||||||
 | 
					    --background-custom-button-hover: linear-gradient(to bottom, rgb(128, 0, 0) 5%, rgb(62, 1, 1) 100%);
 | 
				
			||||||
 | 
					    --background-control-selected: linear-gradient(to bottom, hsla(0, 100%, 25%, 0.5) 5%, hsla(0, 100%, 12%, 0.5) 100%);
 | 
				
			||||||
 | 
					    --background-tooltip: hsla(60, 12%, 85%, 0.95);
 | 
				
			||||||
 | 
					    --color-tooltip:hsla(282, 47%, 33%, 0.9);
 | 
				
			||||||
 | 
					    --color-tooltip-faint:hsla(282, 47%, 66%, 0.5);
 | 
				
			||||||
 | 
					    --background-error:hsla(16, 100%, 50%, 0.8);
 | 
				
			||||||
 | 
					    --color-profile-border: hsla(0, 0%, 80%, 0.05);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
							
								
								
									
										84
									
								
								less/fonts.less
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,84 @@
 | 
				
			|||||||
 | 
					/* ==================== (A) Fonts ==================== */
 | 
				
			||||||
 | 
					@font-face {
 | 
				
			||||||
 | 
					  font-family: "GoudyAcc";
 | 
				
			||||||
 | 
					  src: url('../fonts/goudyacc.ttf') format("truetype");
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					@font-face {
 | 
				
			||||||
 | 
					  font-family: "MedievalSharp";
 | 
				
			||||||
 | 
					  src: url('../fonts/MedievalSharp.ttf') format("truetype");
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					@font-face {
 | 
				
			||||||
 | 
					  font-family: "GrenzeGotisch";
 | 
				
			||||||
 | 
					  src: url('../fonts/GrenzeGotisch-Regular.ttf') format("truetype");
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					@font-face {
 | 
				
			||||||
 | 
					  font-family: "Fondamento";
 | 
				
			||||||
 | 
					  src: url('../fonts/Fondamento.ttf') format("truetype");
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					@font-face {
 | 
				
			||||||
 | 
					  font-family: "CaslonAntique";
 | 
				
			||||||
 | 
					  src: url('../fonts/CaslonAntique.ttf') format("truetype");
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					@font-face {
 | 
				
			||||||
 | 
					  font-family: 'HeuresDraconiques';
 | 
				
			||||||
 | 
					  src:
 | 
				
			||||||
 | 
					      url('../fonts/heuresdraconiques2.woff') format('woff'),
 | 
				
			||||||
 | 
					      url('../fonts/heuresdraconiques2.woff2') format('woff2'),
 | 
				
			||||||
 | 
					      url('../fonts/heuresdraconiques2.ttf') format('truetype');
 | 
				
			||||||
 | 
					  font-weight: normal;
 | 
				
			||||||
 | 
					  font-style: normal;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					:root {
 | 
				
			||||||
 | 
					  /* =================== 1. ACTOR SHEET FONT STYLES =========== */
 | 
				
			||||||
 | 
					    --window-header-title-font-family: CaslonAntique;
 | 
				
			||||||
 | 
					    --window-header-title-font-size: 1.6rem;
 | 
				
			||||||
 | 
					    --window-header-title-font-weight: normal;
 | 
				
			||||||
 | 
					    --window-header-title-color: #f5f5f5;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    --major-button-font-family: CaslonAntique;
 | 
				
			||||||
 | 
					    --major-button-font-size: 1.4rem;
 | 
				
			||||||
 | 
					    --major-button-font-weight: normal;
 | 
				
			||||||
 | 
					    --major-button-color: #dadada;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    --tab-header-font-family: CaslonAntique;
 | 
				
			||||||
 | 
					    --tab-header-font-size: 1.2rem;
 | 
				
			||||||
 | 
					    --tab-header-font-weight: 700;
 | 
				
			||||||
 | 
					    --tab-header-color: #403f3e;
 | 
				
			||||||
 | 
					    --tab-header-color-active: #4a0404;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    --actor-input-font-family: CaslonAntique;
 | 
				
			||||||
 | 
					    --actor-input-font-size: 1.2rem;
 | 
				
			||||||
 | 
					    --actor-input-font-weight: 500;
 | 
				
			||||||
 | 
					    --actor-input-color: black;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    --actor-label-font-family: CaslonAntique;
 | 
				
			||||||
 | 
					    --actor-label-font-size: 1.2rem;
 | 
				
			||||||
 | 
					    --actor-label-font-weight: 700;
 | 
				
			||||||
 | 
					    --actor-label-color: #464331c4;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Global styles & Font */
 | 
				
			||||||
 | 
					.window-app {
 | 
				
			||||||
 | 
					  font-family: CaslonAntique;
 | 
				
			||||||
 | 
					  text-align: justify;
 | 
				
			||||||
 | 
					  font-size: 1rem;
 | 
				
			||||||
 | 
					  letter-spacing: 1px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Fonts */
 | 
				
			||||||
 | 
					.sheet header.sheet-header h1 input,
 | 
				
			||||||
 | 
					.window-app .window-header,
 | 
				
			||||||
 | 
					#actors .directory-list,
 | 
				
			||||||
 | 
					#navigation #scene-list .scene.nav-item {
 | 
				
			||||||
 | 
					  font-family: "GoudyAcc"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* For title, sidebar character and scene */
 | 
				
			||||||
 | 
					.sheet nav.sheet-tabs,
 | 
				
			||||||
 | 
					.window-app input,
 | 
				
			||||||
 | 
					.sheet header.sheet-header .header-compteurs,
 | 
				
			||||||
 | 
					.sheet header.sheet-header .flex-group-center.flex-fatigue,
 | 
				
			||||||
 | 
					select,  .item-checkbox, #sidebar, #players, #navigation #nav-toggle {
 | 
				
			||||||
 | 
					    font-family: "CaslonAntique"; /* For sheet parts; For nav and title */
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										2091
									
								
								less/foundryvtt-reve-de-dragon.less
									
									
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										7
									
								
								less/item/monnaie.less
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,7 @@
 | 
				
			|||||||
 | 
					// Styles pour la feuille d'objet Monnaie
 | 
				
			||||||
 | 
					.monnaie-content {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  .item-sheet-common();
 | 
				
			||||||
 | 
					  .item-sheet-header();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										7
									
								
								less/item/munition.less
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,7 @@
 | 
				
			|||||||
 | 
					// Styles pour la feuille d'objet Monnaie
 | 
				
			||||||
 | 
					.munition-content {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  .item-sheet-common();
 | 
				
			||||||
 | 
					  .item-sheet-header();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										7
									
								
								less/item/tarot.less
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,7 @@
 | 
				
			|||||||
 | 
					// Styles pour la feuille d'objet Monnaie
 | 
				
			||||||
 | 
					.tarot-content {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  .item-sheet-common();
 | 
				
			||||||
 | 
					  .item-sheet-header();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										108
									
								
								less/sheets.less
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,108 @@
 | 
				
			|||||||
 | 
					.item-sheet-common() {
 | 
				
			||||||
 | 
					  padding: 0px;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Styles pour la section de description, si le partiel utilise une structure standard
 | 
				
			||||||
 | 
					  .editor,
 | 
				
			||||||
 | 
					  .editor-content {
 | 
				
			||||||
 | 
					    height: auto; // Ajuster selon le besoin
 | 
				
			||||||
 | 
					    min-height: 100px; // Hauteur minimale pour la description
 | 
				
			||||||
 | 
					    background: var(--rdd-bg-input-alt); // Une couleur de fond alternative
 | 
				
			||||||
 | 
					    padding: 5px;
 | 
				
			||||||
 | 
					    border-radius: 3px;
 | 
				
			||||||
 | 
					    color: var(--rdd-color-text-primary);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  .window-content {
 | 
				
			||||||
 | 
					    font-family: CaslonAntique;
 | 
				
			||||||
 | 
					    text-align: justify;
 | 
				
			||||||
 | 
					    font-size: 1rem;
 | 
				
			||||||
 | 
					    letter-spacing: 1px;
 | 
				
			||||||
 | 
					    padding: 0% 0 0 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    font-size: calc(var(--font-size-standard) * 1);
 | 
				
			||||||
 | 
					    color: var(--color-dark-1);
 | 
				
			||||||
 | 
					    background-size: 100% 100%;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  fieldset {
 | 
				
			||||||
 | 
					    background: var(--fieldset-background);
 | 
				
			||||||
 | 
					    color: var(--rdd-color-text-primary);
 | 
				
			||||||
 | 
					    margin-bottom: 4px;
 | 
				
			||||||
 | 
					    border-radius: 6px;
 | 
				
			||||||
 | 
					    border-color: var(--rdd-color-text-primary);
 | 
				
			||||||
 | 
					    border-width: 2px;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  .form-group {
 | 
				
			||||||
 | 
					    display: flex;
 | 
				
			||||||
 | 
					    flex-direction: row;
 | 
				
			||||||
 | 
					    flex-wrap: wrap;
 | 
				
			||||||
 | 
					    justify-content: flex-start;
 | 
				
			||||||
 | 
					    align-items: center;
 | 
				
			||||||
 | 
					    padding: 2px 0;
 | 
				
			||||||
 | 
					    border-bottom: 1px solid var(--rdd-color-shadow-primary);
 | 
				
			||||||
 | 
					    font-size: 0.9rem;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    label {
 | 
				
			||||||
 | 
					      font-weight: normal;
 | 
				
			||||||
 | 
					      flex: 2;
 | 
				
			||||||
 | 
					      padding-left: 5px;
 | 
				
			||||||
 | 
					      margin: 0;
 | 
				
			||||||
 | 
					      color: var(
 | 
				
			||||||
 | 
					        --rdd-color-text-primary
 | 
				
			||||||
 | 
					      ); // Assurez-vous que cette variable existe dans colors.less
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .attribute-value,
 | 
				
			||||||
 | 
					    input[type="text"],
 | 
				
			||||||
 | 
					    input[type="number"],
 | 
				
			||||||
 | 
					    select {
 | 
				
			||||||
 | 
					      flex: 3;
 | 
				
			||||||
 | 
					      background: var(--rdd-input-background);
 | 
				
			||||||
 | 
					      border: 1px solid var(--rdd-color-border-input); // Assurez-vous que cette variable existe
 | 
				
			||||||
 | 
					      color: var(
 | 
				
			||||||
 | 
					        --rdd-color-text-input
 | 
				
			||||||
 | 
					      ); // Assurez-vous que cette variable existe
 | 
				
			||||||
 | 
					      padding: 2px 2px; // Augmentation du padding vertical
 | 
				
			||||||
 | 
					      border-radius: 3px;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    input[type="checkbox"] {
 | 
				
			||||||
 | 
					      flex: 0 0 20px; // Taille fixe pour les cases à cocher
 | 
				
			||||||
 | 
					      margin-left: 5px;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.item-sheet-header() {
 | 
				
			||||||
 | 
					  background: #011d33 url(../assets/ui/bg_header.webp) no-repeat left top;
 | 
				
			||||||
 | 
					  color: rgba(255, 255, 255, 1);
 | 
				
			||||||
 | 
					  .sheet-header-row {
 | 
				
			||||||
 | 
					    display: flex;
 | 
				
			||||||
 | 
					    flex-direction: row;
 | 
				
			||||||
 | 
					    align-items: center;
 | 
				
			||||||
 | 
					    h1,
 | 
				
			||||||
 | 
					    input {
 | 
				
			||||||
 | 
					      font-family: CaslonAntique;
 | 
				
			||||||
 | 
					      font-size: 2.5rem;
 | 
				
			||||||
 | 
					      font-weight: normal;
 | 
				
			||||||
 | 
					      color: var(--window-header-title-color);
 | 
				
			||||||
 | 
					      margin: 4px;
 | 
				
			||||||
 | 
					      height: 3rem;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  :is(
 | 
				
			||||||
 | 
					    input[type="text"],
 | 
				
			||||||
 | 
					    input[type="number"],
 | 
				
			||||||
 | 
					    input[type="password"],
 | 
				
			||||||
 | 
					    input[type="datetime-local"],
 | 
				
			||||||
 | 
					    input[type="date"],
 | 
				
			||||||
 | 
					    input[type="time"]
 | 
				
			||||||
 | 
					  ) {
 | 
				
			||||||
 | 
					    color: rgba(255, 255, 255, 0.75);
 | 
				
			||||||
 | 
					    background: rgba(255, 255, 255, 0.1);
 | 
				
			||||||
 | 
					    border: 0 none;
 | 
				
			||||||
 | 
					    margin-bottom: 0.2rem;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -44,13 +44,13 @@ export class ChatVente {
 | 
				
			|||||||
    vente.nbLots = Math.max(0, vente.nbLots - quantite)
 | 
					    vente.nbLots = Math.max(0, vente.nbLots - quantite)
 | 
				
			||||||
    await chatMessage.setFlag(SYSTEM_RDD, NB_LOTS, vente.nbLots)
 | 
					    await chatMessage.setFlag(SYSTEM_RDD, NB_LOTS, vente.nbLots)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-vente-item.html', vente);
 | 
					    const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-vente-item.hbs', vente);
 | 
				
			||||||
    chatMessage.update({ content: html });
 | 
					    chatMessage.update({ content: html });
 | 
				
			||||||
    chatMessage.render(true);
 | 
					    chatMessage.render(true);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  static async displayAchatVente(vente) {
 | 
					  static async displayAchatVente(vente) {
 | 
				
			||||||
    const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-vente-item.html', vente);
 | 
					    const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-vente-item.hbs', vente);
 | 
				
			||||||
    const chatMessage = await ChatMessage.create(RdDUtility.chatDataSetup(html))
 | 
					    const chatMessage = await ChatMessage.create(RdDUtility.chatDataSetup(html))
 | 
				
			||||||
    await chatMessage.setFlag(SYSTEM_RDD, NB_LOTS, vente.nbLots)
 | 
					    await chatMessage.setFlag(SYSTEM_RDD, NB_LOTS, vente.nbLots)
 | 
				
			||||||
    await chatMessage.setFlag(SYSTEM_RDD, DETAIL_VENTE, {
 | 
					    await chatMessage.setFlag(SYSTEM_RDD, DETAIL_VENTE, {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -29,7 +29,7 @@ export class DialogItemAchat extends Dialog {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    DialogItemAchat.changeNombreLots(venteData, 1)
 | 
					    DialogItemAchat.changeNombreLots(venteData, 1)
 | 
				
			||||||
    const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/dialog-item-achat.html`, venteData)
 | 
					    const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/dialog-item-achat.hbs`, venteData)
 | 
				
			||||||
    new DialogItemAchat(html, venteData).render(true)
 | 
					    new DialogItemAchat(html, venteData).render(true)
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,7 +20,7 @@ export class DialogItemVente extends Dialog {
 | 
				
			|||||||
      quantiteIllimite: item.isItemCommerce() ? quantiteMax == undefined : !item.parent,
 | 
					      quantiteIllimite: item.isItemCommerce() ? quantiteMax == undefined : !item.parent,
 | 
				
			||||||
      isOwned:  item.parent,
 | 
					      isOwned:  item.parent,
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/dialog-item-vente.html`, venteData);
 | 
					    const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/dialog-item-vente.hbs`, venteData);
 | 
				
			||||||
    return new DialogItemVente(venteData, html).render(true);
 | 
					    return new DialogItemVente(venteData, html).render(true);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,7 +19,6 @@ import { RdDEmpoignade } from "./rdd-empoignade.js";
 | 
				
			|||||||
import { RdDBaseActorSangSheet } from "./actor/base-actor-sang-sheet.js";
 | 
					import { RdDBaseActorSangSheet } from "./actor/base-actor-sang-sheet.js";
 | 
				
			||||||
import { RdDCoeur } from "./coeur/rdd-coeur.js";
 | 
					import { RdDCoeur } from "./coeur/rdd-coeur.js";
 | 
				
			||||||
import { AppPersonnageAleatoire } from "./actor/random/app-personnage-aleatoire.js";
 | 
					import { AppPersonnageAleatoire } from "./actor/random/app-personnage-aleatoire.js";
 | 
				
			||||||
import { RdDItemRace } from "./item/race.js";
 | 
					 | 
				
			||||||
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
 | 
					import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* -------------------------------------------- */
 | 
					/* -------------------------------------------- */
 | 
				
			||||||
@@ -31,7 +30,7 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
 | 
				
			|||||||
  /** @override */
 | 
					  /** @override */
 | 
				
			||||||
  static get defaultOptions() {
 | 
					  static get defaultOptions() {
 | 
				
			||||||
    return foundry.utils.mergeObject(RdDBaseActorReveSheet.defaultOptions, {
 | 
					    return foundry.utils.mergeObject(RdDBaseActorReveSheet.defaultOptions, {
 | 
				
			||||||
      template: "systems/foundryvtt-reve-de-dragon/templates/actor-sheet.html",
 | 
					      template: "systems/foundryvtt-reve-de-dragon/templates/actor-sheet.hbs",
 | 
				
			||||||
      width: 550,
 | 
					      width: 550,
 | 
				
			||||||
      showCompNiveauBase: false,
 | 
					      showCompNiveauBase: false,
 | 
				
			||||||
      vueArchetype: false,
 | 
					      vueArchetype: false,
 | 
				
			||||||
@@ -127,77 +126,73 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
 | 
				
			|||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.html.find('.show-hide-competences').click(async event => {
 | 
					    this.html.find('.show-hide-competences').click(async event => {
 | 
				
			||||||
      this.options.showCompNiveauBase = !this.options.showCompNiveauBase;
 | 
					      this.options.showCompNiveauBase = !this.options.showCompNiveauBase
 | 
				
			||||||
      this.render(true);
 | 
					      this.render(true)
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.html.find('.button-tmr-visu').click(async event => this.actor.displayTMR("visu"))
 | 
					    this.html.find('.button-tmr-visu').click(async event => await this.actor.displayTMR("visu"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Everything below here is only needed if the sheet is editable
 | 
					    // Everything below here is only needed if the sheet is editable
 | 
				
			||||||
    if (!this.options.editable) return;
 | 
					    if (!this.options.editable) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.html.find('.sheet-possession-attack').click(async event => {
 | 
					    this.html.find('.sheet-possession-attack').click(async event => {
 | 
				
			||||||
      const poss = RdDSheetUtility.getItem(event, this.actor)
 | 
					      const poss = RdDSheetUtility.getItem(event, this.actor)
 | 
				
			||||||
      this.actor.conjurerPossession(poss)
 | 
					      await this.actor.conjurerPossession(poss)
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.html.find('.subacteur-coeur-toggle a').click(async event => {
 | 
					    this.html.find('.subacteur-coeur-toggle a').click(async event => {
 | 
				
			||||||
      const subActorIdactorId = RdDSheetUtility.getEventItemData(event, 'subactor-id')
 | 
					      const subActorIdactorId = RdDSheetUtility.getEventItemData(event, 'subactor-id')
 | 
				
			||||||
      const coeurNombre = $(event.currentTarget).data('numero-coeur')
 | 
					      const coeurNombre = $(event.currentTarget).data('numero-coeur')
 | 
				
			||||||
      RdDCoeur.toggleSubActeurCoeur(this.actor.id, subActorIdactorId, coeurNombre)
 | 
					      await RdDCoeur.toggleSubActeurCoeur(this.actor.id, subActorIdactorId, coeurNombre)
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
    this.html.find('.subacteur-tendre-moment').click(async event => {
 | 
					    this.html.find('.subacteur-tendre-moment').click(async event => {
 | 
				
			||||||
      const subActorId = RdDSheetUtility.getEventItemData(event, 'subactor-id')
 | 
					      const subActorId = RdDSheetUtility.getEventItemData(event, 'subactor-id')
 | 
				
			||||||
      RdDCoeur.startSubActeurTendreMoment(this.actor.id, subActorId)
 | 
					      await RdDCoeur.startSubActeurTendreMoment(this.actor.id, subActorId)
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
    this.html.find('.subacteur-delete').click(async event => {
 | 
					    this.html.find('.subacteur-delete').click(async event => {
 | 
				
			||||||
      const li = RdDSheetUtility.getEventElement(event);
 | 
					      const li = RdDSheetUtility.getEventElement(event);
 | 
				
			||||||
      const subActorId = li.data("subactor-id");
 | 
					      const subActorId = li.data("subactor-id");
 | 
				
			||||||
      this.deleteSubActeur(subActorId, li);
 | 
					      this.deleteSubActeur(subActorId, li);
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
    this.html.find("input.derivee-value[name='system.compteurs.stress.value']").change(async event => {
 | 
					    this.html.find("input.derivee-value[name='system.compteurs.stress.value']").change(async event =>
 | 
				
			||||||
      this.actor.updateCompteurValue("stress", parseInt(event.target.value));
 | 
					      await this.actor.updateCompteurValue("stress", parseInt(event.target.value))
 | 
				
			||||||
    });
 | 
					    );
 | 
				
			||||||
    this.html.find("input.derivee-value[name='system.compteurs.experience.value']").change(async event => {
 | 
					    this.html.find("input.derivee-value[name='system.compteurs.experience.value']").change(async event =>
 | 
				
			||||||
      this.actor.updateCompteurValue("experience", parseInt(event.target.value));
 | 
					      await this.actor.updateCompteurValue("experience", parseInt(event.target.value))
 | 
				
			||||||
    });
 | 
					    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.html.find('.creer-tache').click(async event => this.createEmptyTache());
 | 
					    this.html.find('.creer-tache').click(async event => await this.createEmptyTache());
 | 
				
			||||||
    this.html.find('.creer-une-oeuvre').click(async event => this.selectTypeOeuvreToCreate());
 | 
					    this.html.find('.creer-une-oeuvre').click(async event => await this.selectTypeOeuvreToCreate());
 | 
				
			||||||
    this.html.find('.creer-tache-blessure-legere').click(async event => RdDItemBlessure.createTacheSoinBlessure(this.actor, 2));
 | 
					    this.html.find('.creer-tache-blessure-legere').click(async event => await RdDItemBlessure.createTacheSoinBlessure(this.actor, 2));
 | 
				
			||||||
    this.html.find('.creer-tache-blessure-grave').click(async event => RdDItemBlessure.createTacheSoinBlessure(this.actor, 4));
 | 
					    this.html.find('.creer-tache-blessure-grave').click(async event => await RdDItemBlessure.createTacheSoinBlessure(this.actor, 4));
 | 
				
			||||||
    this.html.find('.creer-tache-blessure-critique').click(async event => RdDItemBlessure.createTacheSoinBlessure(this.actor, 6));
 | 
					    this.html.find('.creer-tache-blessure-critique').click(async event => await RdDItemBlessure.createTacheSoinBlessure(this.actor, 6));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.html.find('.blessure-premierssoins-done').change(async event => {
 | 
					    this.html.find('.blessure-premierssoins-done').change(async event => {
 | 
				
			||||||
      const blessure = this.getBlessure(event);
 | 
					      await this.getBlessure(event)?.setSoinsBlessure({ premierssoins: { done: event.currentTarget.checked } });
 | 
				
			||||||
      await blessure?.setSoinsBlessure({ premierssoins: { done: event.currentTarget.checked } });
 | 
					 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    this.html.find('.blessure-soinscomplets-done').change(async event => {
 | 
					    this.html.find('.blessure-soinscomplets-done').change(async event => {
 | 
				
			||||||
      const blessure = this.getBlessure(event);
 | 
					      await this.getBlessure(event)?.setSoinsBlessure({ soinscomplets: { done: event.currentTarget.checked } })
 | 
				
			||||||
      await blessure?.setSoinsBlessure({ soinscomplets: { done: event.currentTarget.checked } })
 | 
					 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    this.html.find('.blessure-premierssoins-bonus').change(async event => {
 | 
					    this.html.find('.blessure-premierssoins-bonus').change(async event => {
 | 
				
			||||||
      const blessure = this.getBlessure(event);
 | 
					      await this.getBlessure(event)?.setSoinsBlessure({ premierssoins: { bonus: Number(event.currentTarget.value) } })
 | 
				
			||||||
      await blessure?.setSoinsBlessure({ premierssoins: { bonus: Number(event.currentTarget.value) } })
 | 
					 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    this.html.find('.blessure-soinscomplets-bonus').change(async event => {
 | 
					    this.html.find('.blessure-soinscomplets-bonus').change(async event => {
 | 
				
			||||||
      const blessure = this.getBlessure(event);
 | 
					      await this.getBlessure(event)?.setSoinsBlessure({ soinscomplets: { bonus: Number(event.currentTarget.value) } })
 | 
				
			||||||
      await blessure?.setSoinsBlessure({ soinscomplets: { bonus: Number(event.currentTarget.value) } })
 | 
					 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.html.find('.roll-chance-actuelle').click(async event => this.actor.rollCarac('chance-actuelle'))
 | 
					    this.html.find('.roll-chance-actuelle').click(async event => await this.actor.rollCarac('chance-actuelle'))
 | 
				
			||||||
    this.html.find('.button-appel-chance').click(async event => this.actor.rollAppelChance())
 | 
					    this.html.find('.button-appel-chance').click(async event => await this.actor.rollAppelChance())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.html.find('[name="jet-astrologie"]').click(async event => this.actor.astrologieNombresAstraux())
 | 
					    this.html.find('[name="jet-astrologie"]').click(async event => await this.actor.astrologieNombresAstraux())
 | 
				
			||||||
    this.html.find('.action-tache').click(async event => this.actor.rollTache(RdDSheetUtility.getItemId(event)))
 | 
					    this.html.find('.action-tache').click(async event => await this.actor.rollTache(RdDSheetUtility.getItemId(event)))
 | 
				
			||||||
    this.html.find('.meditation-label a').click(async event => this.actor.rollMeditation(RdDSheetUtility.getItemId(event)))
 | 
					    this.html.find('.meditation-label a').click(async event => await this.actor.rollMeditation(RdDSheetUtility.getItemId(event)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.html.find('.action-chant').click(async event => this.actor.rollChant(RdDSheetUtility.getItemId(event)))
 | 
					    this.html.find('.action-chant').click(async event => await this.actor.rollChant(RdDSheetUtility.getItemId(event)))
 | 
				
			||||||
    this.html.find('.action-danse').click(async event => this.actor.rollDanse(RdDSheetUtility.getItemId(event)))
 | 
					    this.html.find('.action-danse').click(async event => await this.actor.rollDanse(RdDSheetUtility.getItemId(event)))
 | 
				
			||||||
    this.html.find('.action-musique').click(async event => this.actor.rollMusique(RdDSheetUtility.getItemId(event)))
 | 
					    this.html.find('.action-musique').click(async event => await this.actor.rollMusique(RdDSheetUtility.getItemId(event)))
 | 
				
			||||||
    this.html.find('.action-oeuvre').click(async event => this.actor.rollOeuvre(RdDSheetUtility.getItemId(event)))
 | 
					    this.html.find('.action-oeuvre').click(async event => await this.actor.rollOeuvre(RdDSheetUtility.getItemId(event)))
 | 
				
			||||||
    this.html.find('.action-jeu').click(async event => this.actor.rollJeu(RdDSheetUtility.getItemId(event)))
 | 
					    this.html.find('.action-jeu').click(async event => await this.actor.rollJeu(RdDSheetUtility.getItemId(event)))
 | 
				
			||||||
    this.html.find('.action-recettecuisine').click(async event => this.actor.rollRecetteCuisine(RdDSheetUtility.getItemId(event)))
 | 
					    this.html.find('.action-recettecuisine').click(async event => await this.actor.rollRecetteCuisine(RdDSheetUtility.getItemId(event)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.html.find('.description-aleatoire').click(async event => new AppPersonnageAleatoire(this.actor).render(true))
 | 
					    this.html.find('.description-aleatoire').click(async event => new AppPersonnageAleatoire(this.actor).render(true))
 | 
				
			||||||
    if (game.user.isGM) {
 | 
					    if (game.user.isGM) {
 | 
				
			||||||
@@ -213,16 +208,16 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
 | 
				
			|||||||
        await this.actor.deleteExperienceLog(0, key + 1);
 | 
					        await this.actor.deleteExperienceLog(0, key + 1);
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
      // Boutons spéciaux MJs
 | 
					      // Boutons spéciaux MJs
 | 
				
			||||||
      this.html.find('.forcer-tmr-aleatoire').click(async event => this.actor.reinsertionAleatoire("Action MJ"))
 | 
					      this.html.find('.forcer-tmr-aleatoire').click(async event => await this.actor.reinsertionAleatoire("Action MJ"))
 | 
				
			||||||
      this.html.find('.don-de-haut-reve').click(async event => this.actor.addDonDeHautReve())
 | 
					      this.html.find('.don-de-haut-reve').click(async event => await this.actor.addDonDeHautReve())
 | 
				
			||||||
      this.html.find('.afficher-tmr').click(async event => this.actor.changeTMRVisible())
 | 
					      this.html.find('.afficher-tmr').click(async event => await this.actor.changeTMRVisible())
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Points de reve actuel
 | 
					    // Points de reve actuel
 | 
				
			||||||
    this.html.find('.roll-reve-actuel').click(async event => this.actor.rollCarac('reve-actuel', {resistance:true}))
 | 
					    this.html.find('.roll-reve-actuel').click(async event => await this.actor.rollCarac('reve-actuel', { resistance: true }))
 | 
				
			||||||
    this.html.find('.action-empoignade').click(async event => RdDEmpoignade.onAttaqueEmpoignadeFromItem(RdDSheetUtility.getItem(event, this.actor)))
 | 
					    this.html.find('.action-empoignade').click(async event => await RdDEmpoignade.onAttaqueEmpoignadeFromItem(RdDSheetUtility.getItem(event, this.actor)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.html.find('.roll-arme').click(async event => this.actor.rollArme(foundry.utils.duplicate(this._getEventArmeCombat(event)), 'competence'))
 | 
					    this.html.find('.roll-arme').click(async event => await this.actor.rollArme(foundry.utils.duplicate(this._getEventArmeCombat(event)), 'competence'))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Initiative pour l'arme
 | 
					    // Initiative pour l'arme
 | 
				
			||||||
    this.html.find('.roll-init-arme').click(async event => {
 | 
					    this.html.find('.roll-init-arme').click(async event => {
 | 
				
			||||||
@@ -235,30 +230,34 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
 | 
				
			|||||||
    })
 | 
					    })
 | 
				
			||||||
    // Display TMR
 | 
					    // Display TMR
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.html.find('.button-tmr').click(async event => this.actor.displayTMR("normal"))
 | 
					    this.html.find('.button-tmr').click(async event => await this.actor.displayTMR("normal"))
 | 
				
			||||||
    this.html.find('.button-tmr-rapide').click(async event => this.actor.displayTMR("rapide"))
 | 
					    this.html.find('.button-tmr-rapide').click(async event => await this.actor.displayTMR("rapide"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.html.find('.button-repos').click(async event => await this.actor.repos())
 | 
					    this.html.find('.button-repos').click(async event => await this.actor.repos())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.html.find('.carac-xp-augmenter').click(async event => this.actor.updateCaracXPAuto(event.currentTarget.name.replace("augmenter.", "")))
 | 
					    this.html.find('.carac-xp-augmenter').click(async event => await this.actor.updateCaracXPAuto(event.currentTarget.name.replace("augmenter.", "")))
 | 
				
			||||||
    this.html.find('.competence-xp-augmenter').click(async event => this.actor.updateCompetenceXPAuto(RdDSheetUtility.getItemId(event)))
 | 
					    this.html.find('.competence-xp-augmenter').click(async event => await this.actor.updateCompetenceXPAuto(RdDSheetUtility.getItemId(event)))
 | 
				
			||||||
    this.html.find('.competence-stress-augmenter').click(async event => this.actor.updateCompetenceStress(RdDSheetUtility.getItemId(event)))
 | 
					    this.html.find('.competence-stress-augmenter').click(async event =>{
 | 
				
			||||||
 | 
					      await this.actor.updateCompetenceStress(RdDSheetUtility.getItemId(event))
 | 
				
			||||||
 | 
					      this.render(true)
 | 
				
			||||||
 | 
					    } 
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (this.options.vueDetaillee) {
 | 
					    if (this.options.vueDetaillee) {
 | 
				
			||||||
      // On carac change
 | 
					      // On carac change
 | 
				
			||||||
      this.html.find('input.carac-xp').change(async event => {
 | 
					      this.html.find('input.carac-xp').change(async event => {
 | 
				
			||||||
        let caracName = event.currentTarget.name.replace(".xp", "").replace("system.carac.", "");
 | 
					        let caracName = event.currentTarget.name.replace(".xp", "").replace("system.carac.", "")
 | 
				
			||||||
        this.actor.updateCaracXP(caracName, parseInt(event.target.value));
 | 
					        await this.actor.updateCaracXP(caracName, parseInt(event.target.value))
 | 
				
			||||||
      });
 | 
					      })
 | 
				
			||||||
      // On competence xp change
 | 
					      // On competence xp change
 | 
				
			||||||
      this.html.find('input.competence-xp').change(async event => {
 | 
					      this.html.find('input.competence-xp').change(async event => {
 | 
				
			||||||
        let compName = event.currentTarget.attributes.compname.value;
 | 
					        let compName = event.currentTarget.attributes.compname.value
 | 
				
			||||||
        this.actor.updateCompetenceXP(compName, parseInt(event.target.value));
 | 
					        await this.actor.updateCompetenceXP(compName, parseInt(event.target.value))
 | 
				
			||||||
      });
 | 
					      })
 | 
				
			||||||
      this.html.find('input.competence-xp-sort').change(async event => {
 | 
					      this.html.find('input.competence-xp-sort').change(async event => {
 | 
				
			||||||
        let compName = event.currentTarget.attributes.compname.value;
 | 
					        let compName = event.currentTarget.attributes.compname.value
 | 
				
			||||||
        this.actor.updateCompetenceXPSort(compName, parseInt(event.target.value));
 | 
					        await this.actor.updateCompetenceXPSort(compName, parseInt(event.target.value))
 | 
				
			||||||
      });
 | 
					      })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      this.html.find('.toggle-archetype').click(async event => {
 | 
					      this.html.find('.toggle-archetype').click(async event => {
 | 
				
			||||||
        this.options.vueArchetype = !this.options.vueArchetype;
 | 
					        this.options.vueArchetype = !this.options.vueArchetype;
 | 
				
			||||||
@@ -267,27 +266,27 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
 | 
				
			|||||||
      // On competence archetype change
 | 
					      // On competence archetype change
 | 
				
			||||||
      this.html.find('.competence-archetype').change(async event => {
 | 
					      this.html.find('.competence-archetype').change(async event => {
 | 
				
			||||||
        let compName = event.currentTarget.attributes.compname.value;
 | 
					        let compName = event.currentTarget.attributes.compname.value;
 | 
				
			||||||
        this.actor.updateCompetenceArchetype(compName, parseInt(event.target.value));
 | 
					        await this.actor.updateCompetenceArchetype(compName, parseInt(event.target.value));
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
      this.html.find('.nouvelle-incarnation').click(async event => this.actor.nouvelleIncarnation())
 | 
					      this.html.find('.nouvelle-incarnation').click(async event => await this.actor.nouvelleIncarnation())
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // On pts de reve change
 | 
					    // On pts de reve change
 | 
				
			||||||
    this.html.find('.pointsreve-value').change(async event => this.actor.update({ "system.reve.reve.value": event.currentTarget.value }))
 | 
					    this.html.find('.pointsreve-value').change(async event => await this.actor.update({ "system.reve.reve.value": event.currentTarget.value }))
 | 
				
			||||||
    this.html.find('.seuil-reve-value').change(async event => this.actor.setPointsDeSeuil(event.currentTarget.value))
 | 
					    this.html.find('.seuil-reve-value').change(async event => await this.actor.setPointsDeSeuil(event.currentTarget.value))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.html.find('.stress-test').click(async event => this.actor.transformerStress())
 | 
					    this.html.find('.stress-test').click(async event => await this.actor.transformerStress())
 | 
				
			||||||
    this.html.find('.moral-malheureux').click(async event => this.actor.jetDeMoral('malheureuse'))
 | 
					    this.html.find('.moral-malheureux').click(async event => await this.actor.jetDeMoral('malheureuse'))
 | 
				
			||||||
    this.html.find('.moral-neutre').click(async event => this.actor.jetDeMoral('neutre'))
 | 
					    this.html.find('.moral-neutre').click(async event => await this.actor.jetDeMoral('neutre'))
 | 
				
			||||||
    this.html.find('.moral-heureux').click(async event => this.actor.jetDeMoral('heureuse'))
 | 
					    this.html.find('.moral-heureux').click(async event => await this.actor.jetDeMoral('heureuse'))
 | 
				
			||||||
    this.html.find('.button-ethylisme').click(async event => this.actor.jetEthylisme())
 | 
					    this.html.find('.button-ethylisme').click(async event => await this.actor.jetEthylisme())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.html.find('.ptreve-actuel-plus').click(async event => this.actor.reveActuelIncDec(1))
 | 
					    this.html.find('.ptreve-actuel-plus').click(async event => await this.actor.reveActuelIncDec(1))
 | 
				
			||||||
    this.html.find('.ptreve-actuel-moins').click(async event => this.actor.reveActuelIncDec(-1))
 | 
					    this.html.find('.ptreve-actuel-moins').click(async event => await this.actor.reveActuelIncDec(-1))
 | 
				
			||||||
    this.html.find('.chance-actuelle-plus').click(async event => this.actor.chanceActuelleIncDec(1))
 | 
					    this.html.find('.chance-actuelle-plus').click(async event => await this.actor.chanceActuelleIncDec(1))
 | 
				
			||||||
    this.html.find('.chance-actuelle-moins').click(async event => this.actor.chanceActuelleIncDec(-1))
 | 
					    this.html.find('.chance-actuelle-moins').click(async event => await this.actor.chanceActuelleIncDec(-1))
 | 
				
			||||||
    this.html.find('.fatigue-plus').click(async event => this.actor.santeIncDec("fatigue", 1))
 | 
					    this.html.find('.fatigue-plus').click(async event => await this.actor.santeIncDec("fatigue", 1))
 | 
				
			||||||
    this.html.find('.fatigue-moins').click(async event => this.actor.santeIncDec("fatigue", -1))
 | 
					    this.html.find('.fatigue-moins').click(async event => await this.actor.santeIncDec("fatigue", -1))
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  getBlessure(event) {
 | 
					  getBlessure(event) {
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										435
									
								
								module/actor.js
									
									
									
									
									
								
							
							
						
						@@ -42,6 +42,7 @@ import { RdDItemTete } from "./item/tete.js";
 | 
				
			|||||||
import { DialogSelect } from "./dialog-select.js";
 | 
					import { DialogSelect } from "./dialog-select.js";
 | 
				
			||||||
import { PAS_DE_DRACONIC, POSSESSION_SANS_DRACONIC } from "./item/base-items.js";
 | 
					import { PAS_DE_DRACONIC, POSSESSION_SANS_DRACONIC } from "./item/base-items.js";
 | 
				
			||||||
import { RdDItemRace } from "./item/race.js";
 | 
					import { RdDItemRace } from "./item/race.js";
 | 
				
			||||||
 | 
					import { RdDRollResult } from "./rdd-roll-result.js";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const MAINS_DIRECTRICES = ['Droitier', 'Gaucher', 'Ambidextre']
 | 
					export const MAINS_DIRECTRICES = ['Droitier', 'Gaucher', 'Ambidextre']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -166,22 +167,29 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
  async $perteRevePotionsEnchantees() {
 | 
					  async $perteReveEnchantementsChateauDormants() {
 | 
				
			||||||
    const potionUpdates = this.itemTypes[ITEM_TYPES.potion].map(it => it.perteRevePotion())
 | 
					    const toUpdate = this.items.filter(it => [ITEM_TYPES.potion, ITEM_TYPES.gemme].includes(it.type))
 | 
				
			||||||
 | 
					      .map(it => it.perteReveChateauDormant())
 | 
				
			||||||
      .filter(it => it != undefined)
 | 
					      .filter(it => it != undefined)
 | 
				
			||||||
    if (potionUpdates.length > 0) {
 | 
					
 | 
				
			||||||
      console.log('perte rêve de potions', potionUpdates)
 | 
					    if (toUpdate.length > 0) {
 | 
				
			||||||
      const messageUpdates = await Promise.all(potionUpdates.map(async p => await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-potionenchantee-chateaudormant.html`, {
 | 
					      console.log('perte de rêve des enchantements', toUpdate)
 | 
				
			||||||
        pr: foundry.utils.getProperty(p, 'system.pr'),
 | 
					      const messageUpdates = await Promise.all(
 | 
				
			||||||
        alias: this.getAlias(),
 | 
					        toUpdate.map(async it => await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-pertereve-enchantement-chateaudormant.hbs`, it)))
 | 
				
			||||||
        potionName: p.name,
 | 
					 | 
				
			||||||
        potionImg: p.img
 | 
					 | 
				
			||||||
      })))
 | 
					 | 
				
			||||||
      ChatMessage.create({
 | 
					      ChatMessage.create({
 | 
				
			||||||
        whisper: ChatUtility.getOwners(this),
 | 
					        whisper: ChatUtility.getOwners(this),
 | 
				
			||||||
        content: messageUpdates.reduce(Misc.joining('<br>'))
 | 
					        content: messageUpdates.reduce(Misc.joining('<br>'))
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
      await this.updateEmbeddedDocuments('Item', potionUpdates);
 | 
					      await this.updateEmbeddedDocuments('Item', toUpdate.map(it => it.update));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  async $suppressionLancementsSort() {
 | 
				
			||||||
 | 
					    const updates = this.itemTypes[ITEM_TYPES.sort]
 | 
				
			||||||
 | 
					      .filter(it => it.system.lancements.length > 0)
 | 
				
			||||||
 | 
					      .map(it => { return { _id: it.id, 'system.lancements': [] } })
 | 
				
			||||||
 | 
					    if (updates.length > 0) {
 | 
				
			||||||
 | 
					      await this.updateEmbeddedDocuments('Item', updates)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -235,7 +243,7 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    await this.resetInfoSommeil()
 | 
					    await this.resetInfoSommeil()
 | 
				
			||||||
    ChatMessage.create(message);
 | 
					    ChatMessage.create(message);
 | 
				
			||||||
    this.sheet.render(true);
 | 
					    setTimeout(() => this.sheet.render(), 20)
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async _recuperationSante(message) {
 | 
					  async _recuperationSante(message) {
 | 
				
			||||||
@@ -271,27 +279,32 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
  async dormirChateauDormant() {
 | 
					  async dormirChateauDormant() {
 | 
				
			||||||
    if (!ReglesOptionnelles.isUsing("chateau-dormant-gardien") || !this.system.sommeil || this.system.sommeil.nouveaujour) {
 | 
					    if (!ReglesOptionnelles.isUsing("chateau-dormant-gardien") || !this.system.sommeil || this.system.sommeil.nouveaujour) {
 | 
				
			||||||
 | 
					      await this.$dormirChateauDormant();
 | 
				
			||||||
 | 
					      setTimeout(() => this.sheet.render(), 20)
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  async $dormirChateauDormant() {
 | 
				
			||||||
    const message = {
 | 
					    const message = {
 | 
				
			||||||
      whisper: ChatUtility.getOwners(this),
 | 
					      whisper: ChatUtility.getOwners(this),
 | 
				
			||||||
      content: ""
 | 
					      content: ""
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      await this._recuperationSante(message)
 | 
					    await this._recuperationSante(message);
 | 
				
			||||||
    await this._recupereMoralChateauDormant(message);
 | 
					    await this._recupereMoralChateauDormant(message);
 | 
				
			||||||
    await this._recupereChance();
 | 
					    await this._recupereChance();
 | 
				
			||||||
    await this.transformerStress();
 | 
					    await this.transformerStress();
 | 
				
			||||||
    await this.retourSeuilDeReve(message);
 | 
					    await this.retourSeuilDeReve(message);
 | 
				
			||||||
    await this.setBonusPotionSoin(0);
 | 
					    await this.setBonusPotionSoin(0);
 | 
				
			||||||
    await this.retourSust(message);
 | 
					    await this.retourSust(message);
 | 
				
			||||||
      await this.$perteRevePotionsEnchantees();
 | 
					    await this.$perteReveEnchantementsChateauDormants();
 | 
				
			||||||
      await RdDCoeur.applyCoeurChateauDormant(this, message)
 | 
					    await this.$suppressionLancementsSort();
 | 
				
			||||||
 | 
					    await RdDCoeur.applyCoeurChateauDormant(this, message);
 | 
				
			||||||
    if (message.content != "") {
 | 
					    if (message.content != "") {
 | 
				
			||||||
      message.content = `A la fin Chateau Dormant, ${message.content}<br>Un nouveau jour se lève`;
 | 
					      message.content = `A la fin Chateau Dormant, ${message.content}<br>Un nouveau jour se lève`;
 | 
				
			||||||
      ChatMessage.create(message);
 | 
					      ChatMessage.create(message);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    await this.resetInfoSommeil();
 | 
					    await this.resetInfoSommeil();
 | 
				
			||||||
      this.sheet.render(true);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async resetInfoSommeil() {
 | 
					  async resetInfoSommeil() {
 | 
				
			||||||
@@ -433,10 +446,9 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
      message.content += 'Vous ne trouvez pas le sommeil';
 | 
					      message.content += 'Vous ne trouvez pas le sommeil';
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else {
 | 
					    else {
 | 
				
			||||||
      let jetsReve = [];
 | 
					      let dormi = await this.$dormirDesHeures(message, heures, options);
 | 
				
			||||||
      let dormi = await this.dormirDesHeures(jetsReve, message, heures, options);
 | 
					      if (dormi.jetsReve.length > 0) {
 | 
				
			||||||
      if (jetsReve.length > 0) {
 | 
					        message.content += `Vous récupérez ${dormi.jetsReve.map(it => it < 0 ? '0 (réveil)' : it).reduce(Misc.joining("+"))} Points de rêve. `;
 | 
				
			||||||
        message.content += `Vous récupérez ${jetsReve.map(it => it < 0 ? '0 (réveil)' : it).reduce(Misc.joining("+"))} Points de rêve. `;
 | 
					 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      if (dormi.etat == 'eveil') {
 | 
					      if (dormi.etat == 'eveil') {
 | 
				
			||||||
        await this.reveilReveDeDragon(message, dormi.heures);
 | 
					        await this.reveilReveDeDragon(message, dormi.heures);
 | 
				
			||||||
@@ -449,11 +461,9 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
      ChatMessage.create(message);
 | 
					      ChatMessage.create(message);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (options.chateauDormant) {
 | 
					    if (options.chateauDormant) {
 | 
				
			||||||
      await this.dormirChateauDormant();
 | 
					      await this.$dormirChateauDormant();
 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    else {
 | 
					 | 
				
			||||||
      this.sheet.render(true);
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    setTimeout(() => this.sheet.render(), 20)
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async reveilReveDeDragon(message, heures) {
 | 
					  async reveilReveDeDragon(message, heures) {
 | 
				
			||||||
@@ -463,18 +473,18 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async dormirDesHeures(jetsReve, message, heures, options) {
 | 
					  async $dormirDesHeures(message, heures, options) {
 | 
				
			||||||
    const dormi = { heures: 0, etat: 'dort' };
 | 
					    const dormi = { heures: 0, etat: 'dort', jetsReve: [] };
 | 
				
			||||||
    for (; dormi.heures < heures && dormi.etat == 'dort'; dormi.heures++) {
 | 
					    for (; dormi.heures < heures && dormi.etat == 'dort'; dormi.heures++) {
 | 
				
			||||||
      await this._recupererEthylisme(message);
 | 
					      await this.$recupererEthylisme(message);
 | 
				
			||||||
      if (options.grisReve) {
 | 
					      if (options.grisReve) {
 | 
				
			||||||
        await this.recupererFatigue(message);
 | 
					        await this.$recupererFatigue(message);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      else if (!this.system.sommeil?.insomnie) {
 | 
					      else if (!this.system.sommeil?.insomnie) {
 | 
				
			||||||
        await this.recupererFatigue(message);
 | 
					        await this.$recupererFatigue(message);
 | 
				
			||||||
        dormi.etat = await this.jetRecuperationReve(jetsReve, message);
 | 
					        await this.$jetRecuperationReve(dormi, message);
 | 
				
			||||||
        if (dormi.etat == 'dort' && EffetsDraconiques.isDonDoubleReve(this)) {
 | 
					        if (dormi.etat == 'dort' && EffetsDraconiques.isDonDoubleReve(this)) {
 | 
				
			||||||
          dormi.etat = await this.jetRecuperationReve(jetsReve, message);
 | 
					          await this.$jetRecuperationReve(dormi, message);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -482,35 +492,36 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
  async jetRecuperationReve(jetsReve, message) {
 | 
					  async $jetRecuperationReve(dormi, message) {
 | 
				
			||||||
    if (this.getReveActuel() < this.system.reve.seuil.value) {
 | 
					    if (this.getReveActuel() < this.system.reve.seuil.value) {
 | 
				
			||||||
      let reve = await RdDDice.rollTotal("1dr");
 | 
					      const reve = await RdDDice.rollTotal("1dr")
 | 
				
			||||||
      if (reve >= 7) {
 | 
					      if (reve >= 7) {
 | 
				
			||||||
        // Rêve de Dragon !
 | 
					        // Rêve de Dragon !
 | 
				
			||||||
        message.content += `Vous faites un <strong>Rêve de Dragon</strong> de ${reve} Points de rêve qui vous réveille! `;
 | 
					        message.content += `Vous faites un <strong>Rêve de Dragon</strong> de ${reve} Points de rêve qui vous réveille! `;
 | 
				
			||||||
        await this.combattreReveDeDragon(reve);
 | 
					        await this.combattreReveDeDragon(reve);
 | 
				
			||||||
        jetsReve.push(-1);
 | 
					        dormi.jetsReve.push(-1);
 | 
				
			||||||
        return 'eveil';
 | 
					        dormi.etat = 'eveil'
 | 
				
			||||||
 | 
					        return
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      else {
 | 
					      else {
 | 
				
			||||||
        if (!ReglesOptionnelles.isUsing("recuperation-reve")) {
 | 
					        if (!ReglesOptionnelles.isUsing("recuperation-reve")) {
 | 
				
			||||||
          ChatMessage.create({
 | 
					          ChatMessage.create({
 | 
				
			||||||
            whisper: ChatUtility.getOwners(this),
 | 
					            whisper: ChatUtility.getOwners(this),
 | 
				
			||||||
            content: `Pas de récupération de rêve (${reve} points ignorés)`
 | 
					            content: `Pas de récupération de rêve (${reve} points ignorés)`
 | 
				
			||||||
          });
 | 
					          })
 | 
				
			||||||
          jetsReve.push(0);
 | 
					          dormi.jetsReve.push(0)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else {
 | 
					        else {
 | 
				
			||||||
          await this.reveActuelIncDec(reve);
 | 
					          await this.reveActuelIncDec(reve)
 | 
				
			||||||
          jetsReve.push(reve);
 | 
					          dormi.jetsReve.push(reve)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return 'dort';
 | 
					    dormi.etat = 'dort'
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
  async _recupererEthylisme(message) {
 | 
					  async $recupererEthylisme(message) {
 | 
				
			||||||
    if (!ReglesOptionnelles.isUsing("recuperation-ethylisme")) { return; }
 | 
					    if (!ReglesOptionnelles.isUsing("recuperation-ethylisme")) { return; }
 | 
				
			||||||
    let value = Math.min(Number.parseInt(this.system.compteurs.ethylisme.value) + 1, 1);
 | 
					    let value = Math.min(Number.parseInt(this.system.compteurs.ethylisme.value) + 1, 1);
 | 
				
			||||||
    if (value <= 0) {
 | 
					    if (value <= 0) {
 | 
				
			||||||
@@ -532,7 +543,6 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
      max = Math.floor(max / 2);
 | 
					      max = Math.floor(max / 2);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    const manquant = max - this.system.sante.endurance.value;
 | 
					    const manquant = max - this.system.sante.endurance.value;
 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (manquant > 0) {
 | 
					    if (manquant > 0) {
 | 
				
			||||||
      await this.santeIncDec("endurance", manquant);
 | 
					      await this.santeIncDec("endurance", manquant);
 | 
				
			||||||
      message.content += `Vous récuperez ${manquant} points d'endurance. `;
 | 
					      message.content += `Vous récuperez ${manquant} points d'endurance. `;
 | 
				
			||||||
@@ -540,15 +550,15 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
  async recupererFatigue(message) {
 | 
					  async $recupererFatigue(message) {
 | 
				
			||||||
    if (ReglesOptionnelles.isUsing("appliquer-fatigue")) {
 | 
					    if (ReglesOptionnelles.isUsing("appliquer-fatigue")) {
 | 
				
			||||||
      let fatigue = this.system.sante.fatigue.value;
 | 
					      let fatigue = this.system.sante.fatigue.value
 | 
				
			||||||
      const fatigueMin = this.getFatigueMin();
 | 
					      const fatigueMin = this.getFatigueMin()
 | 
				
			||||||
      if (fatigue <= fatigueMin) {
 | 
					      if (fatigue <= fatigueMin) {
 | 
				
			||||||
        return;
 | 
					        return
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      fatigue = Math.max(fatigueMin, this._calculRecuperationSegment(fatigue));
 | 
					      fatigue = Math.max(fatigueMin, this._calculRecuperationSegment(fatigue))
 | 
				
			||||||
      await this.update({ "system.sante.fatigue.value": fatigue });
 | 
					      await this.update({ 'system.sante.fatigue.value': fatigue });
 | 
				
			||||||
      if (fatigue == 0) {
 | 
					      if (fatigue == 0) {
 | 
				
			||||||
        message.content += "Vous êtes complêtement reposé. ";
 | 
					        message.content += "Vous êtes complêtement reposé. ";
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
@@ -619,7 +629,7 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
    rollData.competence.system.defaut_carac = 'reve-actuel';
 | 
					    rollData.competence.system.defaut_carac = 'reve-actuel';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const dialog = await RdDRoll.create(this, rollData,
 | 
					    const dialog = await RdDRoll.create(this, rollData,
 | 
				
			||||||
      { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-reve-de-dragon.html' },
 | 
					      { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-reve-de-dragon.hbs' },
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        name: 'maitrise',
 | 
					        name: 'maitrise',
 | 
				
			||||||
        label: 'Maîtriser le Rêve de Dragon',
 | 
					        label: 'Maîtriser le Rêve de Dragon',
 | 
				
			||||||
@@ -658,19 +668,23 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
    if (!RdDItemRace.checkRacialMax(this, caracName, to)) {
 | 
					    if (!RdDItemRace.checkRacialMax(this, caracName, to)) {
 | 
				
			||||||
      return
 | 
					      return
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    let updates = {};
 | 
				
			||||||
    if (caracName == LIST_CARAC_PERSONNAGE.reve.code) {
 | 
					    if (caracName == LIST_CARAC_PERSONNAGE.reve.code) {
 | 
				
			||||||
      if (to > Misc.toInt(this.system.reve.seuil.value)) {
 | 
					      if (to > Misc.toInt(this.system.reve.seuil.value)) {
 | 
				
			||||||
        this.setPointsDeSeuil(to);
 | 
					        updates[`system.reve.seuil.value`] = to; // SFA : Direct and packed changes
 | 
				
			||||||
 | 
					        //this.setPointsDeSeuil(to);
 | 
				
			||||||
      } 
 | 
					      } 
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (caracName == LIST_CARAC_PERSONNAGE.chance.code) {
 | 
					    if (caracName == LIST_CARAC_PERSONNAGE.chance.code) {
 | 
				
			||||||
      if (to > Misc.toInt(this.system.compteurs.chance.value)) {
 | 
					      if (to > Misc.toInt(this.system.compteurs.chance.value)) {
 | 
				
			||||||
        this.setPointsDeChance(to);
 | 
					        updates[`system.compteurs.chance.value`] = to; // SFA : Direct and packed changes
 | 
				
			||||||
 | 
					        //this.setPointsDeChance(to);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    let selectedCarac = this.findCaracByName(caracName);
 | 
					    let selectedCarac = this.findCaracByName(caracName);
 | 
				
			||||||
    const from = selectedCarac.value
 | 
					    const from = selectedCarac.value
 | 
				
			||||||
    await this.update({ [`system.carac.${caracName}.value`]: to });
 | 
					    updates[`system.carac.${caracName}.value`] = to;
 | 
				
			||||||
 | 
					    await this.update(updates);
 | 
				
			||||||
    await ExperienceLog.add(this, XP_TOPIC.CARAC, from, to, caracName);
 | 
					    await ExperienceLog.add(this, XP_TOPIC.CARAC, from, to, caracName);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -727,7 +741,7 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
      await competence.update({
 | 
					      await competence.update({
 | 
				
			||||||
        "system.xp": toXp,
 | 
					        "system.xp": toXp,
 | 
				
			||||||
        "system.niveau": toNiveau,
 | 
					        "system.niveau": toNiveau,
 | 
				
			||||||
      });
 | 
					      }, { render: false })
 | 
				
			||||||
      await ExperienceLog.add(this, XP_TOPIC.XP, fromXp, toXp, competence.name);
 | 
					      await ExperienceLog.add(this, XP_TOPIC.XP, fromXp, toXp, competence.name);
 | 
				
			||||||
      await ExperienceLog.add(this, XP_TOPIC.NIVEAU, fromNiveau, toNiveau, competence.name);
 | 
					      await ExperienceLog.add(this, XP_TOPIC.NIVEAU, fromNiveau, toNiveau, competence.name);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -749,7 +763,7 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
          expérience requise: ${xpRequis}
 | 
					          expérience requise: ${xpRequis}
 | 
				
			||||||
          niveau : ${fromNiveau}
 | 
					          niveau : ${fromNiveau}
 | 
				
			||||||
          archétype : ${competence.system.niveau_archetype}`);
 | 
					          archétype : ${competence.system.niveau_archetype}`);
 | 
				
			||||||
      return;
 | 
					      return
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    const xpUtilise = Math.max(0, Math.min(fromXpStress, 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;
 | 
				
			||||||
@@ -758,7 +772,7 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
    await competence.update({
 | 
					    await competence.update({
 | 
				
			||||||
      "system.xp": newXp,
 | 
					      "system.xp": newXp,
 | 
				
			||||||
      "system.niveau": toNiveau,
 | 
					      "system.niveau": toNiveau,
 | 
				
			||||||
    });
 | 
					    }, { render: false })
 | 
				
			||||||
    const toXpStress = Math.max(0, fromXpStress - xpUtilise);
 | 
					    const toXpStress = Math.max(0, fromXpStress - xpUtilise);
 | 
				
			||||||
    await this.update({ "system.compteurs.experience.value": toXpStress });
 | 
					    await this.update({ "system.compteurs.experience.value": toXpStress });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -774,7 +788,7 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
      const toNiveau = compValue ?? RdDItemCompetence.getNiveauBase(competence.system.categorie, competence.getCategories());
 | 
					      const toNiveau = compValue ?? RdDItemCompetence.getNiveauBase(competence.system.categorie, competence.getCategories());
 | 
				
			||||||
      this.notifyCompetencesTronc(competence, toNiveau);
 | 
					      this.notifyCompetencesTronc(competence, toNiveau);
 | 
				
			||||||
      const fromNiveau = competence.system.niveau;
 | 
					      const fromNiveau = competence.system.niveau;
 | 
				
			||||||
      await competence.update({ 'system.niveau': toNiveau });
 | 
					      await competence.update({ 'system.niveau': toNiveau }, { render: true })
 | 
				
			||||||
      await ExperienceLog.add(this, XP_TOPIC.NIVEAU, fromNiveau, toNiveau, competence.name, true);
 | 
					      await ExperienceLog.add(this, XP_TOPIC.NIVEAU, fromNiveau, toNiveau, competence.name, true);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -799,10 +813,10 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
      if (isNaN(toXp) || typeof (toXp) != 'number') toXp = 0;
 | 
					      if (isNaN(toXp) || typeof (toXp) != 'number') toXp = 0;
 | 
				
			||||||
      const fromXp = competence.system.xp;
 | 
					      const fromXp = competence.system.xp;
 | 
				
			||||||
      this.checkCompetenceXP(idOrName, toXp);
 | 
					      this.checkCompetenceXP(idOrName, toXp);
 | 
				
			||||||
      await competence.update({ 'system.xp': toXp });
 | 
					      await competence.update({ 'system.xp': toXp }, { render: false })
 | 
				
			||||||
      await ExperienceLog.add(this, XP_TOPIC.XP, fromXp, toXp, competence.name, true);
 | 
					      await ExperienceLog.add(this, XP_TOPIC.XP, fromXp, toXp, competence.name, true);
 | 
				
			||||||
      if (toXp > fromXp) {
 | 
					      if (toXp > fromXp) {
 | 
				
			||||||
        RdDUtility.checkThanatosXP(idOrName);
 | 
					        RdDUtility.checkThanatosXP(competence)
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -813,10 +827,10 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
    if (competence) {
 | 
					    if (competence) {
 | 
				
			||||||
      if (isNaN(toXpSort) || typeof (toXpSort) != 'number') toXpSort = 0;
 | 
					      if (isNaN(toXpSort) || typeof (toXpSort) != 'number') toXpSort = 0;
 | 
				
			||||||
      const fromXpSort = competence.system.xp_sort;
 | 
					      const fromXpSort = competence.system.xp_sort;
 | 
				
			||||||
      await competence.update({ 'system.xp_sort': toXpSort });
 | 
					      await competence.update({ 'system.xp_sort': toXpSort }, { render: false })
 | 
				
			||||||
      await ExperienceLog.add(this, XP_TOPIC.XPSORT, fromXpSort, toXpSort, competence.name, true);
 | 
					      await ExperienceLog.add(this, XP_TOPIC.XPSORT, fromXpSort, toXpSort, competence.name, true);
 | 
				
			||||||
      if (toXpSort > fromXpSort) {
 | 
					      if (toXpSort > fromXpSort) {
 | 
				
			||||||
        RdDUtility.checkThanatosXP(idOrName);
 | 
					        RdDUtility.checkThanatosXP(competence)
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -825,7 +839,7 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
  async updateCompetenceArchetype(idOrName, compValue) {
 | 
					  async updateCompetenceArchetype(idOrName, compValue) {
 | 
				
			||||||
    let competence = this.getCompetence(idOrName)
 | 
					    let competence = this.getCompetence(idOrName)
 | 
				
			||||||
    if (competence) {
 | 
					    if (competence) {
 | 
				
			||||||
      await competence.update({ 'system.niveau_archetype': Math.max(compValue ?? 0, 0) });
 | 
					      await competence.update({ 'system.niveau_archetype': Math.max(compValue ?? 0, 0) })
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1038,20 +1052,10 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
  async deleteRencontreTMRAtPosition() {
 | 
					 | 
				
			||||||
    const rencontreIds = this.itemTypes[ITEM_TYPES.rencontre].filter(this.filterRencontreTMRDemiReve()).map(it => it.id)
 | 
					 | 
				
			||||||
    if (rencontreIds.length > 0) {
 | 
					 | 
				
			||||||
      await this.deleteEmbeddedDocuments('Item', rencontreIds)
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  getRencontreTMREnAttente() {
 | 
					  getRencontreTMREnAttente() {
 | 
				
			||||||
    return this.itemTypes[ITEM_TYPES.rencontre].find(this.filterRencontreTMRDemiReve())
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  filterRencontreTMRDemiReve() {
 | 
					 | 
				
			||||||
    const position = this.getDemiReve()
 | 
					    const position = this.getDemiReve()
 | 
				
			||||||
    return it => it.system.coord == position
 | 
					    return this.itemTypes[ITEM_TYPES.rencontre].find(it => it.system.coord == position)
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
@@ -1189,12 +1193,12 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
      diffConditions: 0,
 | 
					      diffConditions: 0,
 | 
				
			||||||
      ajustementsForce: CONFIG.RDD.difficultesLibres
 | 
					      ajustementsForce: CONFIG.RDD.difficultesLibres
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-ethylisme.html', rollData);
 | 
					    let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-ethylisme.hbs', rollData);
 | 
				
			||||||
    new RdDRollDialogEthylisme(html, rollData, this, r => this.saouler(r.forceAlcool)).render(true);
 | 
					    new RdDRollDialogEthylisme(html, rollData, this, r => this.saouler(r.forceAlcool)).render(true);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async mangerNourriture(item, onActionItem) {
 | 
					  async mangerNourriture(item) {
 | 
				
			||||||
    return (await DialogConsommer.create(this, item, onActionItem)).render(true);
 | 
					    return (await DialogConsommer.create(this, item)).render(true);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async actionLire(item) {
 | 
					  async actionLire(item) {
 | 
				
			||||||
@@ -1204,9 +1208,9 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async actionHerbe(item, onActionItem = async () => { }) {
 | 
					  async fabriquerDecoctionHerbe(item) {
 | 
				
			||||||
    if (item.isHerbeAPotion()) {
 | 
					    if (item.isHerbeAPotion()) {
 | 
				
			||||||
      return DialogFabriquerPotion.create(this, item, onActionItem);
 | 
					      return DialogFabriquerPotion.create(this, item);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -1382,7 +1386,7 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
    ethylismeData.doses = ethylisme.nb_doses;
 | 
					    ethylismeData.doses = ethylisme.nb_doses;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    await this.update({ 'system.compteurs.ethylisme': ethylisme });
 | 
					    await this.update({ 'system.compteurs.ethylisme': ethylisme });
 | 
				
			||||||
    await RdDResolutionTable.displayRollData(ethylismeData, this, 'chat-resultat-ethylisme.html');
 | 
					    await RdDRollResult.displayRollData(ethylismeData, this, 'chat-resultat-ethylisme.hbs');
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
@@ -1423,7 +1427,7 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    ChatMessage.create({
 | 
					    ChatMessage.create({
 | 
				
			||||||
      whisper: ChatUtility.getOwners(this),
 | 
					      whisper: ChatUtility.getOwners(this),
 | 
				
			||||||
      content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-resultat-transformer-stress.html`, stressRollData)
 | 
					      content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-resultat-transformer-stress.hbs`, stressRollData)
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const toStress = Math.max(fromStress - stressRollData.perte - 1, 0);
 | 
					    const toStress = Math.max(fromStress - stressRollData.perte - 1, 0);
 | 
				
			||||||
@@ -1471,7 +1475,6 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
  createCallbackExperience() {
 | 
					  createCallbackExperience() {
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
      condition: r => r.rolled.isPart && r.finalLevel < 0 && game.settings.get("core", "rollMode") != 'selfroll',
 | 
					 | 
				
			||||||
      action: r => this.appliquerAjoutExperience(r)
 | 
					      action: r => this.appliquerAjoutExperience(r)
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -1479,7 +1482,6 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
  createCallbackAppelAuMoral() { /* Si l'appel au moral est utilisé, on l'affiche dans le chat et on diminue éventuellement le moral */
 | 
					  createCallbackAppelAuMoral() { /* Si l'appel au moral est utilisé, on l'affiche dans le chat et on diminue éventuellement le moral */
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
      condition: r => r.use.appelAuMoral && game.settings.get("core", "rollMode") != 'selfroll',
 | 
					 | 
				
			||||||
      action: r => this._appliquerAppelMoral(r)
 | 
					      action: r => this._appliquerAppelMoral(r)
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -1508,7 +1510,7 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
        if (display) {
 | 
					        if (display) {
 | 
				
			||||||
          ChatMessage.create({
 | 
					          ChatMessage.create({
 | 
				
			||||||
            whisper: ChatUtility.getOwners(this),
 | 
					            whisper: ChatUtility.getOwners(this),
 | 
				
			||||||
            content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-carac-xp.html`, checkXp)
 | 
					            content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-carac-xp.hbs`, checkXp)
 | 
				
			||||||
          });
 | 
					          });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return checkXp;
 | 
					        return checkXp;
 | 
				
			||||||
@@ -1540,7 +1542,7 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
        if (display) {
 | 
					        if (display) {
 | 
				
			||||||
          ChatMessage.create({
 | 
					          ChatMessage.create({
 | 
				
			||||||
            whisper: ChatUtility.getOwners(this),
 | 
					            whisper: ChatUtility.getOwners(this),
 | 
				
			||||||
            content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-competence-xp.html`, checkXp)
 | 
					            content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-competence-xp.hbs`, checkXp)
 | 
				
			||||||
          });
 | 
					          });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return checkXp;
 | 
					        return checkXp;
 | 
				
			||||||
@@ -1550,13 +1552,16 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
  async appliquerAjoutExperience(rollData, hideChatMessage = 'show') {
 | 
					  async appliquerAjoutExperience(rollData, hideChatMessage = 'show') {
 | 
				
			||||||
    if (!Misc.hasConnectedGM()) {
 | 
					    if (!rollData.rolled.isPart ||
 | 
				
			||||||
 | 
					      rollData.finalLevel >= 0 ||
 | 
				
			||||||
 | 
					      game.settings.get("core", "rollMode") == 'selfroll' ||
 | 
				
			||||||
 | 
					      !Misc.hasConnectedGM()) {
 | 
				
			||||||
      return
 | 
					      return
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    hideChatMessage = hideChatMessage == 'hide' || (Misc.isRollModeHiddenToPlayer() && !game.user.isGM)
 | 
					    hideChatMessage = hideChatMessage == 'hide' || (Misc.isRollModeHiddenToPlayer() && !game.user.isGM)
 | 
				
			||||||
    let xpData = await this._appliquerExperience(rollData.rolled, rollData.selectedCarac.label, rollData.competence, rollData.jetResistance);
 | 
					    let xpData = await this._appliquerExperience(rollData.rolled, rollData.selectedCarac.label, rollData.competence, rollData.jetResistance);
 | 
				
			||||||
    if (xpData.length) {
 | 
					    if (xpData.length) {
 | 
				
			||||||
      const content = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-gain-xp.html`, {
 | 
					      const content = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-gain-xp.hbs`, {
 | 
				
			||||||
        actor: this,
 | 
					        actor: this,
 | 
				
			||||||
        xpData
 | 
					        xpData
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
@@ -1574,7 +1579,9 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
  async _appliquerAppelMoral(rollData) {
 | 
					  async _appliquerAppelMoral(rollData) {
 | 
				
			||||||
    if (!rollData.use.moral) return;
 | 
					    if (!rollData.use.moral || game.settings.get("core", "rollMode") == 'selfroll') {
 | 
				
			||||||
 | 
					      return
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    if (rollData.rolled.isEchec ||
 | 
					    if (rollData.rolled.isEchec ||
 | 
				
			||||||
      (rollData.ajustements.diviseurSignificative && (rollData.rolled.roll * rollData.ajustements.diviseurSignificative > rollData.score))) {
 | 
					      (rollData.ajustements.diviseurSignificative && (rollData.rolled.roll * rollData.ajustements.diviseurSignificative > rollData.score))) {
 | 
				
			||||||
      rollData.perteMoralEchec = rollData.moral <= -3 ? 'dissolution' : 'perte';
 | 
					      rollData.perteMoralEchec = rollData.moral <= -3 ? 'dissolution' : 'perte';
 | 
				
			||||||
@@ -1636,7 +1643,7 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
    const dialog = await this.openRollDialog({
 | 
					    const dialog = await this.openRollDialog({
 | 
				
			||||||
      name: 'lancer-un-sort',
 | 
					      name: 'lancer-un-sort',
 | 
				
			||||||
      label: 'Lancer un sort',
 | 
					      label: 'Lancer un sort',
 | 
				
			||||||
      template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-sort.html',
 | 
					      template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-sort.hbs',
 | 
				
			||||||
      rollData: {
 | 
					      rollData: {
 | 
				
			||||||
        carac: { 'reve': reve },
 | 
					        carac: { 'reve': reve },
 | 
				
			||||||
        forceCarac: { 'reve': reve },
 | 
					        forceCarac: { 'reve': reve },
 | 
				
			||||||
@@ -1649,10 +1656,7 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
        diffLibre: RdDItemSort.getDifficulte(sorts[0], -7), // Per default at startup
 | 
					        diffLibre: RdDItemSort.getDifficulte(sorts[0], -7), // Per default at startup
 | 
				
			||||||
        coutreve: Array(30).fill().map((item, index) => 1 + index),
 | 
					        coutreve: Array(30).fill().map((item, index) => 1 + index),
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      callbackAction: async r => {
 | 
					      callbacks: [{ action: r => this._rollUnSortResult(r) }]
 | 
				
			||||||
        await this._rollUnSortResult(r);
 | 
					 | 
				
			||||||
        if (!r.isSortReserve) this.tmrApp?.close();
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    this.tmrApp?.setTMRPendingAction(dialog);
 | 
					    this.tmrApp?.setTMRPendingAction(dialog);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -1726,6 +1730,17 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
        if (rollData.isSortReserve) {
 | 
					        if (rollData.isSortReserve) {
 | 
				
			||||||
          await this.sortMisEnReserve(selectedSort, rollData.competence, rollData.tmr.coord, Number(selectedSort.system.ptreve_reel));
 | 
					          await this.sortMisEnReserve(selectedSort, rollData.competence, rollData.tmr.coord, Number(selectedSort.system.ptreve_reel));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        else {
 | 
				
			||||||
 | 
					          console.log('lancement de sort', rollData.selectedSort)
 | 
				
			||||||
 | 
					          const precedents = rollData.selectedSort.system.lancements ?? []
 | 
				
			||||||
 | 
					          const lancements = [...precedents, {
 | 
				
			||||||
 | 
					            timestamp: game.system.rdd.calendrier.getTimestamp(),
 | 
				
			||||||
 | 
					            reve: rollData.selectedSort.system.ptreve_reel
 | 
				
			||||||
 | 
					          }]
 | 
				
			||||||
 | 
					          await this.updateEmbeddedDocuments('Item',
 | 
				
			||||||
 | 
					            [{ _id: rollData.selectedSort._id, 'system.lancements': lancements }]
 | 
				
			||||||
 | 
					          )
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      else {
 | 
					      else {
 | 
				
			||||||
        rollData.depenseReve = 0;
 | 
					        rollData.depenseReve = 0;
 | 
				
			||||||
@@ -1745,20 +1760,49 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
    reveActuel = Math.max(reveActuel - rollData.depenseReve, 0);
 | 
					    reveActuel = Math.max(reveActuel - rollData.depenseReve, 0);
 | 
				
			||||||
    await this.update({ "system.reve.reve.value": reveActuel });
 | 
					    await this.update({ "system.reve.reve.value": reveActuel });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Final chat message
 | 
					    await RdDRollResult.displayRollData(rollData, this, 'chat-resultat-sort.hbs');
 | 
				
			||||||
    await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-sort.html');
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (reveActuel == 0) { // 0 points de reve
 | 
					    if (reveActuel == 0) { // 0 points de reve
 | 
				
			||||||
      ChatMessage.create({ content: this.name + " est réduit à 0 Points de Rêve, et tombe endormi !" });
 | 
					      ChatMessage.create({ content: this.name + " est réduit à 0 Points de Rêve, et tombe endormi !" });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    if (!rollData.isSortReserve || !rolled.isSuccess) {
 | 
				
			||||||
 | 
					      this.tmrApp?.close();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /**
 | 
				
			||||||
 | 
					   * Méthode pour faire un jet prédéterminer sans ouvrir la fenêtre de dialogue
 | 
				
			||||||
 | 
					   * @param {*} caracName 
 | 
				
			||||||
 | 
					   * @param {*} compName 
 | 
				
			||||||
 | 
					   * @param {*} diff 
 | 
				
			||||||
 | 
					   * @param {*} options 
 | 
				
			||||||
 | 
					   * @returns 
 | 
				
			||||||
 | 
					   */
 | 
				
			||||||
 | 
					  async doRollCaracCompetence(caracName, compName, diff, options = { title: "" }) {
 | 
				
			||||||
 | 
					    const carac = this.getCaracByName(caracName);
 | 
				
			||||||
 | 
					    if (!carac) {
 | 
				
			||||||
 | 
					      ui.notifications.warn(`${this.name} n'a pas de caractéristique correspondant à ${caracName}`)
 | 
				
			||||||
 | 
					      return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    const competence = this.getCompetence(compName);
 | 
				
			||||||
 | 
					    let rollData = {
 | 
				
			||||||
 | 
					      alias: this.getAlias(),
 | 
				
			||||||
 | 
					      caracValue: Number(carac.value),
 | 
				
			||||||
 | 
					      selectedCarac: carac,
 | 
				
			||||||
 | 
					      competence: competence,
 | 
				
			||||||
 | 
					      diffLibre: diff,
 | 
				
			||||||
 | 
					      show: { title: options?.title ?? '' }
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					    RollDataAjustements.calcul(rollData, this);
 | 
				
			||||||
 | 
					    await RdDResolutionTable.rollData(rollData);
 | 
				
			||||||
 | 
					    this.gererExperience(rollData);
 | 
				
			||||||
 | 
					    await RdDRollResult.displayRollData(rollData, this)
 | 
				
			||||||
 | 
					    return rollData.rolled;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
  gererExperience(rollData) {
 | 
					  gererExperience(rollData) {
 | 
				
			||||||
    const callback = this.createCallbackExperience();
 | 
					    this.createCallbackExperience().action(rollData);
 | 
				
			||||||
    if (callback.condition(rollData)) {
 | 
					 | 
				
			||||||
      callback.action(rollData);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
@@ -1771,7 +1815,7 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
        name: nomTache, type: 'tache',
 | 
					        name: nomTache, type: 'tache',
 | 
				
			||||||
        system: {
 | 
					        system: {
 | 
				
			||||||
          carac: 'intellect',
 | 
					          carac: 'intellect',
 | 
				
			||||||
          competence: 'Ecriture',
 | 
					          competence: 'Écriture',
 | 
				
			||||||
          difficulte: item.system.difficulte,
 | 
					          difficulte: item.system.difficulte,
 | 
				
			||||||
          periodicite: "60 minutes",
 | 
					          periodicite: "60 minutes",
 | 
				
			||||||
          fatigue: 2,
 | 
					          fatigue: 2,
 | 
				
			||||||
@@ -1804,6 +1848,27 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
    return undefined;
 | 
					    return undefined;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  async rollCaracCompetence(caracName, compName, diff, options = { title: "" }) {
 | 
				
			||||||
 | 
					    RdDEmpoignade.checkEmpoignadeEnCours(this)
 | 
				
			||||||
 | 
					    const competence = this.getCompetence(compName);
 | 
				
			||||||
 | 
					    await this.openRollDialog({
 | 
				
			||||||
 | 
					      name: 'jet-competence',
 | 
				
			||||||
 | 
					      label: 'Jet ' + Grammar.apostrophe('de', competence.name),
 | 
				
			||||||
 | 
					      template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.hbs',
 | 
				
			||||||
 | 
					      rollData: {
 | 
				
			||||||
 | 
					        alias: this.getAlias(),
 | 
				
			||||||
 | 
					        carac: this.system.carac,
 | 
				
			||||||
 | 
					        selectedCarac: this.getCaracByName(caracName),
 | 
				
			||||||
 | 
					        selectedCaracName: caracName,
 | 
				
			||||||
 | 
					        diffLibre: diff,
 | 
				
			||||||
 | 
					        competence: competence,
 | 
				
			||||||
 | 
					        show: { title: options?.title ?? '' }
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      // TODO:
 | 
				
			||||||
 | 
					      callbacks: [{ action: r => this.$onRollCompetence(r, options) }]
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
  async rollTache(id, options = {}) {
 | 
					  async rollTache(id, options = {}) {
 | 
				
			||||||
    RdDEmpoignade.checkEmpoignadeEnCours(this)
 | 
					    RdDEmpoignade.checkEmpoignadeEnCours(this)
 | 
				
			||||||
@@ -1814,7 +1879,7 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
    await this.openRollDialog({
 | 
					    await this.openRollDialog({
 | 
				
			||||||
      name: 'jet-competence',
 | 
					      name: 'jet-competence',
 | 
				
			||||||
      label: 'Jet de Tâche ' + tacheData.name,
 | 
					      label: 'Jet de Tâche ' + tacheData.name,
 | 
				
			||||||
      template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.html',
 | 
					      template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.hbs',
 | 
				
			||||||
      rollData: {
 | 
					      rollData: {
 | 
				
			||||||
        competence: compData,
 | 
					        competence: compData,
 | 
				
			||||||
        tache: tacheData,
 | 
					        tache: tacheData,
 | 
				
			||||||
@@ -1825,7 +1890,7 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
          [tacheData.system.carac]: foundry.utils.duplicate(this.system.carac[tacheData.system.carac])
 | 
					          [tacheData.system.carac]: foundry.utils.duplicate(this.system.carac[tacheData.system.carac])
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      callbackAction: r => this._tacheResult(r, options)
 | 
					      callbacks: [{ action: r => this._tacheResult(r, options) }]
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1848,14 +1913,14 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
    await this.updateEmbeddedDocuments('Item', [rollData.tache]);
 | 
					    await this.updateEmbeddedDocuments('Item', [rollData.tache]);
 | 
				
			||||||
    await this.santeIncDec("fatigue", rollData.tache.system.fatigue);
 | 
					    await this.santeIncDec("fatigue", rollData.tache.system.fatigue);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-tache.html');
 | 
					    await RdDRollResult.displayRollData(rollData, this, 'chat-resultat-tache.hbs');
 | 
				
			||||||
    if (options?.onRollAutomate) {
 | 
					    if (options?.onRollAutomate) {
 | 
				
			||||||
      options.onRollAutomate(rollData);
 | 
					      options.onRollAutomate(rollData);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
  async _rollArt(artData, selected, oeuvre, callbackAction = r => this._resultArt(r)) {
 | 
					  async _rollArt(artData, selected, oeuvre, callbackAction = async r => await this._resultArt(r)) {
 | 
				
			||||||
    oeuvre.system.niveau = oeuvre.system.niveau ?? 0;
 | 
					    oeuvre.system.niveau = oeuvre.system.niveau ?? 0;
 | 
				
			||||||
    foundry.utils.mergeObject(artData,
 | 
					    foundry.utils.mergeObject(artData,
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
@@ -1877,10 +1942,10 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
    await this.openRollDialog({
 | 
					    await this.openRollDialog({
 | 
				
			||||||
      name: `jet-${artData.art}`,
 | 
					      name: `jet-${artData.art}`,
 | 
				
			||||||
      label: `${artData.verbe} ${oeuvre.name}`,
 | 
					      label: `${artData.verbe} ${oeuvre.name}`,
 | 
				
			||||||
      template: `systems/foundryvtt-reve-de-dragon/templates/dialog-roll-${oeuvre.type}.html`,
 | 
					      template: `systems/foundryvtt-reve-de-dragon/templates/dialog-roll-${oeuvre.type}.hbs`,
 | 
				
			||||||
      rollData: artData,
 | 
					      rollData: artData,
 | 
				
			||||||
      callbackAction: callbackAction
 | 
					      callbacks: [{ action: callbackAction }],
 | 
				
			||||||
    });
 | 
					    })
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
@@ -1889,7 +1954,7 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
    const baseQualite = (artData.rolled.isSuccess ? niveau : artData.competence.system.niveau);
 | 
					    const baseQualite = (artData.rolled.isSuccess ? niveau : artData.competence.system.niveau);
 | 
				
			||||||
    artData.qualiteFinale = Math.min(baseQualite, niveau) + artData.rolled.ptQualite;
 | 
					    artData.qualiteFinale = Math.min(baseQualite, niveau) + artData.rolled.ptQualite;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    await RdDResolutionTable.displayRollData(artData, this.name, `chat-resultat-${artData.art}.html`);
 | 
					    await RdDRollResult.displayRollData(artData, this.name, `chat-resultat-${artData.art}.hbs`);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
@@ -1966,7 +2031,7 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
      ui.notifications.info(`${platCuisine.system.quantite} rations de ${platCuisine.name} ont été ajoutés à votre équipement`);
 | 
					      ui.notifications.info(`${platCuisine.system.quantite} rations de ${platCuisine.name} ont été ajoutés à votre équipement`);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    cuisine.platCuisine = platCuisine;
 | 
					    cuisine.platCuisine = platCuisine;
 | 
				
			||||||
    await RdDResolutionTable.displayRollData(cuisine, this.name, `chat-resultat-${cuisine.art}.html`);
 | 
					    await RdDRollResult.displayRollData(cuisine, this.name, `chat-resultat-${cuisine.art}.hbs`);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async preparerNourriture(item) {
 | 
					  async preparerNourriture(item) {
 | 
				
			||||||
@@ -2040,13 +2105,12 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const dialog = await RdDRoll.create(this, meditationData,
 | 
					    const dialog = await RdDRoll.create(this, meditationData,
 | 
				
			||||||
      { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-meditation.html' },
 | 
					      { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-meditation.hbs' },
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        name: 'jet-meditation',
 | 
					        name: 'jet-meditation',
 | 
				
			||||||
        label: "Jet de méditation",
 | 
					        label: "Jet de méditation",
 | 
				
			||||||
        callbacks: [
 | 
					        callbacks: [
 | 
				
			||||||
          this.createCallbackExperience(),
 | 
					          this.createCallbackExperience(),
 | 
				
			||||||
          { condition: r => r.rolled.isEPart, action: r => this._meditationEPart(r) },
 | 
					 | 
				
			||||||
          { action: r => this._meditationResult(r) }
 | 
					          { action: r => this._meditationResult(r) }
 | 
				
			||||||
        ]
 | 
					        ]
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
@@ -2055,21 +2119,16 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
  async _meditationResult(meditationRoll) {
 | 
					  async _meditationResult(meditationRoll) {
 | 
				
			||||||
    this.santeIncDec("fatigue", 2);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (meditationRoll.rolled.isSuccess) {
 | 
					    if (meditationRoll.rolled.isSuccess) {
 | 
				
			||||||
      await this.createEmbeddedDocuments("Item", [RdDItemSigneDraconique.prepareSigneDraconiqueMeditation(meditationRoll.meditation, meditationRoll.rolled)]);
 | 
					      await this.createEmbeddedDocuments("Item", [RdDItemSigneDraconique.prepareSigneDraconiqueMeditation(meditationRoll.meditation, meditationRoll.rolled)]);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    if (meditationRoll.rolled.isEPart){
 | 
				
			||||||
    await RdDResolutionTable.displayRollData(meditationRoll, this.name, 'chat-resultat-meditation.html');
 | 
					      await this.updateEmbeddedDocuments('Item', [{ _id: meditationRoll.meditation._id, 'system.malus': meditationRoll.meditation.system.malus - 1 }]);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    await this.santeIncDec("fatigue", 2);
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					    await RdDRollResult.displayRollData(meditationRoll, this.name, 'chat-resultat-meditation.hbs');
 | 
				
			||||||
  _meditationEPart(meditationRoll) {
 | 
					 | 
				
			||||||
    this.updateEmbeddedDocuments('Item', [{ _id: meditationRoll.meditation._id, 'system.malus': meditationRoll.meditation.system.malus - 1 }]);
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
  _getSignesDraconiques(coord) {
 | 
					  _getSignesDraconiques(coord) {
 | 
				
			||||||
    const type = TMRUtility.getTMRType(coord);
 | 
					    const type = TMRUtility.getTMRType(coord);
 | 
				
			||||||
@@ -2113,7 +2172,7 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    const dialog = await RdDRoll.create(this, rollData,
 | 
					    const dialog = await RdDRoll.create(this, rollData,
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-signedraconique.html',
 | 
					        html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-signedraconique.hbs',
 | 
				
			||||||
        close: async html => await this._onCloseRollDialog(html)
 | 
					        close: async html => await this._onCloseRollDialog(html)
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
@@ -2148,7 +2207,7 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
      await ExperienceLog.add(this, XP_TOPIC.XPSORT, fromXp, toXp, `${rollData.competence.name} : signe draconique`);
 | 
					      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 RdDRollResult.displayRollData(rollData, this.name, 'chat-resultat-lecture-signedraconique.hbs');
 | 
				
			||||||
    this.tmrApp.close();
 | 
					    this.tmrApp.close();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -2157,15 +2216,15 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
    await this.openRollDialog({
 | 
					    await this.openRollDialog({
 | 
				
			||||||
      name: 'appelChance',
 | 
					      name: 'appelChance',
 | 
				
			||||||
      label: 'Appel à la chance',
 | 
					      label: 'Appel à la chance',
 | 
				
			||||||
      template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html',
 | 
					      template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.hbs',
 | 
				
			||||||
      rollData: { selectedCarac: this.getCaracByName('chance-actuelle'), surprise: '' },
 | 
					      rollData: { selectedCarac: this.getCaracByName('chance-actuelle'), surprise: '' },
 | 
				
			||||||
      callbackAction: r => this._appelChanceResult(r, onSuccess, onEchec)
 | 
					      callbacks: [{ action: r => this.$appelChanceResult(r, onSuccess, onEchec) }]
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
  async _appelChanceResult(rollData, onSuccess, onEchec) {
 | 
					  async $appelChanceResult(rollData, onSuccess, onEchec) {
 | 
				
			||||||
    await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-appelchance.html')
 | 
					    await RdDRollResult.displayRollData(rollData, this, 'chat-resultat-appelchance.hbs')
 | 
				
			||||||
    if (rollData.rolled.isSuccess) {
 | 
					    if (rollData.rolled.isSuccess) {
 | 
				
			||||||
      await this.setFlag(SYSTEM_RDD, 'utilisationChance', true);
 | 
					      await this.setFlag(SYSTEM_RDD, 'utilisationChance', true);
 | 
				
			||||||
      await this.chanceActuelleIncDec(-1);
 | 
					      await this.chanceActuelleIncDec(-1);
 | 
				
			||||||
@@ -2457,7 +2516,6 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
      })
 | 
					      })
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    const blessure = this.getItem(blessureId, 'blessure')
 | 
					    const blessure = this.getItem(blessureId, 'blessure')
 | 
				
			||||||
    console.log('TODO update blessure', this, blessureId, rollData, rollData.tache);
 | 
					 | 
				
			||||||
    if (blessure && !blessure.system.premierssoins.done) {
 | 
					    if (blessure && !blessure.system.premierssoins.done) {
 | 
				
			||||||
      const tache = rollData.tache;
 | 
					      const tache = rollData.tache;
 | 
				
			||||||
      if (rollData.rolled.isETotal) {
 | 
					      if (rollData.rolled.isETotal) {
 | 
				
			||||||
@@ -2574,12 +2632,13 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
  async incDecItemUse(itemId, inc = 1) {
 | 
					  async incDecItemUse(itemId, shouldIncrease = true) {
 | 
				
			||||||
 | 
					    if (shouldIncrease) {
 | 
				
			||||||
      const currentItemUse = this.getFlag(SYSTEM_RDD, 'itemUse');
 | 
					      const currentItemUse = this.getFlag(SYSTEM_RDD, 'itemUse');
 | 
				
			||||||
      let itemUse = currentItemUse ? foundry.utils.duplicate(currentItemUse) : {};
 | 
					      let itemUse = currentItemUse ? foundry.utils.duplicate(currentItemUse) : {};
 | 
				
			||||||
    itemUse[itemId] = (itemUse[itemId] ?? 0) + inc;
 | 
					      itemUse[itemId] = (itemUse[itemId] ?? 0) + 1;
 | 
				
			||||||
      await this.setFlag(SYSTEM_RDD, 'itemUse', itemUse);
 | 
					      await this.setFlag(SYSTEM_RDD, 'itemUse', itemUse);
 | 
				
			||||||
    console.log("ITEM USE INC", inc, itemUse);
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
@@ -2618,7 +2677,7 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
      rollData.competence.system.defaut_carac = caracTache;
 | 
					      rollData.competence.system.defaut_carac = caracTache;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      const dialog = await RdDRoll.create(this, rollData,
 | 
					      const dialog = await RdDRoll.create(this, rollData,
 | 
				
			||||||
        { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-alchimie.html' },
 | 
					        { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-alchimie.hbs' },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          name: 'tache-alchimique',
 | 
					          name: 'tache-alchimique',
 | 
				
			||||||
          label: 'Tache Alchimique',
 | 
					          label: 'Tache Alchimique',
 | 
				
			||||||
@@ -2639,7 +2698,7 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
  async _alchimieResult(rollData) {
 | 
					  async _alchimieResult(rollData) {
 | 
				
			||||||
    await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-alchimie.html');
 | 
					    await RdDRollResult.displayRollData(rollData, this, 'chat-resultat-alchimie.hbs');
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
@@ -2788,25 +2847,25 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
  async consommerPotionSoin(potionData) {
 | 
					  async consommerPotionSoin(potion) {
 | 
				
			||||||
    potionData.alias = this.name;
 | 
					    potion.alias = this.name;
 | 
				
			||||||
    potionData.supprimer = true;
 | 
					    potion.supprimer = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (potionData.system.magique) {
 | 
					    if (potion.system.magique) {
 | 
				
			||||||
      // Gestion de la résistance:
 | 
					      // Gestion de la résistance:
 | 
				
			||||||
      potionData.rolled = await RdDResolutionTable.roll(this.getReveActuel(), -8);
 | 
					      potion.rolled = await RdDResolutionTable.roll(this.getReveActuel(), -8);
 | 
				
			||||||
      if (potionData.rolled.isEchec) {
 | 
					      if (potion.rolled.isEchec) {
 | 
				
			||||||
        await this.reveActuelIncDec(-1);
 | 
					        await this.reveActuelIncDec(-1);
 | 
				
			||||||
        potionData.guerisonData = await this.buildPotionGuerisonList(potionData.system.puissance);
 | 
					        potion.guerisonData = await this.buildPotionGuerisonList(potion.system.puissance);
 | 
				
			||||||
        potionData.guerisonMinutes = potionData.guerisonData.pointsConsommes * 5;
 | 
					        potion.guerisonMinutes = potion.guerisonData.pointsConsommes * 5;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (!potionData.system.magique || potionData.rolled.isSuccess) {
 | 
					    if (!potion.system.magique || potion.rolled.isSuccess) {
 | 
				
			||||||
      await this.setBonusPotionSoin(potionData.system.herbebonus);
 | 
					      await this.setBonusPotionSoin(potion.system.herbebonus);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    ChatMessage.create({
 | 
					    ChatMessage.create({
 | 
				
			||||||
      whisper: ChatUtility.getOwners(this),
 | 
					      whisper: ChatUtility.getOwners(this),
 | 
				
			||||||
      content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-consommer-potion-soin.html`, potionData)
 | 
					      content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-consommer-potion-soin.hbs`, potion)
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -2815,46 +2874,47 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
  async consommerPotionRepos(potionData) {
 | 
					  async consommerPotionRepos(potion) {
 | 
				
			||||||
    potionData.alias = this.name;
 | 
					    potion.alias = this.name;
 | 
				
			||||||
    potionData.supprimer = true;
 | 
					    potion.supprimer = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (potionData.system.magique) {
 | 
					    if (potion.system.magique) {
 | 
				
			||||||
      // Gestion de la résistance:
 | 
					      // Gestion de la résistance:
 | 
				
			||||||
      potionData.rolled = await RdDResolutionTable.roll(this.getReveActuel(), -8);
 | 
					      potion.rolled = await RdDResolutionTable.roll(this.getReveActuel(), -8);
 | 
				
			||||||
      if (potionData.rolled.isEchec) {
 | 
					      if (potion.rolled.isEchec) {
 | 
				
			||||||
        await this.reveActuelIncDec(-1);
 | 
					        await this.reveActuelIncDec(-1);
 | 
				
			||||||
        let fatigueActuelle = this.getFatigueActuelle();
 | 
					        let fatigueActuelle = this.getFatigueActuelle();
 | 
				
			||||||
        potionData.caseFatigueReel = Math.min(fatigueActuelle, potionData.system.puissance);
 | 
					        potion.caseFatigueReel = Math.min(fatigueActuelle, potion.system.puissance);
 | 
				
			||||||
        potionData.guerisonDureeUnite = (potionData.system.reposalchimique) ? "rounds" : "minutes";
 | 
					        potion.guerisonDureeUnite = (potion.system.reposalchimique) ? "rounds" : "minutes";
 | 
				
			||||||
        potionData.guerisonDureeValue = (potionData.system.reposalchimique) ? potionData.caseFatigueReel : potionData.caseFatigueReel * 5;
 | 
					        potion.guerisonDureeValue = (potion.system.reposalchimique) ? potion.caseFatigueReel : potion.caseFatigueReel * 5;
 | 
				
			||||||
        potionData.aphasiePermanente = false;
 | 
					        potion.aphasiePermanente = false;
 | 
				
			||||||
        if (potionData.system.reposalchimique) {
 | 
					        if (potion.system.reposalchimique) {
 | 
				
			||||||
          let chanceAphasie = await RdDDice.rollTotal("1d100");
 | 
					          let chanceAphasie = await RdDDice.rollTotal("1d100");
 | 
				
			||||||
          if (chanceAphasie <= potionData.system.pr) {
 | 
					          if (chanceAphasie <= potion.system.pr) {
 | 
				
			||||||
            potionData.aphasiePermanente = true;
 | 
					            potion.aphasiePermanente = true;
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        await this.santeIncDec("fatigue", -potionData.caseFatigueReel);
 | 
					        await this.santeIncDec("fatigue", -potion.caseFatigueReel);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (!potionData.system.magique || potionData.rolled.isSuccess) {
 | 
					    if (!potion.system.magique || potion.rolled.isSuccess) {
 | 
				
			||||||
      this.bonusRepos = potionData.system.herbebonus;
 | 
					      this.bonusRepos = potion.system.herbebonus;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    ChatMessage.create({
 | 
					    ChatMessage.create({
 | 
				
			||||||
      whisper: ChatUtility.getOwners(this),
 | 
					      whisper: ChatUtility.getOwners(this),
 | 
				
			||||||
      content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-consommer-potion-repos.html`, potionData)
 | 
					      content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-consommer-potion-repos.hbs`, potion)
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
  async fabriquerPotion(herbeData) {
 | 
					  async fabriquerPotion(herbeData) {
 | 
				
			||||||
    let newPotion = {
 | 
					    const newPotion = {
 | 
				
			||||||
      name: `Potion de ${herbeData.system.categorie} (${herbeData.name})`, type: 'potion',
 | 
					      name: `Potion de ${herbeData.system.categorie} (${herbeData.name})`, type: 'potion',
 | 
				
			||||||
      img: "systems/foundryvtt-reve-de-dragon/icons/objets/fiole_verre.webp",
 | 
					      img: "systems/foundryvtt-reve-de-dragon/icons/objets/fiole_verre.webp",
 | 
				
			||||||
      system: {
 | 
					      system: {
 | 
				
			||||||
        quantite: 1, cout: 0, encombrement: 0.1,
 | 
					        quantite: 1, cout: 0, encombrement: 0.1,
 | 
				
			||||||
        categorie: herbeData.system.categorie,
 | 
					        categorie: herbeData.system.categorie,
 | 
				
			||||||
 | 
					        etat: 'Liquide',
 | 
				
			||||||
        herbe: herbeData.name,
 | 
					        herbe: herbeData.name,
 | 
				
			||||||
        rarete: herbeData.system.rarete,
 | 
					        rarete: herbeData.system.rarete,
 | 
				
			||||||
        herbebrins: herbeData.nbBrins,
 | 
					        herbebrins: herbeData.nbBrins,
 | 
				
			||||||
@@ -2862,61 +2922,52 @@ export class RdDActor extends RdDBaseActorSang {
 | 
				
			|||||||
        description: ""
 | 
					        description: ""
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    await this.createEmbeddedDocuments('Item', [newPotion], { renderSheet: true });
 | 
					    await this.createEmbeddedDocuments('Item', [newPotion])
 | 
				
			||||||
 | 
					    await this.diminuerQuantiteObjet(herbeData._id, herbeData.nbBrins)
 | 
				
			||||||
    let newQuantite = herbeData.system.quantite - herbeData.nbBrins;
 | 
					 | 
				
			||||||
    let messageData = {
 | 
					 | 
				
			||||||
      alias: this.getAlias(),
 | 
					 | 
				
			||||||
      nbBrinsReste: newQuantite,
 | 
					 | 
				
			||||||
      potion: newPotion,
 | 
					 | 
				
			||||||
      herbe: herbeData
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    this.diminuerQuantiteObjet(herbeData._id, herbeData.nbBrins);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ChatMessage.create({
 | 
					    ChatMessage.create({
 | 
				
			||||||
      whisper: ChatUtility.getOwners(this),
 | 
					      whisper: ChatUtility.getOwners(this),
 | 
				
			||||||
      content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-fabriquer-potion-base.html`, messageData)
 | 
					      content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-fabriquer-potion-base.hbs`, {
 | 
				
			||||||
    });
 | 
					        alias: this.getAlias(),
 | 
				
			||||||
 | 
					        nbBrinsReste: herbeData.system.quantite - herbeData.nbBrins,
 | 
				
			||||||
 | 
					        potion: newPotion,
 | 
				
			||||||
 | 
					        herbe: herbeData
 | 
				
			||||||
 | 
					      })
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
  async diminuerQuantiteObjet(id, nb, options = { supprimerSiZero: false }) {
 | 
					  async diminuerQuantiteObjet(id, nb, options = { supprimerSiZero: false }) {
 | 
				
			||||||
    const item = this.getItem(id);
 | 
					    await this.getItem(id)?.diminuerQuantite(nb, options);
 | 
				
			||||||
    if (item) {
 | 
					 | 
				
			||||||
      await item.diminuerQuantite(nb, options);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
  async consommerPotionGenerique(potionData) {
 | 
					  async consommerPotionGenerique(potion) {
 | 
				
			||||||
    potionData.alias = this.name;
 | 
					    potion.alias = this.name;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (potionData.system.magique) {
 | 
					    if (potion.system.magique) {
 | 
				
			||||||
      // Gestion de la résistance:
 | 
					      // Gestion de la résistance:
 | 
				
			||||||
      potionData.rolled = await RdDResolutionTable.roll(this.getReveActuel(), -8);
 | 
					      potion.rolled = await RdDResolutionTable.roll(this.getReveActuel(), -8);
 | 
				
			||||||
      if (potionData.rolled.isEchec) {
 | 
					      if (potion.rolled.isEchec) {
 | 
				
			||||||
        await this.reveActuelIncDec(-1);
 | 
					        await this.reveActuelIncDec(-1);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    ChatMessage.create({
 | 
					    ChatMessage.create({
 | 
				
			||||||
      whisper: ChatUtility.getOwners(this),
 | 
					      whisper: ChatUtility.getOwners(this),
 | 
				
			||||||
      content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-consommer-potion-generique.html`, potionData)
 | 
					      content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-consommer-potion-generique.hbs`, potion)
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
  async consommerPotion(potion, onActionItem = async () => { }) {
 | 
					  async consommerPotion(potion) {
 | 
				
			||||||
    const potionData = potion
 | 
					    if (potion.system.categorie.includes('Soin')) {
 | 
				
			||||||
 | 
					      this.consommerPotionSoin(potion);
 | 
				
			||||||
    if (potionData.system.categorie.includes('Soin')) {
 | 
					    } else if (potion.system.categorie.includes('Repos')) {
 | 
				
			||||||
      this.consommerPotionSoin(potionData);
 | 
					      this.consommerPotionRepos(potion);
 | 
				
			||||||
    } else if (potionData.system.categorie.includes('Repos')) {
 | 
					 | 
				
			||||||
      this.consommerPotionRepos(potionData);
 | 
					 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      this.consommerPotionGenerique(potionData);
 | 
					      this.consommerPotionGenerique(potion);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    await this.diminuerQuantiteObjet(potion.id, 1, { supprimerSiZero: potionData.supprimer });
 | 
					    await this.diminuerQuantiteObjet(potion.id, 1, { supprimerSiZero: potion.supprimer });
 | 
				
			||||||
    await onActionItem()
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,16 +26,17 @@ export class RdDBaseActorReveSheet extends RdDBaseActorSheet {
 | 
				
			|||||||
    // Everything below here is only needed if the sheet is editable
 | 
					    // Everything below here is only needed if the sheet is editable
 | 
				
			||||||
    if (!this.options.editable) return;
 | 
					    if (!this.options.editable) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.html.find('.button-encaissement').click(async event => this.actor.encaisser())
 | 
					    this.html.find('.button-encaissement').click(async event => await this.actor.encaisser())
 | 
				
			||||||
    this.html.find('.roll-carac').click(async event => {
 | 
					    this.html.find('.roll-carac').click(async event => {
 | 
				
			||||||
      this.actor.rollCarac(Grammar.toLowerCaseNoAccent(event.currentTarget.attributes['data-carac-name'].value))})
 | 
					      await this.actor.rollCarac(Grammar.toLowerCaseNoAccent(event.currentTarget.attributes['data-carac-name'].value))
 | 
				
			||||||
    this.html.find('.roll-competence').click(async event => this.actor.rollCompetence(RdDSheetUtility.getItemId(event)));
 | 
					    })
 | 
				
			||||||
    this.html.find('.endurance-plus').click(async event => this.actor.santeIncDec("endurance", 1));
 | 
					    this.html.find('.roll-competence').click(async event => await this.actor.rollCompetence(RdDSheetUtility.getItemId(event)));
 | 
				
			||||||
    this.html.find('.endurance-moins').click(async event => this.actor.santeIncDec("endurance", -1));
 | 
					    this.html.find('.endurance-plus').click(async event => await this.actor.santeIncDec("endurance", 1));
 | 
				
			||||||
 | 
					    this.html.find('.endurance-moins').click(async event => await this.actor.santeIncDec("endurance", -1));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (game.user.isGM) {
 | 
					    if (game.user.isGM) {
 | 
				
			||||||
      this.html.find('.button-remise-a-neuf').click(async event => this.actor.remiseANeuf())
 | 
					      this.html.find('.button-remise-a-neuf').click(async event => await this.actor.remiseANeuf())
 | 
				
			||||||
      this.html.find('.delete-active-effect').click(async event => this.actor.removeEffect(this.html.find(event.currentTarget).parents(".active-effect").data('effect')));
 | 
					      this.html.find('.delete-active-effect').click(async event => await this.actor.removeEffect(this.html.find(event.currentTarget).parents(".active-effect").data('effect')));
 | 
				
			||||||
      this.html.find('.enlever-tous-effets').click(async event => await this.actor.removeEffects());
 | 
					      this.html.find('.enlever-tous-effets').click(async event => await this.actor.removeEffects());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    this.html.find('.competence-add').click(async event =>
 | 
					    this.html.find('.competence-add').click(async event =>
 | 
				
			||||||
@@ -55,14 +56,13 @@ export class RdDBaseActorReveSheet extends RdDBaseActorSheet {
 | 
				
			|||||||
    if (this.options.vueDetaillee) {
 | 
					    if (this.options.vueDetaillee) {
 | 
				
			||||||
      // On carac change
 | 
					      // On carac change
 | 
				
			||||||
      this.html.find('.carac-value').change(async event => {
 | 
					      this.html.find('.carac-value').change(async event => {
 | 
				
			||||||
        let caracName = event.currentTarget.name.replace(".value", "").replace("system.carac.", "");
 | 
					        let caracName = event.currentTarget.name.replace(".value", "").replace("system.carac.", "")
 | 
				
			||||||
        this.actor.updateCarac(caracName, parseInt(event.target.value));
 | 
					        await this.actor.updateCarac(caracName, parseInt(event.target.value))
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
      // On competence change
 | 
					      // On competence change
 | 
				
			||||||
      this.html.find('.competence-value').change(async event => {
 | 
					      this.html.find('.competence-value').change(async event => {
 | 
				
			||||||
        let compName = event.currentTarget.attributes.compname.value;
 | 
					        let compName = event.currentTarget.attributes.compname.value
 | 
				
			||||||
        //console.log("Competence changed :", compName);
 | 
					        await this.actor.updateCompetence(compName, parseInt(event.target.value))
 | 
				
			||||||
        this.actor.updateCompetence(compName, parseInt(event.target.value));
 | 
					 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,6 +15,7 @@ import { StatusEffects } from "../settings/status-effects.js";
 | 
				
			|||||||
import { Targets } from "../targets.js";
 | 
					import { Targets } from "../targets.js";
 | 
				
			||||||
import { RdDConfirm } from "../rdd-confirm.js";
 | 
					import { RdDConfirm } from "../rdd-confirm.js";
 | 
				
			||||||
import { RdDCarac } from "../rdd-carac.js";
 | 
					import { RdDCarac } from "../rdd-carac.js";
 | 
				
			||||||
 | 
					import { RdDRollResult } from "../rdd-roll-result.js";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { ChatUtility } from "../chat-utility.js";
 | 
					import { ChatUtility } from "../chat-utility.js";
 | 
				
			||||||
import { DialogValidationEncaissement } from "../dialog-validation-encaissement.js";
 | 
					import { DialogValidationEncaissement } from "../dialog-validation-encaissement.js";
 | 
				
			||||||
@@ -268,30 +269,17 @@ export class RdDBaseActorReve extends RdDBaseActor {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
  async openRollDialog({ name, label, template, rollData, callbackAction }) {
 | 
					  async openRollDialog({ name, label, template, rollData, callbacks }) {
 | 
				
			||||||
    const dialog = await RdDRoll.create(this, rollData,
 | 
					    const dialog = await RdDRoll.create(this, rollData,
 | 
				
			||||||
      { html: template, close: async html => await this._onCloseRollDialog(html) },
 | 
					      { html: template, close: async html => await this._onCloseRollDialog(html) },
 | 
				
			||||||
      {
 | 
					      { name: name, label: label, callbacks: [this.createCallbackExperience(), this.createCallbackAppelAuMoral()].concat(callbacks) })
 | 
				
			||||||
        name: name,
 | 
					    dialog.render(true)
 | 
				
			||||||
        label: label,
 | 
					 | 
				
			||||||
        callbacks: [
 | 
					 | 
				
			||||||
          this.createCallbackExperience(),
 | 
					 | 
				
			||||||
          this.createCallbackAppelAuMoral(),
 | 
					 | 
				
			||||||
          { action: callbackAction }
 | 
					 | 
				
			||||||
        ]
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    dialog.render(true);
 | 
					 | 
				
			||||||
    return dialog
 | 
					    return dialog
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  createEmptyCallback() {
 | 
					  createCallbackExperience() { return { action: r => { } } }
 | 
				
			||||||
    return {
 | 
					  createCallbackAppelAuMoral() { return { action: r => { } } }
 | 
				
			||||||
      condition: r => false,
 | 
					
 | 
				
			||||||
      action: r => { }
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  createCallbackExperience() { return this.createEmptyCallback(); }
 | 
					 | 
				
			||||||
  createCallbackAppelAuMoral() { return this.createEmptyCallback(); }
 | 
					 | 
				
			||||||
  async _onCloseRollDialog(html) { }
 | 
					  async _onCloseRollDialog(html) { }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async rollCaracCompetence(caracName, compName, diff, options = { title: "" }) {
 | 
					  async rollCaracCompetence(caracName, compName, diff, options = { title: "" }) {
 | 
				
			||||||
@@ -299,8 +287,8 @@ export class RdDBaseActorReve extends RdDBaseActor {
 | 
				
			|||||||
    const competence = this.getCompetence(compName);
 | 
					    const competence = this.getCompetence(compName);
 | 
				
			||||||
    await this.openRollDialog({
 | 
					    await this.openRollDialog({
 | 
				
			||||||
      name: 'jet-competence',
 | 
					      name: 'jet-competence',
 | 
				
			||||||
      label: competence? 'Jet ' + Grammar.apostrophe('de', competence.name) : `Jet sans compétence (${compName})`,
 | 
					      label: competence ? 'Jet ' + Grammar.apostrophe('de', competence.name) : `Jet sans compétence (${compName})`,
 | 
				
			||||||
      template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.html',
 | 
					      template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.hbs',
 | 
				
			||||||
      rollData: {
 | 
					      rollData: {
 | 
				
			||||||
        alias: this.getAlias(),
 | 
					        alias: this.getAlias(),
 | 
				
			||||||
        carac: this.system.carac,
 | 
					        carac: this.system.carac,
 | 
				
			||||||
@@ -310,7 +298,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
 | 
				
			|||||||
        competence: competence,
 | 
					        competence: competence,
 | 
				
			||||||
        show: { title: options?.title ?? '' }
 | 
					        show: { title: options?.title ?? '' }
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      callbackAction: r => this.$onRollCompetence(r, options)
 | 
					      callbacks: [async r => this.$onRollCompetence(r, options)]
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  /**
 | 
					  /**
 | 
				
			||||||
@@ -353,16 +341,14 @@ export class RdDBaseActorReve extends RdDBaseActor {
 | 
				
			|||||||
    const selectedCaracName = ['apparence', 'perception', 'force', 'reve'].find(it => carac[it] != undefined)
 | 
					    const selectedCaracName = ['apparence', 'perception', 'force', 'reve'].find(it => carac[it] != undefined)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    await this.openRollDialog({
 | 
					    await this.openRollDialog({
 | 
				
			||||||
      name: `jet-${this.id}`,
 | 
					 | 
				
			||||||
      label: `Jet de ${this.getAlias()}`,
 | 
					 | 
				
			||||||
      template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll.html',
 | 
					 | 
				
			||||||
      rollData: {
 | 
					      rollData: {
 | 
				
			||||||
 | 
					        alias: this.getAlias(),
 | 
				
			||||||
        carac: carac,
 | 
					        carac: carac,
 | 
				
			||||||
        selectedCarac: carac[selectedCaracName],
 | 
					        selectedCarac: carac[selectedCaracName],
 | 
				
			||||||
        selectedCaracName: selectedCaracName,
 | 
					        selectedCaracName: selectedCaracName,
 | 
				
			||||||
        competences: this.itemTypes['competence']
 | 
					        competences: this.itemTypes['competence']
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      callbackAction: r => this.$onRollCaracResult(r)
 | 
					      callbacks: [{ action: r => this.$onRollCaracResult(r) }]
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
@@ -373,32 +359,38 @@ export class RdDBaseActorReve extends RdDBaseActor {
 | 
				
			|||||||
    foundry.utils.mergeObject(options, { resistance: false, diff: 0 }, { overwrite: false })
 | 
					    foundry.utils.mergeObject(options, { resistance: false, diff: 0 }, { overwrite: false })
 | 
				
			||||||
    RdDEmpoignade.checkEmpoignadeEnCours(this)
 | 
					    RdDEmpoignade.checkEmpoignadeEnCours(this)
 | 
				
			||||||
    let selectedCarac = this.getCaracByName(caracName)
 | 
					    let selectedCarac = this.getCaracByName(caracName)
 | 
				
			||||||
    console.log("selectedCarac", selectedCarac)
 | 
					    const title = 'Jet ' + Grammar.apostrophe('de', selectedCarac.label);
 | 
				
			||||||
 | 
					    const jetResistance = options.resistance ? caracName : undefined;
 | 
				
			||||||
    await this.openRollDialog({
 | 
					    await this.openRollDialog({
 | 
				
			||||||
      name: 'jet-' + caracName,
 | 
					      name: 'jet-' + caracName,
 | 
				
			||||||
      label: 'Jet ' + Grammar.apostrophe('de', selectedCarac.label),
 | 
					      label: title,
 | 
				
			||||||
      template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html',
 | 
					      template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.hbs',
 | 
				
			||||||
      rollData: {
 | 
					      rollData: {
 | 
				
			||||||
 | 
					        alias: this.getAlias(),
 | 
				
			||||||
        selectedCarac: selectedCarac,
 | 
					        selectedCarac: selectedCarac,
 | 
				
			||||||
        competences: this.itemTypes['competence'],
 | 
					        competences: this.itemTypes['competence'],
 | 
				
			||||||
        diffLibre: options.diff ?? 0,
 | 
					        diffLibre: options.diff ?? 0,
 | 
				
			||||||
        jetResistance: options.resistance ? caracName : undefined
 | 
					        jetResistance: jetResistance
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      callbackAction: r => this.$onRollCaracResult(r)
 | 
					      callbacks: [{ action: r => this.$onRollCaracResult(r) }]
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
  async $onRollCaracResult(rollData) {
 | 
					  async $onRollCaracResult(rollData) {
 | 
				
			||||||
    // Final chat message
 | 
					    // Final chat message
 | 
				
			||||||
    await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-general.html');
 | 
					    await RdDRollResult.displayRollData(rollData, this, 'chat-resultat-general.hbs');
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
  async rollCompetence(idOrName, options = { tryTarget: true, arme: undefined }) {
 | 
					  async rollCompetence(idOrName, options = { tryTarget: true, arme: undefined }) {
 | 
				
			||||||
    RdDEmpoignade.checkEmpoignadeEnCours(this)
 | 
					    RdDEmpoignade.checkEmpoignadeEnCours(this)
 | 
				
			||||||
    const competence = this.getCompetence(idOrName);
 | 
					    const competence = this.getCompetence(idOrName);
 | 
				
			||||||
    let rollData = { carac: this.system.carac, competence: competence, arme: options.arme }
 | 
					    let rollData = {
 | 
				
			||||||
 | 
					      carac: this.system.carac,
 | 
				
			||||||
 | 
					      competence: competence,
 | 
				
			||||||
 | 
					      arme: options.arme
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    if (competence.type == ITEM_TYPES.competencecreature) {
 | 
					    if (competence.type == ITEM_TYPES.competencecreature) {
 | 
				
			||||||
      const token = RdDUtility.getSelectedToken(this)
 | 
					      const token = RdDUtility.getSelectedToken(this)
 | 
				
			||||||
      const arme = RdDItemCompetenceCreature.armeCreature(competence)
 | 
					      const arme = RdDItemCompetenceCreature.armeCreature(competence)
 | 
				
			||||||
@@ -416,18 +408,18 @@ export class RdDBaseActorReve extends RdDBaseActor {
 | 
				
			|||||||
      // Transformer la competence de créature
 | 
					      // Transformer la competence de créature
 | 
				
			||||||
      RdDItemCompetenceCreature.setRollDataCreature(rollData)
 | 
					      RdDItemCompetenceCreature.setRollDataCreature(rollData)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    const dialogLabel = 'Jet ' + Grammar.apostrophe('de', competence.name);
 | 
				
			||||||
    await this.openRollDialog({
 | 
					    await this.openRollDialog({
 | 
				
			||||||
      name: 'jet-competence',
 | 
					      name: 'jet-competence',
 | 
				
			||||||
      label: 'Jet ' + Grammar.apostrophe('de', competence.name),
 | 
					      label: dialogLabel,
 | 
				
			||||||
      template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.html',
 | 
					      template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.hbs',
 | 
				
			||||||
      rollData: rollData,
 | 
					      rollData: rollData,
 | 
				
			||||||
      callbackAction: r => this.$onRollCompetence(r, options)
 | 
					      callbacks: [{ action: r => this.$onRollCompetence(r, options) }]
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async $onRollCompetence(rollData, options) {
 | 
					  async $onRollCompetence(rollData, options) {
 | 
				
			||||||
    await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-competence.html')
 | 
					    await RdDRollResult.displayRollData(rollData, this, 'chat-resultat-competence.hbs')
 | 
				
			||||||
    if (options?.onRollAutomate) {
 | 
					    if (options?.onRollAutomate) {
 | 
				
			||||||
      options.onRollAutomate(rollData);
 | 
					      options.onRollAutomate(rollData);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -527,7 +519,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
 | 
				
			|||||||
    await ChatUtility.createChatWithRollMode(
 | 
					    await ChatUtility.createChatWithRollMode(
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        roll: encaissement.roll,
 | 
					        roll: encaissement.roll,
 | 
				
			||||||
        content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-resultat-encaissement.html', encaissement)
 | 
					        content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-resultat-encaissement.hbs', encaissement)
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      this
 | 
					      this
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
@@ -537,7 +529,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
 | 
				
			|||||||
      encaissement.isGM = true
 | 
					      encaissement.isGM = true
 | 
				
			||||||
      ChatMessage.create({
 | 
					      ChatMessage.create({
 | 
				
			||||||
        whisper: ChatUtility.getGMs(),
 | 
					        whisper: ChatUtility.getGMs(),
 | 
				
			||||||
        content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-resultat-encaissement.html', encaissement)
 | 
					        content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-resultat-encaissement.hbs', encaissement)
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -562,10 +554,8 @@ export class RdDBaseActorReve extends RdDBaseActor {
 | 
				
			|||||||
      await entite.setEntiteReveAccordee(this);
 | 
					      await entite.setEntiteReveAccordee(this);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-accorder-cauchemar.html');
 | 
					    await RdDRollResult.displayRollData(rollData, this, 'chat-resultat-accorder-cauchemar.hbs');
 | 
				
			||||||
    if (rolled.isPart) {
 | 
					 | 
				
			||||||
    await this.appliquerAjoutExperience(rollData, true);
 | 
					    await this.appliquerAjoutExperience(rollData, true);
 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    return rolled.isSuccess;
 | 
					    return rolled.isSuccess;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,20 +17,20 @@ export class RdDBaseActorSangSheet extends RdDBaseActorReveSheet {
 | 
				
			|||||||
    // Everything below here is only needed if the sheet is editable
 | 
					    // Everything below here is only needed if the sheet is editable
 | 
				
			||||||
    if (!this.options.editable) return;
 | 
					    if (!this.options.editable) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.html.find('.creer-blessure-legere').click(async event => RdDItemBlessure.createBlessure(this.actor, 2));
 | 
					    this.html.find('.creer-blessure-legere').click(async event => await RdDItemBlessure.createBlessure(this.actor, 2));
 | 
				
			||||||
    this.html.find('.creer-blessure-grave').click(async event => RdDItemBlessure.createBlessure(this.actor, 4));
 | 
					    this.html.find('.creer-blessure-grave').click(async event => await RdDItemBlessure.createBlessure(this.actor, 4));
 | 
				
			||||||
    this.html.find('.creer-blessure-critique').click(async event => RdDItemBlessure.createBlessure(this.actor, 6));
 | 
					    this.html.find('.creer-blessure-critique').click(async event => await RdDItemBlessure.createBlessure(this.actor, 6));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.html.find('.subir-blessure-contusion').click(async event => RdDItemBlessure.applyFullBlessure(this.actor, 0));
 | 
					    this.html.find('.subir-blessure-contusion').click(async event => await RdDItemBlessure.applyFullBlessure(this.actor, 0));
 | 
				
			||||||
    this.html.find('.subir-blessure-legere').click(async event => RdDItemBlessure.applyFullBlessure(this.actor, 2));
 | 
					    this.html.find('.subir-blessure-legere').click(async event => await RdDItemBlessure.applyFullBlessure(this.actor, 2));
 | 
				
			||||||
    this.html.find('.subir-blessure-grave').click(async event => RdDItemBlessure.applyFullBlessure(this.actor, 4));
 | 
					    this.html.find('.subir-blessure-grave').click(async event => await RdDItemBlessure.applyFullBlessure(this.actor, 4));
 | 
				
			||||||
    this.html.find('.subir-blessure-critique').click(async event => RdDItemBlessure.applyFullBlessure(this.actor, 6));
 | 
					    this.html.find('.subir-blessure-critique').click(async event => await RdDItemBlessure.applyFullBlessure(this.actor, 6));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.html.find('.jet-vie').click(async event => this.actor.jetDeVie())
 | 
					    this.html.find('.jet-vie').click(async event => await this.actor.jetDeVie())
 | 
				
			||||||
    this.html.find('.jet-endurance').click(async event => await this.jetEndurance())
 | 
					    this.html.find('.jet-endurance').click(async event => await this.jetEndurance())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.html.find('.vie-plus').click(async event => this.actor.santeIncDec("vie", 1))
 | 
					    this.html.find('.vie-plus').click(async event => await this.actor.santeIncDec("vie", 1))
 | 
				
			||||||
    this.html.find('.vie-moins').click(async event => this.actor.santeIncDec("vie", -1))
 | 
					    this.html.find('.vie-moins').click(async event => await this.actor.santeIncDec("vie", -1))
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async jetEndurance() {
 | 
					  async jetEndurance() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,7 +39,12 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
 | 
				
			|||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  getFatigueRestante() { return this.getFatigueMax() - this.getFatigueActuelle() }
 | 
					  isCumulFatigueCauseSommeil(cumulFatigue){
 | 
				
			||||||
 | 
					    return ReglesOptionnelles.isUsing("appliquer-fatigue")
 | 
				
			||||||
 | 
					    ? (this.getFatigueRestante() <= cumulFatigue)
 | 
				
			||||||
 | 
					    : (this.getEnduranceActuelle() <= cumulFatigue)
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  getFatigueRestante() {return this.getFatigueMax() - this.getFatigueActuelle() }
 | 
				
			||||||
  getFatigueMin() { return this.system.sante.endurance.max - this.system.sante.endurance.value }
 | 
					  getFatigueMin() { return this.system.sante.endurance.max - this.system.sante.endurance.value }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  malusFatigue() {
 | 
					  malusFatigue() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,11 +14,12 @@ import { ItemAction } from "../item/item-actions.js";
 | 
				
			|||||||
 * Extend the basic ActorSheet with some very simple modifications
 | 
					 * Extend the basic ActorSheet with some very simple modifications
 | 
				
			||||||
 * @extends {ActorSheet}
 | 
					 * @extends {ActorSheet}
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export class RdDBaseActorSheet extends ActorSheet {
 | 
					export class RdDBaseActorSheet extends foundry.appv1.sheets.ActorSheet {
 | 
				
			||||||
 | 
					  static _warnedAppV1 = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /** @override */
 | 
					  /** @override */
 | 
				
			||||||
  static get defaultOptions() {
 | 
					  static get defaultOptions() {
 | 
				
			||||||
    return foundry.utils.mergeObject(ActorSheet.defaultOptions, {
 | 
					    return foundry.utils.mergeObject(foundry.appv1.sheets.ActorSheet.defaultOptions, {
 | 
				
			||||||
      classes: ["rdd", "sheet", "actor"],
 | 
					      classes: ["rdd", "sheet", "actor"],
 | 
				
			||||||
      tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac" }],
 | 
					      tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac" }],
 | 
				
			||||||
      dragDrop: [{ dragSelector: ".item-list .item", dropSelector: undefined }],
 | 
					      dragDrop: [{ dragSelector: ".item-list .item", dropSelector: undefined }],
 | 
				
			||||||
@@ -85,14 +86,14 @@ export class RdDBaseActorSheet extends ActorSheet {
 | 
				
			|||||||
    super.activateListeners(html);
 | 
					    super.activateListeners(html);
 | 
				
			||||||
    this.html = html;
 | 
					    this.html = html;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.html.find('.actionItem').click(event => ItemAction.onActionItem(event, this.actor, this.options))
 | 
					    this.html.find('.actionItem').click(async event => await ItemAction.onActionItem(event, this.actor, this.options))
 | 
				
			||||||
    this.html.find('.item-edit').click(async event => this.itemActionEdit(event))
 | 
					    this.html.find('.item-edit').click(async event => await this.itemActionEdit(event))
 | 
				
			||||||
    this.html.find('.conteneur-name a').click(async event => {
 | 
					    this.html.find('.conteneur-name a').click(async event => {
 | 
				
			||||||
      RdDUtility.toggleAfficheContenu(this.getItemId(event))
 | 
					      RdDUtility.toggleAfficheContenu(this.getItemId(event))
 | 
				
			||||||
      this.render(true)
 | 
					      this.render(true)
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.html.find('.actor-montrer').click(async event => this.actor.postActorToChat());
 | 
					    this.html.find('.actor-montrer').click(async event => await this.actor.postActorToChat());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.html.find('.recherche')
 | 
					    this.html.find('.recherche')
 | 
				
			||||||
      .each((index, field) => {
 | 
					      .each((index, field) => {
 | 
				
			||||||
@@ -106,22 +107,17 @@ export class RdDBaseActorSheet extends ActorSheet {
 | 
				
			|||||||
    // Everything below here is only needed if the sheet is editable
 | 
					    // Everything below here is only needed if the sheet is editable
 | 
				
			||||||
    if (!this.options.editable) return;
 | 
					    if (!this.options.editable) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.html.find('.item-equip-armure').click(async event => this.actor.equiperObjet(this.getItem(event)))
 | 
					    this.html.find('.item-equip-armure').click(async event => await this.actor.equiperObjet(this.getItem(event)))
 | 
				
			||||||
    this.html.find('.item-delete').click(async event => RdDUtility.confirmActorItemDelete(this.getItem(event), this.actor));
 | 
					    this.html.find('.item-delete').click(async event => await RdDUtility.confirmActorItemDelete(this.getItem(event), this.actor));
 | 
				
			||||||
    this.html.find('.item-split').click(async event => RdDSheetUtility.splitItem(this.getItem(event), this.actor))
 | 
					    this.html.find('.item-quantite-plus').click(async event => await this.actor.itemQuantiteIncDec(this.getItemId(event), 1));
 | 
				
			||||||
    this.html.find('.item-quantite-plus').click(async event => this.actor.itemQuantiteIncDec(this.getItemId(event), 1));
 | 
					    this.html.find('.item-quantite-moins').click(async event => await this.actor.itemQuantiteIncDec(this.getItemId(event), -1));
 | 
				
			||||||
    this.html.find('.item-quantite-moins').click(async event => this.actor.itemQuantiteIncDec(this.getItemId(event), -1));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.html.find('.creer-un-objet').click(async event => {
 | 
					    this.html.find('.creer-un-objet').click(async event => await this.selectObjetTypeToCreate())
 | 
				
			||||||
      this.selectObjetTypeToCreate();
 | 
					    this.html.find('.nettoyer-conteneurs').click(async event => await this.actor.nettoyerConteneurs())
 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
    this.html.find('.nettoyer-conteneurs').click(async event => {
 | 
					 | 
				
			||||||
      this.actor.nettoyerConteneurs();
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.html.find('.vue-detaillee').click(async event => {
 | 
					    this.html.find('.vue-detaillee').click(async event => {
 | 
				
			||||||
      this.options.vueDetaillee = !this.options.vueDetaillee;
 | 
					      this.options.vueDetaillee = !this.options.vueDetaillee
 | 
				
			||||||
      this.render(true);
 | 
					      this.render(true)
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -244,16 +244,19 @@ export class RdDBaseActor extends Actor {
 | 
				
			|||||||
  async onUpdateActor(update, options, actorId) { }
 | 
					  async onUpdateActor(update, options, actorId) { }
 | 
				
			||||||
  async onDeleteItem(item, options, id) {
 | 
					  async onDeleteItem(item, options, id) {
 | 
				
			||||||
    if (item.isInventaire()) {
 | 
					    if (item.isInventaire()) {
 | 
				
			||||||
      this._removeItemFromConteneur(item)
 | 
					      await this._removeItemFromConteneur(item)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  _removeItemFromConteneur(item) {
 | 
					  async _removeItemFromConteneur(item) {
 | 
				
			||||||
    this.items.filter(it => it.isConteneur() && it.system.contenu.includes(item.id))
 | 
					    const updates = this.items.filter(it => it.isConteneur() && it.system.contenu.includes(item.id))
 | 
				
			||||||
      .forEach(conteneur => {
 | 
					      .map(conteneur => {
 | 
				
			||||||
        const nouveauContenu = conteneur.system.contenu.filter(id => id != item.id);
 | 
					        const nouveauContenu = conteneur.system.contenu.filter(id => id != item.id)
 | 
				
			||||||
        conteneur.update({ 'system.contenu': nouveauContenu });
 | 
					        return { _id: conteneur.id, 'system.contenu': nouveauContenu }
 | 
				
			||||||
      });
 | 
					      })
 | 
				
			||||||
 | 
					    if (updates.length > 0) {
 | 
				
			||||||
 | 
					      await this.updateEmbeddedDocuments('Item', updates)
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async onTimeChanging(oldTimestamp, newTimestamp) {
 | 
					  async onTimeChanging(oldTimestamp, newTimestamp) {
 | 
				
			||||||
@@ -414,7 +417,7 @@ export class RdDBaseActor extends Actor {
 | 
				
			|||||||
      user: achat.userId,
 | 
					      user: achat.userId,
 | 
				
			||||||
      speaker: { alias: (acheteur ?? vendeur).getAlias() },
 | 
					      speaker: { alias: (acheteur ?? vendeur).getAlias() },
 | 
				
			||||||
      whisper: ChatUtility.getOwners(this),
 | 
					      whisper: ChatUtility.getOwners(this),
 | 
				
			||||||
      content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-achat-item.html', chatAchatItem)
 | 
					      content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-achat-item.hbs', chatAchatItem)
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!achat.vente.quantiteIllimite) {
 | 
					    if (!achat.vente.quantiteIllimite) {
 | 
				
			||||||
@@ -731,7 +734,7 @@ export class RdDBaseActor extends Actor {
 | 
				
			|||||||
      name: this.getAlias(),
 | 
					      name: this.getAlias(),
 | 
				
			||||||
      system: { description: this.system.description }
 | 
					      system: { description: this.system.description }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    renderTemplate('systems/foundryvtt-reve-de-dragon/templates/post-actor.html', chatData)
 | 
					    foundry.applications.handlebars.renderTemplate('systems/foundryvtt-reve-de-dragon/templates/post-actor.hbs', chatData)
 | 
				
			||||||
      .then(html => ChatMessage.create(RdDUtility.chatDataSetup(html, modeOverride)));
 | 
					      .then(html => ChatMessage.create(RdDUtility.chatDataSetup(html, modeOverride)));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -744,7 +747,7 @@ export class RdDBaseActor extends Actor {
 | 
				
			|||||||
  async jetDeMoral() { this.actionImpossible("jet de moral") }
 | 
					  async jetDeMoral() { this.actionImpossible("jet de moral") }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async resetItemUse() { }
 | 
					  async resetItemUse() { }
 | 
				
			||||||
  async incDecItemUse(itemId, inc = 1) { }
 | 
					  async incDecItemUse(itemId, shouldIncrease = true) { }
 | 
				
			||||||
  getItemUse(itemId) { return 0; }
 | 
					  getItemUse(itemId) { return 0; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async finDeRound(options = { terminer: false }) { }
 | 
					  async finDeRound(options = { terminer: false }) { }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,7 +12,7 @@ export class RdDCommerceSheet extends RdDBaseActorSheet {
 | 
				
			|||||||
  /** @override */
 | 
					  /** @override */
 | 
				
			||||||
  static get defaultOptions() {
 | 
					  static get defaultOptions() {
 | 
				
			||||||
    return foundry.utils.mergeObject(super.defaultOptions, {
 | 
					    return foundry.utils.mergeObject(super.defaultOptions, {
 | 
				
			||||||
      template: "systems/foundryvtt-reve-de-dragon/templates/actor/commerce-actor-sheet.html",
 | 
					      template: "systems/foundryvtt-reve-de-dragon/templates/actor/commerce-actor-sheet.hbs",
 | 
				
			||||||
      width: 600, height: 720,
 | 
					      width: 600, height: 720,
 | 
				
			||||||
      tabs: []
 | 
					      tabs: []
 | 
				
			||||||
    }, { inplace: false })
 | 
					    }, { inplace: false })
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,7 +10,7 @@ export class RdDCreatureSheet extends RdDBaseActorSangSheet {
 | 
				
			|||||||
  /** @override */
 | 
					  /** @override */
 | 
				
			||||||
  static get defaultOptions() {
 | 
					  static get defaultOptions() {
 | 
				
			||||||
    return foundry.utils.mergeObject(RdDBaseActorSangSheet.defaultOptions, {
 | 
					    return foundry.utils.mergeObject(RdDBaseActorSangSheet.defaultOptions, {
 | 
				
			||||||
      template: "systems/foundryvtt-reve-de-dragon/templates/actor-creature-sheet.html",
 | 
					      template: "systems/foundryvtt-reve-de-dragon/templates/actor-creature-sheet.hbs",
 | 
				
			||||||
      width: 640, height: 720
 | 
					      width: 640, height: 720
 | 
				
			||||||
    }, { inplace: false })
 | 
					    }, { inplace: false })
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -26,15 +26,15 @@ export class RdDCreatureSheet extends RdDBaseActorSangSheet {
 | 
				
			|||||||
    // On competence change
 | 
					    // On competence change
 | 
				
			||||||
    this.html.find('.creature-carac').change(async event => {
 | 
					    this.html.find('.creature-carac').change(async event => {
 | 
				
			||||||
      let compName = event.currentTarget.attributes.compname.value;
 | 
					      let compName = event.currentTarget.attributes.compname.value;
 | 
				
			||||||
      this.actor.updateCreatureCompetence(compName, "carac_value", parseInt(event.target.value));
 | 
					      await this.actor.updateCreatureCompetence(compName, "carac_value", parseInt(event.target.value));
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    this.html.find('.creature-niveau').change(async event => {
 | 
					    this.html.find('.creature-niveau').change(async event => {
 | 
				
			||||||
      let compName = event.currentTarget.attributes.compname.value;
 | 
					      let compName = event.currentTarget.attributes.compname.value;
 | 
				
			||||||
      this.actor.updateCreatureCompetence(compName, "niveau", parseInt(event.target.value));
 | 
					      await this.actor.updateCreatureCompetence(compName, "niveau", parseInt(event.target.value));
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    this.html.find('.creature-dommages').change(async event => {
 | 
					    this.html.find('.creature-dommages').change(async event => {
 | 
				
			||||||
      let compName = event.currentTarget.attributes.compname.value;
 | 
					      let compName = event.currentTarget.attributes.compname.value;
 | 
				
			||||||
      this.actor.updateCreatureCompetence(compName, "dommages", parseInt(event.target.value));
 | 
					      await this.actor.updateCreatureCompetence(compName, "dommages", parseInt(event.target.value));
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,7 @@ export class RdDActorEntiteSheet extends RdDBaseActorReveSheet {
 | 
				
			|||||||
  /** @override */
 | 
					  /** @override */
 | 
				
			||||||
  static get defaultOptions() {
 | 
					  static get defaultOptions() {
 | 
				
			||||||
    return foundry.utils.mergeObject(RdDBaseActorReveSheet.defaultOptions, {
 | 
					    return foundry.utils.mergeObject(RdDBaseActorReveSheet.defaultOptions, {
 | 
				
			||||||
      template: "systems/foundryvtt-reve-de-dragon/templates/actor-entite-sheet.html",
 | 
					      template: "systems/foundryvtt-reve-de-dragon/templates/actor-entite-sheet.hbs",
 | 
				
			||||||
      width: 640, height: 720,
 | 
					      width: 640, height: 720,
 | 
				
			||||||
    }, { inplace: false })
 | 
					    }, { inplace: false })
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -33,15 +33,15 @@ export class RdDActorEntiteSheet extends RdDBaseActorReveSheet {
 | 
				
			|||||||
    // On competence change
 | 
					    // On competence change
 | 
				
			||||||
    this.html.find('.creature-carac').change(async event => {
 | 
					    this.html.find('.creature-carac').change(async event => {
 | 
				
			||||||
      let compName = event.currentTarget.attributes.compname.value;
 | 
					      let compName = event.currentTarget.attributes.compname.value;
 | 
				
			||||||
      this.actor.updateCreatureCompetence(compName, "carac_value", parseInt(event.target.value));
 | 
					      await this.actor.updateCreatureCompetence(compName, "carac_value", parseInt(event.target.value));
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    this.html.find('.creature-dommages').change(async event => {
 | 
					    this.html.find('.creature-dommages').change(async event => {
 | 
				
			||||||
      let compName = event.currentTarget.attributes.compname.value;
 | 
					      let compName = event.currentTarget.attributes.compname.value;
 | 
				
			||||||
      this.actor.updateCreatureCompetence(compName, "dommages", parseInt(event.target.value));
 | 
					      await this.actor.updateCreatureCompetence(compName, "dommages", parseInt(event.target.value));
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.html.find('.resonance-add').click(async event =>
 | 
					    this.html.find('.resonance-add').click(async event =>
 | 
				
			||||||
      DialogSelect.select({
 | 
					      await DialogSelect.select({
 | 
				
			||||||
        label: "Choisir un acteur à accorder",
 | 
					        label: "Choisir un acteur à accorder",
 | 
				
			||||||
        list: game.actors.filter(it => it.isPersonnage() && it.prototypeToken.actorLink)
 | 
					        list: game.actors.filter(it => it.isPersonnage() && it.prototypeToken.actorLink)
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,7 +7,7 @@ import { CATEGORIES_COMPETENCES, CATEGORIES_DRACONIC, Mapping } from "./mapping.
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export class RdDActorExportSheet extends RdDActorSheet {
 | 
					export class RdDActorExportSheet extends RdDActorSheet {
 | 
				
			||||||
  static init() {
 | 
					  static init() {
 | 
				
			||||||
    loadTemplates([
 | 
					    foundry.applications.handlebars.loadTemplates([
 | 
				
			||||||
      "systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs",
 | 
					      "systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs",
 | 
				
			||||||
      "systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/blessure.hbs",
 | 
					      "systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/blessure.hbs",
 | 
				
			||||||
      "systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/blessures.hbs",
 | 
					      "systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/blessures.hbs",
 | 
				
			||||||
@@ -21,7 +21,7 @@ export class RdDActorExportSheet extends RdDActorSheet {
 | 
				
			|||||||
      "systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/protection.hbs",
 | 
					      "systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/protection.hbs",
 | 
				
			||||||
      "systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs",
 | 
					      "systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs",
 | 
				
			||||||
    ])
 | 
					    ])
 | 
				
			||||||
    Actors.registerSheet(SYSTEM_RDD, RdDActorExportSheet, { types: ["personnage"], makeDefault: false, label: "Feuille simplifiée" })
 | 
					    foundry.documents.collections.Actors.registerSheet(SYSTEM_RDD, RdDActorExportSheet, { types: ["personnage"], makeDefault: false, label: "Feuille simplifiée" })
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  static get defaultOptions() {
 | 
					  static get defaultOptions() {
 | 
				
			||||||
@@ -104,13 +104,12 @@ export class RdDActorExportSheet extends RdDActorSheet {
 | 
				
			|||||||
    this.html.find('.click-blessure-add').click(async event =>
 | 
					    this.html.find('.click-blessure-add').click(async event =>
 | 
				
			||||||
      await this.actor.ajouterBlessure({
 | 
					      await this.actor.ajouterBlessure({
 | 
				
			||||||
        gravite: this.html.find(event.currentTarget).data('gravite')
 | 
					        gravite: this.html.find(event.currentTarget).data('gravite')
 | 
				
			||||||
        // event.currentTarget.attributes['data-gravite'].value
 | 
					 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
    this.html.find('.button-export').click(async event => {
 | 
					    this.html.find('.button-export').click(async event => await
 | 
				
			||||||
      ExportScriptarium.INSTANCE.exportActors([this.actor],
 | 
					      ExportScriptarium.INSTANCE.exportActors([this.actor],
 | 
				
			||||||
        `${this.actor.uuid}-${this.actor.name}`
 | 
					        `${this.actor.uuid}-${this.actor.name}`
 | 
				
			||||||
      )
 | 
					      )
 | 
				
			||||||
    })
 | 
					    )
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,7 +3,7 @@ import { Misc } from "../../misc.js"
 | 
				
			|||||||
import { EXPORT_CSV_SCRIPTARIUM, OptionsAvancees } from "../../settings/options-avancees.js"
 | 
					import { EXPORT_CSV_SCRIPTARIUM, OptionsAvancees } from "../../settings/options-avancees.js"
 | 
				
			||||||
import { Mapping } from "./mapping.js"
 | 
					import { Mapping } from "./mapping.js"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const IMG_SCRIPTARIUM = '<img class="context-menu-img" src="systems/foundryvtt-reve-de-dragon/styles/img/ui/scriptarium.svg">'
 | 
					const IMG_SCRIPTARIUM = '<img class="context-menu-img" src="systems/foundryvtt-reve-de-dragon/assets/ui/scriptarium.svg">'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export class ExportScriptarium {
 | 
					export class ExportScriptarium {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,7 +26,7 @@ const RANDOM_VALUES = {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export class AppPersonnageAleatoire extends FormApplication {
 | 
					export class AppPersonnageAleatoire extends FormApplication {
 | 
				
			||||||
  static preloadHandlebars() {
 | 
					  static preloadHandlebars() {
 | 
				
			||||||
    loadTemplates([
 | 
					    foundry.applications.handlebars.loadTemplates([
 | 
				
			||||||
      'systems/foundryvtt-reve-de-dragon/templates/actor/random/champ-aleatoire.hbs',
 | 
					      'systems/foundryvtt-reve-de-dragon/templates/actor/random/champ-aleatoire.hbs',
 | 
				
			||||||
    ])
 | 
					    ])
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,7 +7,7 @@ export class RdDActorVehiculeSheet extends RdDBaseActorSheet {
 | 
				
			|||||||
  /** @override */
 | 
					  /** @override */
 | 
				
			||||||
  static get defaultOptions() {
 | 
					  static get defaultOptions() {
 | 
				
			||||||
    return foundry.utils.mergeObject(RdDBaseActorSheet.defaultOptions, {
 | 
					    return foundry.utils.mergeObject(RdDBaseActorSheet.defaultOptions, {
 | 
				
			||||||
      template: "systems/foundryvtt-reve-de-dragon/templates/actor-vehicule-sheet.html",
 | 
					      template: "systems/foundryvtt-reve-de-dragon/templates/actor-vehicule-sheet.hbs",
 | 
				
			||||||
      width: 640, height: 720,
 | 
					      width: 640, height: 720,
 | 
				
			||||||
    }, { inplace: false })
 | 
					    }, { inplace: false })
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -32,18 +32,10 @@ export class RdDActorVehiculeSheet extends RdDBaseActorSheet {
 | 
				
			|||||||
    super.activateListeners(html);
 | 
					    super.activateListeners(html);
 | 
				
			||||||
    if (!this.options.editable) return;
 | 
					    if (!this.options.editable) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.html.find('.resistance-moins').click(async event => {
 | 
					    this.html.find('.resistance-moins').click(async event => await this.actor.vehicleIncDec("resistance", -1))
 | 
				
			||||||
      this.actor.vehicleIncDec("resistance", -1);
 | 
					    this.html.find('.resistance-plus').click(async event => await this.actor.vehicleIncDec("resistance", 1))
 | 
				
			||||||
    });
 | 
					    this.html.find('.structure-moins').click(async event => await this.actor.vehicleIncDec("structure", -1))
 | 
				
			||||||
    this.html.find('.resistance-plus').click(async event => {
 | 
					    this.html.find('.structure-plus').click(async event => await this.actor.vehicleIncDec("structure", 1))
 | 
				
			||||||
      this.actor.vehicleIncDec("resistance", 1);
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
    this.html.find('.structure-moins').click(async event => {
 | 
					 | 
				
			||||||
      this.actor.vehicleIncDec("structure", -1);
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
    this.html.find('.structure-plus').click(async event => {
 | 
					 | 
				
			||||||
      this.actor.vehicleIncDec("structure", 1);
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										5
									
								
								module/applications/sheets/_module.mjs
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					export { default as RdDItemBaseSheet} from "./common-item-sheet.mjs"
 | 
				
			||||||
 | 
					export { default as RdDMonnaieSheet } from "./monnaie-sheet.mjs"
 | 
				
			||||||
 | 
					export { default as RdDMunitionSheet } from "./munition-sheet.mjs"
 | 
				
			||||||
 | 
					export { default as RdDTarotSheet } from "./tarot-sheet.mjs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										111
									
								
								module/applications/sheets/common-item-sheet.mjs
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,111 @@
 | 
				
			|||||||
 | 
					const { HandlebarsApplicationMixin } = foundry.applications.api
 | 
				
			||||||
 | 
					import { SYSTEM_RDD } from "../../constants.js"
 | 
				
			||||||
 | 
					import { Misc } from "../../misc.js"
 | 
				
			||||||
 | 
					import { RdDSheetUtility } from "../../rdd-sheet-utility.js";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default class RdDItemBaseSheet extends HandlebarsApplicationMixin(foundry.applications.sheets.ItemSheetV2) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  static preloadHandlebars(...templatesList) {
 | 
				
			||||||
 | 
					    const handlebars = ["systems/foundryvtt-reve-de-dragon/templates/sheets/item/common/header.hbs"]
 | 
				
			||||||
 | 
					    templatesList.forEach(templates =>
 | 
				
			||||||
 | 
					      templates.forEach(t =>
 | 
				
			||||||
 | 
					        t.handlebars().forEach(h => handlebars.push(h))
 | 
				
			||||||
 | 
					      )
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					    loadTemplates(Misc.distinct(handlebars))
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  static register(sheetClass) {
 | 
				
			||||||
 | 
					    const itemType = sheetClass.ITEM_TYPE
 | 
				
			||||||
 | 
					    Items.registerSheet(SYSTEM_RDD, sheetClass, {
 | 
				
			||||||
 | 
					      label: Misc.typeName('Item', itemType),
 | 
				
			||||||
 | 
					      types: [itemType],
 | 
				
			||||||
 | 
					      makeDefault: true
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  static registerAll(...sheetClasses) {
 | 
				
			||||||
 | 
					    const handlebars = ["systems/foundryvtt-reve-de-dragon/templates/sheets/item/common/header.hbs"]
 | 
				
			||||||
 | 
					    sheetClasses.forEach(sheetClass => {
 | 
				
			||||||
 | 
					      sheetClass.TEMPLATES.forEach(t =>
 | 
				
			||||||
 | 
					        t.handlebars().forEach(h => handlebars.push(h))
 | 
				
			||||||
 | 
					      )
 | 
				
			||||||
 | 
					      const itemType = sheetClass.ITEM_TYPE
 | 
				
			||||||
 | 
					      foundry.documents.collections.Items.registerSheet(SYSTEM_RDD, sheetClass, {
 | 
				
			||||||
 | 
					        label: Misc.typeName('Item', itemType),
 | 
				
			||||||
 | 
					        types: [itemType],
 | 
				
			||||||
 | 
					        makeDefault: true
 | 
				
			||||||
 | 
					      })
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					    foundry.applications.handlebars.loadTemplates(Misc.distinct(handlebars))
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  static get ITEM_TYPE() { return undefined }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  constructor(options = {}) {
 | 
				
			||||||
 | 
					    super(options)
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  static get TEMPLATES() { return [] }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /** @override */
 | 
				
			||||||
 | 
					  static DEFAULT_OPTIONS = {
 | 
				
			||||||
 | 
					    classes: ["fvtt-rdd", "item"],
 | 
				
			||||||
 | 
					    position: {
 | 
				
			||||||
 | 
					      width: 448,
 | 
				
			||||||
 | 
					      height: "auto",
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    form: {
 | 
				
			||||||
 | 
					      submitOnChange: true,
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    window: {
 | 
				
			||||||
 | 
					      resizable: true,
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    actions: {
 | 
				
			||||||
 | 
					      editImage: RdDItemBaseSheet.#onEditImage,
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /** @override */
 | 
				
			||||||
 | 
					  async _prepareContext() {
 | 
				
			||||||
 | 
					    return {
 | 
				
			||||||
 | 
					      item: this.document,
 | 
				
			||||||
 | 
					      options: RdDSheetUtility.getOptions(this.document, this.isEditable),
 | 
				
			||||||
 | 
					      fields: this.document.schema.fields,
 | 
				
			||||||
 | 
					      systemFields: this.document.system.schema.fields,
 | 
				
			||||||
 | 
					      system: this.document.system,
 | 
				
			||||||
 | 
					      source: this.document.toObject(),
 | 
				
			||||||
 | 
					      isEditable: this.isEditable,
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // #region Actions
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /**
 | 
				
			||||||
 | 
					   * Handle changing a Document's image.
 | 
				
			||||||
 | 
					   *
 | 
				
			||||||
 | 
					   * @this RdDItemBaseSheet
 | 
				
			||||||
 | 
					   * @param {PointerEvent} event   The originating click event
 | 
				
			||||||
 | 
					   * @param {HTMLElement} target   The capturing HTML element which defined a [data-action]
 | 
				
			||||||
 | 
					   * @returns {Promise}
 | 
				
			||||||
 | 
					   * @private
 | 
				
			||||||
 | 
					   */
 | 
				
			||||||
 | 
					  static async #onEditImage(event, target) {
 | 
				
			||||||
 | 
					    const attr = target.dataset.edit
 | 
				
			||||||
 | 
					    const current = foundry.utils.getProperty(this.document, attr)
 | 
				
			||||||
 | 
					    const { img } = this.document.constructor.getDefaultArtwork?.(this.document.toObject()) ?? {}
 | 
				
			||||||
 | 
					    const fp = new FilePicker({
 | 
				
			||||||
 | 
					      current,
 | 
				
			||||||
 | 
					      type: "image",
 | 
				
			||||||
 | 
					      redirectToRoot: img ? [img] : [],
 | 
				
			||||||
 | 
					      callback: (path) => {
 | 
				
			||||||
 | 
					        this.document.update({ [attr]: path })
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      top: this.position.top + 40,
 | 
				
			||||||
 | 
					      left: this.position.left + 10,
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					    return fp.browse()
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  // #endregion
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										35
									
								
								module/applications/sheets/monnaie-sheet.mjs
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,35 @@
 | 
				
			|||||||
 | 
					import { TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE } from "../../common/_module.mjs";
 | 
				
			||||||
 | 
					import { ITEM_TYPES } from "../../constants.js";
 | 
				
			||||||
 | 
					import RdDItemBaseSheet from "./common-item-sheet.mjs";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default class RdDMonnaieSheet extends RdDItemBaseSheet {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /** @override */
 | 
				
			||||||
 | 
					  static get ITEM_TYPE() { return ITEM_TYPES.monnaie }
 | 
				
			||||||
 | 
					  static get TEMPLATES() { return [TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE] }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /** @override */
 | 
				
			||||||
 | 
					  static DEFAULT_OPTIONS = Object.assign({},
 | 
				
			||||||
 | 
					    RdDItemBaseSheet.DEFAULT_OPTIONS,
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      classes: ["fvtt-rdd", "item", "monnaie"],
 | 
				
			||||||
 | 
					      position: { width: 448 },
 | 
				
			||||||
 | 
					      window: { contentClasses: ["monnaie-content"] }
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /** @override */
 | 
				
			||||||
 | 
					  static PARTS = {
 | 
				
			||||||
 | 
					    main: {
 | 
				
			||||||
 | 
					      template: "systems/foundryvtt-reve-de-dragon/templates/sheets/item/monnaie.hbs",
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /** @override */
 | 
				
			||||||
 | 
					  async _prepareContext() {
 | 
				
			||||||
 | 
					    return Object.assign(
 | 
				
			||||||
 | 
					      await super._prepareContext(),
 | 
				
			||||||
 | 
					      await TEMPLATE_DESCRIPTION.prepareContext(this.document),
 | 
				
			||||||
 | 
					      await TEMPLATE_INVENTAIRE.prepareContext(this.document)
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										34
									
								
								module/applications/sheets/munition-sheet.mjs
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,34 @@
 | 
				
			|||||||
 | 
					import { TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE } from "../../common/_module.mjs";
 | 
				
			||||||
 | 
					import { ITEM_TYPES } from "../../constants.js";
 | 
				
			||||||
 | 
					import RdDItemBaseSheet from "./common-item-sheet.mjs";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default class RdDMunitionSheet extends RdDItemBaseSheet {
 | 
				
			||||||
 | 
					  /** @override */
 | 
				
			||||||
 | 
					  static get ITEM_TYPE() { return ITEM_TYPES.munition }
 | 
				
			||||||
 | 
					  static get TEMPLATES() { return [TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE] }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /** @override */
 | 
				
			||||||
 | 
					  static DEFAULT_OPTIONS = Object.assign({},
 | 
				
			||||||
 | 
					    RdDItemBaseSheet.DEFAULT_OPTIONS,
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      classes: ["fvtt-rdd", "item", "munition"],
 | 
				
			||||||
 | 
					      position: { width: 448 },
 | 
				
			||||||
 | 
					      window: { contentClasses: ["munition-content"] }
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /** @override */
 | 
				
			||||||
 | 
					  static PARTS = {
 | 
				
			||||||
 | 
					    main: {
 | 
				
			||||||
 | 
					      template: "systems/foundryvtt-reve-de-dragon/templates/sheets/item/munition.hbs",
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /** @override */
 | 
				
			||||||
 | 
					  async _prepareContext() {
 | 
				
			||||||
 | 
					    return Object.assign(
 | 
				
			||||||
 | 
					      await super._prepareContext(),
 | 
				
			||||||
 | 
					      await TEMPLATE_DESCRIPTION.prepareContext(this.document),
 | 
				
			||||||
 | 
					      await TEMPLATE_INVENTAIRE.prepareContext(this.document)
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										33
									
								
								module/applications/sheets/tarot-sheet.mjs
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,33 @@
 | 
				
			|||||||
 | 
					import { TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE } from "../../common/_module.mjs";
 | 
				
			||||||
 | 
					import { ITEM_TYPES } from "../../constants.js";
 | 
				
			||||||
 | 
					import RdDItemBaseSheet from "./common-item-sheet.mjs";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default class RdDTarotSheet extends RdDItemBaseSheet {
 | 
				
			||||||
 | 
					  /** @override */
 | 
				
			||||||
 | 
					  static get ITEM_TYPE() { return ITEM_TYPES.tarot }
 | 
				
			||||||
 | 
					  static get TEMPLATES() { return [TEMPLATE_DESCRIPTION] }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /** @override */
 | 
				
			||||||
 | 
					  static DEFAULT_OPTIONS = Object.assign({},
 | 
				
			||||||
 | 
					    RdDItemBaseSheet.DEFAULT_OPTIONS,
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      classes: ["fvtt-rdd", "item", "tarot"],
 | 
				
			||||||
 | 
					      position: { width: 448 },
 | 
				
			||||||
 | 
					      window: { contentClasses: ["tarot-content"] }
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /** @override */
 | 
				
			||||||
 | 
					  static PARTS = {
 | 
				
			||||||
 | 
					    main: {
 | 
				
			||||||
 | 
					      template: "systems/foundryvtt-reve-de-dragon/templates/sheets/item/tarot.hbs",
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /** @override */
 | 
				
			||||||
 | 
					  async _prepareContext() {
 | 
				
			||||||
 | 
					    return Object.assign(
 | 
				
			||||||
 | 
					      await super._prepareContext(),
 | 
				
			||||||
 | 
					      await TEMPLATE_DESCRIPTION.prepareContext(this.document)
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -13,7 +13,7 @@ const TEXT_ROLL_MANAGERS = [
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export class RdDTextEditor {
 | 
					export class RdDTextEditor {
 | 
				
			||||||
  static registerChatCallbacks(html) {
 | 
					  static registerChatCallbacks(html) {
 | 
				
			||||||
    html.on("click", '.roll-text', async event => await RdDTextEditor.rollText(event))
 | 
					    $(html).on("click", '.roll-text', async event => await RdDTextEditor.rollText(event))
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  static async enrichHTML(text, object, options = {showlink:true}) {
 | 
					  static async enrichHTML(text, object, options = {showlink:true}) {
 | 
				
			||||||
@@ -30,7 +30,7 @@ export class RdDTextEditor {
 | 
				
			|||||||
      context.text = await manager.onReplaceRoll(context);
 | 
					      context.text = await manager.onReplaceRoll(context);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return await TextEditor.enrichHTML(context.text, {
 | 
					    return await foundry.applications.ux.TextEditor.implementation.enrichHTML(context.text, {
 | 
				
			||||||
      relativeTo: object,
 | 
					      relativeTo: object,
 | 
				
			||||||
      secrets: object?.isOwner,
 | 
					      secrets: object?.isOwner,
 | 
				
			||||||
      async: true
 | 
					      async: true
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,7 +5,7 @@ import { RdDUtility } from "../../rdd-utility.js";
 | 
				
			|||||||
import { RdDAlchimie } from "../../rdd-alchimie.js";
 | 
					import { RdDAlchimie } from "../../rdd-alchimie.js";
 | 
				
			||||||
import { TextRollManager } from "./text-roll-formatter.js";
 | 
					import { TextRollManager } from "./text-roll-formatter.js";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const REGEX_ALCHIMIE_TERMES = "(?<termes>(\\w|-)+)"
 | 
					const REGEX_ALCHIMIE_TERMES = "(?<termes>([-A-Za-zÀ-ÖØ-öø-ÿ ])+)"
 | 
				
			||||||
const REGEX_ALCHIMIE_MANIP = "(?<manip>(couleur|consistance))"
 | 
					const REGEX_ALCHIMIE_MANIP = "(?<manip>(couleur|consistance))"
 | 
				
			||||||
const XREGEXP_ROLL_ALCHIMIE = XRegExp("@roll\\[" + REGEX_ALCHIMIE_MANIP + "\\s+" + REGEX_ALCHIMIE_TERMES + "\\]", 'giu')
 | 
					const XREGEXP_ROLL_ALCHIMIE = XRegExp("@roll\\[" + REGEX_ALCHIMIE_MANIP + "\\s+" + REGEX_ALCHIMIE_TERMES + "\\]", 'giu')
 | 
				
			||||||
const XREGEXP_ROLL_ALCHIMIE_MANIP = XRegExp("@" + REGEX_ALCHIMIE_MANIP + "\\{" + REGEX_ALCHIMIE_TERMES + "\\}", 'giu')
 | 
					const XREGEXP_ROLL_ALCHIMIE_MANIP = XRegExp("@" + REGEX_ALCHIMIE_MANIP + "\\{" + REGEX_ALCHIMIE_TERMES + "\\}", 'giu')
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,7 +5,7 @@ import { RdDUtility } from "../../rdd-utility.js";
 | 
				
			|||||||
import { TextRollManager } from "./text-roll-formatter.js";
 | 
					import { TextRollManager } from "./text-roll-formatter.js";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const REGECP_CARAC = "(?<carac>[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+)"
 | 
					const REGECP_CARAC = "(?<carac>[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+)"
 | 
				
			||||||
const REGEXP_COMP = "(\\/(?<competence>[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+))?"
 | 
					const REGEXP_COMP = "(\\/(?<competence>[A-Za-zÀ-ÖØ-öø-ÿ ]+([1-2]?[A-Za-zÀ-ÖØ-öø-ÿ ]+)?))?"
 | 
				
			||||||
const REGEXP_DIFF = "(/(?<diff>[\\+\\-]?\\d+(d\\d+)?))?"
 | 
					const REGEXP_DIFF = "(/(?<diff>[\\+\\-]?\\d+(d\\d+)?))?"
 | 
				
			||||||
const REGEXP_ROLL_CARAC_COMP = REGECP_CARAC + REGEXP_COMP + REGEXP_DIFF
 | 
					const REGEXP_ROLL_CARAC_COMP = REGECP_CARAC + REGEXP_COMP + REGEXP_DIFF
 | 
				
			||||||
const XREGEXP_ROLL_CARAC_COMP = XRegExp("@roll\\[" + REGEXP_ROLL_CARAC_COMP + "\\]", 'giu')
 | 
					const XREGEXP_ROLL_CARAC_COMP = XRegExp("@roll\\[" + REGEXP_ROLL_CARAC_COMP + "\\]", 'giu')
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,7 +10,7 @@ import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
 | 
				
			|||||||
export class ChatUtility {
 | 
					export class ChatUtility {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  static async init() {
 | 
					  static async init() {
 | 
				
			||||||
    Hooks.on("renderChatMessage", async (app, html, msg) => await ChatUtility.onRenderChatMessage(app, html, msg))
 | 
					    Hooks.on("renderChatMessageHTML", async (app, html, msg) => await ChatUtility.onRenderChatMessage(app, html, msg))
 | 
				
			||||||
    Hooks.on("createChatMessage", async (chatMessage, options, id) => await ChatUtility.onCreateChatMessage(chatMessage, options, id))
 | 
					    Hooks.on("createChatMessage", async (chatMessage, options, id) => await ChatUtility.onCreateChatMessage(chatMessage, options, id))
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -62,7 +62,6 @@ export class ChatUtility {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
 | 
					 | 
				
			||||||
  static removeMessages(socketData) {
 | 
					  static removeMessages(socketData) {
 | 
				
			||||||
    if (Misc.isFirstConnectedGM()) {
 | 
					    if (Misc.isFirstConnectedGM()) {
 | 
				
			||||||
      ChatUtility.onRemoveMessages(socketData);
 | 
					      ChatUtility.onRemoveMessages(socketData);
 | 
				
			||||||
@@ -97,7 +96,7 @@ export class ChatUtility {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        break
 | 
					        break
 | 
				
			||||||
      case "gmroll":
 | 
					      case "gmroll":
 | 
				
			||||||
        messageData.whisper = ChatUtility.getOwners(actor)
 | 
					        messageData.whisper = actor ? ChatUtility.getOwners(actor) : ChatUtility.getUserAndGMs()
 | 
				
			||||||
        break
 | 
					        break
 | 
				
			||||||
      case "selfroll":
 | 
					      case "selfroll":
 | 
				
			||||||
        messageData.whisper = [game.user]
 | 
					        messageData.whisper = [game.user]
 | 
				
			||||||
@@ -108,7 +107,7 @@ export class ChatUtility {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  static getOwners(document) {
 | 
					  static getOwners(document) {
 | 
				
			||||||
    return game.users.filter(it => document.getUserLevel(it) == CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER)
 | 
					    return document ? game.users.filter(it => document.getUserLevel(it) == CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER) : [game.user]
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  static getUserAndGMs() {
 | 
					  static getUserAndGMs() {
 | 
				
			||||||
@@ -191,15 +190,15 @@ export class ChatUtility {
 | 
				
			|||||||
    if (rddTimestamp) {
 | 
					    if (rddTimestamp) {
 | 
				
			||||||
      const timestamp = new RdDTimestamp(rddTimestamp);
 | 
					      const timestamp = new RdDTimestamp(rddTimestamp);
 | 
				
			||||||
      const timestampData = timestamp.toCalendrier();
 | 
					      const timestampData = timestamp.toCalendrier();
 | 
				
			||||||
      const dateHeure = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/common/date-heure.hbs', timestampData);
 | 
					      const dateHeure = await foundry.applications.handlebars.renderTemplate('systems/foundryvtt-reve-de-dragon/templates/common/date-heure.hbs', timestampData);
 | 
				
			||||||
      html.find('header.message-header .message-sender').after(dateHeure)
 | 
					      $(html).find('header.message-header .message-sender').after(dateHeure)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  static async onCreateChatMessage(chatMessage, options, id) {
 | 
					  static async onCreateChatMessage(chatMessage, options, id) {
 | 
				
			||||||
    if (chatMessage.isAuthor) {
 | 
					    if (chatMessage.isAuthor) {
 | 
				
			||||||
      await chatMessage.setFlag(SYSTEM_RDD, 'rdd-timestamp', game.system.rdd.calendrier.getTimestamp());
 | 
					      await chatMessage.setFlag(SYSTEM_RDD, 'rdd-timestamp', game.system.rdd.calendrier.getTimestamp());
 | 
				
			||||||
      await chatMessage.update({ content: await RdDTextEditor.enrichHTML(chatMessage.content, undefined, {showLink:false}) })
 | 
					      await chatMessage.update({ content: await RdDTextEditor.enrichHTML(chatMessage.content, undefined, { showLink: false }) })
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,13 +5,13 @@ const INFO_COEUR = 'info-coeur';
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export class RdDCoeur {
 | 
					export class RdDCoeur {
 | 
				
			||||||
  static registerChatCallbacks(html) {
 | 
					  static registerChatCallbacks(html) {
 | 
				
			||||||
    html.on("click", 'a.accepter-tendre-moment', event => {
 | 
					    $(html).on("click", 'a.accepter-tendre-moment', event => {
 | 
				
			||||||
      RdDCoeur.accepterTendreMoment(RdDCoeur.extractInfoCoeur(event))
 | 
					      RdDCoeur.accepterTendreMoment(RdDCoeur.extractInfoCoeur(event))
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
    html.on("click", 'a.refuser-tendre-moment', event => {
 | 
					    $(html).on("click", 'a.refuser-tendre-moment', event => {
 | 
				
			||||||
      RdDCoeur.refuserTendreMoment(RdDCoeur.extractInfoCoeur(event))
 | 
					      RdDCoeur.refuserTendreMoment(RdDCoeur.extractInfoCoeur(event))
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
    html.on("click", 'a.perdre-point-coeur-douceur', event => {
 | 
					    $(html).on("click", 'a.perdre-point-coeur-douceur', event => {
 | 
				
			||||||
      RdDCoeur.perdreEnDouceur(
 | 
					      RdDCoeur.perdreEnDouceur(
 | 
				
			||||||
        RdDCoeur.extractInfoCoeur(event),
 | 
					        RdDCoeur.extractInfoCoeur(event),
 | 
				
			||||||
        event.currentTarget.attributes['data-actor-id'].value)
 | 
					        event.currentTarget.attributes['data-actor-id'].value)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										8
									
								
								module/common/_module.mjs
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					import { CommonDescription } from "./description.mjs";
 | 
				
			||||||
 | 
					import { CommonInventaire } from "./inventaire.mjs";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const TEMPLATE_DESCRIPTION = new CommonDescription()
 | 
				
			||||||
 | 
					export const TEMPLATE_INVENTAIRE = new CommonInventaire()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const ALL_COMMON_TEMPLATES = [TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE]
 | 
				
			||||||
 | 
					
 | 
				
			||||||