Compare commits
1 Commits
13.0.2
...
f31da34461
Author | SHA1 | Date | |
---|---|---|---|
f31da34461 |
@ -1,6 +1,6 @@
|
||||
name: Release Creation
|
||||
|
||||
on:
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
@ -9,11 +9,9 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: echo "💡 The ${{ gitea.repository }} repository will cloned to the runner."
|
||||
|
||||
|
||||
#- uses: actions/checkout@v3
|
||||
- uses: RouxAntoine/checkout@v3.5.4
|
||||
with:
|
||||
ref: 'v13'
|
||||
|
||||
# get part of the tag after the `v`
|
||||
- name: Extract tag version number
|
||||
@ -31,7 +29,7 @@ jobs:
|
||||
url: https://www.uberwald.me/gitea/${{gitea.repository}}
|
||||
manifest: https://www.uberwald.me/gitea/${{gitea.repository}}/releases/download/${{github.event.release.tag_name}}/system.json
|
||||
download: https://www.uberwald.me/gitea/${{gitea.repository}}/releases/download/${{github.event.release.tag_name}}/rddsystem.zip
|
||||
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
@ -39,7 +37,7 @@ jobs:
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
|
||||
- name: Build the compendiums
|
||||
run: node ./tools/packCompendiumsToDist.mjs
|
||||
|
||||
@ -48,29 +46,29 @@ jobs:
|
||||
apt update -y
|
||||
apt install -y zip
|
||||
|
||||
- run: zip -r ./rddsystem.zip system.json template.json README.md LICENSE.txt assets/ css/ fonts/ icons lang/ module/ packs/ pic/ sounds/ styles/ templates/
|
||||
|
||||
- run: zip -r ./rddsystem.zip system.json template.json README.md LICENSE.txt assets/ fonts/ icons lang/ module/ packs/ pic/ sounds/ styles/ templates/
|
||||
|
||||
- name: setup go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: '>=1.20.1'
|
||||
|
||||
- name: Use Go Action
|
||||
|
||||
- name: Use Go Action
|
||||
id: use-go-action
|
||||
uses: https://gitea.com/actions/release-action@main
|
||||
with:
|
||||
files: |-
|
||||
./rddsystem.zip
|
||||
./rddsystem.zip
|
||||
system.json
|
||||
api_key: '${{secrets.ALLOW_PUSH_RELEASE}}'
|
||||
|
||||
- name: Publish to Foundry server
|
||||
- name: Publish to Foundry server
|
||||
uses: djlechuck/foundryvtt-publish-package-action@v1
|
||||
with:
|
||||
token: ${{ secrets.FOUNDRYVTT_RELEASE_TOKEN }}
|
||||
id: 'foundryvtt-reve-de-dragon'
|
||||
version: ${{github.event.release.tag_name}}
|
||||
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/v13/changelog.md'
|
||||
compatibility-minimum: '13'
|
||||
compatibility-verified: '13'
|
||||
notes: 'https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/branch/v11/changelog.md'
|
||||
compatibility-minimum: '12'
|
||||
compatibility-verified: '12'
|
0
.gitlab/issue_templates/.gitkeep
Normal file
0
.gitlab/issue_templates/.gitkeep
Normal file
14
.gitlab/issue_templates/Bug.md
Normal file
14
.gitlab/issue_templates/Bug.md
Normal file
@ -0,0 +1,14 @@
|
||||
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
|
14
.gitlab/issue_templates/Feature.md
Normal file
14
.gitlab/issue_templates/Feature.md
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
### 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
|
@ -1,78 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
viewBox="0 0 512 512"
|
||||
style="height: 256px; width: 256px;"
|
||||
version="1.1"
|
||||
id="svg8"
|
||||
sodipodi:docname="add-skill.svg"
|
||||
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)">
|
||||
<metadata
|
||||
id="metadata14">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs12" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="2138"
|
||||
inkscape:window-height="1465"
|
||||
id="namedview10"
|
||||
showgrid="false"
|
||||
inkscape:zoom="1.0150849"
|
||||
inkscape:cx="466.02267"
|
||||
inkscape:cy="44.586362"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg8" />
|
||||
<path
|
||||
d="M0 0h512v512H0z"
|
||||
fill="url(#pattern)"
|
||||
fill-opacity="0.5"
|
||||
id="path2" />
|
||||
<g
|
||||
class=""
|
||||
transform="translate(-81.40366,-2.6174234)"
|
||||
id="g6">
|
||||
<path
|
||||
d="m 119.1,25 v 0.1 c -25,3.2 -47.1,32 -47.1,68.8 0,20.4 7.1,38.4 17.5,50.9 L 99.7,157 84,159.9 c -13.7,2.6 -23.8,9.9 -32.2,21.5 -8.5,11.5 -14.9,27.5 -19.4,45.8 -8.2,33.6 -9.9,74.7 -10.1,110.5 h 44 l 11.9,158.4 h 96.3 L 185,337.7 h 41.9 c 0,-36.2 -0.3,-77.8 -7.8,-111.7 -4,-18.5 -10.2,-34.4 -18.7,-45.9 -8.6,-11.4 -19.2,-18.7 -34.5,-21 l -16,-2.5 L 160,144 c 10,-12.5 16.7,-30.2 16.7,-50.1 0,-39.2 -24.8,-68.8 -52.4,-68.8 -2.9,0 -4.7,-0.1 -5.2,-0.1 z M 311,55 v 48 H 208 v 18 h 103 v 158 h -55 v 18 h 55 V 407 H 208 v 18 h 103 v 32 h 80.8 c -0.5,-2.9 -0.8,-5.9 -0.8,-9 0,-3.1 0.3,-6.1 0.8,-9 H 329 V 297 h 62.8 c -0.5,-2.9 -0.8,-5.9 -0.8,-9 0,-3.1 0.3,-6.1 0.8,-9 H 329 V 73 h 62.8 c -0.5,-2.92 -0.8,-5.93 -0.8,-9 0,-3.07 0.3,-6.08 0.8,-9 z m 129,202 c -17.2,0 -31,13.8 -31,31 0,17.2 13.8,31 31,31 17.2,0 31,-13.8 31,-31 0,-17.2 -13.8,-31 -31,-31 z m 0,160 c -17.2,0 -31,13.8 -31,31 0,17.2 13.8,31 31,31 17.2,0 31,-13.8 31,-31 0,-17.2 -13.8,-31 -31,-31 z"
|
||||
fill="#000000"
|
||||
fill-opacity="0.8"
|
||||
transform="matrix(0.6,0,0,0.6,102.4,102.4)"
|
||||
id="path4"
|
||||
sodipodi:nodetypes="ccsccccccccccccccccssccccccccccccccccsccccsccccsccssssssssss" />
|
||||
</g>
|
||||
<g
|
||||
class=""
|
||||
transform="translate(124.63542,-119.78046)"
|
||||
id="g6-1">
|
||||
<path
|
||||
d="m 158.81777,136.77499 c -9.48,32.22 -28.656,28.8 -47.61,26.04 21.39,6.12 29.61,22.38 25.998,47.64 7.596,-27.6 25.572,-31.56 47.652,-26.04 -22.56,-7.26 -34.14,-21.24 -26.04,-47.64 z m -41.76,76.08 c 5.496,10.02 4.578,18.06 -3.366,24 7.476,-4.14 14.91,-8.58 23.946,3.36 -7.542,-9.72 -4.92,-17.4 3.366,-24 -8.352,5.82 -16.482,6.96 -23.946,-3.36 z m 82.32,0.18 c 6.84,16.08 -0.3,24.78 -13.02,30.54 13.62,-5.1 24.48,-2.7 30.54,13.02 -7.62,-19.08 2.88,-24.72 13.02,-30.54 -12.6,5.1 -22.68,0.54 -30.54,-13.02 z m -52.776,31.2 c 9.396,34.68 0.516,58.86 -28.392,71.1 26.076,-7.08 52.428,-15.12 71.208,28.44 -15.84,-35.58 -2.04,-57.24 28.38,-71.28 -30,11.52 -55.86,9 -71.196,-28.26 z"
|
||||
fill="#000000"
|
||||
fill-opacity="0.8"
|
||||
id="path4-2"
|
||||
sodipodi:nodetypes="cccccccccccccccccccc"
|
||||
style="stroke-width:0.6" />
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 3.7 KiB |
163
changelog.md
163
changelog.md
@ -1,157 +1,11 @@
|
||||
# 13.0
|
||||
|
||||
## 13.0.0 - Le début de l'errance d'Illysis
|
||||
|
||||
- Migration vers la version 13 de Foundry
|
||||
|
||||
# 12.0
|
||||
## 12.0.50 - Le sommeil d'Astrobazzarh
|
||||
- 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
|
||||
- Fix problème d'initialisation des feuilles d'items
|
||||
|
||||
## 12.0.34 - la tête d'Astrobazzarh
|
||||
- support de liens "jets de dés"
|
||||
- on peut ajouter des liens "jet de dés" dans les journaux, descriptions, notes, maladresses, ...
|
||||
- avec la syntaxe `@roll[...]` on peut ajouter le lien vers:
|
||||
- un jet de caractéristique/compétence `@roll[carac/competence/difficulte]` / `@roll[carac/difficulte]` / `@roll[carac/competence]`
|
||||
- une formule foundry `@roll[2d6]` pour lancer 2d6
|
||||
- une manipulation alchimique `@roll[couleur vert-bleu]`
|
||||
- les liens "jet avec caractéristiques" s'appliquent:
|
||||
- à tous les tokens sélectionnés
|
||||
- sinon, à l'acteur propriétaire (dans le cas d'un Item) ou à l'acteur courant
|
||||
- sinon, au personnage du joueur
|
||||
- on peut poster les liens dans le tchat pour proposer un jet aux joueurs
|
||||
- gestion des blocs secrets dans les descriptions
|
||||
|
||||
## 12.0.33 - la vieillesse d'Astrobazzarh
|
||||
- retour de l'expérience pour les joueurs
|
||||
- suppression du message "Pas de caractéristique" sur les jets d'odorat-goût
|
||||
|
||||
## 12.0.32 - les rêveries d'Astrobazzarh
|
||||
- Ajout des Items Race pour gérer les ajustements liés aux races
|
||||
|
||||
## 12.0.31 - le mausolée d'Astrobazzarh
|
||||
- Correction: les automatisation de combat jouer-MJ fonctionnentde nouveau
|
||||
|
||||
## 12.0.30 - le cauchemar d'Astrobazzarh
|
||||
- calcul automatique du niveau des entités selon leur rêve
|
||||
- la description des créatures venimeuses contient un lien vers leur venin
|
||||
- Correction: les messages de combats ne marchaient plus (Changement combiné Foundry + rêve de Dragon)
|
||||
|
||||
## 12.0.29 - L'indexation d'Astrobazzarh
|
||||
- les liens dans la descriptions des sorts pointent vers les sorts du compendium
|
||||
- la description du chrasme contient le lien vers son venin plutôt qu'un tableau
|
||||
|
||||
## 12.0.28 - Les réserves d'Astrobazzarh
|
||||
- possibilité de mettre en réserve depuis un sort connu
|
||||
|
||||
## 12.0.27 - Les vêtements d'Astrobazzarh
|
||||
- Ajout de la liste des armures dans l'onglet caractéristiques
|
||||
- Ajout d'une option pour choisir une carte des TMR alternatives
|
||||
- Le Gardien peut créer des sorts en réserve parmi les sorts d'un personnage
|
||||
- Bouton pour ajouter des compétences aux créatures/entités
|
||||
- Bouton pour ajouter un personnage accordé aux entités de cauchemar
|
||||
- Correction du choix d'une cible parmi toutes les cibles pour les combats
|
||||
- Correction des ajouts de blessures (prise en compte de l'endurance et des contusions)
|
||||
- Correction des rituels de Détection et Lecture d'Aura des personnages prétirés
|
||||
- Correction des invocations
|
||||
- support de "personnages" n'ayant pas toutes les compétences
|
||||
- ajout de lien entre le sort et la créature
|
||||
- correction des liens vers les journaux
|
||||
- limitation aux compétences listées
|
||||
- acteur non lié par défaut
|
||||
- Correction des compendiums
|
||||
- l'import de personnages depuis un compendium respecte les acteurs liés/non-liés
|
||||
- les modèles de voyageurs sont liés par défaut
|
||||
- les modèles de personnages non joueurs sont non-liés par défaut
|
||||
|
||||
## 12.0.26 - Astrobazzarh le Haut-rêvant
|
||||
- bouton pour le don de haut-rêve en un clic
|
||||
@ -167,7 +21,7 @@
|
||||
- les tas dans les conteneurs peuvent être désempilés sans rendre le conteneur inutilisable
|
||||
- les conteneurs ne peuvent plus être empilés (pour éviter que le contenu de Schroedinger quand on les sépare)
|
||||
- on peut maintenant saisir et supprimer les bonus de cases de manière intuitive
|
||||
|
||||
|
||||
## 12.0.23 - La bibliothèque d'Astrobazzarh
|
||||
- corrections mineures
|
||||
- meilleure gestion de la parade des armes naturelles
|
||||
@ -249,9 +103,11 @@
|
||||
- encodage de l'export en windows-1252
|
||||
- export de l'esquive avec armure et sans armure
|
||||
|
||||
## 12.0.9 - 12.0.10 - Le scriptorium d'Astrobazzarh
|
||||
## 12.0.10 - Le scriptorium d'Astrobazzarh
|
||||
- corrections de l'export scriptarium
|
||||
- ajout d'une fonction avancée pour un exporter "scriptarium" des personnages
|
||||
|
||||
## 12.0.9 - Le scriptorium d'Astrobazzarh
|
||||
- ajout d'une fonction avancée pour exporter les personnages dans un format csv
|
||||
|
||||
## 12.0.8 - La quincaillerie d'Astrobazzarh
|
||||
- le propriétaire est indiqué dans les feuilles d'équipements/compétences/...
|
||||
@ -278,7 +134,7 @@
|
||||
|
||||
## 12.0.6 - Le bazar d'Astrobazzarh
|
||||
- Corrections de l'inventaire en bazar:
|
||||
- un problème pouvait survenir en déplaçant les objets
|
||||
- un problème pouvait survenir en déplaçant les objets
|
||||
l'inventaire, qui fait qu'un conteneur se retrouve récursivement dans son
|
||||
propre contenu, ce qui empêche d'ouvrir la feuille d'acteur.
|
||||
- un objet non-conteneur pouvait dans certains cas avoir un pseudo contenu
|
||||
@ -286,7 +142,7 @@
|
||||
conteneur (et donc non affiché)
|
||||
- vider les conteneurs supprime correctement toutes les informations liées
|
||||
aux conteneurs/contenus
|
||||
- Les messages pour les tirages dans le compendium utilisent le "roll mode"
|
||||
- Les messages pour les tirages dans le compendium utilisent le "roll mode"
|
||||
courant pour leur visibilité
|
||||
- Fix: restaurer la compatibilité Foundry 11
|
||||
|
||||
@ -381,7 +237,7 @@
|
||||
|
||||
## 11.2.9 - La barbe d'Akarlikarlikar
|
||||
- Amélioration des textes de tooltips
|
||||
- Les tooltips sont plus dans le thème de couleur du système Rêve de Dragon
|
||||
- Les tooltips sont plus dans le thème de couleur du système Rêve de Dragon
|
||||
- Ajouts d'icones pour les attaque/initiative/soins dans les raccourcis sur les tokens (HUD)
|
||||
- Ajout d'une icône et transformation en bouton du lien pour accéder à l'astrologie et aux chiffres astraux
|
||||
- Suppression de message de log inutile sur chaque point de coeur
|
||||
@ -501,7 +357,7 @@ Vu qu'elles ne peuvent pas être utilisées, permet de savoir pourquoi
|
||||
- le message annonçant le joueur dont c'est le tour ne contient plus d'informations de santé
|
||||
- un message avec les informations de santé est envoyé au Gardienn et au propriétaire du token.acteur
|
||||
- le jet de vie est bien fait par le token si besoin
|
||||
- seul les propriétaires peuvent faire les jets de vie
|
||||
- seul les propriétaires peuvent faire les jets de vie
|
||||
- Amélioration de la fenêtre de jets
|
||||
- le type de dégâts pour les attaques est toujours affiché
|
||||
- le moral est indiqué avant l'icone d'appel au moral
|
||||
@ -608,3 +464,4 @@ Vu qu'elles ne peuvent pas être utilisées, permet de savoir pourquoi
|
||||
- correction des achats par le MJ sans acteur sélectionné
|
||||
|
||||
Cf branche v10 pour l'historique des versions 10
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
37
gulpfile.js
37
gulpfile.js
@ -1,37 +0,0 @@
|
||||
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;
|
Binary file not shown.
Before Width: | Height: | Size: 6.3 KiB |
@ -40,7 +40,6 @@
|
||||
"possession": "Possession",
|
||||
"potion": "Potion",
|
||||
"queue": "Queue de Dragon",
|
||||
"race": "Race",
|
||||
"recettealchimique": "Recette alchimique",
|
||||
"recettecuisine": "Recette de cuisine",
|
||||
"rencontre": "Rencontre TMR",
|
||||
|
@ -1,50 +0,0 @@
|
||||
: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);
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
/* ==================== (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 */
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +0,0 @@
|
||||
// Styles pour la feuille d'objet Monnaie
|
||||
.monnaie-content {
|
||||
|
||||
.item-sheet-common();
|
||||
.item-sheet-header();
|
||||
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
// Styles pour la feuille d'objet Monnaie
|
||||
.munition-content {
|
||||
|
||||
.item-sheet-common();
|
||||
.item-sheet-header();
|
||||
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
// Styles pour la feuille d'objet Monnaie
|
||||
.tarot-content {
|
||||
|
||||
.item-sheet-common();
|
||||
.item-sheet-header();
|
||||
|
||||
}
|
108
less/sheets.less
108
less/sheets.less
@ -1,108 +0,0 @@
|
||||
.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)
|
||||
await chatMessage.setFlag(SYSTEM_RDD, NB_LOTS, vente.nbLots)
|
||||
|
||||
const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-vente-item.hbs', vente);
|
||||
const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-vente-item.html', vente);
|
||||
chatMessage.update({ content: html });
|
||||
chatMessage.render(true);
|
||||
}
|
||||
|
||||
static async displayAchatVente(vente) {
|
||||
const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-vente-item.hbs', vente);
|
||||
const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-vente-item.html', vente);
|
||||
const chatMessage = await ChatMessage.create(RdDUtility.chatDataSetup(html))
|
||||
await chatMessage.setFlag(SYSTEM_RDD, NB_LOTS, vente.nbLots)
|
||||
await chatMessage.setFlag(SYSTEM_RDD, DETAIL_VENTE, {
|
||||
|
@ -29,7 +29,7 @@ export class DialogItemAchat extends Dialog {
|
||||
}
|
||||
|
||||
DialogItemAchat.changeNombreLots(venteData, 1)
|
||||
const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/dialog-item-achat.hbs`, venteData)
|
||||
const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/dialog-item-achat.html`, venteData)
|
||||
new DialogItemAchat(html, venteData).render(true)
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ export class DialogItemVente extends Dialog {
|
||||
quantiteIllimite: item.isItemCommerce() ? quantiteMax == undefined : !item.parent,
|
||||
isOwned: item.parent,
|
||||
}
|
||||
const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/dialog-item-vente.hbs`, venteData);
|
||||
const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/dialog-item-vente.html`, venteData);
|
||||
return new DialogItemVente(venteData, html).render(true);
|
||||
}
|
||||
|
||||
|
@ -12,25 +12,24 @@ import { RdDSheetUtility } from "./rdd-sheet-utility.js";
|
||||
import { STATUSES } from "./settings/status-effects.js";
|
||||
import { MAINS_DIRECTRICES } from "./actor.js";
|
||||
import { RdDBaseActorReveSheet } from "./actor/base-actor-reve-sheet.js";
|
||||
import { ITEM_TYPES } from "./constants.js";
|
||||
import { RdDItem } from "./item.js";
|
||||
import { RdDItemBlessure } from "./item/blessure.js";
|
||||
import { RdDEmpoignade } from "./rdd-empoignade.js";
|
||||
import { RdDBaseActorSangSheet } from "./actor/base-actor-sang-sheet.js";
|
||||
import { RdDCoeur } from "./coeur/rdd-coeur.js";
|
||||
import { AppPersonnageAleatoire } from "./actor/random/app-personnage-aleatoire.js";
|
||||
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/**
|
||||
* Extend the basic ActorSheet with some very simple modifications
|
||||
* @extends {ActorSheet}
|
||||
*/
|
||||
export class RdDActorSheet extends RdDBaseActorSangSheet {
|
||||
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
return foundry.utils.mergeObject(RdDBaseActorReveSheet.defaultOptions, {
|
||||
template: "systems/foundryvtt-reve-de-dragon/templates/actor-sheet.hbs",
|
||||
template: "systems/foundryvtt-reve-de-dragon/templates/actor-sheet.html",
|
||||
width: 550,
|
||||
showCompNiveauBase: false,
|
||||
vueArchetype: false,
|
||||
@ -45,8 +44,8 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
|
||||
cssClass: this.isEditable ? "editable" : "locked",
|
||||
limited: this.actor.limited,
|
||||
owner: this.actor.isOwner,
|
||||
biographie: await RdDTextEditor.enrichHTML(this.actor.system.biographie, this.actor),
|
||||
notes: await RdDTextEditor.enrichHTML(this.actor.system.notes, this.actor),
|
||||
biographie: await TextEditor.enrichHTML(this.actor.system.biographie, { async: true }),
|
||||
notes: await TextEditor.enrichHTML(this.actor.system.notes, { async: true }),
|
||||
});
|
||||
foundry.utils.mergeObject(formData.calc, {
|
||||
surenc: this.actor.computeMalusSurEncombrement(),
|
||||
@ -84,7 +83,7 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
|
||||
formData.combat.push(RdDItemArme.corpsACorps(actor));
|
||||
formData.combat.push(RdDItemArme.empoignade(actor));
|
||||
|
||||
formData.esquives = this.actor.getCompetencesEsquive()
|
||||
formData.esquives = this.actor.getCompetences("Esquive");
|
||||
formData.combat = RdDCombatManager.listActionsArmes(formData.combat, formData.competences, formData.system.carac);
|
||||
formData.empoignades = this.actor.getEmpoignades();
|
||||
|
||||
@ -99,7 +98,6 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
|
||||
cacheTMR: this.actor.isTMRCache()
|
||||
}
|
||||
|
||||
formData.race = actor.itemTypes[ITEM_TYPES.race].find(it => true)
|
||||
formData.subacteurs = {
|
||||
vehicules: this.actor.listeVehicules(),
|
||||
montures: this.actor.listeMontures(),
|
||||
@ -126,73 +124,80 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
|
||||
})
|
||||
|
||||
this.html.find('.show-hide-competences').click(async event => {
|
||||
this.options.showCompNiveauBase = !this.options.showCompNiveauBase
|
||||
this.render(true)
|
||||
this.options.showCompNiveauBase = !this.options.showCompNiveauBase;
|
||||
this.render(true);
|
||||
});
|
||||
|
||||
this.html.find('.button-tmr-visu').click(async event => await this.actor.displayTMR("visu"))
|
||||
this.html.find('.button-tmr-visu').click(async event => this.actor.displayTMR("visu"))
|
||||
|
||||
// Everything below here is only needed if the sheet is editable
|
||||
if (!this.options.editable) return;
|
||||
|
||||
this.html.find('.sheet-possession-attack').click(async event => {
|
||||
const poss = RdDSheetUtility.getItem(event, this.actor)
|
||||
await this.actor.conjurerPossession(poss)
|
||||
this.actor.conjurerPossession(poss)
|
||||
})
|
||||
|
||||
this.html.find('.subacteur-coeur-toggle a').click(async event => {
|
||||
const subActorIdactorId = RdDSheetUtility.getEventItemData(event, 'subactor-id')
|
||||
const coeurNombre = $(event.currentTarget).data('numero-coeur')
|
||||
await RdDCoeur.toggleSubActeurCoeur(this.actor.id, subActorIdactorId, coeurNombre)
|
||||
RdDCoeur.toggleSubActeurCoeur(this.actor.id, subActorIdactorId, coeurNombre)
|
||||
})
|
||||
this.html.find('.subacteur-tendre-moment').click(async event => {
|
||||
const subActorId = RdDSheetUtility.getEventItemData(event, 'subactor-id')
|
||||
await RdDCoeur.startSubActeurTendreMoment(this.actor.id, subActorId)
|
||||
RdDCoeur.startSubActeurTendreMoment(this.actor.id, subActorId)
|
||||
})
|
||||
this.html.find('.subacteur-delete').click(async event => {
|
||||
const li = RdDSheetUtility.getEventElement(event);
|
||||
const subActorId = li.data("subactor-id");
|
||||
this.deleteSubActeur(subActorId, li);
|
||||
})
|
||||
this.html.find("input.derivee-value[name='system.compteurs.stress.value']").change(async event =>
|
||||
await this.actor.updateCompteurValue("stress", parseInt(event.target.value))
|
||||
);
|
||||
this.html.find("input.derivee-value[name='system.compteurs.experience.value']").change(async event =>
|
||||
await this.actor.updateCompteurValue("experience", parseInt(event.target.value))
|
||||
);
|
||||
this.html.find("input.derivee-value[name='system.compteurs.stress.value']").change(async event => {
|
||||
this.actor.updateCompteurValue("stress", parseInt(event.target.value));
|
||||
});
|
||||
this.html.find("input.derivee-value[name='system.compteurs.experience.value']").change(async event => {
|
||||
this.actor.updateCompteurValue("experience", parseInt(event.target.value));
|
||||
});
|
||||
|
||||
this.html.find('.creer-tache').click(async event => await this.createEmptyTache());
|
||||
this.html.find('.creer-une-oeuvre').click(async event => await this.selectTypeOeuvreToCreate());
|
||||
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 => await RdDItemBlessure.createTacheSoinBlessure(this.actor, 4));
|
||||
this.html.find('.creer-tache-blessure-critique').click(async event => await RdDItemBlessure.createTacheSoinBlessure(this.actor, 6));
|
||||
this.html.find('.creer-tache').click(async event => this.createEmptyTache());
|
||||
this.html.find('.creer-une-oeuvre').click(async event => this.selectTypeOeuvreToCreate());
|
||||
this.html.find('.creer-tache-blessure-legere').click(async event => 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-critique').click(async event => RdDItemBlessure.createTacheSoinBlessure(this.actor, 6));
|
||||
|
||||
this.html.find('.blessure-premierssoins-done').change(async event => {
|
||||
await this.getBlessure(event)?.setSoinsBlessure({ premierssoins: { done: event.currentTarget.checked } });
|
||||
const blessure = this.getBlessure(event);
|
||||
await blessure?.setSoinsBlessure({ premierssoins: { done: event.currentTarget.checked } });
|
||||
});
|
||||
this.html.find('.blessure-soinscomplets-done').change(async event => {
|
||||
await this.getBlessure(event)?.setSoinsBlessure({ soinscomplets: { done: event.currentTarget.checked } })
|
||||
const blessure = this.getBlessure(event);
|
||||
await blessure?.setSoinsBlessure({ soinscomplets: { done: event.currentTarget.checked } })
|
||||
});
|
||||
this.html.find('.blessure-premierssoins-bonus').change(async event => {
|
||||
await this.getBlessure(event)?.setSoinsBlessure({ premierssoins: { bonus: Number(event.currentTarget.value) } })
|
||||
const blessure = this.getBlessure(event);
|
||||
await blessure?.setSoinsBlessure({ premierssoins: { bonus: Number(event.currentTarget.value) } })
|
||||
});
|
||||
this.html.find('.blessure-soinscomplets-bonus').change(async event => {
|
||||
await this.getBlessure(event)?.setSoinsBlessure({ soinscomplets: { bonus: Number(event.currentTarget.value) } })
|
||||
const blessure = this.getBlessure(event);
|
||||
await blessure?.setSoinsBlessure({ soinscomplets: { bonus: Number(event.currentTarget.value) } })
|
||||
});
|
||||
|
||||
this.html.find('.roll-chance-actuelle').click(async event => await this.actor.rollCarac('chance-actuelle'))
|
||||
this.html.find('.button-appel-chance').click(async event => await this.actor.rollAppelChance())
|
||||
// Equip Inventory Item
|
||||
this.html.find('.item-equip').click(async event => this.actor.equiperObjet(RdDSheetUtility.getItemId(event)))
|
||||
this.html.find('.chance-actuelle').click(async event => this.actor.rollCarac('chance-actuelle'))
|
||||
|
||||
this.html.find('[name="jet-astrologie"]').click(async event => await this.actor.astrologieNombresAstraux())
|
||||
this.html.find('.action-tache').click(async event => await this.actor.rollTache(RdDSheetUtility.getItemId(event)))
|
||||
this.html.find('.meditation-label a').click(async event => await this.actor.rollMeditation(RdDSheetUtility.getItemId(event)))
|
||||
this.html.find('.button-appel-chance').click(async event => this.actor.rollAppelChance())
|
||||
|
||||
this.html.find('.action-chant').click(async event => await this.actor.rollChant(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 => await this.actor.rollMusique(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 => await this.actor.rollJeu(RdDSheetUtility.getItemId(event)))
|
||||
this.html.find('.action-recettecuisine').click(async event => await this.actor.rollRecetteCuisine(RdDSheetUtility.getItemId(event)))
|
||||
this.html.find('[name="jet-astrologie"]').click(async event => this.actor.astrologieNombresAstraux())
|
||||
this.html.find('.tache-label a').click(async event => this.actor.rollTache(RdDSheetUtility.getItemId(event)))
|
||||
this.html.find('.meditation-label a').click(async event => this.actor.rollMeditation(RdDSheetUtility.getItemId(event)))
|
||||
|
||||
this.html.find('.chant-label a').click(async event => this.actor.rollChant(RdDSheetUtility.getItemId(event)))
|
||||
this.html.find('.danse-label a').click(async event => this.actor.rollDanse(RdDSheetUtility.getItemId(event)))
|
||||
this.html.find('.musique-label a').click(async event => this.actor.rollMusique(RdDSheetUtility.getItemId(event)))
|
||||
this.html.find('.oeuvre-label a').click(async event => this.actor.rollOeuvre(RdDSheetUtility.getItemId(event)))
|
||||
this.html.find('.jeu-label a').click(async event => this.actor.rollJeu(RdDSheetUtility.getItemId(event)))
|
||||
this.html.find('.recettecuisine-label a').click(async event => this.actor.rollRecetteCuisine(RdDSheetUtility.getItemId(event)))
|
||||
|
||||
this.html.find('.description-aleatoire').click(async event => new AppPersonnageAleatoire(this.actor).render(true))
|
||||
if (game.user.isGM) {
|
||||
@ -208,16 +213,17 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
|
||||
await this.actor.deleteExperienceLog(0, key + 1);
|
||||
});
|
||||
// Boutons spéciaux MJs
|
||||
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 => await this.actor.addDonDeHautReve())
|
||||
this.html.find('.afficher-tmr').click(async event => await this.actor.changeTMRVisible())
|
||||
this.html.find('.forcer-tmr-aleatoire').click(async event => this.actor.reinsertionAleatoire("Action MJ"))
|
||||
this.html.find('.don-de-haut-reve').click(async event => this.actor.addDonDeHautReve())
|
||||
this.html.find('.nouveau-sort-reserve').click(async event => this.actor.addSortReserve())
|
||||
this.html.find('.afficher-tmr').click(async event => this.actor.changeTMRVisible())
|
||||
}
|
||||
|
||||
// Points de reve actuel
|
||||
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 => await RdDEmpoignade.onAttaqueEmpoignadeFromItem(RdDSheetUtility.getItem(event, this.actor)))
|
||||
this.html.find('.roll-reve-actuel').click(async event => this.actor.rollCarac('reve-actuel', true))
|
||||
this.html.find('.empoignade-label a').click(async event => RdDEmpoignade.onAttaqueEmpoignadeFromItem(RdDSheetUtility.getItem(event, this.actor)))
|
||||
|
||||
this.html.find('.roll-arme').click(async event => await this.actor.rollArme(foundry.utils.duplicate(this._getEventArmeCombat(event)), 'competence'))
|
||||
this.html.find('.roll-arme').click(async event => this.actor.rollArme(foundry.utils.duplicate(this._getEventArmeCombat(event)), 'competence'))
|
||||
|
||||
// Initiative pour l'arme
|
||||
this.html.find('.roll-init-arme').click(async event => {
|
||||
@ -230,34 +236,30 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
|
||||
})
|
||||
// Display TMR
|
||||
|
||||
this.html.find('.button-tmr').click(async event => await this.actor.displayTMR("normal"))
|
||||
this.html.find('.button-tmr-rapide').click(async event => await this.actor.displayTMR("rapide"))
|
||||
this.html.find('.button-tmr').click(async event => this.actor.displayTMR("normal"))
|
||||
this.html.find('.button-tmr-rapide').click(async event => this.actor.displayTMR("rapide"))
|
||||
|
||||
this.html.find('.button-repos').click(async event => await this.actor.repos())
|
||||
|
||||
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 => await this.actor.updateCompetenceXPAuto(RdDSheetUtility.getItemId(event)))
|
||||
this.html.find('.competence-stress-augmenter').click(async event =>{
|
||||
await this.actor.updateCompetenceStress(RdDSheetUtility.getItemId(event))
|
||||
this.render(true)
|
||||
}
|
||||
)
|
||||
this.html.find('.carac-xp-augmenter').click(async event => 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-stress-augmenter').click(async event => this.actor.updateCompetenceStress(RdDSheetUtility.getItemId(event)))
|
||||
|
||||
if (this.options.vueDetaillee) {
|
||||
// On carac change
|
||||
this.html.find('input.carac-xp').change(async event => {
|
||||
let caracName = event.currentTarget.name.replace(".xp", "").replace("system.carac.", "")
|
||||
await this.actor.updateCaracXP(caracName, parseInt(event.target.value))
|
||||
})
|
||||
let caracName = event.currentTarget.name.replace(".xp", "").replace("system.carac.", "");
|
||||
this.actor.updateCaracXP(caracName, parseInt(event.target.value));
|
||||
});
|
||||
// On competence xp change
|
||||
this.html.find('input.competence-xp').change(async event => {
|
||||
let compName = event.currentTarget.attributes.compname.value
|
||||
await this.actor.updateCompetenceXP(compName, parseInt(event.target.value))
|
||||
})
|
||||
let compName = event.currentTarget.attributes.compname.value;
|
||||
this.actor.updateCompetenceXP(compName, parseInt(event.target.value));
|
||||
});
|
||||
this.html.find('input.competence-xp-sort').change(async event => {
|
||||
let compName = event.currentTarget.attributes.compname.value
|
||||
await this.actor.updateCompetenceXPSort(compName, parseInt(event.target.value))
|
||||
})
|
||||
let compName = event.currentTarget.attributes.compname.value;
|
||||
this.actor.updateCompetenceXPSort(compName, parseInt(event.target.value));
|
||||
});
|
||||
|
||||
this.html.find('.toggle-archetype').click(async event => {
|
||||
this.options.vueArchetype = !this.options.vueArchetype;
|
||||
@ -266,27 +268,25 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
|
||||
// On competence archetype change
|
||||
this.html.find('.competence-archetype').change(async event => {
|
||||
let compName = event.currentTarget.attributes.compname.value;
|
||||
await this.actor.updateCompetenceArchetype(compName, parseInt(event.target.value));
|
||||
this.actor.updateCompetenceArchetype(compName, parseInt(event.target.value));
|
||||
});
|
||||
this.html.find('.nouvelle-incarnation').click(async event => await this.actor.nouvelleIncarnation())
|
||||
this.html.find('.nouvelle-incarnation').click(async event => this.actor.nouvelleIncarnation())
|
||||
}
|
||||
|
||||
// On pts de reve change
|
||||
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 => await this.actor.setPointsDeSeuil(event.currentTarget.value))
|
||||
this.html.find('.pointsreve-value').change(async event => 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('.stress-test').click(async event => await this.actor.transformerStress())
|
||||
this.html.find('.moral-malheureux').click(async event => await this.actor.jetDeMoral('malheureuse'))
|
||||
this.html.find('.moral-neutre').click(async event => await this.actor.jetDeMoral('neutre'))
|
||||
this.html.find('.moral-heureux').click(async event => await this.actor.jetDeMoral('heureuse'))
|
||||
this.html.find('.button-ethylisme').click(async event => await this.actor.jetEthylisme())
|
||||
this.html.find('.stress-test').click(async event => this.actor.transformerStress())
|
||||
this.html.find('.moral-malheureux').click(async event => this.actor.jetDeMoral('malheureuse'))
|
||||
this.html.find('.moral-neutre').click(async event => this.actor.jetDeMoral('neutre'))
|
||||
this.html.find('.moral-heureux').click(async event => this.actor.jetDeMoral('heureuse'))
|
||||
this.html.find('.button-ethylisme').click(async event => this.actor.jetEthylisme())
|
||||
|
||||
this.html.find('.ptreve-actuel-plus').click(async event => await 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 => await 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 => await this.actor.santeIncDec("fatigue", 1))
|
||||
this.html.find('.fatigue-moins').click(async event => await this.actor.santeIncDec("fatigue", -1))
|
||||
this.html.find('.ptreve-actuel-plus').click(async event => this.actor.reveActuelIncDec(1))
|
||||
this.html.find('.ptreve-actuel-moins').click(async event => this.actor.reveActuelIncDec(-1))
|
||||
this.html.find('.fatigue-plus').click(async event => this.actor.santeIncDec("fatigue", 1))
|
||||
this.html.find('.fatigue-moins').click(async event => this.actor.santeIncDec("fatigue", -1))
|
||||
}
|
||||
|
||||
getBlessure(event) {
|
||||
@ -323,7 +323,7 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
|
||||
/* -------------------------------------------- */
|
||||
async selectTypeOeuvreToCreate() {
|
||||
let types = RdDItem.getTypesOeuvres();
|
||||
let content = `<span class="generic-label">Selectionnez le type d'oeuvre</span><select class="item-type">`;
|
||||
let content = `<span class="competence-label">Selectionnez le type d'oeuvre</span><select class="item-type">`;
|
||||
for (let typeName of types) {
|
||||
content += `<option value="${typeName}">${Misc.typeName('Item', typeName)}</option>`
|
||||
}
|
||||
|
662
module/actor.js
662
module/actor.js
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,4 @@
|
||||
import { RdDTextEditor } from "../apps/rdd-text-roll-editor.js";
|
||||
import { Grammar } from "../grammar.js";
|
||||
import { ITEM_TYPES } from "../constants.js";
|
||||
import { RdDSheetUtility } from "../rdd-sheet-utility.js";
|
||||
import { RdDBaseActorSheet } from "./base-actor-sheet.js";
|
||||
|
||||
@ -26,45 +24,19 @@ export class RdDBaseActorReveSheet extends RdDBaseActorSheet {
|
||||
// Everything below here is only needed if the sheet is editable
|
||||
if (!this.options.editable) return;
|
||||
|
||||
this.html.find('.button-encaissement').click(async event => await this.actor.encaisser())
|
||||
this.html.find('.button-encaissement').click(async event => this.actor.encaisser())
|
||||
this.html.find('.roll-carac').click(async event => {
|
||||
await this.actor.rollCarac(Grammar.toLowerCaseNoAccent(event.currentTarget.attributes['data-carac-name'].value))
|
||||
})
|
||||
this.html.find('.roll-competence').click(async event => await this.actor.rollCompetence(RdDSheetUtility.getItemId(event)));
|
||||
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));
|
||||
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('.endurance-moins').click(async event => this.actor.santeIncDec("endurance", -1));
|
||||
|
||||
if (game.user.isGM) {
|
||||
this.html.find('.button-remise-a-neuf').click(async event => await this.actor.remiseANeuf())
|
||||
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('.button-remise-a-neuf').click(async event => 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('.enlever-tous-effets').click(async event => await this.actor.removeEffects());
|
||||
}
|
||||
this.html.find('.competence-add').click(async event =>
|
||||
await this.actor.createEmbeddedDocuments("Item", [{
|
||||
type: ITEM_TYPES.competencecreature,
|
||||
name: 'Nouvelle competence',
|
||||
img: 'systems/foundryvtt-reve-de-dragon/icons/compcreature-serres.webp',
|
||||
system: {
|
||||
carac_value: this.actor.getForce(),
|
||||
}
|
||||
}], { renderSheet: true })
|
||||
)
|
||||
this.html.find('.roll-text').click(async event => await RdDTextEditor.rollText(event, this.actor))
|
||||
this.html.find('.chat-roll-text').click(async event => await RdDTextEditor.chatRollText(event))
|
||||
|
||||
|
||||
if (this.options.vueDetaillee) {
|
||||
// On carac change
|
||||
this.html.find('.carac-value').change(async event => {
|
||||
let caracName = event.currentTarget.name.replace(".value", "").replace("system.carac.", "")
|
||||
await this.actor.updateCarac(caracName, parseInt(event.target.value))
|
||||
});
|
||||
// On competence change
|
||||
this.html.find('.competence-value').change(async event => {
|
||||
let compName = event.currentTarget.attributes.compname.value
|
||||
await this.actor.updateCompetence(compName, parseInt(event.target.value))
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,29 +1,34 @@
|
||||
import { ENTITE_INCARNE, SHOW_DICE, SYSTEM_RDD } from "../constants.js";
|
||||
import { ChatUtility } from "../chat-utility.js";
|
||||
import { DialogValidationEncaissement } from "../dialog-validation-encaissement.js";
|
||||
import { Grammar } from "../grammar.js";
|
||||
import { RdDItemCompetence } from "../item-competence.js";
|
||||
import { Misc } from "../misc.js";
|
||||
import { RdDEmpoignade } from "../rdd-empoignade.js";
|
||||
import { RdDResolutionTable } from "../rdd-resolution-table.js";
|
||||
import { RdDEncaisser } from "../rdd-roll-encaisser.js";
|
||||
import { RdDRoll } from "../rdd-roll.js";
|
||||
import { RdDUtility } from "../rdd-utility.js";
|
||||
import { ReglesOptionnelles } from "../settings/regles-optionnelles.js";
|
||||
import { RdDBaseActor } from "./base-actor.js";
|
||||
import { ITEM_TYPES } from "../constants.js";
|
||||
import { RdDItemCompetence } from "../item-competence.js";
|
||||
import { RdDItemCompetenceCreature } from "../item-competencecreature.js";
|
||||
import { RdDItemArme } from "../item-arme.js";
|
||||
import { StatusEffects } from "../settings/status-effects.js";
|
||||
import { ITEM_TYPES } from "../item.js";
|
||||
import { Targets } from "../targets.js";
|
||||
import { RdDConfirm } from "../rdd-confirm.js";
|
||||
import { RdDCarac } from "../rdd-carac.js";
|
||||
import { RdDRollResult } from "../rdd-roll-result.js";
|
||||
|
||||
import { ChatUtility } from "../chat-utility.js";
|
||||
import { DialogValidationEncaissement } from "../dialog-validation-encaissement.js";
|
||||
import { RdDCombat } from "../rdd-combat.js";
|
||||
import { RdDEmpoignade } from "../rdd-empoignade.js";
|
||||
import { RdDPossession } from "../rdd-possession.js";
|
||||
import { BASE_CORPS_A_CORPS, BASE_ESQUIVE, POSSESSION_SANS_DRACONIC } from "../item/base-items.js";
|
||||
import { RollDataAjustements } from "../rolldata-ajustements.js";
|
||||
import { RdDCombat, RdDCombatManager } from "../rdd-combat.js";
|
||||
import { RdDConfirm } from "../rdd-confirm.js";
|
||||
import { ENTITE_INCARNE, SHOW_DICE, SYSTEM_RDD } from "../constants.js";
|
||||
import { RdDItemArme } from "../item-arme.js";
|
||||
import { RdDCarac } from "../rdd-carac.js";
|
||||
|
||||
const POSSESSION_SANS_DRACONIC = {
|
||||
img: 'systems/foundryvtt-reve-de-dragon/icons/entites/possession.webp',
|
||||
name: 'Sans draconic',
|
||||
system: {
|
||||
niveau: 0,
|
||||
defaut_carac: "reve-actuel",
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Classe de base pour les acteurs disposant de rêve (donc, pas des objets)
|
||||
@ -39,15 +44,6 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
||||
this.system.sante.endurance.value = Math.min(this.system.sante.endurance.value, this.system.sante.endurance.max)
|
||||
}
|
||||
|
||||
getCarac() {
|
||||
return foundry.utils.mergeObject(this.system.carac,
|
||||
{
|
||||
'reve-actuel': this.getCaracReveActuel(),
|
||||
'chance-actuelle': this.getCaracChanceActuelle()
|
||||
},
|
||||
{ inplace: false })
|
||||
}
|
||||
|
||||
getCaracChanceActuelle() {
|
||||
return {
|
||||
label: 'Chance actuelle',
|
||||
@ -64,6 +60,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
getTaille() { return Misc.toInt(this.system.carac.taille?.value) }
|
||||
getConstitution() { return this.getReve() }
|
||||
getForce() { return this.getReve() }
|
||||
@ -166,24 +163,24 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
||||
}
|
||||
return RdDItemCompetence.findCompetence(this.items, idOrName, options)
|
||||
}
|
||||
|
||||
getCompetences(name, options = { onMessage: message => { } }) {
|
||||
return RdDItemCompetence.findCompetences(this.items, name, options)
|
||||
getCompetences(name) {
|
||||
return RdDItemCompetence.findCompetences(this.items, name)
|
||||
}
|
||||
|
||||
getCompetenceCorpsACorps(options = { onMessage: message => { } }) {
|
||||
return this.getCompetence(BASE_CORPS_A_CORPS.name, options) ?? BASE_CORPS_A_CORPS
|
||||
getCompetenceCorpsACorps(options = {}) {
|
||||
return this.getCompetence("Corps à corps", options)
|
||||
}
|
||||
|
||||
getCompetencesEsquive(options = { onMessage: message => { } }) {
|
||||
return this.getCompetences(BASE_ESQUIVE.name, options) ?? [BASE_ESQUIVE]
|
||||
getCompetencesEsquive() {
|
||||
return this.getCompetences("esquive")
|
||||
}
|
||||
|
||||
getArmeParade(armeParadeId) {
|
||||
return RdDItemArme.getArme(armeParadeId ? this.getEmbeddedDocument('Item', armeParadeId) : undefined)
|
||||
const item = armeParadeId ? this.getEmbeddedDocument('Item', armeParadeId) : undefined;
|
||||
return RdDItemArme.getArme(item);
|
||||
}
|
||||
|
||||
getDraconicOuPossession() { return POSSESSION_SANS_DRACONIC }
|
||||
getDraconicOuPossession() {
|
||||
return POSSESSION_SANS_DRACONIC
|
||||
}
|
||||
|
||||
getPossession(possessionId) {
|
||||
return this.itemTypes[ITEM_TYPES.possession].find(it => it.system.possessionid == possessionId);
|
||||
@ -269,70 +266,32 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async openRollDialog({ name, label, template, rollData, callbacks }) {
|
||||
async openRollDialog({ name, label, template, rollData, callbackAction }) {
|
||||
const dialog = await RdDRoll.create(this, rollData,
|
||||
{ html: template, close: async html => await this._onCloseRollDialog(html) },
|
||||
{ name: name, label: label, callbacks: [this.createCallbackExperience(), this.createCallbackAppelAuMoral()].concat(callbacks) })
|
||||
dialog.render(true)
|
||||
{
|
||||
name: name,
|
||||
label: label,
|
||||
callbacks: [
|
||||
this.createCallbackExperience(),
|
||||
this.createCallbackAppelAuMoral(),
|
||||
{ action: callbackAction }
|
||||
]
|
||||
});
|
||||
dialog.render(true);
|
||||
return dialog
|
||||
}
|
||||
|
||||
createCallbackExperience() { return { action: r => { } } }
|
||||
createCallbackAppelAuMoral() { return { action: r => { } } }
|
||||
|
||||
createEmptyCallback() {
|
||||
return {
|
||||
condition: r => false,
|
||||
action: r => { }
|
||||
};
|
||||
}
|
||||
createCallbackExperience() { return this.createEmptyCallback(); }
|
||||
createCallbackAppelAuMoral() { return this.createEmptyCallback(); }
|
||||
async _onCloseRollDialog(html) { }
|
||||
|
||||
async rollCaracCompetence(caracName, compName, diff, options = { title: "" }) {
|
||||
RdDEmpoignade.checkEmpoignadeEnCours(this)
|
||||
const competence = this.getCompetence(compName);
|
||||
await this.openRollDialog({
|
||||
name: 'jet-competence',
|
||||
label: competence ? 'Jet ' + Grammar.apostrophe('de', competence.name) : `Jet sans compétence (${compName})`,
|
||||
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 ?? '' }
|
||||
},
|
||||
callbacks: [async r => this.$onRollCompetence(r, options)]
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Méthode pour faire un jet prédéterminer sans ouvrir la fenêtre de dialogue
|
||||
* @param {*} caracName code ou label de la caractéristique. On peut utiliser 'intel' pour Intellect.
|
||||
* @param {*} compName nom de compétence ou nom abrégé.
|
||||
* @param {*} diff difficulté (0 si undefined)
|
||||
* @param {*} options
|
||||
* @returns le jet effectué
|
||||
*/
|
||||
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 ?? 0,
|
||||
show: { title: options?.title ?? '' }
|
||||
}
|
||||
RollDataAjustements.calcul(rollData, this);
|
||||
await RdDResolutionTable.rollData(rollData);
|
||||
this.gererExperience(rollData);
|
||||
await RdDResolutionTable.displayRollData(rollData, this)
|
||||
return rollData.rolled;
|
||||
}
|
||||
|
||||
gererExperience(rollData) { }
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async roll() {
|
||||
RdDEmpoignade.checkEmpoignadeEnCours(this)
|
||||
@ -341,56 +300,61 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
||||
const selectedCaracName = ['apparence', 'perception', 'force', 'reve'].find(it => carac[it] != undefined)
|
||||
|
||||
await this.openRollDialog({
|
||||
name: `jet-${this.id}`,
|
||||
label: `Jet de ${this.getAlias()}`,
|
||||
template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll.html',
|
||||
rollData: {
|
||||
alias: this.getAlias(),
|
||||
carac: carac,
|
||||
selectedCarac: carac[selectedCaracName],
|
||||
selectedCaracName: selectedCaracName,
|
||||
competences: this.itemTypes['competence']
|
||||
},
|
||||
callbacks: [{ action: r => this.$onRollCaracResult(r) }]
|
||||
})
|
||||
callbackAction: r => this.$onRollCaracResult(r)
|
||||
});
|
||||
}
|
||||
|
||||
getCarac() {
|
||||
// TODO: le niveau d'une entité de cauchemar devrait être exclu...
|
||||
return foundry.utils.mergeObject(this.system.carac,
|
||||
{
|
||||
'reve-actuel': this.getCaracReveActuel(),
|
||||
'chance-actuelle': this.getCaracChanceActuelle()
|
||||
},
|
||||
{ inplace: false })
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollCarac(caracName, options = {}) {
|
||||
async rollCarac(caracName, jetResistance = undefined) {
|
||||
if (Grammar.equalsInsensitive(caracName, 'taille')) {
|
||||
return
|
||||
}
|
||||
foundry.utils.mergeObject(options, { resistance: false, diff: 0 }, { overwrite: false })
|
||||
RdDEmpoignade.checkEmpoignadeEnCours(this)
|
||||
let selectedCarac = this.getCaracByName(caracName)
|
||||
const title = 'Jet ' + Grammar.apostrophe('de', selectedCarac.label);
|
||||
const jetResistance = options.resistance ? caracName : undefined;
|
||||
console.log("selectedCarac", selectedCarac)
|
||||
await this.openRollDialog({
|
||||
name: 'jet-' + caracName,
|
||||
label: title,
|
||||
template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.hbs',
|
||||
label: 'Jet ' + Grammar.apostrophe('de', selectedCarac.label),
|
||||
template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html',
|
||||
rollData: {
|
||||
alias: this.getAlias(),
|
||||
selectedCarac: selectedCarac,
|
||||
competences: this.itemTypes['competence'],
|
||||
diffLibre: options.diff ?? 0,
|
||||
jetResistance: jetResistance
|
||||
jetResistance: jetResistance ? caracName : undefined
|
||||
},
|
||||
callbacks: [{ action: r => this.$onRollCaracResult(r) }]
|
||||
callbackAction: r => this.$onRollCaracResult(r)
|
||||
});
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async $onRollCaracResult(rollData) {
|
||||
// Final chat message
|
||||
await RdDRollResult.displayRollData(rollData, this, 'chat-resultat-general.hbs');
|
||||
await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-general.html');
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollCompetence(idOrName, options = { tryTarget: true, arme: undefined }) {
|
||||
RdDEmpoignade.checkEmpoignadeEnCours(this)
|
||||
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) {
|
||||
const token = RdDUtility.getSelectedToken(this)
|
||||
const arme = RdDItemCompetenceCreature.armeCreature(competence)
|
||||
@ -408,18 +372,18 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
||||
// Transformer la competence de créature
|
||||
RdDItemCompetenceCreature.setRollDataCreature(rollData)
|
||||
}
|
||||
const dialogLabel = 'Jet ' + Grammar.apostrophe('de', competence.name);
|
||||
|
||||
await this.openRollDialog({
|
||||
name: 'jet-competence',
|
||||
label: dialogLabel,
|
||||
template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.hbs',
|
||||
label: 'Jet ' + Grammar.apostrophe('de', competence.name),
|
||||
template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.html',
|
||||
rollData: rollData,
|
||||
callbacks: [{ action: r => this.$onRollCompetence(r, options) }]
|
||||
callbackAction: r => this.$onRollCompetence(r, options)
|
||||
});
|
||||
}
|
||||
|
||||
async $onRollCompetence(rollData, options) {
|
||||
await RdDRollResult.displayRollData(rollData, this, 'chat-resultat-competence.hbs')
|
||||
await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-competence.html')
|
||||
if (options?.onRollAutomate) {
|
||||
options.onRollAutomate(rollData);
|
||||
}
|
||||
@ -519,7 +483,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
||||
await ChatUtility.createChatWithRollMode(
|
||||
{
|
||||
roll: encaissement.roll,
|
||||
content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-resultat-encaissement.hbs', encaissement)
|
||||
content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-resultat-encaissement.html', encaissement)
|
||||
},
|
||||
this
|
||||
)
|
||||
@ -529,7 +493,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
||||
encaissement.isGM = true
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getGMs(),
|
||||
content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-resultat-encaissement.hbs', encaissement)
|
||||
content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-resultat-encaissement.html', encaissement)
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -542,7 +506,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
||||
|| entite.isEntiteAccordee(this)) {
|
||||
return true;
|
||||
}
|
||||
const rolled = await RdDResolutionTable.roll(this.getReveActuel(), - Number(entite.getNiveau()));
|
||||
const rolled = await RdDResolutionTable.roll(this.getReveActuel(), - Number(entite.system.carac.niveau.value));
|
||||
const rollData = {
|
||||
alias: this.getAlias(),
|
||||
rolled: rolled,
|
||||
@ -554,8 +518,10 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
||||
await entite.setEntiteReveAccordee(this);
|
||||
}
|
||||
|
||||
await RdDRollResult.displayRollData(rollData, this, 'chat-resultat-accorder-cauchemar.hbs');
|
||||
await this.appliquerAjoutExperience(rollData, true);
|
||||
await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-accorder-cauchemar.html');
|
||||
if (rolled.isPart) {
|
||||
await this.appliquerAjoutExperience(rollData, true);
|
||||
}
|
||||
return rolled.isSuccess;
|
||||
}
|
||||
|
||||
|
@ -17,20 +17,20 @@ export class RdDBaseActorSangSheet extends RdDBaseActorReveSheet {
|
||||
// Everything below here is only needed if the sheet is editable
|
||||
if (!this.options.editable) return;
|
||||
|
||||
this.html.find('.creer-blessure-legere').click(async event => await RdDItemBlessure.createBlessure(this.actor, 2));
|
||||
this.html.find('.creer-blessure-grave').click(async event => await RdDItemBlessure.createBlessure(this.actor, 4));
|
||||
this.html.find('.creer-blessure-critique').click(async event => await RdDItemBlessure.createBlessure(this.actor, 6));
|
||||
this.html.find('.creer-blessure-legere').click(async event => RdDItemBlessure.createBlessure(this.actor, 2));
|
||||
this.html.find('.creer-blessure-grave').click(async event => RdDItemBlessure.createBlessure(this.actor, 4));
|
||||
this.html.find('.creer-blessure-critique').click(async event => RdDItemBlessure.createBlessure(this.actor, 6));
|
||||
|
||||
this.html.find('.subir-blessure-contusion').click(async event => await RdDItemBlessure.applyFullBlessure(this.actor, 0));
|
||||
this.html.find('.subir-blessure-legere').click(async event => await RdDItemBlessure.applyFullBlessure(this.actor, 2));
|
||||
this.html.find('.subir-blessure-grave').click(async event => await RdDItemBlessure.applyFullBlessure(this.actor, 4));
|
||||
this.html.find('.subir-blessure-critique').click(async event => await RdDItemBlessure.applyFullBlessure(this.actor, 6));
|
||||
this.html.find('.subir-blessure-contusion').click(async event => RdDItemBlessure.applyFullBlessure(this.actor, 0));
|
||||
this.html.find('.subir-blessure-legere').click(async event => RdDItemBlessure.applyFullBlessure(this.actor, 2));
|
||||
this.html.find('.subir-blessure-grave').click(async event => RdDItemBlessure.applyFullBlessure(this.actor, 4));
|
||||
this.html.find('.subir-blessure-critique').click(async event => RdDItemBlessure.applyFullBlessure(this.actor, 6));
|
||||
|
||||
this.html.find('.jet-vie').click(async event => await this.actor.jetDeVie())
|
||||
this.html.find('.jet-vie').click(async event => this.actor.jetDeVie())
|
||||
this.html.find('.jet-endurance').click(async event => await this.jetEndurance())
|
||||
|
||||
this.html.find('.vie-plus').click(async event => await this.actor.santeIncDec("vie", 1))
|
||||
this.html.find('.vie-moins').click(async event => await this.actor.santeIncDec("vie", -1))
|
||||
this.html.find('.vie-plus').click(async event => this.actor.santeIncDec("vie", 1))
|
||||
this.html.find('.vie-moins').click(async event => this.actor.santeIncDec("vie", -1))
|
||||
}
|
||||
|
||||
async jetEndurance() {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { RdDUtility } from "../rdd-utility.js";
|
||||
import { MAX_ENDURANCE_FATIGUE, RdDUtility } from "../rdd-utility.js";
|
||||
import { ReglesOptionnelles } from "../settings/regles-optionnelles.js";
|
||||
import { STATUSES } from "../settings/status-effects.js";
|
||||
import { ITEM_TYPES } from "../constants.js";
|
||||
import { ITEM_TYPES } from "../item.js";
|
||||
import { RdDBaseActorReve } from "./base-actor-reve.js";
|
||||
import { RdDDice } from "../rdd-dice.js";
|
||||
import { RdDItemBlessure } from "../item/blessure.js";
|
||||
@ -39,12 +39,7 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
|
||||
return 0;
|
||||
}
|
||||
|
||||
isCumulFatigueCauseSommeil(cumulFatigue){
|
||||
return ReglesOptionnelles.isUsing("appliquer-fatigue")
|
||||
? (this.getFatigueRestante() <= cumulFatigue)
|
||||
: (this.getEnduranceActuelle() <= cumulFatigue)
|
||||
}
|
||||
getFatigueRestante() {return this.getFatigueMax() - this.getFatigueActuelle() }
|
||||
getFatigueRestante() { return this.getFatigueMax() - this.getFatigueActuelle() }
|
||||
getFatigueMin() { return this.system.sante.endurance.max - this.system.sante.endurance.value }
|
||||
|
||||
malusFatigue() {
|
||||
|
@ -3,23 +3,19 @@ import { Misc } from "../misc.js";
|
||||
import { DialogSplitItem } from "../dialog-split-item.js";
|
||||
import { RdDSheetUtility } from "../rdd-sheet-utility.js";
|
||||
import { Monnaie } from "../item-monnaie.js";
|
||||
import { ITEM_TYPES } from "../constants.js";
|
||||
import { RdDItem } from "../item.js";
|
||||
import { RdDItem, ITEM_TYPES } from "../item.js";
|
||||
import { RdDItemCompetenceCreature } from "../item-competencecreature.js";
|
||||
import { RdDTextEditor } from "../apps/rdd-text-roll-editor.js";
|
||||
import { ItemAction } from "../item/item-actions.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/**
|
||||
* Extend the basic ActorSheet with some very simple modifications
|
||||
* @extends {ActorSheet}
|
||||
*/
|
||||
export class RdDBaseActorSheet extends foundry.appv1.sheets.ActorSheet {
|
||||
static _warnedAppV1 = true
|
||||
export class RdDBaseActorSheet extends ActorSheet {
|
||||
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
return foundry.utils.mergeObject(foundry.appv1.sheets.ActorSheet.defaultOptions, {
|
||||
return foundry.utils.mergeObject(ActorSheet.defaultOptions, {
|
||||
classes: ["rdd", "sheet", "actor"],
|
||||
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac" }],
|
||||
dragDrop: [{ dragSelector: ".item-list .item", dropSelector: undefined }],
|
||||
@ -29,7 +25,7 @@ export class RdDBaseActorSheet extends foundry.appv1.sheets.ActorSheet {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async getData() {
|
||||
Monnaie.validerMonnaies(this.actor)
|
||||
Monnaie.validerMonnaies(this.actor.itemTypes['monnaie']);
|
||||
|
||||
this.actor.computeEtatGeneral();
|
||||
let formData = {
|
||||
@ -39,13 +35,13 @@ export class RdDBaseActorSheet extends foundry.appv1.sheets.ActorSheet {
|
||||
img: this.actor.img,
|
||||
name: this.actor.name,
|
||||
system: this.actor.system,
|
||||
description: await RdDTextEditor.enrichHTML(this.actor.system.description, this.actor),
|
||||
notesmj: await RdDTextEditor.enrichHTML(this.actor.system.notesmj, this.actor),
|
||||
description: await TextEditor.enrichHTML(this.actor.system.description, { async: true }),
|
||||
notesmj: await TextEditor.enrichHTML(this.actor.system.notesmj, { async: true }),
|
||||
options: RdDSheetUtility.mergeDocumentRights(this.options, this.actor, this.isEditable),
|
||||
effects: this.actor.effects
|
||||
}
|
||||
|
||||
RdDUtility.filterItemsPerTypeForSheet(formData, this.actor.itemTypes);
|
||||
RdDBaseActorSheet.filterItemsPerTypeForSheet(formData, this.actor.itemTypes);
|
||||
formData.calc = {
|
||||
fortune: Monnaie.toSolsDeniers(this.actor.getFortune()),
|
||||
prixTotalEquipement: this.actor.computePrixTotalEquipement(),
|
||||
@ -57,7 +53,6 @@ export class RdDBaseActorSheet extends foundry.appv1.sheets.ActorSheet {
|
||||
formData.conteneurs = RdDUtility.conteneursRacine(formData.conteneurs);
|
||||
formData.competences.filter(it => it.type == ITEM_TYPES.competencecreature)
|
||||
.forEach(it => it.isdommages = RdDItemCompetenceCreature.isDommages(it))
|
||||
|
||||
return formData;
|
||||
}
|
||||
|
||||
@ -81,49 +76,122 @@ export class RdDBaseActorSheet extends foundry.appv1.sheets.ActorSheet {
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static filterItemsPerTypeForSheet(formData, itemTypes) {
|
||||
formData.blessures = Misc.arrayOrEmpty(itemTypes['blessure']);
|
||||
formData.recettescuisine = Misc.arrayOrEmpty(itemTypes['recettecuisine']);
|
||||
formData.recettesAlchimiques = Misc.arrayOrEmpty(itemTypes['recettealchimique']);
|
||||
formData.maladies = Misc.arrayOrEmpty(itemTypes['maladie']);
|
||||
formData.poisons = Misc.arrayOrEmpty(itemTypes['poison']);
|
||||
formData.possessions = Misc.arrayOrEmpty(itemTypes['possession']);
|
||||
formData.maladiesPoisons = formData.maladies.concat(formData.poisons);
|
||||
formData.competences = (itemTypes['competence'] ?? []).concat(itemTypes['competencecreature'] ?? []);
|
||||
formData.sortsReserve = Misc.arrayOrEmpty(itemTypes['sortreserve']);
|
||||
|
||||
formData.sorts = Misc.arrayOrEmpty(itemTypes['sort']);
|
||||
formData.rencontres = Misc.arrayOrEmpty(itemTypes['rencontre']);
|
||||
formData.casestmr = Misc.arrayOrEmpty(itemTypes['casetmr']);
|
||||
formData.signesdraconiques = Misc.arrayOrEmpty(itemTypes['signedraconique']);
|
||||
formData.queues = Misc.arrayOrEmpty(itemTypes['queue']);
|
||||
formData.souffles = Misc.arrayOrEmpty(itemTypes['souffle']);
|
||||
formData.ombres = Misc.arrayOrEmpty(itemTypes['ombre']);
|
||||
formData.tetes = Misc.arrayOrEmpty(itemTypes['tete']);
|
||||
formData.taches = Misc.arrayOrEmpty(itemTypes['tache']);
|
||||
formData.meditations = Misc.arrayOrEmpty(itemTypes['meditation']);
|
||||
formData.chants = Misc.arrayOrEmpty(itemTypes['chant']);
|
||||
formData.danses = Misc.arrayOrEmpty(itemTypes['danse']);
|
||||
formData.musiques = Misc.arrayOrEmpty(itemTypes['musique']);
|
||||
formData.oeuvres = Misc.arrayOrEmpty(itemTypes['oeuvre']);
|
||||
formData.jeux = Misc.arrayOrEmpty(itemTypes['jeu']);
|
||||
|
||||
formData.services = Misc.arrayOrEmpty(itemTypes['service']);
|
||||
formData.conteneurs = Misc.arrayOrEmpty(itemTypes['conteneur']);
|
||||
formData.materiel = Misc.arrayOrEmpty(itemTypes['objet']);
|
||||
formData.armes = Misc.arrayOrEmpty(itemTypes['arme']);
|
||||
formData.armures = Misc.arrayOrEmpty(itemTypes['armure']);
|
||||
formData.munitions = Misc.arrayOrEmpty(itemTypes['munition']);
|
||||
formData.livres = Misc.arrayOrEmpty(itemTypes['livre']);
|
||||
formData.potions = Misc.arrayOrEmpty(itemTypes['potion']);
|
||||
formData.plantes = Misc.arrayOrEmpty(itemTypes['plante']);
|
||||
formData.ingredients = Misc.arrayOrEmpty(itemTypes['ingredient']);
|
||||
formData.faunes = Misc.arrayOrEmpty(itemTypes['faune']);
|
||||
formData.herbes = Misc.arrayOrEmpty(itemTypes['herbe']);
|
||||
formData.nourritureboissons = Misc.arrayOrEmpty(itemTypes['nourritureboisson']);
|
||||
formData.gemmes = Misc.arrayOrEmpty(itemTypes['gemme']);
|
||||
formData.monnaies = Misc.arrayOrEmpty(itemTypes['monnaie']).sort(Monnaie.triValeurEntiere());
|
||||
formData.objets = Misc.arrayOrEmpty(itemTypes['objet'])
|
||||
|
||||
formData.inventaires = RdDItem.getItemTypesInventaire('all')
|
||||
.map(t => Misc.arrayOrEmpty(itemTypes[t]))
|
||||
.reduce((a, b) => a.concat(b), [])
|
||||
.sort(Misc.ascending(it => it.name));
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */ /** @override */
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
this.html = html;
|
||||
|
||||
this.html.find('.actionItem').click(async event => await ItemAction.onActionItem(event, this.actor, this.options))
|
||||
this.html.find('.item-edit').click(async event => await this.itemActionEdit(event))
|
||||
this.html.find('.conteneur-name a').click(async event => {
|
||||
RdDUtility.toggleAfficheContenu(this.getItemId(event))
|
||||
this.render(true)
|
||||
})
|
||||
|
||||
this.html.find('.actor-montrer').click(async event => await this.actor.postActorToChat());
|
||||
RdDUtility.toggleAfficheContenu(this.getItemId(event));
|
||||
this.render(true);
|
||||
});
|
||||
this.html.find('.actor-montrer').click(async event => this.actor.postActorToChat());
|
||||
this.html.find('.item-edit').click(async event => this.getItem(event)?.sheet.render(true))
|
||||
this.html.find('.item-montrer').click(async event => this.getItem(event)?.postItemToChat());
|
||||
|
||||
this.html.find('.recherche')
|
||||
.each((index, field) => {
|
||||
this._rechercheSelectArea(field);
|
||||
})
|
||||
.keyup(async event => this._rechercherKeyup(event))
|
||||
.change(async event => this._rechercherKeyup(event))
|
||||
|
||||
this.html.find('.recherche').prop("disabled", false)
|
||||
.change(async event => this._rechercherKeyup(event));
|
||||
this.html.find('.recherche').prop("disabled", false);
|
||||
|
||||
// Everything below here is only needed if the sheet is editable
|
||||
if (!this.options.editable) return;
|
||||
|
||||
this.html.find('.item-equip-armure').click(async event => await this.actor.equiperObjet(this.getItem(event)))
|
||||
this.html.find('.item-delete').click(async event => await RdDUtility.confirmActorItemDelete(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-moins').click(async event => await this.actor.itemQuantiteIncDec(this.getItemId(event), -1));
|
||||
this.html.find('.item-action').click(async event => {
|
||||
const item = RdDSheetUtility.getItem(event, this.actor);
|
||||
item?.actionPrincipale(this.actor, async () => this.render())
|
||||
});
|
||||
|
||||
this.html.find('.creer-un-objet').click(async event => await this.selectObjetTypeToCreate())
|
||||
this.html.find('.nettoyer-conteneurs').click(async event => await this.actor.nettoyerConteneurs())
|
||||
|
||||
this.html.find('.item-split').click(async event => {
|
||||
const item = this.getItem(event);
|
||||
RdDSheetUtility.splitItem(item, this.actor);
|
||||
});
|
||||
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 => this.actor.itemQuantiteIncDec(this.getItemId(event), -1));
|
||||
this.html.find('.item-delete').click(async event => RdDUtility.confirmActorItemDelete(this, this.getItem(event)));
|
||||
this.html.find('.item-vendre').click(async event => this.vendre(this.getItem(event)));
|
||||
|
||||
this.html.find('.creer-un-objet').click(async event => {
|
||||
this.selectObjetTypeToCreate();
|
||||
});
|
||||
this.html.find('.nettoyer-conteneurs').click(async event => {
|
||||
this.actor.nettoyerConteneurs();
|
||||
});
|
||||
|
||||
this.html.find('.vue-detaillee').click(async event => {
|
||||
this.options.vueDetaillee = !this.options.vueDetaillee
|
||||
this.render(true)
|
||||
this.options.vueDetaillee = !this.options.vueDetaillee;
|
||||
this.render(true);
|
||||
});
|
||||
}
|
||||
|
||||
itemActionEdit(event) {
|
||||
const item = this.getItem(event);
|
||||
return item?.sheet.render(true);
|
||||
if (this.options.vueDetaillee) {
|
||||
// On carac change
|
||||
this.html.find('.carac-value').change(async event => {
|
||||
let caracName = event.currentTarget.name.replace(".value", "").replace("system.carac.", "");
|
||||
this.actor.updateCarac(caracName, parseInt(event.target.value));
|
||||
});
|
||||
// On competence change
|
||||
this.html.find('.competence-value').change(async event => {
|
||||
let compName = event.currentTarget.attributes.compname.value;
|
||||
//console.log("Competence changed :", compName);
|
||||
this.actor.updateCompetence(compName, parseInt(event.target.value));
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_rechercherKeyup(event) {
|
||||
@ -192,7 +260,7 @@ export class RdDBaseActorSheet extends foundry.appv1.sheets.ActorSheet {
|
||||
/* -------------------------------------------- */
|
||||
async selectObjetTypeToCreate() {
|
||||
let types = this.getTypesInventaire().sort(Misc.ascending(type => Misc.typeName('Item', type)));
|
||||
let content = `<span class="generic-label">Selectionnez le type d'équipement</span><select class="item-type">`;
|
||||
let content = `<span class="competence-label">Selectionnez le type d'équipement</span><select class="item-type">`;
|
||||
for (let typeName of types) {
|
||||
content += `<option value="${typeName}">${Misc.typeName('Item', typeName)}</option>`
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ import { ChatUtility } from "../chat-utility.js";
|
||||
import { SYSTEM_SOCKET_ID } from "../constants.js";
|
||||
import { Grammar } from "../grammar.js";
|
||||
import { Monnaie } from "../item-monnaie.js";
|
||||
import { ITEM_TYPES } from "../constants.js";
|
||||
import { ITEM_TYPES } from "../item.js";
|
||||
import { Misc } from "../misc.js";
|
||||
import { RdDAudio } from "../rdd-audio.js";
|
||||
import { RdDConfirm } from "../rdd-confirm.js";
|
||||
@ -21,7 +21,7 @@ export class RdDBaseActor extends Actor {
|
||||
|
||||
static $findCaracByName(carac, name) {
|
||||
const caracList = Object.entries(carac);
|
||||
let entry = Misc.findFirstLike(name, caracList, { mapper: it => it[0], description: 'caractéristique', onMessage: m => { } });
|
||||
let entry = Misc.findFirstLike(name, caracList, { mapper: it => it[0], description: 'caractéristique' });
|
||||
if (!entry || entry.length == 0) {
|
||||
entry = Misc.findFirstLike(name, caracList, { mapper: it => it[1].label, description: 'caractéristique' });
|
||||
}
|
||||
@ -81,6 +81,7 @@ export class RdDBaseActor extends Actor {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static getRealActor(actorId, tokenId) {
|
||||
if (tokenId) {
|
||||
let token = canvas.tokens.get(tokenId)
|
||||
@ -160,11 +161,8 @@ export class RdDBaseActor extends Actor {
|
||||
return RdDBaseActor.$findCaracByName(carac, name);
|
||||
}
|
||||
|
||||
mapCarac(caracCode) { return caracCode }
|
||||
|
||||
getCaracByName(name) {
|
||||
name = this.mapCarac(Grammar.toLowerCaseNoAccent(name))
|
||||
switch (name) {
|
||||
switch (Grammar.toLowerCaseNoAccent(name)) {
|
||||
case 'reve-actuel': case 'reve actuel':
|
||||
return this.getCaracReveActuel();
|
||||
case 'chance-actuelle': case 'chance-actuelle':
|
||||
@ -178,19 +176,11 @@ export class RdDBaseActor extends Actor {
|
||||
await super._preCreate(data, options, user);
|
||||
|
||||
// Configure prototype token settings
|
||||
if (this.type === "personnage") {
|
||||
this.updateSource({
|
||||
sight: { enabled: true },
|
||||
actorLink: options.fromCompendium ? data.prototypeToken.actorLink : true,
|
||||
disposition: CONST.TOKEN_DISPOSITIONS.FRIENDLY
|
||||
})
|
||||
} else {
|
||||
const prototypeToken = {
|
||||
sight: { enabled: true },
|
||||
disposition: CONST.TOKEN_DISPOSITIONS.NEUTRAL
|
||||
}
|
||||
this.updateSource({ prototypeToken });
|
||||
}
|
||||
const prototypeToken = {};
|
||||
if (this.type === "personnage") Object.assign(prototypeToken, {
|
||||
sight: { enabled: true }, actorLink: true, disposition: CONST.TOKEN_DISPOSITIONS.FRIENDLY
|
||||
});
|
||||
this.updateSource({ prototypeToken });
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -244,19 +234,16 @@ export class RdDBaseActor extends Actor {
|
||||
async onUpdateActor(update, options, actorId) { }
|
||||
async onDeleteItem(item, options, id) {
|
||||
if (item.isInventaire()) {
|
||||
await this._removeItemFromConteneur(item)
|
||||
this._removeItemFromConteneur(item)
|
||||
}
|
||||
}
|
||||
|
||||
async _removeItemFromConteneur(item) {
|
||||
const updates = this.items.filter(it => it.isConteneur() && it.system.contenu.includes(item.id))
|
||||
.map(conteneur => {
|
||||
const nouveauContenu = conteneur.system.contenu.filter(id => id != item.id)
|
||||
return { _id: conteneur.id, 'system.contenu': nouveauContenu }
|
||||
})
|
||||
if (updates.length > 0) {
|
||||
await this.updateEmbeddedDocuments('Item', updates)
|
||||
}
|
||||
_removeItemFromConteneur(item) {
|
||||
this.items.filter(it => it.isConteneur() && it.system.contenu.includes(item.id))
|
||||
.forEach(conteneur => {
|
||||
const nouveauContenu = conteneur.system.contenu.filter(id => id != item.id);
|
||||
conteneur.update({ 'system.contenu': nouveauContenu });
|
||||
});
|
||||
}
|
||||
|
||||
async onTimeChanging(oldTimestamp, newTimestamp) {
|
||||
@ -417,7 +404,7 @@ export class RdDBaseActor extends Actor {
|
||||
user: achat.userId,
|
||||
speaker: { alias: (acheteur ?? vendeur).getAlias() },
|
||||
whisper: ChatUtility.getOwners(this),
|
||||
content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-achat-item.hbs', chatAchatItem)
|
||||
content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-achat-item.html', chatAchatItem)
|
||||
});
|
||||
|
||||
if (!achat.vente.quantiteIllimite) {
|
||||
@ -734,26 +721,31 @@ export class RdDBaseActor extends Actor {
|
||||
name: this.getAlias(),
|
||||
system: { description: this.system.description }
|
||||
}
|
||||
foundry.applications.handlebars.renderTemplate('systems/foundryvtt-reve-de-dragon/templates/post-actor.hbs', chatData)
|
||||
renderTemplate('systems/foundryvtt-reve-de-dragon/templates/post-actor.html', chatData)
|
||||
.then(html => ChatMessage.create(RdDUtility.chatDataSetup(html, modeOverride)));
|
||||
}
|
||||
|
||||
actionImpossible(action) {
|
||||
ui.notifications.info(`${this.getAlias()} ne peut pas faire cette action: ${action}`)
|
||||
|
||||
}
|
||||
|
||||
async jetEthylisme() { this.actionImpossible("jet d'éthylisme") }
|
||||
async rollAppelChance() { this.actionImpossible("appel à la chance") }
|
||||
async jetDeMoral() { this.actionImpossible("jet de moral") }
|
||||
|
||||
async actionPrincipale(item, onActionItem = async () => { }) {
|
||||
switch (item.type) {
|
||||
case ITEM_TYPES.conteneur: return await item.sheet.render(true);
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
async resetItemUse() { }
|
||||
async incDecItemUse(itemId, shouldIncrease = true) { }
|
||||
async incDecItemUse(itemId, inc = 1) { }
|
||||
getItemUse(itemId) { return 0; }
|
||||
|
||||
async finDeRound(options = { terminer: false }) { }
|
||||
isActorCombat() { return false }
|
||||
getCaracInit(competence) { return 0 }
|
||||
|
||||
listActionsCombat() { return [] }
|
||||
listActionsPossessions() {
|
||||
return this.itemTypes[ITEM_TYPES.possession]
|
||||
|
@ -12,7 +12,7 @@ export class RdDCommerceSheet extends RdDBaseActorSheet {
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
template: "systems/foundryvtt-reve-de-dragon/templates/actor/commerce-actor-sheet.hbs",
|
||||
template: "systems/foundryvtt-reve-de-dragon/templates/actor/commerce-actor-sheet.html",
|
||||
width: 600, height: 720,
|
||||
tabs: []
|
||||
}, { inplace: false })
|
||||
@ -45,7 +45,6 @@ export class RdDCommerceSheet extends RdDBaseActorSheet {
|
||||
super.activateListeners(html);
|
||||
|
||||
this.html.find('a.item-acheter').click(async event => await this.vente(this.getItem(event)));
|
||||
this.html.find('.service-acheter').click(async event => await this.vente(this.getItem(event)));
|
||||
|
||||
if (!this.options.editable) return;
|
||||
|
||||
|
@ -10,7 +10,7 @@ export class RdDCreatureSheet extends RdDBaseActorSangSheet {
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
return foundry.utils.mergeObject(RdDBaseActorSangSheet.defaultOptions, {
|
||||
template: "systems/foundryvtt-reve-de-dragon/templates/actor-creature-sheet.hbs",
|
||||
template: "systems/foundryvtt-reve-de-dragon/templates/actor-creature-sheet.html",
|
||||
width: 640, height: 720
|
||||
}, { inplace: false })
|
||||
}
|
||||
@ -26,15 +26,15 @@ export class RdDCreatureSheet extends RdDBaseActorSangSheet {
|
||||
// On competence change
|
||||
this.html.find('.creature-carac').change(async event => {
|
||||
let compName = event.currentTarget.attributes.compname.value;
|
||||
await this.actor.updateCreatureCompetence(compName, "carac_value", parseInt(event.target.value));
|
||||
this.actor.updateCreatureCompetence(compName, "carac_value", parseInt(event.target.value));
|
||||
});
|
||||
this.html.find('.creature-niveau').change(async event => {
|
||||
let compName = event.currentTarget.attributes.compname.value;
|
||||
await this.actor.updateCreatureCompetence(compName, "niveau", parseInt(event.target.value));
|
||||
this.actor.updateCreatureCompetence(compName, "niveau", parseInt(event.target.value));
|
||||
});
|
||||
this.html.find('.creature-dommages').change(async event => {
|
||||
let compName = event.currentTarget.attributes.compname.value;
|
||||
await this.actor.updateCreatureCompetence(compName, "dommages", parseInt(event.target.value));
|
||||
this.actor.updateCreatureCompetence(compName, "dommages", parseInt(event.target.value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
import { Grammar } from "../grammar.js";
|
||||
import { ITEM_TYPES } from "../constants.js";
|
||||
import { LIST_CARAC_AUTRES } from "../rdd-carac.js";
|
||||
import { ITEM_TYPES } from "../item.js";
|
||||
import { RdDBaseActorSang } from "./base-actor-sang.js";
|
||||
|
||||
export class RdDCreature extends RdDBaseActorSang {
|
||||
@ -34,16 +32,4 @@ export class RdDCreature extends RdDBaseActorSang {
|
||||
}
|
||||
}
|
||||
|
||||
mapCarac(caracCode) {
|
||||
switch (caracCode) {
|
||||
case 'vue': case 'ouie': case 'odoratgout': case 'empathie': case 'perception':
|
||||
return 'perception'
|
||||
case 'agilite':
|
||||
return 'force'
|
||||
case 'force': case 'constitution': case 'taille': case 'reve': case 'volonte':
|
||||
return caracCode
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,22 +1,19 @@
|
||||
import { RdDBaseActorReveSheet } from "./base-actor-reve-sheet.js";
|
||||
import { RdDSheetUtility } from "../rdd-sheet-utility.js";
|
||||
import { RdDUtility } from "../rdd-utility.js";
|
||||
import { DialogSelect } from "../dialog-select.js";
|
||||
|
||||
export class RdDActorEntiteSheet extends RdDBaseActorReveSheet {
|
||||
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
return foundry.utils.mergeObject(RdDBaseActorReveSheet.defaultOptions, {
|
||||
template: "systems/foundryvtt-reve-de-dragon/templates/actor-entite-sheet.hbs",
|
||||
template: "systems/foundryvtt-reve-de-dragon/templates/actor-entite-sheet.html",
|
||||
width: 640, height: 720,
|
||||
}, { inplace: false })
|
||||
}
|
||||
|
||||
async getData() {
|
||||
let formData = await super.getData();
|
||||
formData.niveau = this.actor.getNiveau()
|
||||
delete formData.system.carac.niveau
|
||||
formData.resonances = this.actor.system.sante.resonnance.actors.map(actorId => game.actors.get(actorId))
|
||||
.map(actor => { return { id: actor.id, name: actor.name, img: actor.img } })
|
||||
return formData
|
||||
@ -33,32 +30,28 @@ export class RdDActorEntiteSheet extends RdDBaseActorReveSheet {
|
||||
// On competence change
|
||||
this.html.find('.creature-carac').change(async event => {
|
||||
let compName = event.currentTarget.attributes.compname.value;
|
||||
await this.actor.updateCreatureCompetence(compName, "carac_value", parseInt(event.target.value));
|
||||
this.actor.updateCreatureCompetence(compName, "carac_value", parseInt(event.target.value));
|
||||
});
|
||||
this.html.find('.creature-niveau').change(async event => {
|
||||
let compName = event.currentTarget.attributes.compname.value;
|
||||
this.actor.updateCreatureCompetence(compName, "niveau", parseInt(event.target.value));
|
||||
});
|
||||
this.html.find('.creature-dommages').change(async event => {
|
||||
let compName = event.currentTarget.attributes.compname.value;
|
||||
await this.actor.updateCreatureCompetence(compName, "dommages", parseInt(event.target.value));
|
||||
})
|
||||
|
||||
this.html.find('.resonance-add').click(async event =>
|
||||
await DialogSelect.select({
|
||||
label: "Choisir un acteur à accorder",
|
||||
list: game.actors.filter(it => it.isPersonnage() && it.prototypeToken.actorLink)
|
||||
},
|
||||
it => this.resonanceAdd(it.id))
|
||||
)
|
||||
|
||||
this.actor.updateCreatureCompetence(compName, "dommages", parseInt(event.target.value));
|
||||
});
|
||||
this.html.find('.resonance-delete').click(async event => {
|
||||
const li = RdDSheetUtility.getEventElement(event);
|
||||
const actorId = li.data("actor-id");
|
||||
if (actorId) {
|
||||
const actorResonance = game.actors.get(actorId);
|
||||
RdDUtility.confirmSubActeurDelete(this, actorResonance, li, () => {
|
||||
this.resonanceDelete(actorId);
|
||||
console.log('Delete : ', actorId);
|
||||
this.deleteSubActeur(actorId);
|
||||
RdDUtility.slideOnDelete(this, li);
|
||||
})
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
async _onDropActor(event, dragData) {
|
||||
@ -67,13 +60,7 @@ export class RdDActorEntiteSheet extends RdDBaseActorReveSheet {
|
||||
super._onDropActor(event, dragData)
|
||||
}
|
||||
|
||||
async resonanceAdd(actorId) {
|
||||
let newResonances = [...this.actor.system.sante.resonnance.actors, actorId]
|
||||
await this.actor.update({ 'system.sante.resonnance.actors': newResonances });
|
||||
}
|
||||
|
||||
async resonanceDelete(actorId) {
|
||||
console.log('Delete : ', actorId);
|
||||
async deleteSubActeur(actorId) {
|
||||
let newResonances = this.actor.system.sante.resonnance.actors.filter(id => id != actorId);
|
||||
await this.actor.update({ 'system.sante.resonnance.actors': newResonances }, { renderSheet: false });
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { ENTITE_INCARNE, ENTITE_NONINCARNE } from "../constants.js";
|
||||
import { ITEM_TYPES } from "../constants.js";
|
||||
import { ITEM_TYPES } from "../item.js";
|
||||
import { Misc } from "../misc.js";
|
||||
import { RdDCarac } from "../rdd-carac.js";
|
||||
import { RdDEncaisser } from "../rdd-roll-encaisser.js";
|
||||
import { STATUSES } from "../settings/status-effects.js";
|
||||
import { RdDBaseActorReve } from "./base-actor-reve.js";
|
||||
@ -19,23 +18,12 @@ export class RdDEntite extends RdDBaseActorReve {
|
||||
isEntite(typeentite = []) {
|
||||
return (typeentite.length == 0 || typeentite.includes(this.system.definition.typeentite));
|
||||
}
|
||||
|
||||
isNonIncarnee() { return this.isEntite([ENTITE_NONINCARNE]) }
|
||||
|
||||
getReveActuel() {
|
||||
return Misc.toInt(this.system.carac.reve?.value)
|
||||
}
|
||||
|
||||
getCarac() {
|
||||
const carac = super.getCarac()
|
||||
delete carac.niveau
|
||||
return carac
|
||||
}
|
||||
|
||||
getNiveau() {
|
||||
const reve = this.getReve()
|
||||
return RdDCarac.getCaracDerivee(reve).niveau
|
||||
}
|
||||
getForce() { return this.getReve() }
|
||||
getAgilite() { return this.getReve() }
|
||||
getChance() { return this.getReve() }
|
||||
@ -76,7 +64,6 @@ export class RdDEntite extends RdDBaseActorReve {
|
||||
}
|
||||
return {}
|
||||
}
|
||||
|
||||
async encaisser() {
|
||||
if (this.isNonIncarnee()) {
|
||||
return
|
||||
@ -117,14 +104,4 @@ export class RdDEntite extends RdDBaseActorReve {
|
||||
super.setEntiteReveAccordee(actor)
|
||||
}
|
||||
}
|
||||
|
||||
mapCarac(caracCode) {
|
||||
switch (caracCode) {
|
||||
case 'taille':
|
||||
case 'reve':
|
||||
return caracCode
|
||||
}
|
||||
return 'reve'
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,8 +6,8 @@ import { ExportScriptarium } from "./export-scriptarium.js";
|
||||
import { CATEGORIES_COMPETENCES, CATEGORIES_DRACONIC, Mapping } from "./mapping.js";
|
||||
|
||||
export class RdDActorExportSheet extends RdDActorSheet {
|
||||
static init() {
|
||||
foundry.applications.handlebars.loadTemplates([
|
||||
static async init() {
|
||||
await loadTemplates([
|
||||
"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/blessures.hbs",
|
||||
@ -21,9 +21,8 @@ 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/sort.hbs",
|
||||
])
|
||||
foundry.documents.collections.Actors.registerSheet(SYSTEM_RDD, RdDActorExportSheet, { types: ["personnage"], makeDefault: false, label: "Feuille simplifiée" })
|
||||
Actors.registerSheet(SYSTEM_RDD, RdDActorExportSheet, { types: ["personnage"], makeDefault: false, label: "Feuille simplifiée" })
|
||||
}
|
||||
|
||||
static get defaultOptions() {
|
||||
return foundry.utils.mergeObject(RdDActorSheet.defaultOptions, {
|
||||
template: "systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/actor-encart-sheet.hbs",
|
||||
@ -104,12 +103,13 @@ export class RdDActorExportSheet extends RdDActorSheet {
|
||||
this.html.find('.click-blessure-add').click(async event =>
|
||||
await this.actor.ajouterBlessure({
|
||||
gravite: this.html.find(event.currentTarget).data('gravite')
|
||||
// event.currentTarget.attributes['data-gravite'].value
|
||||
})
|
||||
)
|
||||
this.html.find('.button-export').click(async event => await
|
||||
this.html.find('.button-export').click(async event => {
|
||||
ExportScriptarium.INSTANCE.exportActors([this.actor],
|
||||
`${this.actor.uuid}-${this.actor.name}`
|
||||
)
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { ACTOR_TYPES } from "../../constants.js"
|
||||
import { ACTOR_TYPES } from "../../item.js"
|
||||
import { Misc } from "../../misc.js"
|
||||
import { EXPORT_CSV_SCRIPTARIUM, OptionsAvancees } from "../../settings/options-avancees.js"
|
||||
import { Mapping } from "./mapping.js"
|
||||
|
||||
const IMG_SCRIPTARIUM = '<img class="context-menu-img" src="systems/foundryvtt-reve-de-dragon/assets/ui/scriptarium.svg">'
|
||||
const IMG_SCRIPTARIUM = '<img class="context-menu-img" src="systems/foundryvtt-reve-de-dragon/styles/img/ui/scriptarium.svg">'
|
||||
|
||||
export class ExportScriptarium {
|
||||
|
||||
|
@ -2,7 +2,7 @@ import { Grammar } from "../../grammar.js"
|
||||
import { RdDItemArme } from "../../item-arme.js"
|
||||
import { RdDItemCompetence } from "../../item-competence.js"
|
||||
import { RdDItemSort } from "../../item-sort.js"
|
||||
import { ITEM_TYPES } from "../../constants.js"
|
||||
import { ITEM_TYPES } from "../../item.js"
|
||||
import { Misc } from "../../misc.js"
|
||||
import { RdDTimestamp } from "../../time/rdd-timestamp.js"
|
||||
import { RdDBonus } from "../../rdd-bonus.js"
|
||||
@ -83,7 +83,6 @@ const MAPPING_BASE = [
|
||||
{ column: "protectionarmure", colName: 'Protection', getter: (actor, context) => Mapping.getProtectionArmure(actor, context) },
|
||||
{ column: "malus_armure", getter: (actor, context) => Mapping.getMalusArmure(actor, context) },
|
||||
{ column: "reve_actuel", rollClass: 'roll-reve-actuel', colName: 'Rêve actuel', getter: (actor, context) => actor.system.reve.reve.value },
|
||||
{ column: "chance_actuel", rollClass: 'roll-chance-actuelle', colName: 'Chance actuelle', getter: (actor, context) => actor.system.compteurs.chance.value },
|
||||
{ column: "vie_actuel", rollClass: 'jet-vie', getter: (actor, context) => actor.system.sante.vie.value },
|
||||
{ column: "endurance_actuel", rollClass: 'jet-endurance', getter: (actor, context) => actor.system.sante.endurance.value },
|
||||
{ column: "esquive", getter: (actor, context) => Mapping.getEsquive(context) },
|
||||
@ -279,7 +278,7 @@ export class Mapping {
|
||||
const race = ['', 'humain'].includes(Grammar.toLowerCaseNoAccent(actor.system.race)) ? '' : (actor.system.race + ' ')
|
||||
const heure = actor.system.heure
|
||||
const hn = `${sexeFeminin} à l'heure ${RdDTimestamp.definition(heure).avecArticle}`
|
||||
const age = (actor.system.age && actor.system.age >0) ? `${actor.system.age} ans` : undefined
|
||||
const age = actor.system.age ? `${actor.system.age} ans` : undefined
|
||||
const taille = actor.system.taille
|
||||
const poids = actor.system.poids
|
||||
const cheveux = actor.system.cheveux ? `cheveux ${actor.system.cheveux}` : undefined
|
||||
|
@ -26,7 +26,7 @@ const RANDOM_VALUES = {
|
||||
|
||||
export class AppPersonnageAleatoire extends FormApplication {
|
||||
static preloadHandlebars() {
|
||||
foundry.applications.handlebars.loadTemplates([
|
||||
loadTemplates([
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/random/champ-aleatoire.hbs',
|
||||
])
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ export class RdDActorVehiculeSheet extends RdDBaseActorSheet {
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
return foundry.utils.mergeObject(RdDBaseActorSheet.defaultOptions, {
|
||||
template: "systems/foundryvtt-reve-de-dragon/templates/actor-vehicule-sheet.hbs",
|
||||
template: "systems/foundryvtt-reve-de-dragon/templates/actor-vehicule-sheet.html",
|
||||
width: 640, height: 720,
|
||||
}, { inplace: false })
|
||||
}
|
||||
@ -32,10 +32,18 @@ export class RdDActorVehiculeSheet extends RdDBaseActorSheet {
|
||||
super.activateListeners(html);
|
||||
if (!this.options.editable) return;
|
||||
|
||||
this.html.find('.resistance-moins').click(async event => await 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('.structure-plus').click(async event => await this.actor.vehicleIncDec("structure", 1))
|
||||
this.html.find('.resistance-moins').click(async event => {
|
||||
this.actor.vehicleIncDec("resistance", -1);
|
||||
});
|
||||
this.html.find('.resistance-plus').click(async event => {
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +0,0 @@
|
||||
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"
|
||||
|
@ -1,111 +0,0 @@
|
||||
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
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
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)
|
||||
)
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
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)
|
||||
)
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
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)
|
||||
)
|
||||
}
|
||||
}
|
@ -6,7 +6,6 @@ import { Grammar } from "../grammar.js";
|
||||
import { Misc } from "../misc.js";
|
||||
import { ENTITE_INCARNE, ENTITE_NONINCARNE } from "../constants.js";
|
||||
import { RdDItemTete } from "../item/tete.js";
|
||||
import { ITEM_TYPES } from "../constants.js";
|
||||
|
||||
const WHITESPACES = "\\s+"
|
||||
const NUMERIC = "[\\+\\-]?\\d+"
|
||||
@ -27,13 +26,14 @@ const MANIEMENTS = {
|
||||
'de lancer': (weapon) => { return { name: weapon.system.lancer, categorie: 'lancer' } },
|
||||
'de jet': (weapon) => { return { name: weapon.system.lancer, categorie: 'lancer' } },
|
||||
'à une main': (weapon) => { return { name: weapon.system.competence, categorie: 'melee' } },
|
||||
'à deux mains': (weapon) => { return { name: weapon.system.competence.replace("à 1 main", "à 2 mains"), categorie: 'melee' } },
|
||||
'à deux main': (weapon) => { return { name: weapon.system.competence.replace("à 1 main", "à 2 main"), categorie: 'melee' } },
|
||||
'mêlée': (weapon) => { return { name: weapon.system.competence, categorie: 'melee' } },
|
||||
}
|
||||
const XREGEXP_WEAPON_MANIEMENT = "(?<maniement>(" + Misc.join(Object.keys(MANIEMENTS), '|') + "))"
|
||||
|
||||
const XREGEXP_SORT_VOIE = "(?<voies>[OHNT](\\/[OHNT])*)"
|
||||
const XREGEXP_SORT_NAME = "(?<name>[^\\(]+)"
|
||||
// const XREGEXP_SORT_CASE = "(?<coord>([A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+|[A-M]\\d{1,2})+)"
|
||||
const XREGEXP_SORT_CASE = "(?<coord>([A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+|[A-M]\\d{1,2}))"
|
||||
|
||||
const XREGEXP_SORT = "(" + XREGEXP_SORT_VOIE
|
||||
@ -164,18 +164,26 @@ export class RdDStatBlockParser {
|
||||
switch (type) {
|
||||
case "creature":
|
||||
RdDStatBlockParser.parseCreature(statString, actorData)
|
||||
await RdDStatBlockParser.parseCompetences(statString, actorData, items)
|
||||
break
|
||||
case "entite":
|
||||
RdDStatBlockParser.parseEntite(statString, actorData)
|
||||
await RdDStatBlockParser.parseCompetences(statString, actorData, items)
|
||||
break
|
||||
case "personnage":
|
||||
await RdDStatBlockParser.parseArmors(statString, actorData, items);
|
||||
await RdDStatBlockParser.parseCompetences(statString, actorData, items);
|
||||
await RdDStatBlockParser.parseWeapons(statString, items);
|
||||
await RdDStatBlockParser.parseHautReve(statString, actorData, items);
|
||||
RdDStatBlockParser.parsePersonnage(statString, actorData);
|
||||
}
|
||||
if (type == "personnage") {
|
||||
// Now process armors
|
||||
await RdDStatBlockParser.parseArmors(statString, actorData, items);
|
||||
}
|
||||
|
||||
// Get skills from compendium
|
||||
await RdDStatBlockParser.parseCompetences(statString, actorData, items);
|
||||
|
||||
|
||||
if (type == "personnage") {
|
||||
// Now process weapons
|
||||
await RdDStatBlockParser.parseWeapons(statString, items);
|
||||
|
||||
await RdDStatBlockParser.parseHautReve(statString, actorData, items);
|
||||
RdDStatBlockParser.parsePersonnage(statString, actorData);
|
||||
}
|
||||
|
||||
const name = RdDStatBlockParser.extractName(type, statString);
|
||||
@ -185,7 +193,6 @@ export class RdDStatBlockParser {
|
||||
|
||||
let newActor = await RdDBaseActorReve.create({ name, type, system: actorData, items });
|
||||
await newActor.remiseANeuf()
|
||||
await RdDStatBlockParser.adjustAttacks(newActor)
|
||||
await RdDStatBlockParser.setValeursActuelles(newActor, statString)
|
||||
await newActor?.sheet.render(true)
|
||||
}
|
||||
@ -260,7 +267,7 @@ export class RdDStatBlockParser {
|
||||
}
|
||||
let weapMatch = XRegExp.exec(statString, XRegExp(weapon.name
|
||||
+ "(\\s*" + XREGEXP_WEAPON_MANIEMENT + ")?"
|
||||
+ "\\s+(?<value>[\\+\\-]?\\d+)", 'giu'));
|
||||
+ "\\s+(?<value>\\+\\d+)", 'giu'));
|
||||
if (weapMatch) {
|
||||
weapon = weapon.toObject();
|
||||
weapon.system.equipe = 'true';
|
||||
@ -289,21 +296,6 @@ export class RdDStatBlockParser {
|
||||
}
|
||||
}
|
||||
|
||||
static async adjustAttacks(newActor) {
|
||||
if (["creature", "entite"].includes(newActor.type)) {
|
||||
const bonusDommages = newActor.getBonusDegat()
|
||||
const ajustementAttaques = newActor.itemTypes[ITEM_TYPES.competencecreature].filter(it => it.system.iscombat)
|
||||
.map(it => {
|
||||
return {
|
||||
_id: it.id,
|
||||
'system.categorie': 'melee',
|
||||
'system.dommages': it.system.dommages - bonusDommages
|
||||
}
|
||||
})
|
||||
await newActor.updateEmbeddedDocuments('Item', ajustementAttaques)
|
||||
}
|
||||
}
|
||||
|
||||
static async setValeursActuelles(newActor, statString) {
|
||||
const updates = {
|
||||
}
|
||||
@ -420,9 +412,9 @@ export class RdDStatBlockParser {
|
||||
actorData.taille = taille.value;
|
||||
}
|
||||
// Get weight
|
||||
const poids = XRegExp.exec(statString, XRegExp(",\\s+(?<value>\\d+)\\s+kg", 'giu'));
|
||||
const poids = XRegExp.exec(statString, XRegExp("(?<value>\\d+ kg)", 'giu'));
|
||||
if (poids?.value) {
|
||||
actorData.poids = poids.value + ' kg';
|
||||
actorData.poids = poids.value;
|
||||
}
|
||||
// Get cheveux
|
||||
const cheveux = XRegExp.exec(statString, XRegExp("kg,\\s+(?<value>[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+),\\s+yeux", 'giu'));
|
||||
@ -443,7 +435,7 @@ export class RdDStatBlockParser {
|
||||
}
|
||||
|
||||
static parseCreature(statString, actorData) {
|
||||
let protection = XRegExp.exec(statString, XRegExp("protection(\\s+naturelle)?\\s+(?<value>[\\-]?\\d+)", 'giu'));
|
||||
let protection = XRegExp.exec(statString, XRegExp("protection\\s+(?<value>[\\-]?\\d+)", 'giu'));
|
||||
if (protection?.value) {
|
||||
actorData.attributs.protection.value = Number(protection.value);
|
||||
}
|
||||
@ -469,40 +461,33 @@ export class RdDStatBlockParser {
|
||||
}
|
||||
|
||||
static parseActorType(statString) {
|
||||
let force = XRegExp.exec(statString, XRegExp("Force\\s+(?<value>[\\+\\-]?\\d+)", 'giu'))
|
||||
let vue = XRegExp.exec(statString, XRegExp("Vue\\s+(?<value>[\\+\\-]?\\d+)", 'giu'))
|
||||
let niveau = XRegExp.exec(statString, XRegExp("Niveau\\s+(?<value>[\\+\\-]?\\d+)", 'giu'))
|
||||
let perception = XRegExp.exec(statString, XRegExp("perception\\s+(?<value>\\d+)", 'giu'))
|
||||
if (!force) {
|
||||
return "entite"
|
||||
}
|
||||
if (!vue || perception) {
|
||||
if (perception?.value) {
|
||||
return "creature"
|
||||
}
|
||||
if (niveau?.value) {
|
||||
return "entite"
|
||||
}
|
||||
return "personnage"
|
||||
}
|
||||
|
||||
static extractName(actorType, statString) {
|
||||
if (actorType == "personnage") {
|
||||
// Check if ',né le' is present
|
||||
let namePersonnage = "Importé"
|
||||
if (statString.includes(", né")) {
|
||||
// Name is all string before first comma ','
|
||||
namePersonnage = XRegExp.exec(statString, XRegExp("(?<value>[\\p{Letter}\'\\-\\s\\d]+),", 'giu'));
|
||||
} else {
|
||||
namePersonnage = XRegExp.exec(statString, XRegExp("(?<value>[\\p{Letter}\'\\-\\s\\d]+)\\s+TAILLE", 'giu'));
|
||||
}
|
||||
if (namePersonnage?.value) {
|
||||
return Misc.upperFirst(namePersonnage?.value.toLowerCase());
|
||||
}
|
||||
switch (actorType) {
|
||||
case "personnage":
|
||||
// Check if ',né le' is present
|
||||
let namePersonnage = "Importé"
|
||||
if (statString.includes(", né")) {
|
||||
// Name is all string before first comma ','
|
||||
namePersonnage = XRegExp.exec(statString, XRegExp("(?<value>[\\p{Letter}\\s\\d]+),", 'giu'));
|
||||
} else {
|
||||
namePersonnage = XRegExp.exec(statString, XRegExp("(?<value>[\\p{Letter}\\s\\d]+)\\s+TAILLE", 'giu'));
|
||||
}
|
||||
if (namePersonnage?.value) {
|
||||
return Misc.upperFirst(namePersonnage?.value);
|
||||
}
|
||||
}
|
||||
|
||||
const name = XRegExp.exec(statString, XRegExp("(?<value>.+)\\s+taille", 'giu'));
|
||||
if (actorType == "entite") {
|
||||
if (!(name?.value)) {
|
||||
const nameEntiteReve = XRegExp.exec(statString, XRegExp("(?<value>.+)\\s+rêve", 'giu'));
|
||||
return Misc.upperFirst(nameEntiteReve?.value || "Importé");
|
||||
}
|
||||
}
|
||||
return Misc.upperFirst(name?.value || "Importé");
|
||||
}
|
||||
|
||||
|
@ -1,78 +0,0 @@
|
||||
import "./xregexp-all.js";
|
||||
import { SystemCompendiums } from "../settings/system-compendiums.js";
|
||||
import { ACTOR_TYPES } from "../constants.js";
|
||||
import { TextRollAlchimie } from "./textroll/text-roll-alchimie.js";
|
||||
import { TextRollCaracCompetence } from "./textroll/text-roll-carac-competence.js";
|
||||
import { TextRollFormula } from "./textroll/text-roll-formula.js";
|
||||
import { TextRollManager } from "./textroll/text-roll-formatter.js";
|
||||
|
||||
const TEXT_ROLL_MANAGERS = [
|
||||
new TextRollAlchimie(),
|
||||
new TextRollCaracCompetence(),
|
||||
new TextRollFormula()]
|
||||
|
||||
export class RdDTextEditor {
|
||||
static registerChatCallbacks(html) {
|
||||
$(html).on("click", '.roll-text', async event => await RdDTextEditor.rollText(event))
|
||||
}
|
||||
|
||||
static async enrichHTML(text, object, options = {showlink:true}) {
|
||||
const context = {
|
||||
text,
|
||||
object,
|
||||
options,
|
||||
competences: await SystemCompendiums.getCompetences(ACTOR_TYPES.personnage),
|
||||
}
|
||||
|
||||
for (let manager of TEXT_ROLL_MANAGERS) {
|
||||
context.code = manager.code
|
||||
context.template = manager.template
|
||||
context.text = await manager.onReplaceRoll(context);
|
||||
}
|
||||
|
||||
return await foundry.applications.ux.TextEditor.implementation.enrichHTML(context.text, {
|
||||
relativeTo: object,
|
||||
secrets: object?.isOwner,
|
||||
async: true
|
||||
})
|
||||
}
|
||||
|
||||
static async _applyReplaceAll(manager, context) {
|
||||
context.code = manager.code
|
||||
context.template = manager.template
|
||||
context.text = await manager.onReplaceRoll(context);
|
||||
return context.text
|
||||
}
|
||||
|
||||
static getEventElement(event) {
|
||||
return $(event.currentTarget)?.parents(".roll-text-link");
|
||||
}
|
||||
|
||||
static async rollText(event, actor) {
|
||||
const code = TextRollManager.getNode(event)?.data('code')
|
||||
const manager = TEXT_ROLL_MANAGERS.find(it => it.code == code)
|
||||
if (manager) {
|
||||
await manager.onRollText(event, actor)
|
||||
}
|
||||
}
|
||||
|
||||
static async chatRollText(event) {
|
||||
const node = TextRollManager.getNode(event);
|
||||
if (node) {
|
||||
const code = node.data('code')
|
||||
const param = node.data('json')
|
||||
const manager = TEXT_ROLL_MANAGERS.find(it => it.code == code)
|
||||
|
||||
const text = await TextRollManager.createRollText(
|
||||
{
|
||||
code,
|
||||
template: manager.template,
|
||||
options: { showLink: false }
|
||||
},
|
||||
param)
|
||||
ChatMessage.create({
|
||||
content: text
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
import "../xregexp-all.js";
|
||||
import { ACTOR_TYPES, ITEM_TYPES } from "../../constants.js";
|
||||
import { RdDCarac } from "../../rdd-carac.js";
|
||||
import { RdDUtility } from "../../rdd-utility.js";
|
||||
import { RdDAlchimie } from "../../rdd-alchimie.js";
|
||||
import { TextRollManager } from "./text-roll-formatter.js";
|
||||
|
||||
const REGEX_ALCHIMIE_TERMES = "(?<termes>([-A-Za-zÀ-ÖØ-öø-ÿ ])+)"
|
||||
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_MANIP = XRegExp("@" + REGEX_ALCHIMIE_MANIP + "\\{" + REGEX_ALCHIMIE_TERMES + "\\}", 'giu')
|
||||
|
||||
/**
|
||||
* classe pour gérer les jets d'alchimie
|
||||
*/
|
||||
export class TextRollAlchimie {
|
||||
get code() { return 'alchimie' }
|
||||
get template() { return `systems/foundryvtt-reve-de-dragon/templates/apps/textroll/link-text-roll-alchimie.hbs` }
|
||||
|
||||
async onReplaceRoll(context) {
|
||||
const handler = new AlchimieTextBuilder(context)
|
||||
return await handler.replaceAll()
|
||||
}
|
||||
|
||||
async onRollText(event, actor) {
|
||||
actor = this.getSelectedActor(actor)
|
||||
if (actor) {
|
||||
const node = TextRollManager.getNode(event)
|
||||
const recetteId = node.data('recetteid')
|
||||
const manip = node.data('manip')
|
||||
const termes = node.data('termes')
|
||||
if (recetteId) {
|
||||
await actor.effectuerTacheAlchimie(recetteId, manip, termes)
|
||||
}
|
||||
else {
|
||||
const carac = RdDCarac.caracDetails(RdDAlchimie.getCaracTache(manip))
|
||||
const diff = RdDAlchimie.getDifficulte(termes)
|
||||
await actor.rollCaracCompetence(carac.code, 'Alchimie', diff)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getSelectedActor(actor) {
|
||||
actor = actor ?? RdDUtility.getSelectedActor()
|
||||
if (actor && actor.type == ACTOR_TYPES.personnage) {
|
||||
return actor
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
class AlchimieTextBuilder {
|
||||
constructor(context) {
|
||||
this.context = context
|
||||
}
|
||||
|
||||
async replaceAll() {
|
||||
await XRegExp.forEach(this.context.text, XREGEXP_ROLL_ALCHIMIE, async (rollMatch, i) => await this.replaceMatch(rollMatch, i))
|
||||
await XRegExp.forEach(this.context.text, XREGEXP_ROLL_ALCHIMIE_MANIP, async (rollMatch, i) => await this.replaceMatch(rollMatch, i))
|
||||
return this.context.text
|
||||
}
|
||||
|
||||
async replaceMatch(rollMatch, i) {
|
||||
if (rollMatch.termes && rollMatch.manip) {
|
||||
const manip = rollMatch.manip
|
||||
const termes = rollMatch.termes
|
||||
const carac = RdDCarac.caracDetails(RdDAlchimie.getCaracTache(manip))
|
||||
const diff = RdDAlchimie.getDifficulte(termes)
|
||||
const recette = (this.context.object instanceof Item && this.context.object.type == ITEM_TYPES.recettealchimique) ? this.context.object : undefined
|
||||
const replacement = await TextRollManager.createRollText(this.context,
|
||||
{
|
||||
code: this.context.code,
|
||||
manip, termes, carac, diff, recetteid: recette?.id,
|
||||
})
|
||||
this.context.text = this.context.text.replace(rollMatch[0], replacement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,98 +0,0 @@
|
||||
import "../xregexp-all.js";
|
||||
import { RdDCarac } from "../../rdd-carac.js";
|
||||
import { RdDItemCompetence } from "../../item-competence.js";
|
||||
import { RdDUtility } from "../../rdd-utility.js";
|
||||
import { TextRollManager } from "./text-roll-formatter.js";
|
||||
|
||||
const REGECP_CARAC = "(?<carac>[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_ROLL_CARAC_COMP = REGECP_CARAC + REGEXP_COMP + REGEXP_DIFF
|
||||
const XREGEXP_ROLL_CARAC_COMP = XRegExp("@roll\\[" + REGEXP_ROLL_CARAC_COMP + "\\]", 'giu')
|
||||
|
||||
/**
|
||||
* classe pour gérer les jets de caractéristique/compétence depuis
|
||||
* les journaux/descriptions
|
||||
*/
|
||||
export class TextRollCaracCompetence {
|
||||
get code() { return 'carac' }
|
||||
get template() { return `systems/foundryvtt-reve-de-dragon/templates/apps/textroll/link-text-roll-carac-competence.hbs` }
|
||||
|
||||
async onReplaceRoll(context) {
|
||||
const handler = new CaracCompetenceTextBuilder(context)
|
||||
return await handler.replaceAll()
|
||||
}
|
||||
|
||||
async onRollText(event, actor) {
|
||||
const node = TextRollManager.getNode(event)
|
||||
const caracCode = node.data('carac-code')
|
||||
if (caracCode) {
|
||||
const competence = node.data('competence')
|
||||
const diff = await this.calculDiff(node)
|
||||
const actors = this.getSelectedActors(actor)
|
||||
actors.forEach(async it => await this.doRoll(it, caracCode, competence, diff))
|
||||
}
|
||||
}
|
||||
|
||||
async calculDiff(node) {
|
||||
const diff = node.data('diff') ?? 0
|
||||
if (!Number.isInteger(diff)) {
|
||||
const roll = new Roll(diff)
|
||||
await roll.evaluate()
|
||||
await roll.toMessage({ flavor: `La difficulté de ${diff} a donné ${roll.total}` })
|
||||
return roll.total
|
||||
}
|
||||
return diff
|
||||
}
|
||||
|
||||
async doRoll(actor, caracCode, competence, diff) {
|
||||
caracCode = actor.mapCarac(caracCode)
|
||||
if (caracCode) {
|
||||
if (competence) {
|
||||
await actor.rollCaracCompetence(caracCode, competence, diff)
|
||||
}
|
||||
else {
|
||||
await actor.rollCarac(caracCode, { diff })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getSelectedActors(actor) {
|
||||
const selected = canvas.tokens.controlled.map(it => it.actor).filter(it => it)
|
||||
if (selected.length > 0) {
|
||||
return selected
|
||||
}
|
||||
actor = actor ?? RdDUtility.getSelectedActor()
|
||||
if (actor) {
|
||||
return [actor]
|
||||
}
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
class CaracCompetenceTextBuilder {
|
||||
constructor(context) {
|
||||
this.context = context
|
||||
}
|
||||
|
||||
async replaceAll() {
|
||||
await XRegExp.forEach(this.context.text, XREGEXP_ROLL_CARAC_COMP, async (rollMatch, i) => await this.replaceMatch(rollMatch, i))
|
||||
return this.context.text
|
||||
}
|
||||
|
||||
async replaceMatch(rollMatch, i) {
|
||||
const carac = RdDCarac.caracDetails(rollMatch.carac)
|
||||
if (carac) {
|
||||
const competence = rollMatch.competence ? RdDItemCompetence.findCompetence(this.context.competences, rollMatch.competence) : undefined
|
||||
const replacement = await TextRollManager.createRollText(this.context,
|
||||
{
|
||||
code: this.context.code,
|
||||
carac: carac,
|
||||
competence: competence?.name,
|
||||
diff: rollMatch.diff,
|
||||
})
|
||||
this.context.text = this.context.text.replace(rollMatch[0], replacement)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +0,0 @@
|
||||
|
||||
export class TextRollManager {
|
||||
|
||||
static async createRollText(context, param) {
|
||||
return await renderTemplate(context.template, {
|
||||
param, options: context.options
|
||||
})
|
||||
}
|
||||
|
||||
static getNode(event) {
|
||||
return $(event.currentTarget)?.parents(".roll-text-link");
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
import "../xregexp-all.js";
|
||||
import { TextRollManager } from "./text-roll-formatter.js";
|
||||
|
||||
const REGEXP_ROLL_FORMULA = "(?<formula>[^\\[\\]]+)"
|
||||
const XREGEXP_ROLL_FORMULA = XRegExp("@roll\\[" + REGEXP_ROLL_FORMULA + "\\]", 'giu')
|
||||
|
||||
/**
|
||||
* classe pour gérer les jets de dés (formules Foundry)
|
||||
*/
|
||||
export class TextRollFormula {
|
||||
get code() { return 'formula' }
|
||||
get template() { return `systems/foundryvtt-reve-de-dragon/templates/apps/textroll/link-text-roll-formula.hbs` }
|
||||
|
||||
async onReplaceRoll(context) {
|
||||
const handler = new FormulaTextBuilder(context)
|
||||
return await handler.replaceAll()
|
||||
}
|
||||
|
||||
async onRollText(event, actor) {
|
||||
const node = TextRollManager.getNode(event)
|
||||
const rollFormula = node.data('formula')
|
||||
if (rollFormula) {
|
||||
const roll = new Roll(rollFormula)
|
||||
await roll.evaluate()
|
||||
await roll.toMessage()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class FormulaTextBuilder {
|
||||
constructor(context) {
|
||||
this.context = context
|
||||
}
|
||||
|
||||
async replaceAll() {
|
||||
await XRegExp.forEach(this.context.text, XREGEXP_ROLL_FORMULA,
|
||||
async (rollMatch, i) => await this.replaceMatch(rollMatch, i))
|
||||
return this.context.text
|
||||
}
|
||||
|
||||
async replaceMatch(rollMatch, i) {
|
||||
if (rollMatch.formula) {
|
||||
const replacement = await TextRollManager.createRollText(this.context,
|
||||
{
|
||||
code: this.context.code,
|
||||
formula: rollMatch.formula,
|
||||
})
|
||||
this.context.text = this.context.text.replace(rollMatch[0], replacement)
|
||||
}
|
||||
}
|
||||
}
|
@ -2002,7 +2002,7 @@ XRegExp.exec = function (str, regex, pos, sticky) {
|
||||
*/
|
||||
|
||||
|
||||
XRegExp.forEach = async function (str, regex, callback) {
|
||||
XRegExp.forEach = function (str, regex, callback) {
|
||||
var pos = 0;
|
||||
var i = -1;
|
||||
var match;
|
||||
@ -2014,7 +2014,7 @@ XRegExp.forEach = async function (str, regex, callback) {
|
||||
// at least. Actually, because of the way `XRegExp.exec` caches globalized versions of
|
||||
// regexes, mutating the regex will not have any effect on the iteration or matched strings,
|
||||
// which is a nice side effect that brings extra safety.
|
||||
await callback(match, ++i, str, regex);
|
||||
callback(match, ++i, str, regex);
|
||||
pos = match.index + (match[0].length || 1);
|
||||
}
|
||||
};
|
||||
|
@ -1,16 +1,15 @@
|
||||
import { Misc } from "./misc.js";
|
||||
import { SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js";
|
||||
import { RdDTimestamp } from "./time/rdd-timestamp.js";
|
||||
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
|
||||
|
||||
|
||||
/**
|
||||
* Class providing helper methods to get the list of users, and
|
||||
* Class providing helper methods to get the list of users, and
|
||||
*/
|
||||
export class ChatUtility {
|
||||
|
||||
static async init() {
|
||||
Hooks.on("renderChatMessageHTML", async (app, html, msg) => await ChatUtility.onRenderChatMessage(app, html, msg))
|
||||
Hooks.on("renderChatMessage", async (app, html, msg) => await ChatUtility.onRenderChatMessage(app, html, msg))
|
||||
Hooks.on("createChatMessage", async (chatMessage, options, id) => await ChatUtility.onCreateChatMessage(chatMessage, options, id))
|
||||
}
|
||||
|
||||
@ -62,6 +61,7 @@ export class ChatUtility {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
static removeMessages(socketData) {
|
||||
if (Misc.isFirstConnectedGM()) {
|
||||
ChatUtility.onRemoveMessages(socketData);
|
||||
@ -96,7 +96,7 @@ export class ChatUtility {
|
||||
}
|
||||
break
|
||||
case "gmroll":
|
||||
messageData.whisper = actor ? ChatUtility.getOwners(actor) : ChatUtility.getUserAndGMs()
|
||||
messageData.whisper = ChatUtility.getOwners(actor)
|
||||
break
|
||||
case "selfroll":
|
||||
messageData.whisper = [game.user]
|
||||
@ -107,7 +107,7 @@ export class ChatUtility {
|
||||
}
|
||||
|
||||
static getOwners(document) {
|
||||
return document ? game.users.filter(it => document.getUserLevel(it) == CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER) : [game.user]
|
||||
return game.users.filter(it => document.getUserLevel(it) == CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER)
|
||||
}
|
||||
|
||||
static getUserAndGMs() {
|
||||
@ -190,15 +190,14 @@ export class ChatUtility {
|
||||
if (rddTimestamp) {
|
||||
const timestamp = new RdDTimestamp(rddTimestamp);
|
||||
const timestampData = timestamp.toCalendrier();
|
||||
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)
|
||||
const dateHeure = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/common/date-heure.hbs', timestampData);
|
||||
html.find('header.message-header .message-sender').after(dateHeure)
|
||||
}
|
||||
}
|
||||
|
||||
static async onCreateChatMessage(chatMessage, options, id) {
|
||||
if (chatMessage.isAuthor) {
|
||||
await chatMessage.setFlag(SYSTEM_RDD, 'rdd-timestamp', game.system.rdd.calendrier.getTimestamp());
|
||||
await chatMessage.update({ content: await RdDTextEditor.enrichHTML(chatMessage.content, undefined, { showLink: false }) })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,18 @@
|
||||
import { RdDBaseActor } from "../actor/base-actor.js";
|
||||
import { ChatUtility } from "../chat-utility.js";
|
||||
import { ReglesOptionnelles } from "../settings/regles-optionnelles.js";
|
||||
|
||||
const INFO_COEUR = 'info-coeur';
|
||||
|
||||
export class RdDCoeur {
|
||||
static registerChatCallbacks(html) {
|
||||
$(html).on("click", 'a.accepter-tendre-moment', event => {
|
||||
html.on("click", 'a.accepter-tendre-moment', 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))
|
||||
})
|
||||
$(html).on("click", 'a.perdre-point-coeur-douceur', event => {
|
||||
html.on("click", 'a.perdre-point-coeur-douceur', event => {
|
||||
RdDCoeur.perdreEnDouceur(
|
||||
RdDCoeur.extractInfoCoeur(event),
|
||||
event.currentTarget.attributes['data-actor-id'].value)
|
||||
|
@ -1,8 +0,0 @@
|
||||
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]
|
||||
|
@ -1,10 +0,0 @@
|
||||
/**
|
||||
* class describing common methods implemented by template parts,
|
||||
* used for sheet/models/documents
|
||||
*/
|
||||
export default class CommonTemplate {
|
||||
fields() { }
|
||||
handlebars() { return [] }
|
||||
actions() { return {} }
|
||||
async prepareContext(item) { }
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
import { RdDTextEditor } from "../apps/rdd-text-roll-editor.js"
|
||||
import CommonTemplate from "./common-template.mjs"
|
||||
import { HTMLSTRING } from "./field-types.mjs"
|
||||
|
||||
const fields = foundry.data.fields
|
||||
|
||||
export class CommonDescription extends CommonTemplate {
|
||||
fields() {
|
||||
return {
|
||||
description: new fields.HTMLField({ ...HTMLSTRING }),
|
||||
descriptionmj: new fields.HTMLField({ gmOnly: true, ...HTMLSTRING })
|
||||
}
|
||||
}
|
||||
|
||||
handlebars() {
|
||||
return [
|
||||
"systems/foundryvtt-reve-de-dragon/templates/sheets/item/common/template-description.hbs",
|
||||
]
|
||||
}
|
||||
actions() {
|
||||
return {}
|
||||
}
|
||||
|
||||
async prepareContext(item) {
|
||||
const enriched = {
|
||||
description: await RdDTextEditor.enrichHTML(item.system.description, item),
|
||||
descriptionmj: await RdDTextEditor.enrichHTML(item.system.descriptionmj, item),
|
||||
}
|
||||
return { enriched }
|
||||
}
|
||||
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
export const INTEGER = { required: true, nullable: false, min: 0, integer: true }
|
||||
export const DECIMAL = { required: true, nullable: false, min: 0, integer: false } /* TODO: validation de nombre décimales?*/
|
||||
export const INTEGER_SIGNED = { required: true, nullable: false, integer: true }
|
||||
export const DECIMAL_SIGNED = { required: true, nullable: false, integer: false }
|
||||
export const STRING = { required: true, nullable: false, blank: true, trim: true }
|
||||
export const HTMLSTRING = { initial: "", required: true, nullable: false, blank: true, textSearch: true }
|
||||
|
||||
export const MODEL_ARRAY = { initial: [], required: true, nullable: false }
|
||||
|
@ -1,36 +0,0 @@
|
||||
import CommonTemplate from "./common-template.mjs"
|
||||
import { RARETES } from "../item/raretes.js"
|
||||
import { DECIMAL, INTEGER, INTEGER_SIGNED, MODEL_ARRAY, STRING } from "./field-types.mjs"
|
||||
|
||||
const fields = foundry.data.fields
|
||||
|
||||
export class CommonInventaire extends CommonTemplate {
|
||||
fields() {
|
||||
return {
|
||||
encombrement: new fields.NumberField({ label: "Encombrement", initial: 0, ...INTEGER }),
|
||||
quantite: new fields.NumberField({ label: "Quantité", initial: 1, ...INTEGER }),
|
||||
qualite: new fields.NumberField({ label: "Qualité", initial: 0, ...INTEGER_SIGNED }),
|
||||
cout: new fields.NumberField({ label: "Coût", initial: 0.0, ...DECIMAL }),
|
||||
environnement: new fields.ArrayField(
|
||||
new fields.SchemaField({
|
||||
milieu: new fields.StringField({ label: "Milieu", initial: "", ...STRING }),
|
||||
rarete: new fields.StringField({
|
||||
label: "Rareté", initial: RARETES[0].code, ...STRING,
|
||||
validate: (value, options) => RARETES.find(it => it.code == value)
|
||||
}),
|
||||
frequence: new fields.NumberField({ label: "Fréquence", initial: RARETES[0].frequence, ...INTEGER }),
|
||||
}),
|
||||
{ label: "Environnement", ...MODEL_ARRAY }),
|
||||
}
|
||||
}
|
||||
|
||||
handlebars() {
|
||||
return [
|
||||
"systems/foundryvtt-reve-de-dragon/templates/sheets/item/common/template-inventaire.hbs"
|
||||
]
|
||||
}
|
||||
|
||||
async prepareContext(item) {
|
||||
return {}
|
||||
}
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
export const SYSTEM_RDD = 'foundryvtt-reve-de-dragon'
|
||||
export const SYSTEM_SOCKET_ID = 'system.foundryvtt-reve-de-dragon'
|
||||
export const LOG_HEAD = 'RdD | '
|
||||
export const SYSTEM_RDD = 'foundryvtt-reve-de-dragon';
|
||||
export const SYSTEM_SOCKET_ID = 'system.foundryvtt-reve-de-dragon';
|
||||
export const LOG_HEAD = 'RdD | ';
|
||||
|
||||
export const HIDE_DICE = 'hide'
|
||||
export const SHOW_DICE = 'show'
|
||||
export const HIDE_DICE = 'hide';
|
||||
export const SHOW_DICE = 'show';
|
||||
|
||||
export const ENTITE_INCARNE = 'incarne'
|
||||
export const ENTITE_NONINCARNE = 'nonincarne'
|
||||
export const ENTITE_BLURETTE = 'blurette'
|
||||
export const ENTITE_INCARNE = 'incarne';
|
||||
export const ENTITE_NONINCARNE = 'nonincarne';
|
||||
export const ENTITE_BLURETTE = 'blurette';
|
||||
|
||||
export const RDD_CONFIG = {
|
||||
niveauEthylisme : [
|
||||
@ -50,59 +50,4 @@ export const RDD_CONFIG = {
|
||||
{value: "Rare", label: "Rare"},
|
||||
{value: "Rarissime", label: "Rarissime"}
|
||||
]
|
||||
}
|
||||
|
||||
export const ACTOR_TYPES = {
|
||||
personnage: 'personnage',
|
||||
creature: 'creature',
|
||||
entite: 'entite',
|
||||
commerce: 'commerce',
|
||||
vehicule: 'vehicule'
|
||||
}
|
||||
|
||||
export const ITEM_TYPES = {
|
||||
competence: 'competence',
|
||||
competencecreature: 'competencecreature',
|
||||
empoignade: 'empoignade',
|
||||
possession: 'possession',
|
||||
blessure: 'blessure',
|
||||
maladie: 'maladie',
|
||||
poison: 'poison',
|
||||
arme: 'arme',
|
||||
armure: 'armure',
|
||||
conteneur: 'conteneur',
|
||||
objet: 'objet',
|
||||
monnaie: 'monnaie',
|
||||
gemme: 'gemme',
|
||||
munition: 'munition',
|
||||
nourritureboisson: 'nourritureboisson',
|
||||
herbe: 'herbe',
|
||||
plante: 'plante',
|
||||
ingredient: 'ingredient',
|
||||
faune: 'faune',
|
||||
livre: 'livre',
|
||||
potion: 'potion',
|
||||
service: 'service',
|
||||
musique: 'musique',
|
||||
danse: 'danse',
|
||||
chant: 'chant',
|
||||
jeu: 'jeu',
|
||||
race: 'race',
|
||||
recettecuisine: 'recettecuisine',
|
||||
oeuvre: 'oeuvre',
|
||||
recettealchimique: 'recettealchimique',
|
||||
tache: 'tache',
|
||||
sort: 'sort',
|
||||
sortreserve: 'sortreserve',
|
||||
rencontre: 'rencontre',
|
||||
queue: 'queue',
|
||||
ombre: 'ombre',
|
||||
souffle: 'souffle',
|
||||
tete: 'tete',
|
||||
casetmr: 'casetmr',
|
||||
meditation: 'meditation',
|
||||
signedraconique: 'signedraconique',
|
||||
tarot: 'tarot',
|
||||
nombreastral: 'nombreastral',
|
||||
extraitpoetique: 'extraitpoetique',
|
||||
}
|
||||
}
|
@ -27,7 +27,7 @@ export class DialogChoixXpCarac extends Dialog {
|
||||
dialogData = foundry.utils.mergeObject(dialogData, {
|
||||
default: 'appliquer',
|
||||
buttons: {
|
||||
'appliquer': { icon: '<i class="fa-solid fa-check"></i>', label: "Ajouter la répartition", callback: it => this.appliquerSelection() }
|
||||
'appliquer': { icon:'<i class="fa-solid fa-check"></i>', label: "Ajouter la répartition", callback: it => this.appliquerSelection() }
|
||||
}
|
||||
})
|
||||
super(dialogData, dialogOptions)
|
||||
@ -37,13 +37,18 @@ export class DialogChoixXpCarac extends Dialog {
|
||||
}
|
||||
|
||||
activateListeners(html) {
|
||||
//TODO
|
||||
super.activateListeners(html)
|
||||
this.html = html
|
||||
this.html.find("li.xpCarac-option .xpCarac-moins").click(event => this.ajouterXp(event, -1))
|
||||
this.html.find("li.xpCarac-option .xpCarac-plus").click(event => this.ajouterXp(event, 1))
|
||||
this.html.find("li.xpCarac-option .xpCarac-moins").click(event =>
|
||||
this.ajouterXp(event, -1)
|
||||
)
|
||||
this.html.find("li.xpCarac-option .xpCarac-plus").click(event =>
|
||||
this.ajouterXp(event, 1)
|
||||
)
|
||||
}
|
||||
|
||||
ajouterXp(event, delta) {
|
||||
async ajouterXp(event, delta) {
|
||||
const liCarac = this.html.find(event.currentTarget)?.parents("li.xpCarac-option")
|
||||
const label = liCarac?.data("carac-label")
|
||||
const carac = this.caracs.find(c => c.label == label)
|
||||
|
@ -27,7 +27,7 @@ export class DialogChronologie extends Dialog {
|
||||
timestamp: game.system.rdd.calendrier.timestamp,
|
||||
dateReel: game.system.rdd.calendrier.dateReel()
|
||||
};
|
||||
const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/dialog-chronologie.hbs", dialogData);
|
||||
const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/dialog-chronologie.html", dialogData);
|
||||
const dialog = new DialogChronologie(html, dialogData);
|
||||
dialog.render(true);
|
||||
}
|
||||
@ -100,7 +100,7 @@ export class DialogChronologie extends Dialog {
|
||||
}
|
||||
|
||||
async prepareChronologieEntry(journalParameters) {
|
||||
return await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/chronologie-entry.hbs", journalParameters);
|
||||
return await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/chronologie-entry.html", journalParameters);
|
||||
}
|
||||
|
||||
extractJournalParameters() {
|
||||
|
@ -18,7 +18,7 @@ export class DialogCreateSigneDraconique extends Dialog {
|
||||
}))
|
||||
};
|
||||
|
||||
const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/dialog-create-signedraconique.hbs", dialogData);
|
||||
const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/dialog-create-signedraconique.html", dialogData);
|
||||
new DialogCreateSigneDraconique(dialogData, html)
|
||||
.render(true);
|
||||
}
|
||||
@ -49,7 +49,7 @@ export class DialogCreateSigneDraconique extends Dialog {
|
||||
actor.createEmbeddedDocuments("Item", [signe]);
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getOwners(actor),
|
||||
content: await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/chat-signe-draconique-actor.hbs", {
|
||||
content: await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/chat-signe-draconique-actor.html", {
|
||||
signe: signe,
|
||||
alias: actor.getAlias()
|
||||
})
|
||||
|
@ -1,79 +1,88 @@
|
||||
import { Grammar } from "./grammar.js";
|
||||
import { Misc } from "./misc.js";
|
||||
import { RdDUtility } from "./rdd-utility.js";
|
||||
|
||||
export class DialogFabriquerPotion extends Dialog {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async create(actor, item) {
|
||||
const brinsMinimum = DialogFabriquerPotion.nombreBrinsMinimum(item)
|
||||
if (item.system.quantite < brinsMinimum) {
|
||||
ui.notifications.warn(`Vous avez ${item.system.quantite} brins de ${item.name}, il en faut au moins ${brinsMinimum} pour faire une potion!`)
|
||||
return
|
||||
static async create(actor, item, onActionItem) {
|
||||
const min = DialogFabriquerPotion.nombreBrinsMinimum(item);
|
||||
if (item.system.quantite < min) {
|
||||
ui.notifications.warn(`Vous avez ${item.system.quantite} brins de ${item.name}, il en faut au moins ${min} pour faire une potion!`);
|
||||
return;
|
||||
}
|
||||
const potionData = DialogFabriquerPotion.prepareData(item, brinsMinimum)
|
||||
const options = { classes: ["dialogfabriquerpotion"], width: 600, height: 160, 'z-index': 99999 }
|
||||
const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-fabriquer-potion-base.hbs', potionData)
|
||||
let potionData = DialogFabriquerPotion.prepareData(actor, item);
|
||||
|
||||
new DialogFabriquerPotion(actor, potionData, html, options).render(true)
|
||||
const html = await renderTemplate( 'systems/foundryvtt-reve-de-dragon/templates/dialog-fabriquer-potion-base.html', potionData);
|
||||
|
||||
let options = { classes: ["dialogfabriquerpotion"], width: 600, height: 160, 'z-index': 99999 };
|
||||
new DialogFabriquerPotion(actor, potionData, onActionItem, html, options).render(true);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static prepareData(item, brinsMinimum) {
|
||||
const brinsOptimal = DialogFabriquerPotion.nombreBrinsOptimal(item)
|
||||
return foundry.utils.mergeObject(foundry.utils.duplicate(item), {
|
||||
nbBrinsSelect: RdDUtility.buildListOptions(brinsMinimum, brinsOptimal),
|
||||
nbBrins: Math.min(item.system.quantite, brinsOptimal),
|
||||
herbebonus: item.system.niveau
|
||||
})
|
||||
static prepareData(actor, item) {
|
||||
let potionData = foundry.utils.duplicate(item)
|
||||
potionData.nbBrinsSelect = RdDUtility.buildListOptions(
|
||||
DialogFabriquerPotion.nombreBrinsMinimum(item),
|
||||
DialogFabriquerPotion.nombreBrinsOptimal(item));
|
||||
potionData.nbBrins = Math.min(potionData.system.quantite, DialogFabriquerPotion.nombreBrinsOptimal(potionData));
|
||||
potionData.herbebonus = item.system.niveau;
|
||||
potionData.buttonName = "Fabriquer";
|
||||
return potionData;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
constructor(actor, potionData, html, options) {
|
||||
constructor(actor, potionData, onActionItem, html, options) {
|
||||
const conf = {
|
||||
title: `Fabriquer une potion de ${potionData.system.categorie}`,
|
||||
content: html,
|
||||
default: 'fabriquer',
|
||||
buttons: {
|
||||
'fabriquer': { label: "Fabriquer", callback: it => this.onFabriquer() }
|
||||
'fabriquer': {
|
||||
label: potionData.buttonName, callback: it => this.onFabriquer()
|
||||
}
|
||||
}
|
||||
}
|
||||
super(conf, options)
|
||||
};
|
||||
|
||||
this.actor = actor
|
||||
this.potionData = potionData
|
||||
super(conf, options);
|
||||
|
||||
this.actor = actor;
|
||||
this.potionData = potionData;
|
||||
this.onActionItem = onActionItem;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html)
|
||||
this.html = html
|
||||
super.activateListeners(html);
|
||||
this.html = html;
|
||||
this.html.find("[name='nbBrins']").change(event => {
|
||||
this.potionData.nbBrins = Misc.toInt(event.currentTarget.value)
|
||||
const brinsManquants = Math.max(0, DialogFabriquerPotion.nombreBrinsOptimal(this.potionData) - this.potionData.nbBrins)
|
||||
this.potionData.nbBrins = Misc.toInt(event.currentTarget.value);
|
||||
const brinsManquants = Math.max(0, DialogFabriquerPotion.nombreBrinsOptimal(this.potionData) - this.potionData.nbBrins);
|
||||
this.potionData.herbebonus = Math.max(0, this.potionData.system.niveau - brinsManquants)
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async onFabriquer() {
|
||||
await this.html.find("[name='nbBrins']").change()
|
||||
await this.actor.fabriquerPotion(this.potionData)
|
||||
this.close()
|
||||
await this.html.find("[name='nbBrins']").change();
|
||||
await this.actor.fabriquerPotion(this.potionData);
|
||||
this.close();
|
||||
await this.onActionItem()
|
||||
}
|
||||
|
||||
static nombreBrinsMinimum(herbeData) {
|
||||
switch (herbeData.system.categorie ?? '') {
|
||||
case "Soin": return 1 + Math.max(0, 12 - 2 * herbeData.system.niveau)
|
||||
case "Repos": return 1 + Math.max(0, 7 - 2 * herbeData.system.niveau)
|
||||
case "Soin": return 1 + Math.max(0, 12 - 2 * herbeData.system.niveau);
|
||||
case "Repos": return 1 + Math.max(0, 7 - 2 * herbeData.system.niveau);
|
||||
}
|
||||
return 1
|
||||
return 1;
|
||||
}
|
||||
|
||||
static nombreBrinsOptimal(herbeData) {
|
||||
switch (herbeData.system.categorie ?? '') {
|
||||
case "Soin": return 12 - herbeData.system.niveau
|
||||
case "Repos": return 7 - herbeData.system.niveau
|
||||
case "Soin": return 12 - herbeData.system.niveau;
|
||||
case "Repos": return 7 - herbeData.system.niveau;
|
||||
}
|
||||
return 1
|
||||
return 1;
|
||||
}
|
||||
}
|
@ -2,13 +2,13 @@ import { Misc } from "./misc.js";
|
||||
|
||||
export class DialogConsommer extends Dialog {
|
||||
|
||||
static async create(actor, item) {
|
||||
static async create(actor, item, onActionItem = async () => { }) {
|
||||
const consommerData = DialogConsommer.prepareData(actor, item);
|
||||
const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-item-consommer.hbs', consommerData);
|
||||
return new DialogConsommer(actor, item, consommerData, html)
|
||||
const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-item-consommer.html', consommerData);
|
||||
return new DialogConsommer(actor, item, consommerData, html, onActionItem)
|
||||
}
|
||||
|
||||
constructor(actor, item, consommerData, html) {
|
||||
constructor(actor, item, consommerData, html, onActionItem = async () => { }) {
|
||||
const options = { classes: ["dialogconsommer"], width: 350, height: 'fit-content', 'z-index': 99999 };
|
||||
let conf = {
|
||||
title: consommerData.title,
|
||||
@ -16,7 +16,10 @@ export class DialogConsommer extends Dialog {
|
||||
default: consommerData.buttonName,
|
||||
buttons: {
|
||||
[consommerData.buttonName]: {
|
||||
label: consommerData.buttonName, callback: async it => await this.onConsommer()
|
||||
label: consommerData.buttonName, callback: async it => {
|
||||
await this.onConsommer();
|
||||
await onActionItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -3,7 +3,7 @@ export class DialogSelect extends Dialog {
|
||||
static extractIdNameImg(it) { return { id: it.id, name: it.name, img: it.img } }
|
||||
|
||||
static async select(selectionData, onSelectChoice) {
|
||||
const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/dialog-select.hbs", selectionData)
|
||||
const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/dialog-select.html", selectionData)
|
||||
|
||||
const dialogData = {
|
||||
title: selectionData.title ?? selectionData.label,
|
||||
|
@ -7,7 +7,7 @@ export class DialogSplitItem extends Dialog {
|
||||
item: item,
|
||||
choix: { quantite: 1, max: item.system.quantite - 1 }
|
||||
};
|
||||
const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/dialog-item-split.hbs`, splitData);
|
||||
const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/dialog-item-split.html`, splitData);
|
||||
return new DialogSplitItem(item, splitData, html, callback)
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ export class DialogValidationEncaissement extends Dialog {
|
||||
|
||||
static async validerEncaissement(actor, rollData, armure, onEncaisser) {
|
||||
const encaissement = await RdDUtility.jetEncaissement(actor, rollData, armure, { showDice: HIDE_DICE });
|
||||
const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-validation-encaissement.hbs', {
|
||||
const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-validation-encaissement.html', {
|
||||
actor: actor,
|
||||
rollData: rollData,
|
||||
encaissement: encaissement
|
||||
|
@ -1,3 +0,0 @@
|
||||
export { default as RdDModelMonnaie } from "./monnaie.mjs"
|
||||
export { default as RdDModelMunition } from "./munition.mjs"
|
||||
export { default as RdDModelTarot } from "./tarot.mjs"
|
@ -1,11 +0,0 @@
|
||||
import { RdDItem } from "../item.js";
|
||||
|
||||
export default class RdDItemMonnaie extends RdDItem {
|
||||
|
||||
constructor(data, context) {
|
||||
if (!data.img) {
|
||||
data.img = 'systems/foundryvtt-reve-de-dragon/icons/objets/piece_etain_poisson.webp'
|
||||
}
|
||||
super(data, context);
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
import { RdDItem } from "../item.js";
|
||||
|
||||
export default class RdDItemMunition extends RdDItem {
|
||||
static get defaultIcon() {
|
||||
return 'systems/foundryvtt-reve-de-dragon/icons/objets/fleche.webp'
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
import { RdDItem } from "../item.js";
|
||||
|
||||
export default class RdDItemTarot extends RdDItem {
|
||||
static get defaultIcon() {
|
||||
return 'systems/foundryvtt-reve-de-dragon/icons/tarots/dos-tarot.webp'
|
||||
}
|
||||
}
|
@ -1,177 +0,0 @@
|
||||
import { ITEM_TYPES } from "../constants.js"
|
||||
import { RdDItemSort } from "../item-sort.js"
|
||||
import { Misc } from "../misc.js"
|
||||
|
||||
export const ACTION_ITEM_ENCHANTER = {
|
||||
code: 'item-enchanter', label: 'Enchanter', icon: it => 'fa-solid fa-sparkles',
|
||||
filter: it => game.user.isGM || DialogEnchanter.isEnchantable(it),
|
||||
optionsFilter: options => options.editable,
|
||||
action: (item, actor) => DialogEnchanter.enchanter(item)
|
||||
}
|
||||
|
||||
export class DialogEnchanter extends Dialog {
|
||||
|
||||
static isEnchantable(item) {
|
||||
if (!item.isEnchantementPossible) {
|
||||
return false
|
||||
}
|
||||
if (game.user.isGM) {
|
||||
return true
|
||||
}
|
||||
if (item.system.prpermanent) {
|
||||
return false
|
||||
}
|
||||
if (!item.parent?.isHautRevant()) {
|
||||
return false
|
||||
}
|
||||
return RdDItemSort.lancements(RdDItemSort.findEnchantement(item.parent)) > 0
|
||||
|| RdDItemSort.lancements(RdDItemSort.findPurification(item.parent)) > 0
|
||||
|| RdDItemSort.lancements(RdDItemSort.findPermanence(item.parent)) > 0
|
||||
}
|
||||
|
||||
static dateEnchantement() {
|
||||
return game.system.rdd.calendrier.getTimestamp().debutJournee().indexDate
|
||||
}
|
||||
|
||||
static async enchanter(item) {
|
||||
const actor = item.parent
|
||||
const sorts = {
|
||||
enchantement: RdDItemSort.findEnchantement(actor),
|
||||
purification: RdDItemSort.findPurification(actor),
|
||||
permanence: RdDItemSort.findPermanence(actor)
|
||||
}
|
||||
const nouveauxpr = (sorts.enchantement?.system.lancements ?? []).map(it => it.reve)
|
||||
const purification = (sorts.purification?.system.lancements ?? []).find(it => true)
|
||||
const permanence = (sorts.permanence?.system.lancements ?? []).find(it => true)
|
||||
|
||||
const enchanter = {
|
||||
type: item.type == ITEM_TYPES.potion ? 'potion' : Misc.typeName('Item', item.type),
|
||||
actor: actor,
|
||||
item: item,
|
||||
reve: item.system.pr,
|
||||
sorts: sorts,
|
||||
nouveauxpr: nouveauxpr,
|
||||
purification: purification != undefined,
|
||||
permanence: permanence != undefined,
|
||||
options: { isGM: game.user.isGM }
|
||||
}
|
||||
if (!item.isEnchantementPossible) {
|
||||
ui.notifications.info("Seuls les liquides et les gemmes sont enchantables")
|
||||
return
|
||||
}
|
||||
if (item.system.prpermanent) {
|
||||
ui.notifications.info(`La ${enchanter.type} est permanente`)
|
||||
return
|
||||
}
|
||||
if (!game.user.isGM) {
|
||||
if (!(actor?.isPersonnage() || actor?.isHautRevant())) {
|
||||
ui.notifications.info(`Seul un haut rêvant peut enchanter une ${enchanter.type}`)
|
||||
return
|
||||
}
|
||||
if (item.system.quantite != 1) {
|
||||
ui.notifications.info(`Impossible d'enchanter ${item.system.quantite} ${enchanter.type}s ${item.system.quantite > 1 ? 'en une seule fois' : ''}`)
|
||||
return
|
||||
}
|
||||
if (!(nouveauxpr.length > 0 || purification || permanence)) {
|
||||
ui.notifications.info("Le haut-rêvant n'a lancé de rituel d'enchantement")
|
||||
return
|
||||
}
|
||||
if (item.system.magique && item.system.purifie && !purification && !permanence) {
|
||||
ui.notifications.info(`La ${enchanter.type} est déjà enchantée et doit être purifiée`)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/enchantement/dialog-enchanter.hbs`, enchanter)
|
||||
const dialog = new DialogEnchanter(enchanter, html)
|
||||
dialog.render(true)
|
||||
}
|
||||
|
||||
constructor(enchanter, html) {
|
||||
let options = { classes: ["dialog-enchanter"], width: 400, height: 'fit-content', 'z-index': 99999 }
|
||||
let conf = {
|
||||
title: `Enchanter une ${enchanter.type}`,
|
||||
content: html,
|
||||
default: "enchanter",
|
||||
buttons: {
|
||||
"enchanter": { label: "Enchanter", callback: it => this.onEnchanter() }
|
||||
}
|
||||
};
|
||||
super(conf, options)
|
||||
this.html = html
|
||||
this.enchanter = enchanter
|
||||
this.item = enchanter.item
|
||||
}
|
||||
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html)
|
||||
this.html = html
|
||||
this.html.find("input.enchantement").change(event => this.$onSelectEnchantement(event))
|
||||
this.html.find("input.reve").change(event => this.$onForceReve(event))
|
||||
}
|
||||
|
||||
$onSelectEnchantement(event) {
|
||||
const addReve = $(event.currentTarget).data('reve')
|
||||
this.enchanter.idx = $(event.currentTarget).data('idx')
|
||||
this.enchanter.reve = this.item.system.pr + Number(addReve)
|
||||
this.html.find("input.reve").val(this.enchanter.reve)
|
||||
for (let idx = 0; idx < this.enchanter.nouveauxpr.length; idx++) {
|
||||
if (idx != this.enchanter.idx) {
|
||||
this.html.find(`.enchantement[data-idx='${idx}']`).prop("checked", false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$onForceReve(event) {
|
||||
const newReve = Number(event.currentTarget.value)
|
||||
if (this.enchanter.reve != newReve) {
|
||||
this.enchanter.idx = undefined
|
||||
}
|
||||
this.enchanter.reve = newReve
|
||||
}
|
||||
|
||||
async onEnchanter() {
|
||||
foundry.utils.mergeObject(this.enchanter,
|
||||
{
|
||||
rendrepurifie: this.html.find("input.rendrepurifie").prop("checked"),
|
||||
rendrepermanent: this.html.find("input.rendrepermanent").prop("checked"),
|
||||
addreve: this.enchanter.reve != this.item.system.pr
|
||||
},
|
||||
{ inplace: true })
|
||||
const item = this.enchanter.item
|
||||
const actor = this.enchanter.actor
|
||||
|
||||
if (this.enchanter.reve == 0) {
|
||||
await item.update({
|
||||
'system.pr': 0,
|
||||
'system.magique': false,
|
||||
'system.purifie': false,
|
||||
'system.prpermanent': false,
|
||||
'system.prdate': 0
|
||||
})
|
||||
}
|
||||
else {
|
||||
const isPurifiee = this.enchanter.addreve
|
||||
? (this.enchanter.rendrepurifie && (item.item.system.pr == 0 ? true : item.system.purifie))
|
||||
: (this.enchanter.rendrepurifie || item.system.purifie)
|
||||
await item.update({
|
||||
'system.pr': this.enchanter.reve,
|
||||
'system.magique': true,
|
||||
'system.purifie': isPurifiee,
|
||||
'system.prpermanent': item.system.prpermanent || this.enchanter.rendrepermanent,
|
||||
'system.prdate': DialogEnchanter.dateEnchantement()
|
||||
})
|
||||
if (actor) {
|
||||
if (this.enchanter.rendrepurifie) {
|
||||
await RdDItemSort.changeLancementsSort(this.enchanter.sorts.purification, it => it.slice(1));
|
||||
}
|
||||
if (this.enchanter.rendrepermanent) {
|
||||
await RdDItemSort.changeLancementsSort(this.enchanter.sorts.permanence, it => it.slice(1));
|
||||
}
|
||||
if (this.enchanter.addreve && this.enchanter.idx != undefined) {
|
||||
await RdDItemSort.changeLancementsSort(RdDItemSort.findEnchantement(actor), it => it.toSpliced(this.enchanter.idx, 1))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
import { Grammar } from "./grammar.js";
|
||||
import { RdDItemCompetenceCreature } from "./item-competencecreature.js"
|
||||
import { ITEM_TYPES } from "./constants.js";
|
||||
import { BASE_CORPS_A_CORPS } from "./item/base-items.js";
|
||||
import { ITEM_TYPES } from "./item.js";
|
||||
import { RdDCombatManager } from "./rdd-combat.js";
|
||||
|
||||
const nomCategorieParade = {
|
||||
@ -120,13 +119,13 @@ export class RdDItemArme extends Item {
|
||||
|
||||
static defenseArmeParade(armeAttaque, armeParade) {
|
||||
const defCategory = RdDItemArme.getCategorieParade(armeParade)
|
||||
if (defCategory == 'boucliers') {
|
||||
if (defCategory == 'bouclier') {
|
||||
return 'norm'
|
||||
}
|
||||
if (armeAttaque?.system?.competence?.toLowerCase().match(/(fléau)/)) {
|
||||
if (armeAttaque.system.competence.toLowerCase().match(/(fléau)/)) {
|
||||
return ''
|
||||
}
|
||||
if (armeParade.system?.tir) {
|
||||
if (armeParade.system.tir) {
|
||||
return ''
|
||||
}
|
||||
const attCategory = RdDItemArme.getCategorieParade(armeAttaque)
|
||||
@ -237,13 +236,13 @@ export class RdDItemArme extends Item {
|
||||
}
|
||||
|
||||
static corpsACorps(actor) {
|
||||
let competence = actor?.getCompetenceCorpsACorps() ?? BASE_CORPS_A_CORPS
|
||||
let competence = actor?.getCompetenceCorpsACorps() ?? { system: { niveau: -6 } };
|
||||
let melee = actor ? actor.system.carac['melee'].value : 0
|
||||
return {
|
||||
_id: competence.id,
|
||||
_id: competence?.id,
|
||||
name: 'Corps à corps',
|
||||
type: ITEM_TYPES.arme,
|
||||
img: competence.img,
|
||||
img: 'systems/foundryvtt-reve-de-dragon/icons/competence_corps_a_corps.webp',
|
||||
system: {
|
||||
initiative: RdDCombatManager.calculInitiative(competence.system.niveau, melee),
|
||||
equipe: true,
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { Grammar } from "./grammar.js";
|
||||
import { RdDItem } from "./item.js";
|
||||
import { SANS_COMPETENCE } from "./item/base-items.js";
|
||||
import { Misc } from "./misc.js";
|
||||
|
||||
const competenceTroncs = [["Esquive", "Dague", "Corps à corps"],
|
||||
@ -138,7 +137,7 @@ export class RdDItemCompetence extends Item {
|
||||
/* -------------------------------------------- */
|
||||
static computeEconomieXPTronc(competences) {
|
||||
return competenceTroncs.map(
|
||||
list => list.map(name => RdDItemCompetence.findCompetence(competences, name, { onMessage: message => { } }))
|
||||
list => list.map(name => RdDItemCompetence.findCompetence(competences, name))
|
||||
// calcul du coût xp jusqu'au niveau 0 maximum
|
||||
.map(it => RdDItemCompetence.computeDeltaXP(it?.system.base ?? -11, Math.min(it?.system.niveau ?? -11, 0)))
|
||||
.sort(Misc.ascending())
|
||||
@ -204,12 +203,26 @@ export class RdDItemCompetence extends Item {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static findCompetences(list, name, options = {}) {
|
||||
options = foundry.utils.mergeObject(options, { preFilter: it => it.isCompetence(), description: 'compétence' }, { overwrite: false, inplace: false });
|
||||
return Misc.findAllLike(name, list, options);
|
||||
static findCompetences(list, name) {
|
||||
return Misc.findAllLike(name, list, { filter: it => it.isCompetence(), description: 'compétence' });
|
||||
}
|
||||
|
||||
static sansCompetence() { return SANS_COMPETENCE }
|
||||
static sansCompetence() {
|
||||
return {
|
||||
name: "Sans compétence",
|
||||
type: "competence",
|
||||
img: "systems/foundryvtt-reve-de-dragon/icons/templates/icone_parchement_vierge.webp",
|
||||
system: {
|
||||
niveau: 0,
|
||||
default_diffLibre: 0,
|
||||
base: 0,
|
||||
categorie: "Aucune",
|
||||
description: "",
|
||||
descriptionmj: "",
|
||||
defaut_carac: "",
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
static findFirstItem(list, idOrName, options) {
|
||||
return list.find(it => it.id == idOrName && options.preFilter(it))
|
||||
@ -259,9 +272,8 @@ export class RdDItemCompetence extends Item {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static triVisible(competences) {
|
||||
return competences
|
||||
? competences.filter(it => !it.system.isHidden).sort((a, b) => RdDItemCompetence.compare(a, b))
|
||||
: []
|
||||
return competences.filter(it => !it.system.isHidden)
|
||||
.sort((a, b) => RdDItemCompetence.compare(a, b))
|
||||
}
|
||||
|
||||
static $positionTri(comp) {
|
||||
|
@ -1,6 +1,5 @@
|
||||
|
||||
import { ITEM_TYPES } from "./constants.js";
|
||||
import { Grammar } from "./grammar.js";
|
||||
import { ITEM_TYPES } from "./item.js";
|
||||
import { RdDCombatManager } from "./rdd-combat.js";
|
||||
|
||||
export const CATEGORIES_COMPETENCES_CREATURES = {
|
||||
@ -18,11 +17,9 @@ export class RdDItemCompetenceCreature extends Item {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static setRollDataCreature(rollData) {
|
||||
const code = Grammar.toLowerCaseNoAccentNoSpace(rollData.competence.name);
|
||||
const selectedCarac = { code: code, label: rollData.competence.name, value: rollData.competence.system.carac_value };
|
||||
rollData.carac = { [code]: selectedCarac }
|
||||
rollData.competence.system.defaut_carac = code
|
||||
rollData.selectedCarac = selectedCarac
|
||||
rollData.carac = { "carac_creature": { label: rollData.competence.name, value: rollData.competence.system.carac_value } }
|
||||
rollData.competence.system.defaut_carac = "carac_creature"
|
||||
rollData.selectedCarac = rollData.carac.carac_creature
|
||||
rollData.arme = RdDItemCompetenceCreature.armeCreature(rollData.competence);
|
||||
}
|
||||
|
||||
@ -32,20 +29,20 @@ export class RdDItemCompetenceCreature extends Item {
|
||||
if (categorieAttaque != undefined) {
|
||||
// cloner pour ne pas modifier la compétence
|
||||
return foundry.utils.mergeObject(item, {
|
||||
action: item.isCompetencePossession() ? 'possession' : 'attaque',
|
||||
system: {
|
||||
competence: item.name,
|
||||
cac: categorieAttaque == "naturelle" ? "naturelle" : "",
|
||||
niveau: item.system.niveau,
|
||||
initiative: RdDCombatManager.calculInitiative(item.system.niveau, item.system.carac_value),
|
||||
equipe: true,
|
||||
resistance: 100,
|
||||
dommagesReels: item.system.dommages,
|
||||
penetration: 0,
|
||||
force: 0,
|
||||
rapide: true,
|
||||
}
|
||||
}, { inplace: false, });
|
||||
action: item.isCompetencePossession() ? 'possession' : 'attaque',
|
||||
system: {
|
||||
competence: item.name,
|
||||
cac: categorieAttaque == "naturelle" ? "naturelle" : "",
|
||||
niveau: item.system.niveau,
|
||||
initiative: RdDCombatManager.calculInitiative(item.system.niveau, item.system.carac_value),
|
||||
equipe: true,
|
||||
resistance: 100,
|
||||
dommagesReels: item.system.dommages,
|
||||
penetration: 0,
|
||||
force: 0,
|
||||
rapide: true,
|
||||
}
|
||||
}, { inplace: false, });
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Misc } from "./misc.js";
|
||||
import { ITEM_TYPES, LOG_HEAD } from "./constants.js";
|
||||
import { LOG_HEAD } from "./constants.js";
|
||||
|
||||
const MONNAIE_ETAIN = {
|
||||
name: "Denier (étain)", type: 'monnaie',
|
||||
@ -70,17 +70,18 @@ export class Monnaie {
|
||||
}
|
||||
|
||||
static getFortune(monnaies) {
|
||||
return (monnaies ?? [])
|
||||
return (monnaies??[])
|
||||
.map(m => Number(m.system.cout) * Number(m.system.quantite))
|
||||
.reduce(Misc.sum(), 0);
|
||||
}
|
||||
|
||||
static async optimiserFortune(actor, fortune) {
|
||||
Monnaie.validerMonnaies(actor)
|
||||
let resteEnDeniers = Math.round(fortune * 100);
|
||||
const updates = []
|
||||
let monnaies = actor.itemTypes['monnaie'];
|
||||
let updates = [];
|
||||
Monnaie.validerMonnaies(monnaies, actor);
|
||||
|
||||
const parValeur = Misc.classifyFirst(actor.itemTypes[ITEM_TYPES.monnaie], it => VALEUR_DENIERS(it.system.cout));
|
||||
let parValeur = Misc.classifyFirst(monnaies, it => VALEUR_DENIERS(it.system.cout));
|
||||
for (let valeurDeniers of [1000, 100, 10, 1]) {
|
||||
const itemPiece = parValeur[valeurDeniers];
|
||||
if (itemPiece) {
|
||||
@ -101,11 +102,8 @@ export class Monnaie {
|
||||
}
|
||||
}
|
||||
|
||||
static validerMonnaies(actor) {
|
||||
if (!actor) {
|
||||
return
|
||||
}
|
||||
actor.itemTypes[ITEM_TYPES.monnaie]?.filter(it => VALEUR_DENIERS(it.system.cout) == 0)
|
||||
static validerMonnaies(monnaies, actor = undefined) {
|
||||
monnaies.filter(it => VALEUR_DENIERS(it.system.cout) == 0)
|
||||
.map(it => `La monnaie ${it.name} de l'acteur ${actor?.name ?? 'sélectionné'} a une valeur de 0!`)
|
||||
.forEach(message => {
|
||||
ui.notifications.warn(message);
|
||||
|
@ -1,7 +1,9 @@
|
||||
import { ACTOR_TYPES, ITEM_TYPES } from "./constants.js";
|
||||
import { RdDItemSort } from "./item-sort.js";
|
||||
import { RdDUtility } from "./rdd-utility.js";
|
||||
import { RdDAlchimie } from "./rdd-alchimie.js";
|
||||
import { RdDItemCompetence } from "./item-competence.js";
|
||||
import { RdDHerbes } from "./rdd-herbes.js";
|
||||
import { RdDGemme } from "./rdd-gemme.js";
|
||||
import { HtmlUtility } from "./html-utility.js";
|
||||
import { ReglesOptionnelles } from "./settings/regles-optionnelles.js";
|
||||
import { SYSTEM_RDD } from "./constants.js";
|
||||
@ -10,15 +12,13 @@ import { SystemCompendiums } from "./settings/system-compendiums.js";
|
||||
import { Misc } from "./misc.js";
|
||||
import { RdDTimestamp } from "./time/rdd-timestamp.js";
|
||||
import { RdDItemCompetenceCreature } from "./item-competencecreature.js";
|
||||
import { RdDItem } from "./item.js";
|
||||
import { ITEM_TYPES, RdDItem } from "./item.js";
|
||||
import { FLEUVE_COORD, TMRUtility } from "./tmr-utility.js";
|
||||
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
|
||||
import { ItemAction } from "./item/item-actions.js";
|
||||
|
||||
/**
|
||||
* Extend the basic ItemSheet for RdD specific items
|
||||
*/
|
||||
export class RdDItemSheetV1 extends foundry.appv1.sheets.ItemSheet {
|
||||
export class RdDItemSheet extends ItemSheet {
|
||||
|
||||
static get ITEM_TYPE() {
|
||||
return undefined
|
||||
@ -26,12 +26,12 @@ export class RdDItemSheetV1 extends foundry.appv1.sheets.ItemSheet {
|
||||
|
||||
static defaultTemplate(type) {
|
||||
return type ?
|
||||
`systems/foundryvtt-reve-de-dragon/templates/item/${type}-sheet.hbs` :
|
||||
"systems/foundryvtt-reve-de-dragon/templates/item/item-sheet.hbs";
|
||||
`systems/foundryvtt-reve-de-dragon/templates/item-${type}-sheet.html` :
|
||||
"systems/foundryvtt-reve-de-dragon/templates/item-sheet.html";
|
||||
}
|
||||
|
||||
static register(sheetClass) {
|
||||
foundry.documents.collections.Items.registerSheet(SYSTEM_RDD, sheetClass, {
|
||||
Items.registerSheet(SYSTEM_RDD, sheetClass, {
|
||||
label: Misc.typeName('Item', sheetClass.ITEM_TYPE),
|
||||
types: [sheetClass.ITEM_TYPE],
|
||||
makeDefault: true
|
||||
@ -42,7 +42,7 @@ export class RdDItemSheetV1 extends foundry.appv1.sheets.ItemSheet {
|
||||
static get defaultOptions() {
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
classes: [SYSTEM_RDD, "sheet", "item"],
|
||||
template: RdDItemSheetV1.defaultTemplate(RdDItemSheetV1.ITEM_TYPE),
|
||||
template: RdDItemSheet.defaultTemplate(RdDItemSheet.ITEM_TYPE),
|
||||
width: 550,
|
||||
height: 550
|
||||
}, { inplace: false });
|
||||
@ -50,7 +50,7 @@ export class RdDItemSheetV1 extends foundry.appv1.sheets.ItemSheet {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
get template() {
|
||||
return RdDItemSheetV1.defaultTemplate(this.item.type);
|
||||
return RdDItemSheet.defaultTemplate(this.item.type);
|
||||
}
|
||||
|
||||
get title() {
|
||||
@ -97,11 +97,11 @@ export class RdDItemSheetV1 extends foundry.appv1.sheets.ItemSheet {
|
||||
name: this.item.name,
|
||||
system: this.item.system,
|
||||
actorId: this.actor?.id,
|
||||
description: await RdDTextEditor.enrichHTML(this.item.system.description, this.item),
|
||||
descriptionmj: await RdDTextEditor.enrichHTML(this.item.system.descriptionmj, this.item),
|
||||
description: await TextEditor.enrichHTML(this.item.system.description, { async: true }),
|
||||
descriptionmj: await TextEditor.enrichHTML(this.item.system.descriptionmj, { async: true }),
|
||||
isComestible: this.item.getUtilisationCuisine(),
|
||||
options: RdDSheetUtility.mergeDocumentRights({}, this.item, this.isEditable),
|
||||
competences: await SystemCompendiums.getCompetences(ACTOR_TYPES.personnage),
|
||||
options: RdDSheetUtility.mergeDocumentRights(this.options, this.item, this.isEditable),
|
||||
competences: await SystemCompendiums.getCompetences('personnage'),
|
||||
categories: RdDItem.getCategories(this.item.type),
|
||||
}
|
||||
|
||||
@ -120,19 +120,26 @@ export class RdDItemSheetV1 extends foundry.appv1.sheets.ItemSheet {
|
||||
formData.competences = formData.competences.filter(it => it.isCompetenceArme())
|
||||
}
|
||||
if (this.item.type == ITEM_TYPES.recettecuisine) {
|
||||
formData.ingredients = await RdDTextEditor.enrichHTML(this.item.system.ingredients, this.item)
|
||||
formData.ingredients = await TextEditor.enrichHTML(this.object.system.ingredients, { async: true })
|
||||
}
|
||||
if (this.item.type == ITEM_TYPES.extraitpoetique) {
|
||||
formData.extrait = await RdDTextEditor.enrichHTML(this.item.system.extrait, this.item)
|
||||
formData.texte = await RdDTextEditor.enrichHTML(this.item.system.texte, this.item)
|
||||
formData.extrait = await TextEditor.enrichHTML(this.object.system.extrait, { async: true })
|
||||
formData.texte = await TextEditor.enrichHTML(this.object.system.texte, { async: true })
|
||||
}
|
||||
if (this.item.type == ITEM_TYPES.recettealchimique) {
|
||||
formData.manipulation = await RdDTextEditor.enrichHTML(this.item.system.manipulation, this.item)
|
||||
formData.utilisation = await RdDTextEditor.enrichHTML(this.item.system.utilisation, this.item)
|
||||
formData.enchantement = await RdDTextEditor.enrichHTML(this.item.system.enchantement, this.item)
|
||||
formData.sureffet = await RdDTextEditor.enrichHTML(this.item.system.sureffet, this.item)
|
||||
RdDAlchimie.processManipulation(this.item, this.actor?.id);
|
||||
formData.manipulation_update = await TextEditor.enrichHTML(this.object.system.manipulation_update, { async: true })
|
||||
formData.utilisation = await TextEditor.enrichHTML(this.object.system.utilisation, { async: true })
|
||||
formData.enchantement = await TextEditor.enrichHTML(this.object.system.enchantement, { async: true })
|
||||
formData.sureffet = await TextEditor.enrichHTML(this.object.system.sureffet, { async: true })
|
||||
}
|
||||
if (this.item.type == ITEM_TYPES.gemme) {
|
||||
formData.gemmeTypeList = RdDGemme.getGemmeTypeOptionList();
|
||||
RdDGemme.calculDataDerivees(this.item)
|
||||
}
|
||||
if (this.item.type == ITEM_TYPES.potion) {
|
||||
RdDHerbes.calculFormData(formData, this.item)
|
||||
}
|
||||
|
||||
if (this.item.type == ITEM_TYPES.herbe) {
|
||||
if (formData.options.isOwned && ['Soin', 'Repos'].includes(formData.system.categorie)) {
|
||||
formData.isIngredientPotionBase = true;
|
||||
@ -158,19 +165,23 @@ export class RdDItemSheetV1 extends foundry.appv1.sheets.ItemSheet {
|
||||
|
||||
HtmlUtility.showControlWhen(this.html.find(".item-cout"), ReglesOptionnelles.isUsing('afficher-prix-joueurs')
|
||||
|| game.user.isGM
|
||||
|| !this.item.isOwned)
|
||||
HtmlUtility.showControlWhen(this.html.find(".item-magique"), this.item.isMagique)
|
||||
|| !this.item.isOwned);
|
||||
HtmlUtility.showControlWhen(this.html.find(".item-magique"), this.item.isMagique());
|
||||
|
||||
// Everything below here is only needed if the sheet is editable
|
||||
if (!this.options.editable) return
|
||||
if (!this.options.editable) return;
|
||||
|
||||
this.form.ondragstart = async event => await this._onDragStart(event)
|
||||
this.form.ondrop = async event => await this._onDrop(event)
|
||||
this.form.ondragstart = (event) => this._onDragStart(event);
|
||||
this.form.ondrop = (event) => this._onDrop(event);
|
||||
|
||||
// Select competence categorie
|
||||
this.html.find(".categorie").change(async event => await this._onSelectCategorie(event))
|
||||
this.html.find(".categorie").change(event => this._onSelectCategorie(event));
|
||||
|
||||
this.html.find('.sheet-competence-xp').change(event => RdDUtility.checkThanatosXP(this.item))
|
||||
this.html.find('.sheet-competence-xp').change((event) => {
|
||||
if (this.item.isCompetencePersonnage()) {
|
||||
RdDUtility.checkThanatosXP(this.item.name);
|
||||
}
|
||||
});
|
||||
this.html.find(".item-cout input[name='system.cout']").change(event => {
|
||||
if (this.item.isMonnaie()) {
|
||||
const value = event.currentTarget.value;
|
||||
@ -179,60 +190,75 @@ export class RdDItemSheetV1 extends foundry.appv1.sheets.ItemSheet {
|
||||
}
|
||||
}
|
||||
})
|
||||
this.html.find('.delete-bonus-case').click(async event => await this.supprimerBonusCase(event.currentTarget.attributes['data-deleteCoord'].value))
|
||||
this.html.find('.creer-tache-livre').click(async event => await this._getEventActor(event).creerTacheDepuisLivre(this.item))
|
||||
this.html.find('.creer-potion-base').click(async event => await this._getEventActor(event).fabriquerDecoctionHerbe(this.item))
|
||||
this.html.find('input[name="system.cacher_points_de_tache"]').change(async event =>
|
||||
await this.item.update({ 'system.cacher_points_de_tache': event.currentTarget.checked })
|
||||
)
|
||||
this.html.find('.delete-bonus-case').click((event) => {
|
||||
this.supprimerBonusCase(event.currentTarget.attributes['data-deleteCoord'].value)
|
||||
})
|
||||
|
||||
this.html.find('.roll-text').click(async event => await RdDTextEditor.rollText(event, this.actor))
|
||||
this.html.find('.chat-roll-text').click(async event => await RdDTextEditor.chatRollText(event))
|
||||
this.html.find('.date-enchantement').change((event) => {
|
||||
const jour = Number(this.html.find('input.date-enchantement[name="enchantement.jour"]').val());
|
||||
const mois = RdDTimestamp.definition(this.html.find('select.date-enchantement[name="enchantement.mois"]').val());
|
||||
const indexDate = game.system.rdd.calendrier.getIndexFromDate(jour, mois.heure);
|
||||
this.item.update({ 'system.prdate': indexDate });
|
||||
console.warn(`Date d'enchantement modifiée ${jour}/${mois.heure}: ${indexDate}`)
|
||||
});
|
||||
|
||||
this.html.find('.creer-tache-livre').click((event) => this._getEventActor(event).creerTacheDepuisLivre(this.item));
|
||||
this.html.find('.consommer-potion').click((event) => this._getEventActor(event).consommerPotion(this.item, this.getActionRenderItem()));
|
||||
this.html.find('.creer-potion-base').click((event) => this._getEventActor(event).actionHerbe(this.item));
|
||||
this.html.find('input[name="system.cacher_points_de_tache"]').change(async event => await this.item.update({ 'system.cacher_points_de_tache': event.currentTarget.checked }));
|
||||
|
||||
this.html.find('.alchimie-tache a').click((event) => {
|
||||
let actor = this._getEventActor(event);
|
||||
if (actor) {
|
||||
let recetteId = event.currentTarget.attributes['data-recette-id'].value;
|
||||
let tacheName = event.currentTarget.attributes['data-alchimie-tache'].value;
|
||||
let tacheData = event.currentTarget.attributes['data-alchimie-data'].value;
|
||||
actor.effectuerTacheAlchimie(recetteId, tacheName, tacheData);
|
||||
} else {
|
||||
ui.notifications.info("Impossible trouver un acteur pour réaliser cette tache Alchimique.");
|
||||
}
|
||||
});
|
||||
|
||||
if (this.actor) {
|
||||
this.html.find('.actionItem').click(async event => await ItemAction.onActionItem(event, this.actor, this.options))
|
||||
|
||||
// TODO: utiliser un itemAction?
|
||||
this.html.find('.item-potion-consommer').click(async event => await this.itemActionConsommer(event))
|
||||
this.html.find('.item-split').click(async event => RdDSheetUtility.splitItem(RdDSheetUtility.getItem(event, this.actor), this.actor, this.getActionRenderItem()));
|
||||
this.html.find('.item-edit').click(async event => RdDSheetUtility.getItem(event, this.actor)?.sheet.render(true));
|
||||
this.html.find('.item-delete').click(async event => RdDUtility.confirmActorItemDelete(this, RdDSheetUtility.getItem(event, this.actor)));
|
||||
this.html.find('.item-vendre').click(async event => RdDSheetUtility.getItem(event, this.actor)?.proposerVente());
|
||||
this.html.find('.item-montrer').click(async event => RdDSheetUtility.getItem(event, this.actor)?.postItemToChat());
|
||||
this.html.find('.item-action').click(async event => RdDSheetUtility.getItem(event, this.actor)?.actionPrincipale(this.actor, this.getActionRenderItem()));
|
||||
|
||||
this.html.find('.item-quantite-plus').click(async event => {
|
||||
await this.actor.itemQuantiteIncDec(RdDSheetUtility.getItemId(event), 1)
|
||||
//this.render()
|
||||
})
|
||||
this.render();
|
||||
});
|
||||
this.html.find('.item-quantite-moins').click(async event => {
|
||||
await this.actor.itemQuantiteIncDec(RdDSheetUtility.getItemId(event), -1)
|
||||
//this.render()
|
||||
})
|
||||
this.render();
|
||||
});
|
||||
}
|
||||
|
||||
const updateItemTimestamp = (path, timestamp) => this.item.update({ [path]: foundry.utils.duplicate(timestamp) })
|
||||
|
||||
RdDTimestamp.handleTimestampEditor(this.html, 'system.temporel.debut', updateItemTimestamp)
|
||||
RdDTimestamp.handleTimestampEditor(this.html, 'system.temporel.fin', updateItemTimestamp)
|
||||
RdDTimestamp.handleTimestampEditor(this.html, 'system.temporel.debut', updateItemTimestamp);
|
||||
RdDTimestamp.handleTimestampEditor(this.html, 'system.temporel.fin', updateItemTimestamp);
|
||||
}
|
||||
|
||||
async itemActionDelete(event) {
|
||||
const item = RdDSheetUtility.getItem(event, this.actor)
|
||||
return await RdDUtility.confirmActorItemDelete(item, this.actor)
|
||||
}
|
||||
|
||||
async itemActionConsommer(event) {
|
||||
const item = RdDSheetUtility.getItem(event, this.actor)
|
||||
if (item) {
|
||||
await actor.consommerPotion(item)
|
||||
await RdDSheetUtility.renderItemBranch(this.actor, item)
|
||||
getActionRenderItem() {
|
||||
return async () => {
|
||||
let item = this.item;
|
||||
while (item) {
|
||||
await item.sheet?.render()
|
||||
item = this.actor.getContenant(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async itemActionSplit(event) {
|
||||
const item = RdDSheetUtility.getItem(event, this.actor)
|
||||
if (item) {
|
||||
await RdDSheetUtility.splitItem(item, this.actor)
|
||||
await RdDSheetUtility.renderItemBranch(this.actor, item)
|
||||
}
|
||||
_getEventActor(event) {
|
||||
let actorId = event.currentTarget.attributes['data-actor-id'].value;
|
||||
let actor = game.actors.get(actorId);
|
||||
return actor;
|
||||
}
|
||||
|
||||
_getEventActor(event) { return game.actors.get(event.currentTarget.attributes['data-actor-id'].value) }
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _onSelectCategorie(event) {
|
||||
@ -246,7 +272,7 @@ export class RdDItemSheetV1 extends foundry.appv1.sheets.ItemSheet {
|
||||
}
|
||||
}
|
||||
|
||||
async supprimerBonusCase(deleteCoord) {
|
||||
async supprimerBonusCase(deleteCoord){
|
||||
if (this.item.type == ITEM_TYPES.sort) {
|
||||
const oldList = RdDItemSort.getBonusCaseList(this.item)
|
||||
const newList = oldList.filter(it => it.case != deleteCoord);
|
||||
@ -263,7 +289,7 @@ export class RdDItemSheetV1 extends foundry.appv1.sheets.ItemSheet {
|
||||
_updateObject(event, formData) {
|
||||
switch (this.item.type) {
|
||||
case ITEM_TYPES.sort:
|
||||
formData['system.bonuscase'] = RdDItemSort.bonuscasesToString(RdDItemSheetV1._listCaseTmr(
|
||||
formData['system.bonuscase'] = RdDItemSort.bonuscasesToString(RdDItemSheet._listCaseTmr(
|
||||
formData.caseTmrCoord,
|
||||
formData.caseTmrBonus,
|
||||
formData.caseTmrAdd
|
||||
@ -274,7 +300,7 @@ export class RdDItemSheetV1 extends foundry.appv1.sheets.ItemSheet {
|
||||
break
|
||||
}
|
||||
|
||||
return this.item.update(formData)
|
||||
return this.item.update(formData);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -307,13 +333,12 @@ export class RdDItemSheetV1 extends foundry.appv1.sheets.ItemSheet {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _onDragStart(event) { }
|
||||
async _onDropItem(event, dragData) { }
|
||||
async _onDropActor(event, dragData) { }
|
||||
async _onDragStart(event) {
|
||||
}
|
||||
|
||||
async _onDrop(event) {
|
||||
// Try to extract the dragData
|
||||
let dragData = RdDItemSheetV1.$extractDragData(event);
|
||||
let dragData = RdDItemSheet.$extractDragData(event);
|
||||
if (!dragData) return false;
|
||||
const allowed = Hooks.call("dropActorSheetData", this.actor, this, dragData);
|
||||
if (allowed === false) return false;
|
||||
@ -335,7 +360,13 @@ export class RdDItemSheetV1 extends foundry.appv1.sheets.ItemSheet {
|
||||
return JSON.parse(eventData);
|
||||
}
|
||||
} catch (err) { }
|
||||
return undefined
|
||||
return undefined;
|
||||
}
|
||||
|
||||
async _onDropItem(event, dragData) {
|
||||
}
|
||||
|
||||
async _onDropActor(event, dragData) {
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Grammar } from "./grammar.js";
|
||||
import { RdDItemCompetence } from "./item-competence.js";
|
||||
import { ITEM_TYPES } from "./constants.js";
|
||||
import { ITEM_TYPES } from "./item.js";
|
||||
import { Misc } from "./misc.js";
|
||||
import { FLEUVE_COORD, TMRUtility } from "./tmr-utility.js";
|
||||
|
||||
@ -22,21 +22,7 @@ export class RdDItemSort extends Item {
|
||||
}
|
||||
|
||||
static addSpaceToNonNumeric(value) {
|
||||
return Number.isNumeric(value) || ['-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'].includes(String(value).charAt[0]) ? value : ' ' + RdDItemSort.toVar(value)
|
||||
}
|
||||
|
||||
static lancements(sort) { return sort?.system.lancements.length ?? 0 }
|
||||
|
||||
static findEnchantement(actor) { return RdDItemSort.findSort(actor, 'Enchantement', ['Narcos', 'N']) }
|
||||
static findPermanence(actor) { return RdDItemSort.findSort(actor, 'Permanence', ['Narcos', 'N']) }
|
||||
static findPurification(actor) { return RdDItemSort.findSort(actor, 'Purification', ['Narcos', 'N']) }
|
||||
|
||||
static findSort(actor, name, draconics) {
|
||||
return actor.itemTypes[ITEM_TYPES.sort].find(it => Grammar.includesLowerCaseNoAccent(it.name, name)
|
||||
&& (draconics == undefined || draconics.includes(it.system.draconic)))
|
||||
}
|
||||
static async changeLancementsSort(sort, changement) {
|
||||
await sort?.update({ 'system.lancements': changement(sort.system.lancements) });
|
||||
return Number.isNumeric(value) || ['-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'].includes( String(value).charAt[0]) ? value : ' ' + RdDItemSort.toVar(value)
|
||||
}
|
||||
|
||||
static toVar(value) {
|
||||
@ -56,10 +42,6 @@ export class RdDItemSort extends Item {
|
||||
return voies.map(voie => RdDItemCompetence.getVoieDraconic(competencesDraconic, voie))
|
||||
}
|
||||
|
||||
static getBestDraconicSort(competencesDraconic, sort) {
|
||||
return RdDItemSort.getDraconicsSort(competencesDraconic, sort).sort(Misc.descending(it => it.system.niveau)).find(it=>true)
|
||||
}
|
||||
|
||||
static getOrdreCode(code) {
|
||||
return (VOIES_DRACONIC.find(it => it.code == code)?.ordre ?? '?')
|
||||
}
|
||||
@ -96,7 +78,7 @@ export class RdDItemSort extends Item {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static isCoutVariable(sort) {
|
||||
return sort && !Number.isInteger(sort.system.ptreve) && (sort.system.ptreve.toLowerCase() == "variable" || sort.system.ptreve.indexOf("+") >= 0);
|
||||
return sort && (sort.system.ptreve.toLowerCase() == "variable" || sort.system.ptreve.indexOf("+") >= 0);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -169,4 +151,5 @@ export class RdDItemSort extends Item {
|
||||
.map(it => it.split(':'))
|
||||
.map(it => { return { case: it[0], bonus: it[1] } });
|
||||
}
|
||||
|
||||
}
|
224
module/item.js
224
module/item.js
@ -1,15 +1,67 @@
|
||||
import { ITEM_TYPES } from "./constants.js";
|
||||
import { DialogItemVente } from "./achat-vente/dialog-item-vente.js";
|
||||
import { Grammar } from "./grammar.js";
|
||||
import { Misc } from "./misc.js";
|
||||
import { RdDHerbes } from "./rdd-herbes.js";
|
||||
import { RdDTimestamp } from "./time/rdd-timestamp.js";
|
||||
import { RdDUtility } from "./rdd-utility.js";
|
||||
import { SystemCompendiums } from "./settings/system-compendiums.js";
|
||||
import { RdDRaretes } from "./item/raretes.js";
|
||||
import { CATEGORIES_COMPETENCES } from "./item-competence.js";
|
||||
import { CATEGORIES_COMPETENCES_CREATURES } from "./item-competencecreature.js";
|
||||
import { BASE_CORPS_A_CORPS, BASE_ESQUIVE } from "./item/base-items.js";
|
||||
import { ITEM_ACTIONS, DEFAULT_ACTIONS, COMMON_ACTIONS } from "./item/item-actions.js";
|
||||
|
||||
export const ACTOR_TYPES = {
|
||||
personnage: 'personnage',
|
||||
creature: 'creature',
|
||||
entite: 'entite',
|
||||
commerce: 'commerce',
|
||||
vehicule: 'vehicule'
|
||||
}
|
||||
|
||||
export const ITEM_TYPES = {
|
||||
competence: 'competence',
|
||||
competencecreature: 'competencecreature',
|
||||
empoignade: 'empoignade',
|
||||
possession: 'possession',
|
||||
blessure: 'blessure',
|
||||
maladie: 'maladie',
|
||||
poison: 'poison',
|
||||
arme: 'arme',
|
||||
armure: 'armure',
|
||||
conteneur: 'conteneur',
|
||||
objet: 'objet',
|
||||
monnaie: 'monnaie',
|
||||
gemme: 'gemme',
|
||||
munition: 'munition',
|
||||
nourritureboisson: 'nourritureboisson',
|
||||
herbe: 'herbe',
|
||||
plante: 'plante',
|
||||
ingredient: 'ingredient',
|
||||
faune: 'faune',
|
||||
livre: 'livre',
|
||||
potion: 'potion',
|
||||
service: 'service',
|
||||
musique: 'musique',
|
||||
danse: 'danse',
|
||||
chant: 'chant',
|
||||
jeu: 'jeu',
|
||||
recettecuisine: 'recettecuisine',
|
||||
oeuvre: 'oeuvre',
|
||||
recettealchimique: 'recettealchimique',
|
||||
tache: 'tache',
|
||||
sort: 'sort',
|
||||
sortreserve: 'sortreserve',
|
||||
rencontre: 'rencontre',
|
||||
queue: 'queue',
|
||||
ombre: 'ombre',
|
||||
souffle: 'souffle',
|
||||
tete: 'tete',
|
||||
casetmr: 'casetmr',
|
||||
meditation: 'meditation',
|
||||
signedraconique: 'signedraconique',
|
||||
tarot: 'tarot',
|
||||
nombreastral: 'nombreastral',
|
||||
extraitpoetique: 'extraitpoetique',
|
||||
}
|
||||
|
||||
const typesInventaireMateriel = [
|
||||
ITEM_TYPES.arme,
|
||||
@ -41,49 +93,51 @@ const typesObjetsTemporels = [ITEM_TYPES.blessure, ITEM_TYPES.poison, ITEM_TYPES
|
||||
const typesObjetsEquipable = [ITEM_TYPES.arme, ITEM_TYPES.armure, ITEM_TYPES.objet];
|
||||
const typesEnvironnement = typesInventaireMateriel;
|
||||
const encBrin = 0.00005; // un brin = 1 décigramme = 1/10g = 1/10000kg = 1/20000 enc
|
||||
const encPepin = 0.0007; /* un pépin de gemme = 1/10 cm3 = 1/1000 l = 3.5/1000 kg = 7/2000 kg = 7/1000 enc
|
||||
densité 3.5 (~2.3 à 4, parfois plus) -- https://www.juwelo.fr/guide-des-pierres/faits-et-chiffres/
|
||||
*/
|
||||
|
||||
export const defaultItemImg = {
|
||||
arme: "systems/foundryvtt-reve-de-dragon/icons/armes_armures/epee_gnome.webp",
|
||||
armure: "systems/foundryvtt-reve-de-dragon/icons/armes_armures/armure_plaques.webp",
|
||||
chant: "systems/foundryvtt-reve-de-dragon/icons/arts/chant_0.webp",
|
||||
competence: "systems/foundryvtt-reve-de-dragon/icons/competence_defaut.webp",
|
||||
competencecreature: "systems/foundryvtt-reve-de-dragon/icons/competence_defaut.webp",
|
||||
arme: "systems/foundryvtt-reve-de-dragon/icons/armes_armures/epee_gnome.webp",
|
||||
armure: "systems/foundryvtt-reve-de-dragon/icons/armes_armures/armure_plaques.webp",
|
||||
conteneur: "systems/foundryvtt-reve-de-dragon/icons/objets/sac_a_dos.webp",
|
||||
danse: "systems/foundryvtt-reve-de-dragon/icons/arts/danse_0.webp",
|
||||
empoignade: "systems/foundryvtt-reve-de-dragon/icons/empoignade.webp",
|
||||
extraitpoetique: "systems/foundryvtt-reve-de-dragon/icons/competence_ecriture.webp",
|
||||
faune: "systems/foundryvtt-reve-de-dragon/icons/faune/rongeur.webp",
|
||||
gemme: "systems/foundryvtt-reve-de-dragon/icons/gemmes/almaze.webp",
|
||||
sort: "systems/foundryvtt-reve-de-dragon/icons/competence_oniros.webp",
|
||||
herbe: "systems/foundryvtt-reve-de-dragon/icons/botanique/Endorlotte.webp",
|
||||
faune: "systems/foundryvtt-reve-de-dragon/icons/faune/rongeur.webp",
|
||||
ingredient: "systems/foundryvtt-reve-de-dragon/icons/objets/sable_poudre.webp",
|
||||
jeu: "systems/foundryvtt-reve-de-dragon/icons/arts/jeux_petasse.webp",
|
||||
livre: "systems/foundryvtt-reve-de-dragon/icons/objets/livre.webp",
|
||||
maladie: "systems/foundryvtt-reve-de-dragon/icons/maladies_venins/maladie.webp",
|
||||
meditation: "systems/foundryvtt-reve-de-dragon/icons/meditations_ecrits/meditation_alchimie.webp",
|
||||
musique: "systems/foundryvtt-reve-de-dragon/icons/arts/chant_0.webp",
|
||||
nourritureboisson: "systems/foundryvtt-reve-de-dragon/icons/objets/provision_crue.webp",
|
||||
oeuvre: "systems/foundryvtt-reve-de-dragon/icons/competence_comedie.webp",
|
||||
ombre: "systems/foundryvtt-reve-de-dragon/icons/queue_dragon.webp",
|
||||
poison: "systems/foundryvtt-reve-de-dragon/icons/maladies_venins/venin.webp",
|
||||
possession: "systems/foundryvtt-reve-de-dragon/icons/entites/possession2.webp",
|
||||
potion: "systems/foundryvtt-reve-de-dragon/icons/objets/liqueur_de_bagdol.webp",
|
||||
queue: "systems/foundryvtt-reve-de-dragon/icons/queue_dragon.webp",
|
||||
recettealchimique: "systems/foundryvtt-reve-de-dragon/icons/competence_alchimie.webp",
|
||||
recettecuisine: "systems/foundryvtt-reve-de-dragon/icons/arts/recette_cuisine_1.webp",
|
||||
rencontre: "systems/foundryvtt-reve-de-dragon/icons/tete_dragon.webp",
|
||||
queue: "systems/foundryvtt-reve-de-dragon/icons/queue_dragon.webp",
|
||||
ombre: "systems/foundryvtt-reve-de-dragon/icons/queue_dragon.webp",
|
||||
souffle: "systems/foundryvtt-reve-de-dragon/icons/souffle_dragon.webp",
|
||||
tete: "systems/foundryvtt-reve-de-dragon/icons/tete_dragon.webp",
|
||||
meditation: "systems/foundryvtt-reve-de-dragon/icons/meditations_ecrits/meditation_alchimie.webp",
|
||||
recettealchimique: "systems/foundryvtt-reve-de-dragon/icons/competence_alchimie.webp",
|
||||
chant: "systems/foundryvtt-reve-de-dragon/icons/arts/chant_0.webp",
|
||||
danse: "systems/foundryvtt-reve-de-dragon/icons/arts/danse_0.webp",
|
||||
jeu: "systems/foundryvtt-reve-de-dragon/icons/arts/jeux_petasse.webp",
|
||||
recettecuisine: "systems/foundryvtt-reve-de-dragon/icons/arts/recette_cuisine_1.webp",
|
||||
musique: "systems/foundryvtt-reve-de-dragon/icons/arts/chant_0.webp",
|
||||
maladie: "systems/foundryvtt-reve-de-dragon/icons/maladies_venins/maladie.webp",
|
||||
poison: "systems/foundryvtt-reve-de-dragon/icons/maladies_venins/venin.webp",
|
||||
oeuvre: "systems/foundryvtt-reve-de-dragon/icons/competence_comedie.webp",
|
||||
nourritureboisson: "systems/foundryvtt-reve-de-dragon/icons/objets/provision_crue.webp",
|
||||
service: "systems/foundryvtt-reve-de-dragon/icons/services/lit.webp",
|
||||
signedraconique: "systems/foundryvtt-reve-de-dragon/icons/tmr/signe_draconique.webp",
|
||||
sort: "systems/foundryvtt-reve-de-dragon/icons/competence_oniros.webp",
|
||||
gemme: "systems/foundryvtt-reve-de-dragon/icons/gemmes/almaze.webp",
|
||||
possession: "systems/foundryvtt-reve-de-dragon/icons/entites/possession2.webp",
|
||||
sortreserve: "systems/foundryvtt-reve-de-dragon/icons/competence_oniros.webp",
|
||||
souffle: "systems/foundryvtt-reve-de-dragon/icons/souffle_dragon.webp",
|
||||
extraitpoetique: "systems/foundryvtt-reve-de-dragon/icons/competence_ecriture.webp",
|
||||
tarot: "systems/foundryvtt-reve-de-dragon/icons/tarots/dos-tarot.webp",
|
||||
tete: "systems/foundryvtt-reve-de-dragon/icons/tete_dragon.webp",
|
||||
monnaie:"systems/foundryvtt-reve-de-dragon/icons/objets/piece_etain_poisson.webp",
|
||||
munition: "systems/foundryvtt-reve-de-dragon/icons/objets/fleche.webp"
|
||||
empoignade: "systems/foundryvtt-reve-de-dragon/icons/competence_corps_a_corps.webp"
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class RdDItem extends Item {
|
||||
|
||||
static get defaultIcon() {
|
||||
return undefined;
|
||||
}
|
||||
@ -182,6 +236,7 @@ export class RdDItem extends Item {
|
||||
isCompetenceCreature() { return this.type == ITEM_TYPES.competencecreature }
|
||||
isConteneur() { return this.type == ITEM_TYPES.conteneur; }
|
||||
isMonnaie() { return this.type == ITEM_TYPES.monnaie; }
|
||||
isPotion() { return this.type == ITEM_TYPES.potion; }
|
||||
isNourritureBoisson() { return this.type == ITEM_TYPES.nourritureboisson; }
|
||||
isService() { return this.type == ITEM_TYPES.service; }
|
||||
|
||||
@ -189,13 +244,13 @@ export class RdDItem extends Item {
|
||||
isEsquive() {
|
||||
return (this.isCompetence()
|
||||
&& this.system.categorie == 'melee'
|
||||
&& Grammar.includesLowerCaseNoAccent(this.name, BASE_ESQUIVE.name));
|
||||
&& Grammar.includesLowerCaseNoAccent(this.name, 'Esquive'));
|
||||
}
|
||||
|
||||
isCorpsACorps() {
|
||||
return this.isCompetence()
|
||||
&& this.system.categorie == 'melee'
|
||||
&& Grammar.includesLowerCaseNoAccent(this.name, BASE_CORPS_A_CORPS.name)
|
||||
&& Grammar.includesLowerCaseNoAccent(this.name, 'Corps à Corps')
|
||||
}
|
||||
|
||||
isCompetenceArme() {
|
||||
@ -220,12 +275,6 @@ export class RdDItem extends Item {
|
||||
return this.getEnvironnements(milieux).length > 0
|
||||
}
|
||||
|
||||
get nameDisplay() {
|
||||
return this.isMagique ? (this.name + ' <i class="fa-solid fa-sparkles"></i>') : this.name
|
||||
}
|
||||
|
||||
get isEnchantementPossible() { return false }
|
||||
|
||||
getEnvironnements(milieux = undefined) {
|
||||
const environnements = this.isInventaire() ? this.system.environnement : undefined;
|
||||
if (milieux == undefined || !environnements) {
|
||||
@ -305,6 +354,13 @@ export class RdDItem extends Item {
|
||||
|
||||
getUtilisation() {
|
||||
switch (this.type) {
|
||||
case ITEM_TYPES.potion:
|
||||
switch (this.system.categorie) {
|
||||
case 'Alchimie': case 'AlchimieEnchante': case 'AlchimieAutre': return 'alchimie'
|
||||
case 'Cuisine': return 'cuisine'
|
||||
case 'Remede': case 'Repos': case 'ReposEnchante': case 'Soin': case 'SoinEnchante': return 'soins'
|
||||
}
|
||||
return '';
|
||||
case ITEM_TYPES.nourritureboisson: return 'cuisine';
|
||||
case ITEM_TYPES.herbe: case ITEM_TYPES.faune: case ITEM_TYPES.ingredient: case ITEM_TYPES.plante:
|
||||
switch (this.system.categorie) {
|
||||
@ -334,7 +390,7 @@ export class RdDItem extends Item {
|
||||
return this.type == ITEM_TYPES.objet && Grammar.includesLowerCaseNoAccent(this.name, 'cristal alchimique') && this.system.quantite > 0;
|
||||
}
|
||||
|
||||
get isMagique() {
|
||||
isMagique() {
|
||||
return this.system.magique
|
||||
}
|
||||
|
||||
@ -345,7 +401,6 @@ export class RdDItem extends Item {
|
||||
isNomLike(texte) {
|
||||
return Grammar.includesLowerCaseNoAccent(this.name, texte)
|
||||
}
|
||||
|
||||
isNomTypeLike(texte) {
|
||||
return this.isNomLike(texte) || Grammar.includesLowerCaseNoAccent(Misc.typeName(this.type, 'Item'), texte)
|
||||
}
|
||||
@ -364,6 +419,8 @@ export class RdDItem extends Item {
|
||||
return 0;
|
||||
case ITEM_TYPES.herbe:
|
||||
return this.getEncHerbe();
|
||||
case ITEM_TYPES.gemme:
|
||||
return encPepin * this.system.taille;
|
||||
}
|
||||
return Math.max(this.system.encombrement ?? 0, 0);
|
||||
}
|
||||
@ -412,47 +469,68 @@ export class RdDItem extends Item {
|
||||
// appliquer le pourcentage
|
||||
return this.parent.calculerPrix(this);
|
||||
}
|
||||
return this.system.cout
|
||||
return this.system.cout;
|
||||
}
|
||||
|
||||
prepareDerivedData() {
|
||||
super.prepareDerivedData();
|
||||
if (this.isInventaire()) {
|
||||
this.system.encTotal = this.getEncTotal()
|
||||
this.system.encTotal = this.getEncTotal();
|
||||
if (this.isPotion()) {
|
||||
this.prepareDataPotion()
|
||||
}
|
||||
this.system.actionPrincipale = this.getActionPrincipale({ warnIfNot: false });
|
||||
}
|
||||
this.equipable = this.isEquipable()
|
||||
this.equipable = this.isEquipable();
|
||||
}
|
||||
|
||||
itemActions() {
|
||||
return COMMON_ACTIONS.concat(this.itemSpecificActions()).concat(DEFAULT_ACTIONS)
|
||||
prepareDataPotion() {
|
||||
const categorie = Grammar.toLowerCaseNoAccent(this.system.categorie);
|
||||
this.system.magique = categorie.includes('enchante');
|
||||
if (this.system.magique) {
|
||||
if (categorie.includes('soin') || categorie.includes('repos')) {
|
||||
// TODO: utiliser calculPointsRepos / calculPointsGuerison
|
||||
this.system.puissance = RdDHerbes.calculPuissancePotion(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
itemSpecificActions() {
|
||||
const actions = ITEM_ACTIONS[this.type] ?? []
|
||||
return actions
|
||||
}
|
||||
|
||||
isActionAllowed(code) {
|
||||
getActionPrincipale(options = { warnIfNot: true }) {
|
||||
switch (this.type) {
|
||||
case ITEM_TYPES.possession:
|
||||
case ITEM_TYPES.empoignade:
|
||||
case ITEM_TYPES.rencontre:
|
||||
case ITEM_TYPES.signedraconique:
|
||||
switch (code) {
|
||||
case 'item-edit':
|
||||
case 'item-delete':
|
||||
return game.user.isGM
|
||||
}
|
||||
case ITEM_TYPES.maladie:
|
||||
case ITEM_TYPES.poison:
|
||||
return game.user.isGM
|
||||
case ITEM_TYPES.casetmr:
|
||||
switch (code) {
|
||||
case 'item-delete':
|
||||
return game.user.isGM
|
||||
}
|
||||
case ITEM_TYPES.conteneur: return 'Ouvrir';
|
||||
}
|
||||
if (this.actor?.isPersonnage()) {
|
||||
const warn = options.warnIfNot;
|
||||
if (this.getUtilisationCuisine() == 'brut') {
|
||||
return 'Cuisiner';
|
||||
}
|
||||
switch (this.type) {
|
||||
case ITEM_TYPES.nourritureboisson: return this._actionOrWarnQuantiteZero(this.system.boisson ? 'Boire' : 'Manger', warn);
|
||||
case ITEM_TYPES.potion: return this._actionOrWarnQuantiteZero('Consommer', warn);
|
||||
case ITEM_TYPES.livre: return this._actionOrWarnQuantiteZero('Lire', warn);
|
||||
case ITEM_TYPES.herbe: return this.isHerbeAPotion() ? this._actionOrWarnQuantiteZero('Décoction', warn) : undefined;
|
||||
case ITEM_TYPES.queue: case ITEM_TYPES.ombre: return this.system.refoulement > 0 ? 'Refouler' : undefined;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async actionPrincipale(actor, onActionItem = async () => { }) {
|
||||
if (!this.getActionPrincipale()) { return }
|
||||
await actor?.actionPrincipale(this, onActionItem);
|
||||
}
|
||||
|
||||
_actionOrWarnQuantiteZero(actionName, warn) {
|
||||
if ((this.system.quantite ?? 0) <= 0) {
|
||||
if (warn) {
|
||||
ui.notifications.warn(`Vous n'avez plus de ${this.name}.`);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
else {
|
||||
return actionName;
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
async diminuerQuantite(nombre, options = { diminuerQuantite: true, supprimerSiZero: false }) {
|
||||
@ -524,7 +602,7 @@ export class RdDItem extends Item {
|
||||
if (!other || !this.isInventaire()) {
|
||||
return [false, undefined];
|
||||
}
|
||||
if (this.isConteneur()) {
|
||||
if (this.isConteneur()){
|
||||
return [false, `Impossible de regrouper des conteneurs, ils ne sont pas empilables`];
|
||||
}
|
||||
if (this.system.quantite == undefined) {
|
||||
@ -593,7 +671,7 @@ export class RdDItem extends Item {
|
||||
}
|
||||
|
||||
getChatItemTemplate() {
|
||||
return 'systems/foundryvtt-reve-de-dragon/templates/post-item.hbs';
|
||||
return 'systems/foundryvtt-reve-de-dragon/templates/post-item.html';
|
||||
}
|
||||
|
||||
static propertyIfDefined(name, val, condition = true) {
|
||||
@ -725,6 +803,14 @@ export class RdDItem extends Item {
|
||||
]
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
_potionChatData() {
|
||||
return [
|
||||
`<b>Rareté</b>: ${this.system.rarete}`,
|
||||
`<b>Catégorie</b>: ${this.system.categorie}`,
|
||||
...this._inventaireTemplateChatData()
|
||||
]
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
_queueChatData() {
|
||||
function label(categorie) {
|
||||
switch (categorie) {
|
||||
|
@ -1,17 +1,14 @@
|
||||
import { ITEM_TYPES } from "../constants.js";
|
||||
import { RdDItem } from "../item.js";
|
||||
import { Misc } from "../misc.js";
|
||||
import { ReglesOptionnelles } from "../settings/regles-optionnelles.js";
|
||||
|
||||
export class RdDItemArmure extends RdDItem {
|
||||
|
||||
static get ITEM_TYPE() { return ITEM_TYPES.armure }
|
||||
|
||||
static get defaultIcon() {
|
||||
return "systems/foundryvtt-reve-de-dragon/icons/armes_armures/armure_plaques.webp";
|
||||
}
|
||||
|
||||
async deteriorerArmure(dmg) {
|
||||
deteriorerArmure(dmg) {
|
||||
if (!ReglesOptionnelles.isUsing('deteriorationArmure') || this.system.protection == '0') {
|
||||
return;
|
||||
}
|
||||
@ -23,10 +20,12 @@ export class RdDItemArmure extends RdDItem {
|
||||
protection = this.calculProtectionDeterioree();
|
||||
ChatMessage.create({ content: `Votre armure ${this.name} s'est détériorée, elle protège maintenant de ${protection}` });
|
||||
}
|
||||
await this.update({
|
||||
'system.deterioration': deterioration,
|
||||
'system.protection': protection
|
||||
})
|
||||
this.update({
|
||||
system: {
|
||||
deterioration: deterioration,
|
||||
protection: protection
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
calculProtectionDeterioree() {
|
||||
|
@ -1,20 +0,0 @@
|
||||
export const POSSESSION_SANS_DRACONIC = { name: 'Sans draconic', type: 'competence', system: { niveau: 0, defaut_carac: "reve-actuel", }, img: 'systems/foundryvtt-reve-de-dragon/icons/entites/possession.webp' }
|
||||
export const PAS_DE_DRACONIC = { name: 'Pas de draconic', type: 'competence', system: { niveau: -11, defaut_carac: "reve" }, img: 'systems/foundryvtt-reve-de-dragon/icons/entites/possession.webp' }
|
||||
export const BASE_CORPS_A_CORPS = { name: 'Corps à Corps', type: 'competence', system: { niveau: -6, defaut_carac: "melee" }, img: 'systems/foundryvtt-reve-de-dragon/icons/competence_corps_a_corps.webp' }
|
||||
export const BASE_ESQUIVE = { name: 'Esquive', type: 'competence', system: { niveau: -6, defaut_carac: "derobee" }, img: 'systems/foundryvtt-reve-de-dragon/icons/competence_esquive.webp' }
|
||||
|
||||
export const SANS_COMPETENCE = {
|
||||
name: "Sans compétence",
|
||||
type: 'competence',
|
||||
system: {
|
||||
niveau: 0,
|
||||
default_diffLibre: 0,
|
||||
base: 0,
|
||||
categorie: "Aucune",
|
||||
description: "",
|
||||
descriptionmj: "",
|
||||
defaut_carac: "",
|
||||
},
|
||||
img: "systems/foundryvtt-reve-de-dragon/icons/templates/icone_parchement_vierge.webp"
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ export class RdDItemBlessure extends RdDItem {
|
||||
|
||||
prepareDerivedData() {
|
||||
super.prepareDerivedData();
|
||||
this.system.label = RdDItemBlessure.getLabelGravite(this.system.gravite)
|
||||
this.system.label = this.getLabelGravite()
|
||||
}
|
||||
|
||||
static prepareTacheSoin(gravite) {
|
||||
@ -43,32 +43,29 @@ export class RdDItemBlessure extends RdDItem {
|
||||
}
|
||||
|
||||
static async applyFullBlessure(actor, gravite) {
|
||||
const definition = foundry.utils.duplicate(RdDItemBlessure.getDefinition(gravite))
|
||||
|
||||
const definition = RdDItemBlessure.getDefinition(gravite)
|
||||
|
||||
let lostEndurance = 0
|
||||
let lostVie = 0
|
||||
if (definition.endurance) {
|
||||
lostEndurance = new Roll(definition.endurance)
|
||||
await lostEndurance.roll();
|
||||
actor.santeIncDec("endurance", -Number(lostEndurance.total));
|
||||
}
|
||||
if (definition.vie) {
|
||||
await actor.santeIncDec("vie", definition.vie)
|
||||
}
|
||||
const lostEndurance = await RdDItemBlessure.rollLostEndurance(definition.endurance)
|
||||
if (lostEndurance) {
|
||||
await actor.santeIncDec("endurance", -Number(lostEndurance));
|
||||
lostVie = definition.vie
|
||||
actor.santeIncDec("vie", definition.vie)
|
||||
}
|
||||
|
||||
await this.createBlessure(actor, gravite)
|
||||
|
||||
ChatMessage.create({
|
||||
//TODO: hbs
|
||||
content: `Blessure ${definition.label} appliquée à ${actor.name}<br>Perte d'endurance : ${lostEndurance} (${definition.endurance})<br>Perte de Vie : ${definition.vie}`,
|
||||
content: `Blessure ${definition.label} appliquée à ${actor.name}`+
|
||||
`<br>Perte d'endurance : ${lostEndurance}`+
|
||||
`<br>Perte de Vie : ${lostVie}`,
|
||||
whisper: ChatUtility.getOwners(actor)
|
||||
});
|
||||
actor.sheet?.render()
|
||||
}
|
||||
|
||||
static async rollLostEndurance(formula) {
|
||||
if (formula) {
|
||||
const roll = new Roll(formula)
|
||||
await roll.evaluate()
|
||||
return roll.total
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
static async createBlessure(actor, gravite, localisation = '', attackerToken) {
|
||||
@ -128,10 +125,10 @@ export class RdDItemBlessure extends RdDItem {
|
||||
}
|
||||
if (this.system.gravite > 0) {
|
||||
const update = { system: { premierssoins: { bonus: 0 }, soinscomplets: { bonus: 0 } } }
|
||||
const gravite = this.system.gravite
|
||||
const graviteMoindre = gravite - 2
|
||||
const gravite = this.system.gravite;
|
||||
const graviteMoindre = gravite - 2;
|
||||
const moindres = blessures.filter(it => it.system.gravite == graviteMoindre, 'blessures').length
|
||||
const label = RdDItemBlessure.getLabelGravite(this.system.gravite)
|
||||
const label = this.getLabelGravite();
|
||||
|
||||
let rolled = await actor.jetRecuperationConstitution(this.system.soinscomplets.bonus, message);
|
||||
|
||||
@ -161,11 +158,11 @@ export class RdDItemBlessure extends RdDItem {
|
||||
}
|
||||
|
||||
peutRetrograder(graviteMoindre, moindres) {
|
||||
return moindres < RdDItemBlessure.maxBlessures(graviteMoindre)
|
||||
return moindres < RdDItemBlessure.getDefinition(graviteMoindre).max
|
||||
}
|
||||
|
||||
async calculerFinPeriodeTemporel(debut) {
|
||||
return debut.nouveauJour().addJours(this.system.gravite);
|
||||
return await debut.nouveauJour().addJours(this.system.gravite);
|
||||
}
|
||||
|
||||
async onFinPeriode(oldTimestamp, newTimestamp) {
|
||||
@ -185,16 +182,16 @@ export class RdDItemBlessure extends RdDItem {
|
||||
return `systems/foundryvtt-reve-de-dragon/icons/sante/${soins ? 'blessure-soins' : img}.webp`
|
||||
}
|
||||
|
||||
static getLabelGravite(gravite) {
|
||||
return definitionsBlessures.find(it => it.gravite >= gravite).label
|
||||
getLabelGravite() {
|
||||
return RdDItemBlessure.getDefinition(this.system.gravite).label
|
||||
}
|
||||
|
||||
static getDefinition(gravite) {
|
||||
return definitionsBlessures.find(it => it.gravite >= gravite)
|
||||
return definitionsBlessures.sort(Misc.ascending(it => it.gravite))
|
||||
.find(it => it.gravite >= gravite);
|
||||
}
|
||||
|
||||
static maxBlessures(gravite) {
|
||||
return definitionsBlessures.find(it => it.gravite >= gravite).max
|
||||
return RdDItemBlessure.getDefinition(gravite).max
|
||||
}
|
||||
|
||||
isContusion() {
|
||||
@ -219,7 +216,7 @@ export class RdDItemBlessure extends RdDItem {
|
||||
`<b>Heure et Date</b>: ${new RdDTimestamp(this.system.temporel.debut).formatDateHeure()}`,
|
||||
RdDItem.propertyIfDefined('Blessé', this.parent?.name, this.parent),
|
||||
`<b>Localisation</b>: ${this.system.localisation}`,
|
||||
`<b>Gravité</b>: ${this.system.label}`,
|
||||
`<b>Gravité</b>: ${RdDItemBlessure.getDefinition(this.system.gravite).label}`,
|
||||
`<b>Difficulté des soins</b>: ${this.system.difficulte}`,
|
||||
(this.system.soinscomplets.done ?
|
||||
`<b>Bonus soins complets</b>: ${this.system.soinscomplets.bonus}` :
|
||||
|
@ -1,112 +0,0 @@
|
||||
import { RdDItem } from "../item.js";
|
||||
import { ACTION_ITEM_ENCHANTER } from "../enchantement/dialog-enchanter.js";
|
||||
|
||||
const tableGemmes = {
|
||||
"almaze": { label: "Almaze", couleur: "Blanc" },
|
||||
"aquafane": { label: "Aquafane", couleur: "Vert Profond" },
|
||||
"asterite": { label: "Astérite", couleur: "Bleu, Violet ou Blanc" },
|
||||
"cyanolithe": { label: "Cyanolithe", couleur: "Bleu Intense" },
|
||||
"larmededragon": { label: "Larme de Dragon", couleur: "Rouge Intense" },
|
||||
"muska": { label: "Muska", couleur: "Violet Profond" },
|
||||
"nebuleuse": { label: "Nébuleuse", couleur: "Brouillard Intense" },
|
||||
"nebuleuse": { label: "Nébuleuse", couleur: "Brouillard Intense, Rose, Vert ou Bleu Pâle" },
|
||||
"oeildetigre": { label: "Oeil de Tigre", couleur: "Jaune" },
|
||||
"scarlatine": { label: "Scarlatine", couleur: "Rouge Clair ou Orangé" },
|
||||
"seliphane": { label: "Séliphane", couleur: "Vert Lumineux" },
|
||||
"tournelune": { label: "Tournelune", couleur: "Violet ou Bleu" },
|
||||
"zebraide": { label: "Zebraïde", couleur: "Bandes Bicolores, toutes couleurs" }
|
||||
}
|
||||
|
||||
/**
|
||||
* un pépin de gemme = 1/10 cm3 = 1/1000 l = 3.5/1000 kg = 7/2000 kg = 7/1000 enc
|
||||
* densité 3.5 (~2.3 à 4, parfois plus) -- https://www.juwelo.fr/guide-des-pierres/faits-et-chiffres/
|
||||
*/
|
||||
const encPepin = 0.0007;
|
||||
|
||||
/**
|
||||
* Item pour gérer les gemmes
|
||||
*/
|
||||
export class RdDItemGemme extends RdDItem {
|
||||
|
||||
static getGemmeTypeOptionList() {
|
||||
// TODO: look how to map object key-value pairs
|
||||
let options = ""
|
||||
for (let gemmeKey in tableGemmes) {
|
||||
options += `<option value="${gemmeKey}">${tableGemmes[gemmeKey].label}</option>`
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
static get defaultIcon() {
|
||||
return "systems/foundryvtt-reve-de-dragon/icons/gemmes/almaze.webp"
|
||||
}
|
||||
|
||||
get isEnchantementPossible() {
|
||||
return this.enchantabilite > 0
|
||||
}
|
||||
|
||||
get inertie() { return 7 - Number(this.system.purete) }
|
||||
get enchantabilite() { return this.system.taille - this.inertie }
|
||||
|
||||
getEnc() {
|
||||
return encPepin * this.system.taille;
|
||||
}
|
||||
|
||||
itemSpecificActions() {
|
||||
return [ACTION_ITEM_ENCHANTER]
|
||||
}
|
||||
|
||||
prepareDerivedData() {
|
||||
super.prepareDerivedData()
|
||||
this.system.cout = (this.system.taille * this.system.purete) + this.system.qualite
|
||||
this.system.inertie = this.inertie
|
||||
this.system.enchantabilite = this.enchantabilite
|
||||
}
|
||||
|
||||
getUtilisation() {
|
||||
switch (this.system.categorie) {
|
||||
case 'Alchimie': case 'Autre': case 'AlchimieAutre':
|
||||
// TODO: distinguer les remèdes alchimiques enchantables/non
|
||||
return 'alchimie'
|
||||
case 'Cuisine':
|
||||
return 'cuisine'
|
||||
case 'Remede': case 'Repos': case 'Soin':
|
||||
return 'soins'
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
getProprietes() {
|
||||
const proprietes = [
|
||||
`<b>Taille</b>: ${this.system.taille}`,
|
||||
`<b>Pureté</b>: ${this.system.purete}`,
|
||||
`<b>Inertie</b>: ${this.system.inertie}`,
|
||||
`<b>Enchantabilité</b>: ${this.system.enchantabilite}`
|
||||
]
|
||||
const proprietesMagiques = this.system.magique ? [
|
||||
`<b>Enchantée</b> <i class="fa-solid fa-sparkles"></i> ${this.system.purifie ? ', purifiée' : ''} ${this.system.prpermanent ? 'permanente' : ''} `,
|
||||
`<b>Points de rêve</b>: ${this.system.pr}`,
|
||||
`<b>Puissance</b>: ${this.system.puissance}`,
|
||||
] : []
|
||||
return proprietes
|
||||
.concat(proprietesMagiques)
|
||||
.concat(this._inventaireTemplateChatData())
|
||||
.filter(it => it != undefined)
|
||||
}
|
||||
|
||||
perteReveChateauDormant() {
|
||||
if (this.system.magique && !this.system.prpermanent && this.system.pr > 0) {
|
||||
const nouveauReve = Math.max(this.system.pr - 1, 0)
|
||||
return {
|
||||
alias: this.parent.getAlias(),
|
||||
item: this,
|
||||
update: {
|
||||
_id: this.id,
|
||||
'system.pr': nouveauReve,
|
||||
'system.magique': nouveauReve > 0
|
||||
}
|
||||
}
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
}
|
@ -1,146 +0,0 @@
|
||||
import { Misc } from "../misc.js"
|
||||
import { RdDSheetUtility } from "../rdd-sheet-utility.js"
|
||||
import { RdDUtility } from "../rdd-utility.js"
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* TODO:
|
||||
* options.editable ?
|
||||
*
|
||||
*/
|
||||
const _SPACEHOLDER = { placeholder: true }
|
||||
|
||||
const _VENDRE = {
|
||||
code: 'item-vendre', label: 'Vendre ou donner', icon: it => 'fa-solid fa-comments-dollar',
|
||||
filter: it => Misc.toInt(it.system.quantite) > 0,
|
||||
optionsFilter: options => options.editable,
|
||||
action: (item, actor) => item.proposerVente()
|
||||
}
|
||||
const _ACHAT_SERVICE = {
|
||||
code: 'item-service-acheter', label: 'Acheter', icon: it => 'fa-regular fa-coins',
|
||||
//filter: it => Misc.toInt(it.system.quantite) > 0,
|
||||
//optionsFilter: options => options.editable,
|
||||
//action: (item, actor) => item.proposerVente()
|
||||
}
|
||||
const _MONTRER = {
|
||||
code: 'item-montrer', label: 'Montrer', icon: it => 'fa-solid fa-comment',
|
||||
action: (item, actor) => item.postItemToChat()
|
||||
}
|
||||
const _SPLIT = {
|
||||
code: 'item-split', label: 'Séparer le goupe', icon: it => 'fa-solid fa-unlink',
|
||||
filter: it => Misc.toInt(it.system.quantite) > 1,
|
||||
action: (item, actor) => RdDSheetUtility.splitItem(item, actor)
|
||||
}
|
||||
|
||||
const _EDIT = {
|
||||
code: 'item-edit', label: 'Editer', icon: it => 'fa-solid fa-edit',
|
||||
action: (item, actor) => item.sheet.render(true)
|
||||
}
|
||||
const _DELETE = {
|
||||
code: 'item-delete', label: 'Supprimer', icon: it => 'fa-solid fa-trash',
|
||||
optionsFilter: options => options.editable && options.isOwner,
|
||||
action: (item, actor) => RdDUtility.confirmActorItemDelete(item, actor)
|
||||
}
|
||||
const _EQUIPER = {
|
||||
code: 'item-equip', label: 'Equiper', icon: it => it.system.equipe ? 'fa-solid fa-hand-rock' : 'fa-regular fa-hand-paper',
|
||||
filter: it => !it.estContenu && it.isEquipable(),
|
||||
action: (item, actor) => actor.equiperObjet(item)
|
||||
}
|
||||
|
||||
const _CUISINER = {
|
||||
code: 'item-cuisiner', label: 'Cuisiner', icon: it => 'fa-solid fa-utensils',
|
||||
filter: it => it.getUtilisation() == 'cuisine' && it.system.sust > 0,
|
||||
optionsFilter: options => options.editable,
|
||||
action: (item, actor) => actor.preparerNourriture(item)
|
||||
}
|
||||
const _MANGER_CRU = {
|
||||
code: 'item-manger-cru', label: 'Manger cru', icon: it => 'fa-solid fa-drumstick-bite',
|
||||
filter: it => it.getUtilisation() == 'cuisine' && it.system.sust > 0,
|
||||
optionsFilter: options => options.editable,
|
||||
action: (item, actor) => actor.mangerNourriture(item)
|
||||
}
|
||||
const _MANGER = {
|
||||
code: 'item-manger', label: 'Manger', icon: it => 'fa-solid fa-utensils',
|
||||
filter: it => !(it.system.boisson),
|
||||
optionsFilter: options => options.editable,
|
||||
action: (item, actor) => actor.mangerNourriture(item)
|
||||
}
|
||||
const _BOIRE = {
|
||||
code: 'item-boire', label: 'Boire', icon: it => 'fa-solid fa-glass-water',
|
||||
filter: it => it.system.boisson,
|
||||
optionsFilter: options => options.editable,
|
||||
action: (item, actor) => actor.mangerNourriture(item)
|
||||
}
|
||||
const _DECOCTION = {
|
||||
code: 'item-decoction', label: 'Décoction', icon: it => 'fa-solid fa-flask-vial',
|
||||
optionsFilter: options => options.editable,
|
||||
action: (item, actor) => actor.fabriquerDecoctionHerbe(item)
|
||||
}
|
||||
const _OUVRIR = {
|
||||
code: 'item-edit', label: 'Ouvrir', icon: it => 'fa-solid fa-eye',
|
||||
action: (item, actor) => item.sheet.render(true)
|
||||
}
|
||||
|
||||
const _LIRE = {
|
||||
code: 'item-lire', label: 'Lire', icon: it => 'fa-solid fa-book-open',
|
||||
optionsFilter: options => options.editable,
|
||||
action: (item, actor) => actor.actionLire(item)
|
||||
}
|
||||
|
||||
const _REFOULER = {
|
||||
code: 'item-refouler', label: 'Refouler', icon: it => 'fa-solid fa-burst',
|
||||
filter: it => it.system.refoulement > 0,
|
||||
optionsFilter: options => options.editable,
|
||||
action: (item, actor) => actor.actionRefoulement(item)
|
||||
}
|
||||
|
||||
const _SORT_RESERVE = {
|
||||
code: 'item-sortreserve-add', label: 'Ajouter en réserve', icon: it => 'fa-solid fa-sparkles',
|
||||
filter: it => game.user.isGM && !it.system.isrituel,
|
||||
action: (item, actor) => actor.addSortReserve(item)
|
||||
}
|
||||
|
||||
export const COMMON_ACTIONS = [_EQUIPER]
|
||||
export const DEFAULT_ACTIONS = [_SPACEHOLDER, _SPLIT, _VENDRE, _MONTRER, _EDIT, _DELETE]
|
||||
|
||||
export const ITEM_ACTIONS = {
|
||||
faune: [_CUISINER, _MANGER_CRU],
|
||||
ingredient: [_CUISINER, _MANGER_CRU],
|
||||
conteneur: [_OUVRIR],
|
||||
herbe: [_DECOCTION, _CUISINER, _MANGER_CRU],
|
||||
livre: [_LIRE],
|
||||
nourritureboisson: [_MANGER, _BOIRE],
|
||||
ombre: [_REFOULER],
|
||||
plante: [_CUISINER, _MANGER_CRU],
|
||||
queue: [_REFOULER],
|
||||
sort: [_SORT_RESERVE],
|
||||
service: [_ACHAT_SERVICE]
|
||||
}
|
||||
|
||||
|
||||
export class ItemAction {
|
||||
|
||||
static applies(action, item, options) {
|
||||
return action && item
|
||||
&& item.isActionAllowed(action.code)
|
||||
&& (!action.filter || action.filter(item))
|
||||
&& (!action.optionsFilter || action.optionsFilter(options))
|
||||
}
|
||||
|
||||
static icon(action, item) {
|
||||
if (action && action.icon) {
|
||||
return action.icon(item)
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
static async onActionItem(event, actor, options) {
|
||||
const item = RdDSheetUtility.getItem(event, actor)
|
||||
const code = $(event.currentTarget).data('code')
|
||||
const action = item?.itemActions().find(it => it.code == code)
|
||||
if (action && (!action.optionsFilter || action.optionsFilter(options))) {
|
||||
await action.action(item, actor)
|
||||
}
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ export class RdDItemMaladie extends RdDItem {
|
||||
}
|
||||
|
||||
async calculerFinPeriodeTemporel(debut) {
|
||||
return debut.addPeriode(this.system.periode.nombre, this.system.periode.unite);
|
||||
return await debut.addPeriode(this.system.periode.nombre, this.system.periode.unite);
|
||||
}
|
||||
|
||||
async onFinPeriode(oldTimestamp, newTimestamp) {
|
||||
|
@ -1,8 +1,11 @@
|
||||
import { RdDItemQueue } from "./queue.js";
|
||||
|
||||
export class RdDItemOmbre extends RdDItemQueue {
|
||||
import { RdDItem } from "../item.js";
|
||||
|
||||
export class RdDItemOmbre extends RdDItem {
|
||||
static get defaultIcon() {
|
||||
return "systems/foundryvtt-reve-de-dragon/icons/queue_dragon.webp";
|
||||
}
|
||||
|
||||
async calculerFinPeriodeTemporel(debut) {
|
||||
return await debut.appliquerDuree(this.system.duree, this.parent);
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ export class RdDItemPoison extends RdDItem {
|
||||
}
|
||||
|
||||
async calculerFinPeriodeTemporel(debut) {
|
||||
return debut.addPeriode(this.system.periode.nombre, this.system.periode.unite) ;
|
||||
return await debut.addPeriode(this.system.periode.nombre, this.system.periode.unite) ;
|
||||
}
|
||||
|
||||
async onFinPeriode(oldTimestamp, newTimestamp) {
|
||||
|
@ -1,105 +0,0 @@
|
||||
import { Grammar } from "../grammar.js";
|
||||
import { RdDItem } from "../item.js";
|
||||
import { SystemCompendiums } from "../settings/system-compendiums.js";
|
||||
import { ACTION_ITEM_ENCHANTER } from "../enchantement/dialog-enchanter.js";
|
||||
|
||||
// --- Actions sur les "potions"
|
||||
const _CONSOMMER_POTION = {
|
||||
code: 'item-potion-consommer', label: 'Consommer', icon: it => 'fa-solid fa-vial',
|
||||
optionsFilter: options => options.editable,
|
||||
action: (item, actor) => actor.consommerPotion(item)
|
||||
}
|
||||
|
||||
/**
|
||||
* Item pour gérer les potions
|
||||
*/
|
||||
export class RdDItemPotion extends RdDItem {
|
||||
|
||||
static async herbesSoins() {
|
||||
return await RdDItemPotion.$listHerbes(it => Grammar.equalsInsensitive(it.system.categorie, 'Soin') && it.system.niveau > 0)
|
||||
}
|
||||
static async herbesRepos() {
|
||||
return await RdDItemPotion.$listHerbes(it => Grammar.equalsInsensitive(it.system.categorie, 'Repos') && it.system.niveau > 0)
|
||||
}
|
||||
|
||||
static async $listHerbes(filter) {
|
||||
const herbes = await SystemCompendiums.getWorldOrCompendiumItems('herbe', 'faune-flore-mineraux');
|
||||
return herbes.filter(filter)
|
||||
}
|
||||
|
||||
static get defaultIcon() {
|
||||
return "systems/foundryvtt-reve-de-dragon/icons/objets/liqueur_de_bagdol.webp"
|
||||
}
|
||||
|
||||
get isEnchantementPossible() {
|
||||
return this.system.etat == 'Liquide'
|
||||
}
|
||||
|
||||
itemSpecificActions() {
|
||||
return [_CONSOMMER_POTION, ACTION_ITEM_ENCHANTER]
|
||||
}
|
||||
|
||||
prepareDerivedData() {
|
||||
super.prepareDerivedData()
|
||||
this.system.puissance = this.system.magique ? this.calculPuissance() : 0
|
||||
}
|
||||
|
||||
getUtilisation() {
|
||||
switch (this.system.categorie) {
|
||||
case 'Alchimie': case 'Autre': case 'AlchimieAutre':
|
||||
// TODO: distinguer les remèdes alchimiques enchantables/non
|
||||
return 'alchimie'
|
||||
case 'Cuisine':
|
||||
return 'cuisine'
|
||||
case 'Remede': case 'Repos': case 'Soin':
|
||||
return 'soins'
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
getProprietes() {
|
||||
const proprietes = [
|
||||
`<b>Rareté</b>: ${this.system.rarete} `,
|
||||
`<b>Catégorie</b>: ${this.system.categorie}`,
|
||||
`<b>Etat</b>: ${this.system.etat}`
|
||||
]
|
||||
const proprietesMagiques = this.system.magique ? [
|
||||
`<b>Enchantée</b> <i class="fa-solid fa-sparkles"></i> ${this.system.purifie ? ', purifiée' : ''} ${this.system.prpermanent ? 'permanente' : ''} `,
|
||||
`<b>Points de rêve</b>: ${this.system.pr}`,
|
||||
] : []
|
||||
return proprietes
|
||||
.concat(proprietesMagiques)
|
||||
.concat(this._inventaireTemplateChatData())
|
||||
.filter(it => it != undefined)
|
||||
}
|
||||
|
||||
perteReveChateauDormant() {
|
||||
if (this.system.magique && !this.system.prpermanent && this.system.pr > 0) {
|
||||
const nouveaupr = Math.max(this.system.pr - 1, 0)
|
||||
return {
|
||||
alias: this.parent.getAlias(),
|
||||
item: this,
|
||||
nouveaupr: nouveaupr,
|
||||
update: {
|
||||
_id: this.id,
|
||||
'system.pr': nouveaupr,
|
||||
'system.magique': nouveaupr > 0
|
||||
}
|
||||
}
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
calculPuissance() { return this.system.herbebonus * this.system.pr }
|
||||
|
||||
static buildHerbesList(listeHerbes, max) {
|
||||
let list = {}
|
||||
for (let herbe of listeHerbes) {
|
||||
let brins = max - herbe.system.niveau;
|
||||
list[herbe.name] = `${herbe.name} (Bonus: ${herbe.system.niveau}, Brins: ${brins})`;
|
||||
}
|
||||
list['Autre'] = 'Autre (Bonus: variable, Brins: variable)'
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
@ -6,9 +6,8 @@ export class RdDItemQueue extends RdDItem {
|
||||
return "systems/foundryvtt-reve-de-dragon/icons/queue_dragon.webp";
|
||||
}
|
||||
|
||||
async calculerFinPeriodeTemporel(timestamp) {
|
||||
// décaller le début pour calcul correct si la queue dure 12h
|
||||
const debut = timestamp.addMinutes(timestamp.indexMinute == 0 ? -1 : 0);
|
||||
async calculerFinPeriodeTemporel(debut) {
|
||||
return await debut.appliquerDuree(this.system.duree, this.parent);
|
||||
}
|
||||
|
||||
}
|
@ -1,108 +0,0 @@
|
||||
import { ITEM_TYPES } from "../constants.js";
|
||||
import { RdDItem } from "../item.js";
|
||||
import { Misc } from "../misc.js";
|
||||
import { LIST_CARAC_PERSONNAGE, RdDCarac } from "../rdd-carac.js";
|
||||
|
||||
export class RdDItemRace extends RdDItem {
|
||||
|
||||
static get ITEM_TYPE() { return ITEM_TYPES.race }
|
||||
|
||||
static get defaultIcon() {
|
||||
return "systems/foundryvtt-reve-de-dragon/icons/humanoides/humain.webp";
|
||||
}
|
||||
|
||||
static checkRacialMax(actor, code, value) {
|
||||
const race = RdDItemRace.getRace(actor)
|
||||
if (code == LIST_CARAC_PERSONNAGE.force.code) {
|
||||
if (!race.isForceValid(actor, value)) {
|
||||
ui.notifications.warn(race.system.carac.force.limitmessage)
|
||||
return false
|
||||
}
|
||||
}
|
||||
if (code == LIST_CARAC_PERSONNAGE.taille.code) {
|
||||
const carac = RdDCarac.carac(code)
|
||||
if (race.isMax(actor, code, value - 1)) {
|
||||
ui.notifications.warn(`${value} est supérieure au maximum de ${carac.label}`)
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
static applyRacialLimits(actor) {
|
||||
const race = RdDItemRace.getRace(actor)
|
||||
actor.system.carac.taille.value = race.getValidTaille(actor.getTaille())
|
||||
actor.system.carac.force.value = Math.min(
|
||||
actor.getForce(),
|
||||
race.getForceMax(actor))
|
||||
}
|
||||
|
||||
static isRacialMax(actor, code, value = undefined) {
|
||||
return RdDItemRace.getRace(actor).isMax(actor, code, value)
|
||||
}
|
||||
|
||||
static getRace(actor) {
|
||||
return actor.itemTypes[ITEM_TYPES.race].find(it => true) ?? RdDItemRace.getFallbackRace()
|
||||
}
|
||||
|
||||
static getFallbackRace() {
|
||||
if (RdDItemRace.fallback == undefined) {
|
||||
RdDItemRace.fallback = new RdDItemRace({ name: 'Humain', type: RdDItemRace.ITEM_TYPE })
|
||||
}
|
||||
return RdDItemRace.fallback
|
||||
}
|
||||
|
||||
|
||||
isMax(actor, code, value = undefined) {
|
||||
const path = RdDCarac.carac(code)?.path
|
||||
if (path == undefined) {
|
||||
// cas des caractéristiques dérivées, pas de max
|
||||
return false
|
||||
}
|
||||
if (value == undefined) {
|
||||
value = path ? foundry.utils.getProperty(actor, path) : 0
|
||||
}
|
||||
if (code == LIST_CARAC_PERSONNAGE.force.code) {
|
||||
return value >= this.getForceMax(actor)
|
||||
}
|
||||
const pathMax = path.replace(".value", ".max");
|
||||
const max = foundry.utils.getProperty(this, pathMax) ?? -1
|
||||
return (max > 0 && value >= max)
|
||||
}
|
||||
|
||||
getValidTaille(taille) {
|
||||
const min = Math.max(this.system.carac.taille.min, 0)
|
||||
if (min > taille) {
|
||||
ui.notifications.warn("La Taille est inférieur au minimum racial")
|
||||
return min
|
||||
}
|
||||
const raceMax = this.system.carac.taille.max;
|
||||
const max = raceMax < 0 ? taille + 1 : raceMax
|
||||
if (max < taille) {
|
||||
ui.notifications.warn("La Taille est supérieure au maximum racial")
|
||||
return max
|
||||
}
|
||||
return taille
|
||||
}
|
||||
|
||||
isForceValid(actor, value) {
|
||||
return value <= this.getForceMax(actor)
|
||||
}
|
||||
|
||||
getForceMax(actor) {
|
||||
const terms = this.system.carac.force.limit.replaceAll(' ', '').split('+')
|
||||
return terms.map(
|
||||
it => {
|
||||
const term = Number.parseInt(it)
|
||||
if (Number.isInteger(term)) {
|
||||
return term
|
||||
}
|
||||
const path = RdDCarac.carac(it)?.path
|
||||
if (path) {
|
||||
return foundry.utils.getProperty(actor, path)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
).reduce(Misc.sum());
|
||||
}
|
||||
}
|
@ -4,9 +4,9 @@ const RARETE_FREQUENTE = { code: 'Frequente', label: 'Fréquente', frequence: 18
|
||||
const RARETE_RARE = { code: 'Rare', label: 'Rare', frequence: 6, min: 3, max: 12 };
|
||||
const RARETE_RARISSIME = { code: 'Rarissime', label: 'Rarissime', frequence: 2, min: 1, max: 4 };
|
||||
const RARETE_INEXISTANT = { code: 'Inexistant', label: 'Inexistant', frequence: 0, min: 0, max: 0 };
|
||||
const RARETE_EGALE = { code: 'egal', label: 'Egal', frequence: 1, min: 1, max: 1 };
|
||||
const RARETE_EGALE = { code: 'eqal', label: 'Egal', frequence: 1, min: 1, max: 1 };
|
||||
|
||||
export const RARETES = [
|
||||
const RARETES = [
|
||||
RARETE_COMMUNE,
|
||||
RARETE_FREQUENTE,
|
||||
RARETE_RARE,
|
||||
|
@ -74,7 +74,7 @@ export class RdDRencontre extends RdDItem {
|
||||
}
|
||||
|
||||
async calculerFinPeriodeTemporel(debut) {
|
||||
return debut.nouvelleHeure().addHeures(12);
|
||||
return await debut.nouvelleHeure().addHeures(12);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
import { HtmlUtility } from "../html-utility.js";
|
||||
import { RdDItemSheetV1 } from "../item-sheet.js";
|
||||
import { RdDItemSheet } from "../item-sheet.js";
|
||||
import { Misc } from "../misc.js";
|
||||
import { RdDRaretes } from "./raretes.js";
|
||||
|
||||
const TYPE_ITEMS_NATURELS = ["faune", "herbe", "plante", "ingredient"];
|
||||
|
||||
export class RdDItemInventaireSheet extends RdDItemSheetV1 {
|
||||
export class RdDItemInventaireSheet extends RdDItemSheet {
|
||||
|
||||
static get defaultOptions() {
|
||||
return foundry.utils.mergeObject(RdDItemSheetV1.defaultOptions, {
|
||||
return foundry.utils.mergeObject(RdDItemSheet.defaultOptions, {
|
||||
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "informations" }]
|
||||
}, { inplace: false })
|
||||
}
|
||||
@ -34,8 +34,8 @@ export class RdDItemInventaireSheet extends RdDItemSheetV1 {
|
||||
HtmlUtility.showControlWhen(this.html.find("div.description-milieu"), TYPE_ITEMS_NATURELS.includes(this.item.type));
|
||||
|
||||
if (!this.options.editable) return;
|
||||
this.html.find("a.preparer-nourriture").click(async event => await this.preparerNourriture(event));
|
||||
this.html.find("a.manger-nourriture").click(async event => await this.mangerNourriture(event));
|
||||
this.html.find("a.preparer-nourriture").click(event => this.preparerNourriture(event));
|
||||
this.html.find("a.manger-nourriture").click(event => this.mangerNourriture(event));
|
||||
|
||||
this.html.find("input.input-selection-milieu").keypress(event => {
|
||||
if (event.keyCode == '13') {
|
||||
@ -43,11 +43,11 @@ export class RdDItemInventaireSheet extends RdDItemSheetV1 {
|
||||
}
|
||||
event.stopPropagation();
|
||||
})
|
||||
this.html.find("a.milieu-add").click(async event => await this.onAddMilieu(event));
|
||||
this.html.find("div.environnement-milieu a.milieu-delete").click(async event => await this.onDeleteMilieu(event));
|
||||
this.html.find("div.environnement-milieu select.environnement-rarete").change(async event => await this.onChange(event,
|
||||
this.html.find("a.milieu-add").click(event => this.onAddMilieu(event));
|
||||
this.html.find("div.environnement-milieu a.milieu-delete").click(event => this.onDeleteMilieu(event));
|
||||
this.html.find("div.environnement-milieu select.environnement-rarete").change(event => this.onChange(event,
|
||||
updated => this.$changeRarete(event, updated)));
|
||||
this.html.find("div.environnement-milieu input[name='environnement-frequence']").change(async event => await this.onChange(event,
|
||||
this.html.find("div.environnement-milieu input[name='environnement-frequence']").change(event => this.onChange(event,
|
||||
updated => this.$changeFrequence(event, updated)));
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { RdDItemSheetV1 } from "../item-sheet.js";
|
||||
import { RdDItemSheet } from "../item-sheet.js";
|
||||
|
||||
export class RdDBlessureItemSheet extends RdDItemSheetV1 {
|
||||
export class RdDBlessureItemSheet extends RdDItemSheet {
|
||||
|
||||
static get ITEM_TYPE() { return "blessure" };
|
||||
|
||||
@ -15,15 +15,15 @@ export class RdDBlessureItemSheet extends RdDItemSheetV1 {
|
||||
|
||||
if (!this.options.editable) return;
|
||||
|
||||
this.html.find('[name="premierssoins-done"]').change(async event =>
|
||||
await this.item.setSoinsBlessure({ premierssoins: { done: event.currentTarget.checked } })
|
||||
)
|
||||
this.html.find('[name="soinscomplets-done"]').change(async event =>
|
||||
this.html.find('[name="premierssoins-done"]').change(async event => {
|
||||
await this.item.setSoinsBlessure({ premierssoins: { done: event.currentTarget.checked } });
|
||||
});
|
||||
this.html.find('[name="soinscomplets-done"]').change(async event => {
|
||||
await this.item.setSoinsBlessure({ soinscomplets: { done: event.currentTarget.checked } })
|
||||
)
|
||||
});
|
||||
this.html.find('[name="system-gravite"]').change(async event => {
|
||||
const gravite = Number(event.currentTarget.value)
|
||||
await this.item.setSoinsBlessure({ gravite: gravite, difficulte: - gravite })
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,11 @@
|
||||
import { RdDBaseActorSheet } from "../actor/base-actor-sheet.js";
|
||||
import { ITEM_TYPES } from "../constants.js";
|
||||
import { RdDSheetUtility } from "../rdd-sheet-utility.js";
|
||||
import { RdDUtility } from "../rdd-utility.js";
|
||||
import { RdDItemInventaireSheet } from "./sheet-base-inventaire.js";
|
||||
|
||||
export class RdDConteneurItemSheet extends RdDItemInventaireSheet {
|
||||
|
||||
static get ITEM_TYPE() { return ITEM_TYPES.conteneur };
|
||||
static get ITEM_TYPE() { return "conteneur" };
|
||||
|
||||
async getData() {
|
||||
const formData = await super.getData();
|
||||
@ -29,10 +28,9 @@ export class RdDConteneurItemSheet extends RdDItemInventaireSheet {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
prepareConteneurData(formData) {
|
||||
RdDUtility.filterItemsPerTypeForSheet(formData, this.actor.itemTypes);
|
||||
RdDBaseActorSheet.filterItemsPerTypeForSheet(formData, this.actor.itemTypes);
|
||||
this.objetVersConteneur = RdDUtility.buildArbreDeConteneurs(formData.conteneurs, formData.inventaires);
|
||||
const subItems = formData.conteneurs.find(it => it._id == this.item.id)?.subItems;
|
||||
formData.subItems = subItems
|
||||
formData.subItems = formData.conteneurs.find(it => it._id == this.item.id)?.subItems;
|
||||
}
|
||||
|
||||
async _onDragStart(event) {
|
||||
|
@ -9,7 +9,7 @@ export class RdDFauneItemSheet extends RdDItemInventaireSheet {
|
||||
|
||||
if (!this.options.editable) return;
|
||||
|
||||
$(html).find("a.linked-actor-delete").click(async event => await this.onDeleteLinkedActor());
|
||||
html.find("a.linked-actor-delete").click(event => this.onDeleteLinkedActor());
|
||||
}
|
||||
|
||||
async _onDropActor(event, dragData) {
|
||||
|
@ -1,38 +0,0 @@
|
||||
import { ITEM_TYPES } from "../constants.js";
|
||||
import { DialogEnchanter } from "../enchantement/dialog-enchanter.js";
|
||||
import { RdDTimestamp } from "../time/rdd-timestamp.js";
|
||||
import { RdDItemGemme } from "./gemme.js";
|
||||
import { RdDItemInventaireSheet } from "./sheet-base-inventaire.js";
|
||||
|
||||
export class RdDGemmeItemSheet extends RdDItemInventaireSheet {
|
||||
|
||||
static get ITEM_TYPE() { return ITEM_TYPES.gemme };
|
||||
|
||||
async getData() {
|
||||
const formData = foundry.utils.mergeObject(await super.getData(),
|
||||
{
|
||||
inertie: this.item.inertie,
|
||||
enchantabilite: this.item.enchantabilite,
|
||||
isEnchantementPossible: this.item.isEnchantementPossible,
|
||||
gemmeTypeList: RdDItemGemme.getGemmeTypeOptionList(),
|
||||
dateActuelle: game.system.rdd.calendrier.dateCourante(),
|
||||
enchantement: RdDTimestamp.splitIndexDate(this.item.system.prdate)
|
||||
})
|
||||
return formData
|
||||
}
|
||||
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
this.html.find('.item-enchanter').click((event) => DialogEnchanter.enchanter(this.item))
|
||||
|
||||
this.html.find('.date-enchantement').change((event) => {
|
||||
const jour = Number(this.html.find('input.date-enchantement[name="enchantement.jour"]').val())
|
||||
const mois = RdDTimestamp.definition(this.html.find('select.date-enchantement[name="enchantement.mois"]').val())
|
||||
const indexDate = game.system.rdd.calendrier.getIndexFromDate(jour, mois.heure)
|
||||
this.item.update({ 'system.prdate': indexDate })
|
||||
console.warn(`Date d'enchantement modifiée ${jour}/${mois.heure}: ${indexDate}`)
|
||||
});
|
||||
|
||||
}
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
import { ITEM_TYPES } from "../constants.js";
|
||||
import { DialogEnchanter } from "../enchantement/dialog-enchanter.js";
|
||||
import { RdDTimestamp } from "../time/rdd-timestamp.js";
|
||||
import { RdDItemPotion } from "./potion.js";
|
||||
import { RdDItemInventaireSheet } from "./sheet-base-inventaire.js";
|
||||
|
||||
|
||||
export class RdDPotionItemSheet extends RdDItemInventaireSheet {
|
||||
|
||||
static get ITEM_TYPE() { return ITEM_TYPES.potion };
|
||||
|
||||
static $calculBonusHerbe(formData, herbesList, max) {
|
||||
if (Number(formData.system.herbebrins)) {
|
||||
let herbe = herbesList.find(h => h.name.toLowerCase() == formData.system.herbe.toLowerCase());
|
||||
if (herbe) {
|
||||
const brinsRequis = max - herbe.system.niveau;
|
||||
const brinsManquants = Math.max(brinsRequis - formData.system.herbebrins, 0);
|
||||
formData.system.herbebonus = Math.max(herbe.system.niveau - brinsManquants, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async getData() {
|
||||
const formData = await super.getData()
|
||||
formData.isEnchantementPossible = this.item.isEnchantementPossible
|
||||
formData.isSoins = this.item.categorie == 'Soin'
|
||||
formData.isRepos = this.item.categorie == 'Repos'
|
||||
if (formData.isSoins) {
|
||||
const herbesSoins = await RdDItemPotion.herbesSoins()
|
||||
RdDPotionItemSheet.$calculBonusHerbe(formData, herbesSoins, 12);
|
||||
formData.herbesSoins = RdDItemPotion.buildHerbesList(herbesSoins, 12)
|
||||
}
|
||||
if (formData.isRepos) {
|
||||
const herbesRepos = await RdDItemPotion.herbesRepos()
|
||||
RdDPotionItemSheet.$calculBonusHerbe(formData, herbesRepos, 7);
|
||||
formData.herbesRepos = RdDItemPotion.buildHerbesList(herbesRepos, 7)
|
||||
}
|
||||
formData.dateActuelle = game.system.rdd.calendrier.dateCourante()
|
||||
formData.enchantement = RdDTimestamp.splitIndexDate(this.item.system.prdate)
|
||||
return formData
|
||||
}
|
||||
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
this.html.find('.item-enchanter').click((event) => DialogEnchanter.enchanter(this.item))
|
||||
|
||||
this.html.find('.date-enchantement').change((event) => {
|
||||
const jour = Number(this.html.find('input.date-enchantement[name="enchantement.jour"]').val())
|
||||
const mois = RdDTimestamp.definition(this.html.find('select.date-enchantement[name="enchantement.mois"]').val())
|
||||
const indexDate = game.system.rdd.calendrier.getIndexFromDate(jour, mois.heure)
|
||||
this.item.update({ 'system.prdate': indexDate })
|
||||
console.warn(`Date d'enchantement modifiée ${jour}/${mois.heure}: ${indexDate}`)
|
||||
});
|
||||
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
import { RdDRencontre } from "./rencontre.js";
|
||||
import { RdDItemSheetV1 } from "../item-sheet.js";
|
||||
import { RdDItemSheet } from "../item-sheet.js";
|
||||
|
||||
export class RdDRencontreItemSheet extends RdDItemSheetV1 {
|
||||
export class RdDRencontreItemSheet extends RdDItemSheet {
|
||||
|
||||
static get ITEM_TYPE() { return "rencontre" };
|
||||
|
||||
@ -44,8 +44,8 @@ export class RdDRencontreItemSheet extends RdDItemSheetV1 {
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
if (!this.options.editable) return;
|
||||
this.html.find("a.effet-add").click(async event => await this.onAddEffet(event));
|
||||
this.html.find("a.effet-delete").click(async event => await this.onDeleteEffet(event));
|
||||
this.html.find("a.effet-add").click(event => this.onAddEffet(event));
|
||||
this.html.find("a.effet-delete").click(event => this.onDeleteEffet(event));
|
||||
}
|
||||
|
||||
async onAddEffet(event) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { RdDItemSheetV1 } from "../item-sheet.js";
|
||||
import { RdDItemSheet } from "../item-sheet.js";
|
||||
|
||||
export class RdDServiceItemSheet extends RdDItemSheetV1 {
|
||||
export class RdDServiceItemSheet extends RdDItemSheet {
|
||||
|
||||
static get ITEM_TYPE() { return "service" };
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user