Compare commits

..

110 Commits

Author SHA1 Message Date
ee42902b5c Gestion reserve et queues ameliores(Vincent) 2022-09-17 09:09:09 +02:00
838d4381a4 Merge pull request 'Refouler des queues et supprimer des sorts en réserve' (#553) from VincentVk/foundryvtt-reve-de-dragon:v10 into v10
Reviewed-on: #553
2022-09-17 09:04:19 +02:00
Vincent Vandemeulebrouck
2232224951 Suppression de sorts en réserve 2022-09-17 01:54:27 +02:00
Vincent Vandemeulebrouck
1251d04860 Action Refoulement de queue 2022-09-17 01:54:27 +02:00
63c6d5ff0f Integration fixes Vincent 2022-09-16 08:35:48 +02:00
c0d37e42ca Merge pull request 'Petits fixes suite à tests' (#552) from VincentVk/foundryvtt-reve-de-dragon:v10-fixes into v10
Reviewed-on: #552
2022-09-16 08:34:18 +02:00
Vincent Vandemeulebrouck
c8c13d626c Fix drop item sans actor 2022-09-16 02:41:54 +02:00
Vincent Vandemeulebrouck
e1ca7ab738 Amélioration des monnaies
On peut maintenant supprimer es monnaies tant qu'on garde une monnaie
pour chaque valeur de base
2022-09-16 02:41:08 +02:00
Vincent Vandemeulebrouck
8f1ee315ef Template en-tête standard 2022-09-16 02:24:08 +02:00
Vincent Vandemeulebrouck
5daf15901a Correction erreur xp restant 2022-09-16 02:24:08 +02:00
bddaecbc74 Fix entite 2022-09-11 16:14:27 +02:00
87fdd655d4 Merge v10 fixes 2022-09-07 23:09:21 +02:00
9cbb12e900 Merge pull request 'Utilisation de system dans les Item/Actor Sheet' (#551) from VincentVk/foundryvtt-reve-de-dragon:v10 into v10
Reviewed-on: #551
2022-09-07 23:08:26 +02:00
Vincent Vandemeulebrouck
509b7f97dc Utilisation de system dans les Item/Actor Sheet
Utilisation de system dans les data de formulaire pour tous
les Item/Actor (à la base, ou les sous-éléments)

Corrections sur les sorts en réserve (ce ne sont pas des Item)

Petites améliorations:

* `actor.itemTypes[type]`
   revient à faire (sans besoin de filtrer)
    `actor.items.filter(it => it.type == type)`
* dans les ItemSheet, this.object et this.document
  remplacés par this.item
* dans les ActorSheet, this.object et this.document
  remplacés par this.actor

Quelques corrections en plus:
* parade ne marchait pas
* problèmes sur le commerce
2022-09-07 18:47:56 +02:00
5cd9fb3a1c v10 WIP 2022-09-07 09:14:42 +02:00
336767c19e v10 WIP 2022-09-07 09:01:23 +02:00
5a32cf26dc Merge pull request 'Corrections v10' (#550) from VincentVk/foundryvtt-reve-de-dragon:v10 into v10
Reviewed-on: #550
2022-09-07 08:17:41 +02:00
Vincent Vandemeulebrouck
67b0555b11 Corrections v10
Il y en avait partout dans des dialogues, des options,
le drag&drop d'acteur sur acteur, l'empilage d'objet...
2022-09-07 00:36:52 +02:00
59613c3bf8 Sync 2022-09-06 23:52:21 +02:00
e257b6fbee v10 sync 2022-08-31 22:31:27 +02:00
ea990d7c4e Merge VK mods 2022-08-28 08:46:26 +02:00
6271c75508 Merge VK mods 2022-08-28 08:41:53 +02:00
cd7cc8eeef Merge pull request 'Amélioration de la feuille de personnages' (#547) from VincentVk/foundryvtt-reve-de-dragon:v1.5 into v1.5
Reviewed-on: #547
2022-08-28 08:40:51 +02:00
Vincent Vandemeulebrouck
bb3bc0ea77 Suppression logs hbs 2022-08-27 23:17:05 +02:00
Vincent Vandemeulebrouck
f348f3dc3f Condenser les listes (sauf caractéristiques 2022-08-27 23:14:27 +02:00
Vincent Vandemeulebrouck
dbf9f5e908 Améliorations des boutons fontawesome&css 2022-08-27 23:14:27 +02:00
Vincent Vandemeulebrouck
e4da124579 Filtrer les catégories sans compétences 2022-08-27 23:14:27 +02:00
Vincent Vandemeulebrouck
6e361a5531 Ne pas raffraîchir si le text ne change pas 2022-08-27 23:14:27 +02:00
Vincent Vandemeulebrouck
049b23c666 Boutons +/- de fontawsome 2022-08-27 23:14:27 +02:00
Vincent Vandemeulebrouck
3ff59d1f07 Amélioration rendu équipement 2022-08-27 23:14:27 +02:00
cfe8bee1c2 Merge brnch 2022-08-27 19:16:27 +02:00
d4f0cce62b Sync system.json 2022-08-27 19:14:15 +02:00
8c0fbf15b6 Merge VK features 2022-08-27 19:12:44 +02:00
d4fddf8600 Merge pull request 'Arbre de conteneurs et recherche améliorée' (#546) from VincentVk/foundryvtt-reve-de-dragon:v1.5 into v1.5
Reviewed-on: #546
2022-08-27 19:11:56 +02:00
Vincent Vandemeulebrouck
4b1862fa48 Arborescence de conteneurs
Les conteneurs sont maintenant précédés d'une icone:
* pour ouvrir:  '+'
* pour fermer: '-'
* si vide: carré vide
2022-08-26 22:23:09 +02:00
Vincent Vandemeulebrouck
82115ed8d7 Amélioration recherche
La recherche de compétence fonctionne sur timer
2022-08-26 22:23:08 +02:00
59b4f62145 Merge1 2022-07-23 18:36:03 +02:00
3359492f13 v0.5 fixes 2022-07-23 18:34:17 +02:00
676e6739a6 Merge pull request 'Fix import' (#545) from VincentVk/foundryvtt-reve-de-dragon:v1.5 into v1.5
Reviewed-on: #545
2022-07-23 18:33:32 +02:00
Vincent Vandemeulebrouck
872d3fff31 Fix import 2022-07-23 16:48:49 +02:00
5f3361ecc6 Merge v1.5 2022-07-22 22:53:48 +02:00
9c71827baa Add Blurette 2022-07-22 22:45:41 +02:00
fc9ef06e7b Merge pull request 'Support des blurettes' (#544) from VincentVk/foundryvtt-reve-de-dragon:v1.5 into v1.5
Reviewed-on: #544
2022-07-22 22:44:49 +02:00
Vincent Vandemeulebrouck
9e63706de6 Support des blurettes
On peut définir Blurette comme type d'entité.
Pas de jet poour s'accorder aux blurettes.
2022-07-22 21:38:20 +02:00
3958b1bdc2 Add Vincent VK fixes 2022-07-22 10:46:39 +02:00
6d6843223b Merge pull request 'Petits fixes et petits conforts' (#543) from VincentVk/foundryvtt-reve-de-dragon:v1.5 into v1.5
Reviewed-on: #543
2022-07-22 10:45:44 +02:00
Vincent Vandemeulebrouck
46f5cb67f6 Créer un acteur depuis /nom 2022-07-22 01:34:15 +02:00
Vincent Vandemeulebrouck
d51243d74f Fix Bouton "prendre"
Le bouton devenait "Acheter" car le prix après la première prise était
récupéré sous forme de string (et le template fait une comparaison de
nombre)
2022-07-22 01:01:46 +02:00
Vincent Vandemeulebrouck
34cc671f12 Fix init Autre action 2022-07-22 00:36:16 +02:00
Vincent Vandemeulebrouck
16ce6a58dd Fix accorder entite de cauchemar
A priori vieille régression, pas vue depuis.

attaquant._id est devenu attaquant.id
2022-07-22 00:31:27 +02:00
c80cde6d18 Merge v1.5 2022-07-17 11:51:23 +02:00
89910e234d Add Vincent fixes 2022-07-17 11:05:28 +02:00
f30df47d22 Merge pull request 'v1.5' (#542) from VincentVk/foundryvtt-reve-de-dragon:v1.5 into v1.5
Reviewed-on: #542
2022-07-17 11:04:20 +02:00
Vincent Vandemeulebrouck
c3c42bdb21 Fix compétences créatures
Ne pas ajouter toutes les compétences à une nouvelle créature,
il faut presque toutes les enlever
2022-07-17 01:54:01 +02:00
Vincent Vandemeulebrouck
14eb655382 Fix Haubert d'Oniros - rituel 2022-07-17 01:53:02 +02:00
Vincent Vandemeulebrouck
52e4375972 Fix affichage description des entités 2022-07-16 23:38:03 +02:00
15e4bfb713 Fix combat.js 2022-07-14 22:32:57 +02:00
8c2d49652c v10 branch - Update manifest 2022-07-13 08:04:48 +02:00
ed02972a34 v10 branch - Update manifest 2022-07-13 08:03:45 +02:00
7d32a70e00 Fixes pour possession 2022-07-09 09:04:35 +02:00
8aece9cad1 Fixes pour possession 2022-07-09 08:56:44 +02:00
ffd36a045e Merge pull request 'Quelques petits fixes' (#541) from VincentVk/foundryvtt-reve-de-dragon:v1.5 into v1.5
Reviewed-on: #541
2022-07-09 08:55:48 +02:00
Vincent Vandemeulebrouck
bafc52a151 Fix: recherches incorrectes
* cas rare d'un personnage avec carac reve-actuel défini, mais sans
label, qui rend impossible de trouver une autre caractéristique, ce
qui empêche tout jet de caractéristique

* '/rdd <carac> <comp>', quand plusieurs compétences peuvent
correspondre, la première devrait être choisie... mais en pratique,
échec et rien ne se passe
2022-07-08 01:22:53 +02:00
Vincent Vandemeulebrouck
940baad04c Amélioration des possession
* messages plus clairs
* initiatives
* en cas de possession en cours, c'est la seule action possible
* accès dans le HUD
2022-07-03 15:32:24 +02:00
0d288c56d4 Merge from v1.5 possession fix 2022-07-02 09:02:31 +02:00
70c26ebfe0 Fix possession 2022-07-02 08:54:55 +02:00
782c6a8fe2 Merge pull request 'Fix possession' (#540) from VincentVk/foundryvtt-reve-de-dragon:v1.5 into v1.5
Reviewed-on: #540
2022-07-02 08:53:30 +02:00
Vincent Vandemeulebrouck
b417fdfe32 Fix possession
On peut maintenant lutter pour les haut-rêvants
Les messages ont été clarifiés
2022-07-02 01:41:55 +02:00
09c4e691c7 First v10 release 2022-07-01 14:34:29 +02:00
3774fef20c Merge v1.5 -> v10 2022-06-26 16:55:59 +02:00
9bc4260ae1 Fix actor 2022-06-26 16:54:16 +02:00
11274c51d6 Add VincentVK fixes 2022-06-26 16:26:17 +02:00
6377964d07 Merge pull request 'Corrections des TMRs et météo' (#539) from VincentVk/foundryvtt-reve-de-dragon:v1.5-tmrs into v1.5
Reviewed-on: #539
2022-06-26 16:23:58 +02:00
Vincent Vandemeulebrouck
8cf43d4e8a Fix Maîtrise avec TMR cachée
On ne donne plus le nom et les coordonées des cases à maîtriser
quand le personnage est perdu
2022-06-26 01:18:18 +02:00
Vincent Vandemeulebrouck
5efb7d9be0 Fix des TMRs visibles/cachées
Parfois on peut retrouver son chemin dans les TMR:

- Terre d'attache
- Connaisance du fleuve
- changeur des rêves vaincus

On ne peut pas utiliser un messager/passeur quand on est perdu

Les messages ne contiennent plus 'undefined' pour le changeur
2022-06-26 01:18:17 +02:00
Vincent Vandemeulebrouck
f54804c071 Fix checkSoufflePeage 2022-06-26 01:18:17 +02:00
Vincent Vandemeulebrouck
59ece09357 Possession pour non haut-rêvant 2022-06-26 01:18:17 +02:00
Vincent Vandemeulebrouck
5868bf16e0 Commande météo 2022-06-26 01:18:17 +02:00
6873cf0d41 Increase release 2022-06-26 01:17:56 +02:00
255c0a77b4 Big WIP... 2022-06-12 19:40:44 +02:00
698ff79d41 Big WIP... 2022-06-12 13:58:55 +02:00
dffe191d6e Big WIP... 2022-06-12 12:23:33 +02:00
1f3fd0bb46 Big WIP... 2022-06-12 12:14:55 +02:00
0228d5bc56 Big WIP... 2022-06-12 09:46:58 +02:00
6b48839841 Big WIP... 2022-06-12 08:20:19 +02:00
451ee677d2 Big WIP... 2022-06-12 08:17:59 +02:00
2c73f5aa11 Increase release 2022-06-06 23:18:33 +02:00
035da98aaa Merge pull request 'v1.5-fixes' (#538) from VincentVk/foundryvtt-reve-de-dragon:v1.5-fixes into v1.5
Reviewed-on: #538
2022-06-06 23:17:23 +02:00
Vincent Vandemeulebrouck
2885ca1c8f Fix suppression messages combat 2022-06-06 23:03:09 +02:00
Vincent Vandemeulebrouck
218c88a924 Fix détérioration armure
Support des armures sous forme:

* entier
* 0
* d4, d4-1
* 1d4, 1d4-1

Détérioration diminuée de 10 (au lieu de remise à 0)

Décrémentation correcte de l'armure
2022-06-06 23:03:09 +02:00
Vincent Vandemeulebrouck
e22b6c52f1 Fix méditation
- augmentation du malus en cas d'échec particulier/total
- le malus affecte négativement la méditation
- en cas d'échec, aucun signe n'est créé
2022-06-06 23:03:09 +02:00
Vincent Vandemeulebrouck
9b8f694dda Réorganisation dans le haut-rêve
Ajout de la force des rencontres en attente
Ajout des cases pour les sorts et cases spéciales

1. Têtes; souffles et queues
2. Effets temporaires: signes, rencontres, sorts en réserve
3. Apprentissages: sorts, méditations
4. cases spéciales
2022-06-06 23:03:08 +02:00
Vincent Vandemeulebrouck
75562b0af8 Suppressions de logs 2022-06-06 23:03:08 +02:00
Vincent Vandemeulebrouck
3a684c3c54 Fix typo resaon 2022-06-06 23:03:08 +02:00
Vincent Vandemeulebrouck
70354abacb Fix XP en sort
Cas d'xp en sort concaténée
2022-06-06 23:03:08 +02:00
Vincent Vandemeulebrouck
bdead49d01 Renommage methode checkNull 2022-06-06 23:03:08 +02:00
60b6da5cd3 Merge pull request 'v1.5' (#1) from public/foundryvtt-reve-de-dragon:v1.5 into v1.5
Reviewed-on: VincentVk/foundryvtt-reve-de-dragon#1
2022-06-06 23:03:02 +02:00
66218be14a Fix TMR 2022-06-06 23:03:02 +02:00
Vincent Vandemeulebrouck
9aad57c00c Fix Nom des TMR désolation
Il n'y a pas que la désolation de Demain

Change-Id: I41cef0204edae57d6071c8b3b33f0dd63a42c2a5
2022-06-06 23:03:02 +02:00
395e4d4b73 Fix TMR 2022-06-03 09:11:28 +02:00
25de00d2a9 Merge pull request 'Fix Nom des TMR désolation' (#537) from VincentVk/foundryvtt-reve-de-dragon:v1.5-desolation into v1.5
Reviewed-on: #537
2022-06-03 09:09:53 +02:00
Vincent Vandemeulebrouck
0805d1df66 Fix Nom des TMR désolation
Il n'y a pas que la désolation de Demain

Change-Id: I41cef0204edae57d6071c8b3b33f0dd63a42c2a5
2022-06-03 01:30:36 +02:00
e2de9bb645 Fix releas 2022-05-30 10:29:10 +02:00
5d2db17c03 Fix rituels 2022-05-27 17:19:41 +02:00
a3fb328b7d v10 migration, ongoing WIP 2022-05-03 09:01:10 +02:00
4538439c02 v10 migration, ongoing WIP 2022-05-01 23:37:52 +02:00
d83fd27193 Various fixes - WIP 2022-05-01 00:46:24 +02:00
580fdb996b Various fixes - WIP 2022-05-01 00:38:09 +02:00
5214b036d3 Various fixes 2022-04-30 23:42:55 +02:00
f64928858c Prepare for v10 2022-04-30 19:15:55 +02:00
172 changed files with 4025 additions and 4083 deletions

View File

@@ -27,11 +27,11 @@ export class RdDActorCreatureSheet extends RdDActorSheet {
/* -------------------------------------------- */ /* -------------------------------------------- */
async getData() { async getData() {
let formData = await super.getData(); let formData = await super.getData()
console.log("Creature : ", formData); //console.log("Creature : ", formData, formData.system)
formData.calc = { formData.calc = {
caracTotal: RdDCarac.computeTotal(formData.data.carac), caracTotal: RdDCarac.computeTotal(formData.system.carac),
resumeBlessures: this.actor.computeResumeBlessure(formData.data.blessures), resumeBlessures: this.actor.computeResumeBlessure(formData.system.blessures),
encTotal: await this.actor.computeEncombrementTotalEtMalusArmure(), encTotal: await this.actor.computeEncombrementTotalEtMalusArmure(),
surEncombrementMessage: this.actor.getMessageSurEncombrement() surEncombrementMessage: this.actor.getMessageSurEncombrement()
} }

View File

@@ -22,33 +22,24 @@ export class RdDActorEntiteSheet extends ActorSheet {
}); });
} }
/* -------------------------------------------- */
_checkNull(items) {
if (items && items.length) {
return items;
}
return [];
}
/* -------------------------------------------- */ /* -------------------------------------------- */
async getData() { async getData() {
const objectData = Misc.data(this.object);
let formData = { let formData = {
title: this.title, title: this.title,
id: objectData.id, id: this.actor.id,
type: objectData.type, type: this.actor.type,
img: objectData.img, img: this.actor.img,
name: objectData.name, name: this.actor.name,
// actor: this.object,
editable: this.isEditable, editable: this.isEditable,
cssClass: this.isEditable ? "editable" : "locked", cssClass: this.isEditable ? "editable" : "locked",
data: foundry.utils.deepClone(Misc.templateData(this.object)), system: foundry.utils.deepClone(this.actor.system),
effects: this.object.effects.map(e => foundry.utils.deepClone(e.data)), effects: this.actor.effects.map(e => foundry.utils.deepClone(e)),
// items: items, // items: items,
limited: this.object.limited, limited: this.actor.limited,
options: this.options, options: this.options,
owner: this.document.isOwner, owner: this.actor.isOwner,
itemsByType: Misc.classify(this.object.items.map(i => foundry.utils.deepClone(i.data))), itemsByType: Misc.classify(this.actor.items.map(i => foundry.utils.deepClone(i))),
}; };
formData.options.isGM = game.user.isGM; formData.options.isGM = game.user.isGM;
@@ -148,6 +139,6 @@ export class RdDActorEntiteSheet extends ActorSheet {
/** @override */ /** @override */
_updateObject(event, formData) { _updateObject(event, formData) {
// Update the Actor // Update the Actor
return this.object.update(formData); return this.actor.update(formData);
} }
} }

View File

@@ -15,6 +15,7 @@ import { DialogSplitItem } from "./dialog-split-item.js";
import { ReglesOptionelles } from "./regles-optionelles.js"; import { ReglesOptionelles } from "./regles-optionelles.js";
import { DialogRepos } from "./dialog-repos.js"; import { DialogRepos } from "./dialog-repos.js";
import { RdDSheetUtility } from "./rdd-sheet-utility.js"; import { RdDSheetUtility } from "./rdd-sheet-utility.js";
import { TMRUtility } from "./tmr-utility.js";
/* -------------------------------------------- */ /* -------------------------------------------- */
export class RdDActorSheet extends ActorSheet { export class RdDActorSheet extends ActorSheet {
@@ -36,55 +37,51 @@ export class RdDActorSheet extends ActorSheet {
/* -------------------------------------------- */ /* -------------------------------------------- */
async getData() { async getData() {
const objectData = Misc.data(this.object); this.timerRecherche = undefined;
//this.actor.checkMonnaiePresence(this.actor.data.items); // Always check
let formData = { let formData = {
title: this.title, title: this.title,
id: objectData.id, id: this.actor.id,
type: objectData.type, type: this.actor.type,
img: objectData.img, img: this.actor.img,
name: objectData.name, name: this.actor.name,
editable: this.isEditable, editable: this.isEditable,
cssClass: this.isEditable ? "editable" : "locked", cssClass: this.isEditable ? "editable" : "locked",
data: foundry.utils.deepClone(Misc.templateData(this.object)), system: foundry.utils.deepClone(this.actor.system),
effects: this.object.effects.map(e => foundry.utils.deepClone(e.data)), effects: this.actor.effects.map(e => foundry.utils.deepClone(e)),
limited: this.object.limited, limited: this.actor.limited,
options: this.options, options: this.options,
owner: this.document.isOwner, owner: this.actor.isOwner,
itemsByType: Misc.classify(this.object.items.map(i => foundry.utils.deepClone(i.data))), itemsByType: Misc.classify(this.actor.items.map(i => foundry.utils.deepClone(i))),
}; }
RdDUtility.filterItemsPerTypeForSheet(formData)
RdDUtility.filterItemsPerTypeForSheet(formData);
formData.options.isGM = game.user.isGM; formData.options.isGM = game.user.isGM;
if (formData.type == 'creature') return formData; // Shortcut if (formData.type == 'creature') return formData; // Shortcut
formData.competenceByCategory = Misc.classify(formData.competences, it => it.data.categorie); formData.competenceByCategory = Misc.classify(formData.competences, it => it.system.categorie)
formData.calc = { formData.calc = {
comptageArchetype: RdDItemCompetence.computeResumeArchetype(formData.competences), comptageArchetype: RdDItemCompetence.computeResumeArchetype(formData.competences),
competenceXPTotal: RdDItemCompetence.computeTotalXP(formData.competences), competenceXPTotal: RdDItemCompetence.computeTotalXP(formData.competences),
caracTotal: RdDCarac.computeTotal(formData.data.carac, formData.data.beaute), caracTotal: RdDCarac.computeTotal(formData.system.carac, formData.system.beaute),
// Mise à jour de l'encombrement total et du prix de l'équipement // Mise à jour de l'encombrement total et du prix de l'équipement
encTotal: await this.actor.computeEncombrementTotalEtMalusArmure(), encTotal: await this.actor.computeEncombrementTotalEtMalusArmure(),
prixTotalEquipement: this.actor.computePrixTotalEquipement(), prixTotalEquipement: this.actor.computePrixTotalEquipement(),
surprise: RdDBonus.find(this.actor.getSurprise(false)).descr, surprise: RdDBonus.find(this.actor.getSurprise(false)).descr,
fatigue: RdDUtility.calculFatigueHtml(formData.data.sante.fatigue.value, formData.data.sante.endurance.max), fatigue: RdDUtility.calculFatigueHtml(formData.system.sante.fatigue.value, formData.system.sante.endurance.max),
resumeBlessures: this.actor.computeResumeBlessure(formData.data.blessures), resumeBlessures: this.actor.computeResumeBlessure(formData.system.blessures),
surEncombrementMessage: this.actor.getMessageSurEncombrement() surEncombrementMessage: this.actor.getMessageSurEncombrement()
}; };
formData.competences.forEach(item => { formData.competences.forEach(item => {
item.visible = this.options.cherchercompetence item.system.isVisible = this.options.recherche
? RdDItemCompetence.nomContientTexte(item, this.options.cherchercompetence) ? RdDItemCompetence.nomContientTexte(item, this.options.recherche.text)
: (!this.options.showCompNiveauBase || !RdDItemCompetence.isNiveauBase(item)); : (!this.options.showCompNiveauBase || !RdDItemCompetence.isNiveauBase(item));
RdDItemCompetence.levelUp(item, formData.data.compteurs.experience.value); RdDItemCompetence.levelUp(item, formData.system.compteurs.experience.value);
}); });
Object.values(formData.system.carac).forEach(c => {
Object.values(formData.data.carac).forEach(c => {
RdDCarac.levelUp(c); RdDCarac.levelUp(c);
}); });
@@ -92,9 +89,9 @@ export class RdDActorSheet extends ActorSheet {
// toujours avoir une liste d'armes (pour mettre esquive et corps à corps) // toujours avoir une liste d'armes (pour mettre esquive et corps à corps)
formData.combat = duplicate(formData.armes ?? []); formData.combat = duplicate(formData.armes ?? []);
RdDItemArme.computeNiveauArmes(formData.combat, formData.competences); RdDItemArme.computeNiveauArmes(formData.combat, formData.competences);
RdDItemArme.ajoutCorpsACorps(formData.combat, formData.competences, formData.data.carac); RdDItemArme.ajoutCorpsACorps(formData.combat, formData.competences, formData.system.carac);
formData.esquives = this.actor.getCompetences("Esquive").map(i => foundry.utils.deepClone(i.data)); formData.esquives = this.actor.getCompetences("Esquive");
formData.combat = RdDCombatManager.finalizeArmeList(formData.combat, formData.competences, formData.data.carac); formData.combat = RdDCombatManager.listActionsArmes(formData.combat, formData.competences, formData.system.carac);
this.armesList = formData.combat; this.armesList = formData.combat;
@@ -104,8 +101,8 @@ export class RdDActorSheet extends ActorSheet {
formData.hautreve = { formData.hautreve = {
isDemiReve: this.actor.getEffectByLabel("Demi-rêve"), isDemiReve: this.actor.getEffectByLabel("Demi-rêve"),
sortsReserve: formData.data.reve.reserve.list, sortsReserve: formData.system.reve.reserve.list,
rencontres: duplicate(formData.data.reve.rencontre.list), rencontres: duplicate(formData.system.reve.rencontre.list),
casesTmr: formData.itemsByType.casetmr, casesTmr: formData.itemsByType.casetmr,
cacheTMR: this.actor.isTMRCache() cacheTMR: this.actor.isTMRCache()
} }
@@ -118,7 +115,7 @@ export class RdDActorSheet extends ActorSheet {
montures: this.actor.listeMontures(), montures: this.actor.listeMontures(),
suivants: this.actor.listeSuivants() suivants: this.actor.listeSuivants()
} }
if (this.actor.getBestDraconic().data.niveau > -11 && !this.actor.isHautRevant()) { if (this.actor.getBestDraconic().system.niveau > -11 && !this.actor.isHautRevant()) {
ui.notifications.error(`${this.actor.name} a des compétences draconiques, mais pas le don de Haut-Rêve! ui.notifications.error(`${this.actor.name} a des compétences draconiques, mais pas le don de Haut-Rêve!
<br>Ajoutez-lui la tête "Don de Haut-Rêve" pour lui permettre d'utiliser ses compétences et d'accéder aux terres médianes du rêve`); <br>Ajoutez-lui la tête "Don de Haut-Rêve" pour lui permettre d'utiliser ses compétences et d'accéder aux terres médianes du rêve`);
} }
@@ -131,16 +128,16 @@ export class RdDActorSheet extends ActorSheet {
/* -------------------------------------------- */ /* -------------------------------------------- */
async _onDropActor(event, dragData) { async _onDropActor(event, dragData) {
console.log("_onDropActor", this.actor.id, dragData); const dropActor = fromUuidSync(dragData.uuid);
this.actor.addSubActeur(dragData.id || dragData.data._id); this.actor.addSubActeur(dropActor);
super._onDropActor(event, dragData); super._onDropActor(event, dragData);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async _onDropItem(event, dragData) { async _onDropItem(event, dragData) {
const destItemId = $(event.target)?.closest('.item').attr('data-item-id'); const destItemId = $(event.target)?.closest('.item').attr('data-item-id')
const dropParams = RdDSheetUtility.prepareItemDropParameters(destItemId, this.actor.id, dragData, this.objetVersConteneur); const dropParams = RdDSheetUtility.prepareItemDropParameters(destItemId, this.actor.id, dragData, this.objetVersConteneur)
const callSuper = await this.actor.processDropItem(dropParams); const callSuper = await this.actor.processDropItem(dropParams)
if (callSuper) { if (callSuper) {
await super._onDropItem(event, dragData) await super._onDropItem(event, dragData)
} }
@@ -184,7 +181,21 @@ export class RdDActorSheet extends ActorSheet {
}); });
html.find('.item-delete').click(async event => { html.find('.item-delete').click(async event => {
const li = RdDSheetUtility.getEventElement(event); const li = RdDSheetUtility.getEventElement(event);
RdDUtility.confirmerSuppression(this, li); const item = this.actor.getObjet(li.data("item-id"));
RdDUtility.confirmerSuppressionItem(this, item, li);
});
html.find('.sort-reserve-delete').click(async event => {
const li = RdDSheetUtility.getEventElement(event);
const index = li.data('index');
const sortReserve = this.actor.system.reve.reserve.list[index];
RdDUtility.confirmerSuppression(this, li, {
supprimer: `le sort en réserve ${sortReserve.sort.name} en ${TMRUtility.getTMR(sortReserve.coord).label}`,
deleteLabel: "Supprimer le sort en réserve",
onDelete: () => {
console.log("Delete : ", sortReserve.name);
this.actor.deleteSortReserveKey(index);
}
});
}); });
html.find('.item-vendre').click(async event => { html.find('.item-vendre').click(async event => {
const item = RdDSheetUtility.getItem(event, this.actor); const item = RdDSheetUtility.getItem(event, this.actor);
@@ -201,7 +212,11 @@ export class RdDActorSheet extends ActorSheet {
}); });
html.find('.subacteur-delete').click(async event => { html.find('.subacteur-delete').click(async event => {
const li = RdDSheetUtility.getEventElement(event); const li = RdDSheetUtility.getEventElement(event);
RdDUtility.confirmerSuppressionSubacteur(this, li); const actorId = li.data("actor-id");
if (actorId) {
const subActor = game.actors.get(actorId);
RdDUtility.confirmerSuppressionSubacteur(this, subActor, li);
}
}); });
html.find('.encaisser-direct').click(async event => { html.find('.encaisser-direct').click(async event => {
@@ -315,7 +330,7 @@ export class RdDActorSheet extends ActorSheet {
// Boutons spéciaux MJs // Boutons spéciaux MJs
html.find('.forcer-tmr-aleatoire').click(async event => { html.find('.forcer-tmr-aleatoire').click(async event => {
this.actor.cacheTMRetMessage(); this.actor.reinsertionAleatoire("Action MJ");
}); });
html.find('.afficher-tmr').click(async event => { html.find('.afficher-tmr').click(async event => {
this.actor.afficheTMRetMessage(); this.actor.afficheTMRetMessage();
@@ -333,10 +348,10 @@ export class RdDActorSheet extends ActorSheet {
}); });
// Initiative pour l'arme // Initiative pour l'arme
html.find('.arme-initiative a').click(async event => { html.find('.arme-initiative a').click(async event => {
let combatant = game.combat.data.combatants.find(c => c.actor.data._id == this.actor.data._id); let combatant = game.combat.combatants.find(c => c.actor.id == this.actor.id);
if (combatant) { if (combatant) {
let arme = this._getEventArmeCombat(event); let action = this._getEventArmeCombat(event);
RdDCombatManager.rollInitiativeCompetence(combatant._id, arme); RdDCombatManager.rollInitiativeAction(combatant._id, action);
} else { } else {
ui.notifications.info("Impossible de lancer l'initiative sans être dans un combat."); ui.notifications.info("Impossible de lancer l'initiative sans être dans un combat.");
} }
@@ -384,13 +399,11 @@ export class RdDActorSheet extends ActorSheet {
if (this.options.editCaracComp) { if (this.options.editCaracComp) {
// On carac change // On carac change
html.find('.carac-value').change(async event => { html.find('.carac-value').change(async event => {
let caracName = event.currentTarget.name.replace(".value", "").replace("data.carac.", ""); let caracName = event.currentTarget.name.replace(".value", "").replace("system.carac.", "");
//console.log("Value changed :", event, caracName);
this.actor.updateCarac(caracName, parseInt(event.target.value)); this.actor.updateCarac(caracName, parseInt(event.target.value));
}); });
html.find('.carac-xp').change(async event => { html.find('input.carac-xp').change(async event => {
let caracName = event.currentTarget.name.replace(".xp", "").replace("data.carac.", ""); let caracName = event.currentTarget.name.replace(".xp", "").replace("system.carac.", "");
//console.log("Value changed :", event, caracName);
this.actor.updateCaracXP(caracName, parseInt(event.target.value)); this.actor.updateCaracXP(caracName, parseInt(event.target.value));
}); });
// On competence change // On competence change
@@ -400,12 +413,12 @@ export class RdDActorSheet extends ActorSheet {
this.actor.updateCompetence(compName, parseInt(event.target.value)); this.actor.updateCompetence(compName, parseInt(event.target.value));
}); });
// On competence xp change // On competence xp change
html.find('.competence-xp').change(async event => { html.find('input.competence-xp').change(async event => {
let compName = event.currentTarget.attributes.compname.value; let compName = event.currentTarget.attributes.compname.value;
this.actor.updateCompetenceXP(compName, parseInt(event.target.value)); this.actor.updateCompetenceXP(compName, parseInt(event.target.value));
}); });
// On competence xp change // On competence xp change
html.find('.competence-xp-sort').change(async event => { html.find('input.competence-xp-sort').change(async event => {
let compName = event.currentTarget.attributes.compname.value; let compName = event.currentTarget.attributes.compname.value;
this.actor.updateCompetenceXPSort(compName, parseInt(event.target.value)); this.actor.updateCompetenceXPSort(compName, parseInt(event.target.value));
}); });
@@ -424,12 +437,31 @@ export class RdDActorSheet extends ActorSheet {
this.options.editCaracComp = !this.options.editCaracComp; this.options.editCaracComp = !this.options.editCaracComp;
this.render(true); this.render(true);
}); });
html.find('.cherchercompetence').change(async event => {
this.options.cherchercompetence = event.currentTarget.value; html.find('.recherche')
this.render(true); .each((index, field) => {
}); if (this.options.recherche) {
field.focus();
field.setSelectionRange(this.options.recherche.start, this.options.recherche.end);
}
})
.keyup(async event => {
const nouvelleRecherche = this._optionRecherche(event.currentTarget);
if (this.options.recherche?.text != nouvelleRecherche?.text){
this.options.recherche = nouvelleRecherche;
if (this.timerRecherche) {
clearTimeout(this.timerRecherche);
}
this.timerRecherche = setTimeout(() => {
this.timerRecherche = undefined;
this.render(true);
}, 500);
}
})
.change(async event =>
this.options.recherche = this._optionRecherche(event.currentTarget)
);
html.find('.vue-detaillee').click(async event => { html.find('.vue-detaillee').click(async event => {
console.log("CONTROLS", this.options.vueDetaillee)
this.options.vueDetaillee = !this.options.vueDetaillee; this.options.vueDetaillee = !this.options.vueDetaillee;
this.render(true); this.render(true);
}); });
@@ -437,7 +469,7 @@ export class RdDActorSheet extends ActorSheet {
// On pts de reve change // On pts de reve change
html.find('.pointsreve-value').change(async event => { html.find('.pointsreve-value').change(async event => {
let reveValue = event.currentTarget.value; let reveValue = event.currentTarget.value;
this.actor.update({ "data.reve.reve.value": reveValue }); this.actor.update({ "system.reve.reve.value": reveValue });
}); });
// On seuil de reve change // On seuil de reve change
@@ -515,13 +547,24 @@ export class RdDActorSheet extends ActorSheet {
}); });
} }
_optionRecherche(target) {
if (!target.value?.length){
return undefined;
}
return {
text: target.value,
start: target.selectionStart,
end: target.selectionEnd,
};
}
_getEventArmeCombat(event) { _getEventArmeCombat(event) {
const li = $(event.currentTarget)?.parents(".item"); const li = $(event.currentTarget)?.parents(".item");
let armeName = li.data("arme-name"); let armeName = li.data("arme-name");
let compName = li.data('competence-name'); let compName = li.data('competence-name');
const arme = this.armesList.find(a => a.name == armeName && a.data.competence == compName); const arme = this.armesList.find(a => a.name == armeName && a.system.competence == compName);
if (!arme) { if (!arme) {
return { name: armeName, data: { competence: compName } }; return { name: armeName, system: { competence: compName } };
} }
return arme; return arme;
} }
@@ -543,7 +586,7 @@ export class RdDActorSheet extends ActorSheet {
/** @override */ /** @override */
_updateObject(event, formData) { _updateObject(event, formData) {
// Update the Actor // Update the Actor
return this.object.update(formData); return this.actor.update(formData);
} }
async splitItem(item) { async splitItem(item) {
@@ -552,11 +595,11 @@ export class RdDActorSheet extends ActorSheet {
} }
async _onSplitItem(item, split) { async _onSplitItem(item, split) {
if (split >= 1 && split < Misc.data(item).data.quantite) { if (split >= 1 && split < item.system.quantite) {
await item.diminuerQuantite(split); await item.diminuerQuantite(split);
const itemData = duplicate(Misc.data(item)); const splitItem = duplicate(item);
itemData.data.quantite = split; splitItem.system.quantite = split;
await this.actor.createEmbeddedDocuments('Item', [itemData]) await this.actor.createEmbeddedDocuments('Item', [splitItem])
} }
} }

View File

@@ -25,31 +25,22 @@ export class RdDActorVehiculeSheet extends ActorSheet {
}); });
} }
/* -------------------------------------------- */
_checkNull(items) {
if (items && items.length) {
return items;
}
return [];
}
/* -------------------------------------------- */ /* -------------------------------------------- */
async getData() { async getData() {
const objectData = Misc.data(this.object);
let formData = { let formData = {
title: this.title, title: this.title,
id: objectData.id, id: this.actor.id,
type: objectData.type, type: this.actor.type,
img: objectData.img, img: this.actor.img,
name: objectData.name, name: this.actor.name,
editable: this.isEditable, editable: this.isEditable,
cssClass: this.isEditable ? "editable" : "locked", cssClass: this.isEditable ? "editable" : "locked",
data: foundry.utils.deepClone(Misc.templateData(this.object)), system: foundry.utils.deepClone(this.actor.system),
effects: this.object.effects.map(e => foundry.utils.deepClone(e.data)), effects: this.actor.effects.map(e => foundry.utils.deepClone(e)),
limited: this.object.limited, limited: this.actor.limited,
options: this.options, options: this.options,
owner: this.document.isOwner, owner: this.actor.isOwner,
itemsByType: Misc.classify(this.object.items.map(i => foundry.utils.deepClone(i.data))), itemsByType: Misc.classify(this.actor.items.map(i => foundry.utils.deepClone(i))),
}; };
RdDUtility.filterItemsPerTypeForSheet(formData); RdDUtility.filterItemsPerTypeForSheet(formData);
@@ -90,7 +81,7 @@ export class RdDActorVehiculeSheet extends ActorSheet {
async monnaieIncDec(id, value) { async monnaieIncDec(id, value) {
let monnaie = this.getMonnaie(id); let monnaie = this.getMonnaie(id);
if (monnaie) { if (monnaie) {
const quantite = Math.max(0, Misc.templateData(monnaie).quantite + value); const quantite = Math.max(0, monnaie.system.quantite + value);
await this.updateEmbeddedDocuments('Item', [{ _id: monnaie.id, 'data.quantite': quantite }]); await this.updateEmbeddedDocuments('Item', [{ _id: monnaie.id, 'data.quantite': quantite }]);
} }
} }
@@ -113,7 +104,8 @@ export class RdDActorVehiculeSheet extends ActorSheet {
// Delete Inventory Item // Delete Inventory Item
html.find('.item-delete').click(async event => { html.find('.item-delete').click(async event => {
const li = RdDSheetUtility.getEventElement(event); const li = RdDSheetUtility.getEventElement(event);
RdDUtility.confirmerSuppression(this, li); const item = this.actor.getObjet(li.data("item-id"));
RdDUtility.confirmerSuppressionItem(this, item, li);
}); });
html.find('.item-vendre').click(async event => { html.find('.item-vendre').click(async event => {
const item = RdDSheetUtility.getItem(event, this.actor); const item = RdDSheetUtility.getItem(event, this.actor);
@@ -168,6 +160,6 @@ export class RdDActorVehiculeSheet extends ActorSheet {
/** @override */ /** @override */
_updateObject(event, formData) { _updateObject(event, formData) {
// Update the Actor // Update the Actor
return this.object.update(formData); return this.actor.update(formData);
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,6 @@
import { Misc } from "./misc.js"; import { Misc } from "./misc.js";
import { SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js"; import { SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js";
export const MESSAGE_DATA = 'message-data';
/** /**
* Class providing helper methods to get the list of users, and * Class providing helper methods to get the list of users, and
@@ -19,61 +18,50 @@ export class ChatUtility {
/* -------------------------------------------- */ /* -------------------------------------------- */
static notifyUser(userId, level = 'info', message) { static notifyUser(userId, level = 'info', message) {
const data = { const socketData = {
userId: userId, level: level, message: message userId: userId, level: level, message: message
}; };
if (game.user.id == userId) { if (game.user.id == userId) {
ChatUtility.onNotifyUser(data); ChatUtility.onNotifyUser(socketData);
} }
else { else {
game.socket.emit(SYSTEM_SOCKET_ID, { game.socket.emit(SYSTEM_SOCKET_ID, {
msg: "msg_user_ui_notifications", data: data msg: "msg_user_ui_notifications", data: socketData
}); });
} }
} }
static onNotifyUser(data) { static onNotifyUser(socketData) {
if (game.user.id == data.userId) { if (game.user.id == socketData.userId) {
switch (data.level) { switch (socketData.level) {
case 'warn': ui.notifications.warn(data.message); break; case 'warn': ui.notifications.warn(socketData.message); break;
case 'error': ui.notifications.error(data.message); break; case 'error': ui.notifications.error(socketData.message); break;
default: ui.notifications.info(data.message); break; default: ui.notifications.info(socketData.message); break;
} }
} }
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static onRemoveMessages(data) { static onRemoveMessages(socketData) {
if (Misc.isUniqueConnectedGM()) { if (Misc.isUniqueConnectedGM()) {
if (data.part) { if (socketData.part) {
const toDelete = game.messages.filter(it => it.data.content.includes(data.part)); const toDelete = game.messages.filter(it => it.content.includes(socketData.part));
toDelete.forEach(it => it.delete()); toDelete.forEach(it => it.delete());
} }
if (data.messageId) { if (socketData.messageId) {
game.messages.get(data.messageId)?.delete(); game.messages.get(socketData.messageId)?.delete();
} }
} }
} }
static onRemoveMessages(data) {
if (Misc.isUniqueConnectedGM()) {
if (data.part) {
const toDelete = game.messages.filter(it => it.data.content.includes(data.part));
toDelete.forEach(it => it.delete());
}
if (data.messageId) {
game.messages.get(data.messageId)?.delete();
}
}
}
/* -------------------------------------------- */ /* -------------------------------------------- */
static removeMessages(data) { static removeMessages(socketData) {
if (Misc.isUniqueConnectedGM()) { if (Misc.isUniqueConnectedGM()) {
ChatUtility.onRemoveMessages(data); ChatUtility.onRemoveMessages(socketData);
} }
else { else {
game.socket.emit(SYSTEM_SOCKET_ID, { msg: "msg_delete_chat_message", data: data }); game.socket.emit(SYSTEM_SOCKET_ID, { msg: "msg_delete_chat_message", data: socketData });
} }
} }
@@ -141,7 +129,7 @@ export class ChatUtility {
/* -------------------------------------------- */ /* -------------------------------------------- */
static getUsers(filter) { static getUsers(filter) {
return Misc.getUsers().filter(filter).map(user => user.data._id); return Misc.getUsers().filter(filter).map(user => user.id);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@@ -154,17 +142,17 @@ export class ChatUtility {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static handleGMChatMessage(data) { static handleGMChatMessage(socketData) {
console.log("blindMessageToGM", data); console.log("blindMessageToGM", socketData);
if (game.user.isGM) { // message privé pour GM only if (game.user.isGM) { // message privé pour GM only
data.user = game.user.id; socketData.user = game.user.id;
ChatMessage.create(data); ChatMessage.create(socketData);
} }
} }
static async setMessageData(chatMessage, key, data) { static async setMessageData(chatMessage, key, flag) {
if (data) { if (flag) {
await chatMessage.setFlag(SYSTEM_RDD, key, JSON.stringify(data)); await chatMessage.setFlag(SYSTEM_RDD, key, JSON.stringify(flag));
} }
} }

View File

@@ -3,3 +3,7 @@ export const SYSTEM_SOCKET_ID = 'system.foundryvtt-reve-de-dragon';
export const HIDE_DICE = 'hide'; export const HIDE_DICE = 'hide';
export const SHOW_DICE = 'show'; export const SHOW_DICE = 'show';
export const ENTITE_INCARNE = 'incarne';
export const ENTITE_NONINCARNE = 'nonincarne';
export const ENTITE_BLURETTE = 'blurette';

View File

@@ -10,9 +10,9 @@ export class DialogCreateSigneDraconique extends Dialog {
const signe = await RdDItemSigneDraconique.randomSigneDraconique({ephemere: true}); const signe = await RdDItemSigneDraconique.randomSigneDraconique({ephemere: true});
let dialogData = { let dialogData = {
signe: signe, signe: signe,
tmrs: TMRUtility.listSelectedTMR(signe.data.typesTMR ?? []), tmrs: TMRUtility.listSelectedTMR(signe.system.typesTMR ?? []),
actors: game.actors.filter(actor => actor.isHautRevant()).map(actor => { actors: game.actors.filter(actor => actor.isHautRevant()).map(actor => {
let actorData = duplicate(Misc.data(actor)); let actorData = duplicate(actor);
actorData.selected = actor.hasPlayerOwner; actorData.selected = actor.hasPlayerOwner;
return actorData; return actorData;
}) })
@@ -38,7 +38,7 @@ export class DialogCreateSigneDraconique extends Dialog {
} }
async _onCreerSigneActeurs() { async _onCreerSigneActeurs() {
await $("[name='signe.data.ephemere']").change(); await $("[name='signe.system.ephemere']").change();
await $(".signe-xp-sort").change(); await $(".signe-xp-sort").change();
this.validerSigne(); this.validerSigne();
this.dialogData.actors.filter(it => it.selected).map(it => game.actors.get(it._id)) this.dialogData.actors.filter(it => it.selected).map(it => game.actors.get(it._id))
@@ -48,31 +48,31 @@ export class DialogCreateSigneDraconique extends Dialog {
async _createSigneForActor(actor, signe) { async _createSigneForActor(actor, signe) {
actor.createEmbeddedDocuments("Item", [signe]); actor.createEmbeddedDocuments("Item", [signe]);
ChatMessage.create({ ChatMessage.create({
whisper: ChatUtility.getWhisperRecipientsAndGMs(Misc.data(actor).name), whisper: ChatUtility.getWhisperRecipientsAndGMs(actor.name),
content: await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/chat-signe-draconique-actor.html", { content: await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/chat-signe-draconique-actor.html", {
signe: signe, signe: signe,
alias: Misc.data(actor).name alias: actor.name
}) })
}); });
} }
validerSigne() { validerSigne() {
this.dialogData.signe.name = $("[name='signe.name']").val(); this.dialogData.signe.name = $("[name='signe.name']").val();
this.dialogData.signe.data.valeur.norm = $("[name='signe.data.valeur.norm']").val(); this.dialogData.signe.system.valeur.norm = $("[name='signe.system.valeur.norm']").val();
this.dialogData.signe.data.valeur.sign = $("[name='signe.data.valeur.sign']").val(); this.dialogData.signe.system.valeur.sign = $("[name='signe.system.valeur.sign']").val();
this.dialogData.signe.data.valeur.part = $("[name='signe.data.valeur.part']").val(); this.dialogData.signe.system.valeur.part = $("[name='signe.system.valeur.part']").val();
this.dialogData.signe.data.difficulte = $("[name='signe.data.difficulte']").val(); this.dialogData.signe.system.difficulte = $("[name='signe.system.difficulte']").val();
this.dialogData.signe.data.ephemere = $("[name='signe.data.ephemere']").prop("checked"); this.dialogData.signe.system.ephemere = $("[name='signe.system.ephemere']").prop("checked");
this.dialogData.signe.data.duree = $("[name='signe.data.duree']").val(); this.dialogData.signe.system.duree = $("[name='signe.system.duree']").val();
this.dialogData.signe.data.typesTMR = $(".select-tmr").val(); this.dialogData.signe.system.typesTMR = $(".select-tmr").val();
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
activateListeners(html) { activateListeners(html) {
super.activateListeners(html); super.activateListeners(html);
this.setEphemere(this.dialogData.signe.data.ephemere); this.setEphemere(this.dialogData.signe.system.ephemere);
html.find(".signe-aleatoire").click(event => this.setSigneAleatoire()); html.find(".signe-aleatoire").click(event => this.setSigneAleatoire());
html.find("[name='signe.data.ephemere']").change((event) => this.setEphemere(event.currentTarget.checked)); html.find("[name='signe.system.ephemere']").change((event) => this.setEphemere(event.currentTarget.checked));
html.find(".select-actor").change((event) => this.onSelectActor(event)); html.find(".select-actor").change((event) => this.onSelectActor(event));
html.find(".signe-xp-sort").change((event) => this.onValeurXpSort(event)); html.find(".signe-xp-sort").change((event) => this.onValeurXpSort(event));
} }
@@ -81,19 +81,19 @@ export class DialogCreateSigneDraconique extends Dialog {
const newSigne = await RdDItemSigneDraconique.randomSigneDraconique({ephemere: true}); const newSigne = await RdDItemSigneDraconique.randomSigneDraconique({ephemere: true});
$("[name='signe.name']").val(newSigne.name); $("[name='signe.name']").val(newSigne.name);
$("[name='signe.data.valeur.norm']").val(newSigne.data.valeur.norm); $("[name='signe.system.valeur.norm']").val(newSigne.system.valeur.norm);
$("[name='signe.data.valeur.sign']").val(newSigne.data.valeur.sign); $("[name='signe.system.valeur.sign']").val(newSigne.system.valeur.sign);
$("[name='signe.data.valeur.part']").val(newSigne.data.valeur.part); $("[name='signe.system.valeur.part']").val(newSigne.system.valeur.part);
$("[name='signe.data.difficulte']").val(newSigne.data.difficulte); $("[name='signe.system.difficulte']").val(newSigne.system.difficulte);
$("[name='signe.data.duree']").val(newSigne.data.duree); $("[name='signe.system.duree']").val(newSigne.system.duree);
$("[name='signe.data.ephemere']").prop("checked", newSigne.data.ephemere); $("[name='signe.system.ephemere']").prop("checked", newSigne.system.ephemere);
$(".select-tmr").val(newSigne.data.typesTMR); $(".select-tmr").val(newSigne.system.typesTMR);
this.setEphemere(newSigne.data.ephemere); this.setEphemere(newSigne.system.ephemere);
} }
async setEphemere(ephemere) { async setEphemere(ephemere) {
this.dialogData.signe.data.ephemere = ephemere; this.dialogData.signe.system.ephemere = ephemere;
HtmlUtility._showControlWhen($(".signe-data-duree"), ephemere); HtmlUtility._showControlWhen($(".signe-system-duree"), ephemere);
} }
async onSelectActor(event) { async onSelectActor(event) {
@@ -111,8 +111,8 @@ export class DialogCreateSigneDraconique extends Dialog {
onValeurXpSort(event) { onValeurXpSort(event) {
const codeReussite = event.currentTarget.attributes['data-typereussite']?.value ?? 0; const codeReussite = event.currentTarget.attributes['data-typereussite']?.value ?? 0;
const xp = Number(event.currentTarget.value); const xp = Number(event.currentTarget.value);
const oldValeur = this.dialogData.signe.data.valeur; const oldValeur = this.dialogData.signe.system.valeur;
this.dialogData.signe.data.valeur = RdDItemSigneDraconique.calculValeursXpSort(codeReussite, xp, oldValeur); this.dialogData.signe.system.valeur = RdDItemSigneDraconique.calculValeursXpSort(codeReussite, xp, oldValeur);
} }
} }

View File

@@ -9,7 +9,7 @@ export class DialogFabriquerPotion extends Dialog {
let potionData = DialogFabriquerPotion.prepareData(actor, item); let potionData = DialogFabriquerPotion.prepareData(actor, item);
let conf = { let conf = {
title: `Fabriquer une potion de ${potionData.data.categorie}`, title: `Fabriquer une potion de ${potionData.system.categorie}`,
content: await renderTemplate(dialogConfig.html, potionData), content: await renderTemplate(dialogConfig.html, potionData),
default: potionData.buttonName, default: potionData.buttonName,
}; };
@@ -24,9 +24,9 @@ export class DialogFabriquerPotion extends Dialog {
/* -------------------------------------------- */ /* -------------------------------------------- */
static prepareData(actor, item) { static prepareData(actor, item) {
let potionData = duplicate(Misc.data(item)); let potionData = duplicate(item)
potionData.nbBrinsSelect = RdDUtility.buildListOptions(1, potionData.data.quantite); potionData.nbBrinsSelect = RdDUtility.buildListOptions(1, potionData.system.quantite);
potionData.nbBrins = Math.min(potionData.data.quantite, DialogFabriquerPotion.getNombreBrinOptimal(potionData)); potionData.nbBrins = Math.min(potionData.system.quantite, DialogFabriquerPotion.getNombreBrinOptimal(potionData));
potionData.buttonName = "Fabriquer"; potionData.buttonName = "Fabriquer";
return potionData; return potionData;
} }
@@ -46,9 +46,9 @@ export class DialogFabriquerPotion extends Dialog {
} }
static getNombreBrinOptimal(herbeData) { static getNombreBrinOptimal(herbeData) {
switch (herbeData.data.categorie ?? '') { switch (herbeData.system.categorie ?? '') {
case "Soin": return 12 - herbeData.data.niveau; case "Soin": return 12 - herbeData.system.niveau;
case "Repos": return 7 - herbeData.data.niveau; case "Repos": return 7 - herbeData.system.niveau;
} }
return 1; return 1;
} }

View File

@@ -34,7 +34,7 @@ export class DialogItemAchat extends Dialog {
const actionAchat = venteData.prixLot > 0 ? "Acheter" : "Prendre"; const actionAchat = venteData.prixLot > 0 ? "Acheter" : "Prendre";
const buttons = {}; const buttons = {};
if (isConsommable) { if (isConsommable) {
buttons["consommer"] = { label: venteData.item.data.boisson ? "Boire" : "Manger", callback: it => { this.onAchatConsommer(); } } buttons["consommer"] = { label: venteData.item.system.boisson ? "Boire" : "Manger", callback: it => { this.onAchatConsommer(); } }
} }
buttons[actionAchat] = { label: actionAchat, callback: it => { this.onAchat(); } }; buttons[actionAchat] = { label: actionAchat, callback: it => { this.onAchat(); } };
buttons["decliner"] = { label: "Décliner", callback: it => { } }; buttons["decliner"] = { label: "Décliner", callback: it => { } };
@@ -55,12 +55,12 @@ export class DialogItemAchat extends Dialog {
static prepareVenteData(buttonAcheter, vendeurId, vendeur, acheteur) { static prepareVenteData(buttonAcheter, vendeurId, vendeur, acheteur) {
const jsondata = buttonAcheter.attributes['data-jsondata']?.value; const jsondata = buttonAcheter.attributes['data-jsondata']?.value;
const prixLot = buttonAcheter.attributes['data-prixLot']?.value ?? 0; const prixLot = parseInt(buttonAcheter.attributes['data-prixLot']?.value ?? 0);
let venteData = { let venteData = {
item: JSON.parse(jsondata), item: JSON.parse(jsondata),
vendeurId: vendeurId, vendeurId: vendeurId,
vendeur: Misc.data(vendeur), vendeur: vendeur,
acheteur: Misc.data(acheteur), acheteur:acheteur,
tailleLot: parseInt(buttonAcheter.attributes['data-tailleLot']?.value ?? 1), tailleLot: parseInt(buttonAcheter.attributes['data-tailleLot']?.value ?? 1),
quantiteIllimite: buttonAcheter.attributes['data-quantiteIllimite']?.value == 'true', quantiteIllimite: buttonAcheter.attributes['data-quantiteIllimite']?.value == 'true',
quantiteNbLots: parseInt(buttonAcheter.attributes['data-quantiteNbLots']?.value), quantiteNbLots: parseInt(buttonAcheter.attributes['data-quantiteNbLots']?.value),

View File

@@ -38,22 +38,22 @@ export class DialogConsommer extends Dialog {
/* -------------------------------------------- */ /* -------------------------------------------- */
static prepareData(actor, item) { static prepareData(actor, item) {
const itemData = duplicate(Misc.data(item)); item = duplicate(item);
let consommerData = { let consommerData = {
item: itemData, item: item,
cuisine: Misc.data(actor.getCompetence('cuisine')), cuisine: actor.getCompetence('cuisine'),
choix: { choix: {
doses: 1, doses: 1,
seForcer: false, seForcer: false,
} }
} }
switch (itemData.type) { switch (item.type) {
case 'nourritureboisson': case 'nourritureboisson':
consommerData.title = itemData.data.boisson ? `${itemData.name}: boire une dose` : `${itemData.name}: manger une portion`; consommerData.title = item.system.boisson ? `${item.name}: boire une dose` : `${item.name}: manger une portion`;
consommerData.buttonName = itemData.data.boisson ? "Boire" : "Manger"; consommerData.buttonName = item.system.boisson ? "Boire" : "Manger";
break; break;
case 'potion': case 'potion':
consommerData.title = `${itemData.name}: boire la potion`; consommerData.title = `${item.name}: boire la potion`;
consommerData.buttonName = "Boire"; consommerData.buttonName = "Boire";
break; break;
} }
@@ -61,11 +61,11 @@ export class DialogConsommer extends Dialog {
return consommerData; return consommerData;
} }
static calculDoses(consommerData) { static calculDoses(consommer) {
const doses = consommerData.choix.doses; const doses = consommer.choix.doses;
consommerData.totalSust = Misc.keepDecimals(doses * (consommerData.item.data.sust ?? 0), 2); consommer.totalSust = Misc.keepDecimals(doses * (consommer.item.system.sust ?? 0), 2);
consommerData.totalDesaltere = consommerData.item.data.boisson consommer.totalDesaltere = consommer.item.system.boisson
? Misc.keepDecimals(doses * (consommerData.item.data.desaltere ?? 0), 2) ? Misc.keepDecimals(doses * (consommer.item.system.desaltere ?? 0), 2)
: 0; : 0;
} }

View File

@@ -4,15 +4,14 @@ import { Misc } from "./misc.js";
export class DialogItemVente extends Dialog { export class DialogItemVente extends Dialog {
static async create(item, callback) { static async create(item, callback) {
const itemData = Misc.data(item); const quantite = item.isConteneur() ? 1 : item.system.quantite;
const quantite = item.isConteneur() ? 1 : itemData.data.quantite;
const venteData = { const venteData = {
item: itemData, item: item,
alias: item.actor?.name ?? game.user.name, alias: item.actor?.name ?? game.user.name,
vendeurId: item.actor?.id, vendeurId: item.actor?.id,
prixOrigine: itemData.data.cout, prixOrigine: item.system.cout,
prixUnitaire: itemData.data.cout, prixUnitaire: item.system.cout,
prixLot: itemData.data.cout, prixLot: item.system.cout,
tailleLot: 1, tailleLot: 1,
quantiteNbLots: quantite, quantiteNbLots: quantite,
quantiteMaxLots: quantite, quantiteMaxLots: quantite,

View File

@@ -3,7 +3,7 @@ import { Misc } from "./misc.js";
export class DialogRepos extends Dialog { export class DialogRepos extends Dialog {
static async create(actor) { static async create(actor) {
let actorData = Misc.data(actor) let actorData = actor
const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/dialog-repos.html", actorData); const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/dialog-repos.html", actorData);
new DialogRepos(html, actor).render(true); new DialogRepos(html, actor).render(true);
} }

View File

@@ -3,10 +3,9 @@ import { Misc } from "./misc.js";
export class DialogSplitItem extends Dialog { export class DialogSplitItem extends Dialog {
static async create(item, callback) { static async create(item, callback) {
const itemData = Misc.data(item);
const splitData = { const splitData = {
item: itemData, item: item,
choix: { quantite: 1, max: itemData.data.quantite - 1 } choix: { quantite: 1, max: item.system.quantite - 1 }
}; };
const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/dialog-item-split.html`, splitData); const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/dialog-item-split.html`, splitData);
return new DialogSplitItem(item, splitData, html, callback) return new DialogSplitItem(item, splitData, html, callback)

View File

@@ -9,7 +9,7 @@ export class DialogStress extends Dialog {
immediat: false, immediat: false,
actors: game.actors.filter(actor => actor.hasPlayerOwner && actor.isPersonnage()) actors: game.actors.filter(actor => actor.hasPlayerOwner && actor.isPersonnage())
.map(actor => { .map(actor => {
let actorData = duplicate(Misc.data(actor)); let actorData = duplicate(actor);
actorData.selected = actor.hasPlayerOwner; actorData.selected = actor.hasPlayerOwner;
return actorData; return actorData;
}) })

View File

@@ -1,9 +0,0 @@
/* -------------------------------------------- */
import { RdDUtility } from "./rdd-utility.js";
/* -------------------------------------------- */
// Activate chat listeners defined
// Hooks.on('renderChatLog', (log, html, data) => {
// RdDUtility.chatListeners(html);
// });

View File

@@ -19,36 +19,34 @@ const nomCategorieParade = {
/* -------------------------------------------- */ /* -------------------------------------------- */
export class RdDItemArme extends Item { export class RdDItemArme extends Item {
static isArme(itemData) { static isArme(item) {
itemData = Misc.data(itemData); return (item.type == 'competencecreature' && item.system.iscombat) || item.type == 'arme';
return (itemData.type == 'competencecreature' && itemData.data.iscombat) || itemData.type == 'arme';
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static getArmeData(armeData) { static getArme(arme) {
armeData = Misc.data(armeData); switch (arme ? arme.type : '') {
switch (armeData ? armeData.type : '') { case 'arme': return arme;
case 'arme': return armeData;
case 'competencecreature': case 'competencecreature':
return RdDItemCompetenceCreature.toArme(armeData); return RdDItemCompetenceCreature.toActionArme(arme);
} }
return RdDItemArme.mainsNues(); return RdDItemArme.mainsNues();
} }
static computeNiveauArmes(armes, competences) { static computeNiveauArmes(armes, competences) {
for (const arme of armes) { for (const arme of armes) {
arme.data.niveau = RdDItemArme.niveauCompetenceArme(arme, competences); arme.system.niveau = RdDItemArme.niveauCompetenceArme(arme, competences);
} }
} }
static niveauCompetenceArme(arme, competences) { static niveauCompetenceArme(arme, competences) {
const compArme = competences.find(it => it.name == arme.data.competence); const compArme = competences.find(it => it.name == arme.system.competence);
return compArme?.data.niveau ?? -8; return compArme?.system.niveau ?? -8;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static getNomCategorieParade(arme) { static getNomCategorieParade(arme) {
const categorie = arme?.data ? RdDItemArme.getCategorieParade(arme) : arme; const categorie = arme?.system ? RdDItemArme.getCategorieParade(arme) : arme;
return nomCategorieParade[categorie]; return nomCategorieParade[categorie];
} }
@@ -66,21 +64,20 @@ export class RdDItemArme extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static getCategorieParade(armeData) { static getCategorieParade(armeData) {
armeData = Misc.data(armeData); if (armeData.system.categorie_parade) {
if (armeData.data.categorie_parade) { return armeData.system.categorie_parade;
return armeData.data.categorie_parade;
} }
// pour compatibilité avec des personnages existants // pour compatibilité avec des personnages existants
if (armeData.type == 'competencecreature' || armeData.data.categorie == 'creature') { if (armeData.type == 'competencecreature' || armeData.system.categorie == 'creature') {
return armeData.data.categorie_parade || (armeData.data.isparade ? 'armes-naturelles' : ''); return armeData.system.categorie_parade || (armeData.system.isparade ? 'armes-naturelles' : '');
} }
if (!armeData.type.match(/arme|competencecreature/)) { if (!armeData.type.match(/arme|competencecreature/)) {
return ''; return '';
} }
if (armeData.data.competence == undefined) { if (armeData.system.competence == undefined) {
return 'competencecreature'; return 'competencecreature';
} }
let compname = armeData.data.competence.toLowerCase(); let compname = armeData.system.competence.toLowerCase();
if (compname.match(/^(dague de jet|javelot|fouet|arc|arbalête|fronde|hache de jet|fléau)$/)) return ''; if (compname.match(/^(dague de jet|javelot|fouet|arc|arbalête|fronde|hache de jet|fléau)$/)) return '';
if (compname.match('hache')) return 'haches'; if (compname.match('hache')) return 'haches';
@@ -137,22 +134,21 @@ export class RdDItemArme extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static armeUneOuDeuxMains(armeData, aUneMain) { static armeUneOuDeuxMains(armeData, aUneMain) {
armeData = Misc.data(armeData); if (armeData && !armeData.system.cac) {
if (armeData && !armeData.data.cac) { armeData.system.unemain = armeData.system.unemain || !armeData.system.deuxmains;
armeData.data.unemain = armeData.data.unemain || !armeData.data.deuxmains; const uneOuDeuxMains = armeData.system.unemain && armeData.system.deuxmains;
const uneOuDeuxMains = armeData.data.unemain && armeData.data.deuxmains; const containsSlash = !Number.isInteger(armeData.system.dommages) && armeData.system.dommages.includes("/");
const containsSlash = !Number.isInteger(armeData.data.dommages) && armeData.data.dommages.includes("/");
if (containsSlash) { // Sanity check if (containsSlash) { // Sanity check
armeData = duplicate(armeData); armeData = duplicate(armeData);
const tableauDegats = armeData.data.dommages.split("/"); const tableauDegats = armeData.system.dommages.split("/");
if (aUneMain) if (aUneMain)
armeData.data.dommagesReels = Number(tableauDegats[0]); armeData.system.dommagesReels = Number(tableauDegats[0]);
else // 2 mains else // 2 mains
armeData.data.dommagesReels = Number(tableauDegats[1]); armeData.system.dommagesReels = Number(tableauDegats[1]);
} }
else { else {
armeData.data.dommagesReels = Number(armeData.data.dommages); armeData.system.dommagesReels = Number(armeData.system.dommages);
} }
if (uneOuDeuxMains != containsSlash) { if (uneOuDeuxMains != containsSlash) {
@@ -162,23 +158,22 @@ export class RdDItemArme extends Item {
return armeData; return armeData;
} }
static isArmeUtilisable(itemData) { static isArmeUtilisable(arme) {
itemData = Misc.data(itemData); return arme.type == 'arme' && arme.system.equipe && (arme.system.resistance > 0 || arme.system.portee_courte > 0);
return itemData.type == 'arme' && itemData.data.equipe && (itemData.data.resistance > 0 || itemData.data.portee_courte > 0);
} }
static ajoutCorpsACorps(armes, competences, carac) { static ajoutCorpsACorps(armes, competences, carac) {
let corpsACorps = competences.find(it => it.name == 'Corps à corps') ?? { data: { niveau: -6 } }; let corpsACorps = competences.find(it => it.name == 'Corps à corps') ?? { system: { niveau: -6 } };
let init = RdDCombatManager.calculInitiative(corpsACorps.data.niveau, carac['melee'].value); let init = RdDCombatManager.calculInitiative(corpsACorps.system.niveau, carac['melee'].value);
armes.push(RdDItemArme.mainsNues({ niveau: corpsACorps.data.niveau, initiative: init })); armes.push(RdDItemArme.mainsNues({ niveau: corpsACorps.system.niveau, initiative: init }));
//armes.push(RdDItemArme.empoignade({ niveau: corpsACorps.data.niveau, initiative: init })); //armes.push(RdDItemArme.empoignade({ niveau: corpsACorps.system.niveau, initiative: init }));
} }
static corpsACorps(actorData) { static corpsACorps(mainsNuesActor) {
const corpsACorps = { const corpsACorps = {
name: 'Corps à corps', name: 'Corps à corps',
img: 'systems/foundryvtt-reve-de-dragon/icons/competence_corps_a_corps.webp', img: 'systems/foundryvtt-reve-de-dragon/icons/competence_corps_a_corps.webp',
data: { system: {
equipe: true, equipe: true,
rapide: true, rapide: true,
force: 0, force: 0,
@@ -189,24 +184,24 @@ export class RdDItemArme extends Item {
categorie_parade: 'sans-armes' categorie_parade: 'sans-armes'
} }
}; };
mergeObject(corpsACorps.data, actorData ??{}, { overwrite: false }); mergeObject(corpsACorps.system, mainsNuesActor ?? {}, { overwrite: false });
return corpsACorps; return corpsACorps;
} }
static mainsNues(actorData) { static mainsNues(mainsNuesActor) {
const mainsNues = RdDItemArme.corpsACorps(actorData); const mainsNues = RdDItemArme.corpsACorps(mainsNuesActor)
mainsNues.name = 'Mains nues'; mainsNues.name = 'Mains nues'
mainsNues.data.cac = 'pugilat'; mainsNues.system.cac = 'pugilat'
mainsNues.data.baseInit = 4; mainsNues.system.baseInit = 4
return mainsNues; return mainsNues;
} }
static empoignade(actorData) { static empoignade(mainsNuesActor) {
const empoignade = RdDItemArme.corpsACorps(actorData); const empoignade = RdDItemArme.corpsACorps(mainsNuesActor)
empoignade.name = 'Empoignade'; empoignade.name = 'Empoignade'
empoignade.data.cac = 'empoignade'; empoignade.system.cac = 'empoignade'
empoignade.data.baseInit = 3; empoignade.system.baseInit = 3
empoignade.data.mortalite = 'empoignade'; empoignade.system.mortalite = 'empoignade'
return empoignade; return empoignade
} }
} }

View File

@@ -76,10 +76,10 @@ export class RdDItemCompetence extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static getCategorie(competence) { static getCategorie(competence) {
return Misc.data(competence)?.data.categorie; return competence?.system.categorie;
} }
static isDraconic(competence) { static isDraconic(competence) {
return Misc.data(competence)?.data.categorie == 'draconic'; return competence?.system.categorie == 'draconic';
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@@ -89,9 +89,9 @@ export class RdDItemCompetence extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static isCompetenceArme(competence) { static isCompetenceArme(competence) {
switch (Misc.templateData(competence).categorie) { switch (competence.system.categorie) {
case 'melee': case 'melee':
return Misc.data(competence).name != 'Esquive'; return competence.name != 'Esquive';
case 'tir': case 'tir':
case 'lancer': case 'lancer':
return true; return true;
@@ -101,15 +101,15 @@ export class RdDItemCompetence extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static isArmeUneMain(competence) { static isArmeUneMain(competence) {
return Misc.data(competence)?.name.toLowerCase().includes("1 main"); return competence.name.toLowerCase().includes("1 main");
} }
static isArme2Main(competence) { static isArme2Main(competence) {
return Misc.data(competence)?.name.toLowerCase().includes("2 main"); return competence.name.toLowerCase().includes("2 main");
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static isMalusEncombrementTotal(competence) { static isMalusEncombrementTotal(competence) {
return Misc.data(competence)?.name.toLowerCase().match(/(natation|acrobatie)/); return competence?.name.toLowerCase().match(/(natation|acrobatie)/) || 0;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@@ -133,11 +133,10 @@ export class RdDItemCompetence extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static computeXP(competence) { static computeXP(competence) {
const itemData = Misc.data(competence); const factor = competence.name.includes('Thanatos') ? 2 : 1; // Thanatos compte double !
const factor = itemData.name.includes('Thanatos') ? 2 : 1; // Thanatos compte double ! const xpNiveau = RdDItemCompetence.computeDeltaXP(competence.system.base, competence.system.niveau ?? competence.system.base);
const xpNiveau = RdDItemCompetence.computeDeltaXP(itemData.data.base, itemData.data.niveau ?? itemData.data.base); const xp = competence.system.xp ?? 0;
const xp = itemData.data.xp ?? 0; const xpSort = competence.system.xp_sort ?? 0;
const xpSort = itemData.data.xp_sort ?? 0;
return factor * (xpNiveau + xp) + xpSort; return factor * (xpNiveau + xp) + xpSort;
} }
@@ -146,7 +145,7 @@ export class RdDItemCompetence extends Item {
return competenceTroncs.map( return competenceTroncs.map(
list => list.map(name => RdDItemCompetence.findCompetence(competences, name)) list => list.map(name => RdDItemCompetence.findCompetence(competences, name))
// calcul du coût xp jusqu'au niveau 0 maximum // calcul du coût xp jusqu'au niveau 0 maximum
.map(it => RdDItemCompetence.computeDeltaXP(it?.data.base ?? -11, Math.min(it?.data.niveau ?? -11, 0))) .map(it => RdDItemCompetence.computeDeltaXP(it?.system.base ?? -11, Math.min(it?.system.niveau ?? -11, 0)))
.sort(Misc.ascending()) .sort(Misc.ascending())
.splice(0, list.length - 1) // prendre toutes les valeurs sauf l'une des plus élevées .splice(0, list.length - 1) // prendre toutes les valeurs sauf l'une des plus élevées
.reduce(Misc.sum(), 0) .reduce(Misc.sum(), 0)
@@ -162,11 +161,10 @@ export class RdDItemCompetence extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static computeCompetenceXPCost(competence) { static computeCompetenceXPCost(competence) {
const compData = Misc.data(competence); let xp = RdDItemCompetence.getDeltaXp(competence.system.base, competence.system.niveau ?? competence.system.base);
let xp = RdDItemCompetence.getDeltaXp(compData.data.base, compData.data.niveau ?? compData.data.base); xp += competence.system.xp ?? 0;
xp += compData.data.xp ?? 0;
if (compData.name.includes('Thanatos')) xp *= 2; /// Thanatos compte double ! if (compData.name.includes('Thanatos')) xp *= 2; /// Thanatos compte double !
xp += compData.data.xp_sort ?? 0; xp += competence.system.xp_sort ?? 0;
return xp; return xp;
} }
@@ -175,45 +173,48 @@ export class RdDItemCompetence extends Item {
let economie = 0; let economie = 0;
for (let troncList of competenceTroncs) { for (let troncList of competenceTroncs) {
let list = troncList.map(name => RdDItemCompetence.findCompetence(competences, name)) let list = troncList.map(name => RdDItemCompetence.findCompetence(competences, name))
.sort(Misc.descending(c => Misc.templateData(c).niveau)); // tri du plus haut au plus bas .sort(Misc.descending(c => this.system.niveau)); // tri du plus haut au plus bas
list.splice(0, 1); // ignorer la plus élevée list.splice(0, 1); // ignorer la plus élevée
list.map(c => Misc.templateData(c)).forEach(tplData => { list.map(c => c).forEach(c => {
economie += RdDItemCompetence.getDeltaXp(tplData.base, Math.min(tplData.niveau, 0)); economie += RdDItemCompetence.getDeltaXp(c.system.base, Math.min(c.system.niveau, 0))
}); });
} }
return economie; return economie;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static levelUp(itemData, stressTransforme) { static levelUp(item, stressTransforme) {
itemData.data.xpNext = RdDItemCompetence.getCompetenceNextXp(itemData.data.niveau); item.system.xpNext = RdDItemCompetence.getCompetenceNextXp(item.system.niveau);
const xpManquant = itemData.data.xpNext - itemData.data.xp; const xpManquant = item.system.xpNext - item.system.xp;
itemData.data.isLevelUp = xpManquant <= 0; item.system.isLevelUp = xpManquant <= 0;
itemData.data.isStressLevelUp = (xpManquant > 0 && stressTransforme >= xpManquant && itemData.data.niveau < itemData.data.niveau_archetype); item.system.isStressLevelUp = (xpManquant > 0 && stressTransforme >= xpManquant && item.system.niveau < item.system.niveau_archetype);
itemData.data.stressXpMax = 0; item.system.stressXpMax = 0;
if (xpManquant > 0 && stressTransforme > 0 && itemData.data.niveau < itemData.data.niveau_archetype) { if (xpManquant > 0 && stressTransforme > 0 && item.system.niveau < item.system.niveau_archetype) {
itemData.data.stressXpMax = Math.min(xpManquant , stressTransforme); item.system.stressXpMax = Math.min(xpManquant , stressTransforme);
} }
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static isVisible(itemData) { static isVisible(item) {
return Number(itemData.data.niveau) != RdDItemCompetence.getNiveauBase(itemData.data.categorie); return Number(item.system.niveau) != RdDItemCompetence.getNiveauBase(item.system.categorie);
} }
static nomContientTexte(itemData, texte) { static nomContientTexte(item, texte) {
return Grammar.toLowerCaseNoAccent(itemData.name).includes(Grammar.toLowerCaseNoAccent(texte)) return Grammar.toLowerCaseNoAccent(item.name).includes(Grammar.toLowerCaseNoAccent(texte))
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static isNiveauBase(itemData) { static isNiveauBase(item) {
return Number(itemData.data.niveau) == RdDItemCompetence.getNiveauBase(itemData.data.categorie); return Number(item.system.niveau) == RdDItemCompetence.getNiveauBase(item.system.categorie);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static findCompetence(list, idOrName, options = {}) { static findCompetence(list, idOrName, options = {}) {
if (idOrName == undefined) {
return undefined;
}
options = mergeObject(options, { options = mergeObject(options, {
filter: it => RdDItemCompetence.isCompetence(it), preFilter: it => RdDItemCompetence.isCompetence(it),
description: 'compétence', description: 'compétence',
}); });
return list.find(it => it.id == idOrName && RdDItemCompetence.isCompetence(it)) return list.find(it => it.id == idOrName && RdDItemCompetence.isCompetence(it))
@@ -257,7 +258,7 @@ export class RdDItemCompetence extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static computeResumeArchetype(competences) { static computeResumeArchetype(competences) {
const archetype = RdDItemCompetence.getLimitesArchetypes(); const archetype = RdDItemCompetence.getLimitesArchetypes();
competences.map(it => Math.max(0, Misc.templateData(it).niveau_archetype)) competences.map(it => Math.max(0, it.system.niveau_archetype))
.forEach(niveau => { .forEach(niveau => {
archetype[niveau] = archetype[niveau] ?? { "niveau": niveau, "nombreMax": 0, "nombre": 0 }; archetype[niveau] = archetype[niveau] ?? { "niveau": niveau, "nombreMax": 0, "nombre": 0 };
archetype[niveau].nombre = (archetype[niveau]?.nombre ?? 0) + 1; archetype[niveau].nombre = (archetype[niveau]?.nombre ?? 0) + 1;

View File

@@ -5,46 +5,45 @@ export class RdDItemCompetenceCreature extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static setRollDataCreature(rollData) { static setRollDataCreature(rollData) {
rollData.competence = Misc.data(rollData.competence); rollData.competence = rollData.competence
rollData.carac = { "carac_creature": { label: rollData.competence.name, value: rollData.competence.data.carac_value } }; rollData.carac = { "carac_creature": { label: rollData.competence.name, value: rollData.competence.system.carac_value } }
rollData.competence.data.defaut_carac = "carac_creature" rollData.competence.system.defaut_carac = "carac_creature"
rollData.competence.data.categorie = "creature" rollData.competence.system.categorie = "creature"
rollData.selectedCarac = rollData.carac.carac_creature rollData.selectedCarac = rollData.carac.carac_creature
if (rollData.competence.data.iscombat) { if (rollData.competence.system.iscombat) {
rollData.arme = RdDItemCompetenceCreature.toArme(rollData.competence); rollData.arme = RdDItemCompetenceCreature.toActionArme(rollData.competence);
} }
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static toArme(item) { static toActionArme(item) {
if (RdDItemCompetenceCreature.isCompetenceAttaque(item)) { if (RdDItemCompetenceCreature.isCompetenceAttaque(item)) {
// si c'est un Item compétence: cloner pour ne pas modifier lma compétence // si c'est un Item compétence: cloner pour ne pas modifier lma compétence
let arme = Misc.data( (item instanceof Item) ? item.clone(): item); let arme = (item instanceof Item) ? item.clone(): item;
mergeObject(arme.data, mergeObject(arme.system,
{ {
competence: arme.name, competence: arme.name,
resistance: 100, resistance: 100,
equipe: true, equipe: true,
dommagesReels: arme.data.dommages, dommagesReels: arme.system.dommages,
penetration: 0, penetration: 0,
force: 0, force: 0,
rapide: true rapide: true,
action: 'attaque'
}); });
return arme; return arme;
} }
console.error("RdDItemCompetenceCreature.toArme(", item, ") : impossible de transformer l'Item en arme"); console.error("RdDItemCompetenceCreature.toActionArme(", item, ") : impossible de transformer l'Item en arme");
return undefined; return undefined;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static isCompetenceAttaque(itemData) { static isCompetenceAttaque(item) {
itemData = Misc.data(itemData); return item.type == 'competencecreature' && item.system.iscombat;
return itemData.type == 'competencecreature' && itemData.data.iscombat;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static isCompetenceParade(itemData) { static isCompetenceParade(item) {
itemData = Misc.data(itemData); return item.type == 'competencecreature' && item.system.isparade;
return itemData.type == 'competencecreature' && itemData.data.isparade;
} }
} }

View File

@@ -3,7 +3,7 @@ export class RdDItemMeditation {
static calculDifficulte(rollData) { static calculDifficulte(rollData) {
if (rollData.meditation) { if (rollData.meditation) {
// Malus permanent éventuel // Malus permanent éventuel
let diff = -rollData.meditation.data.malus ?? 0; let diff = rollData.meditation.system.malus ?? 0;
if (!rollData.conditionMeditation.isHeure) diff -= 2; if (!rollData.conditionMeditation.isHeure) diff -= 2;
if (!rollData.conditionMeditation.isVeture) diff -= 2; if (!rollData.conditionMeditation.isVeture) diff -= 2;
if (!rollData.conditionMeditation.isComportement) diff -= 2; if (!rollData.conditionMeditation.isComportement) diff -= 2;

View File

@@ -1,54 +1,60 @@
import { Misc } from "./misc.js"; import { Misc } from "./misc.js";
const monnaiesData = [ const MONNAIES_STANDARD = [
{ {
name: "Etain (1 denier)", type: 'monnaie', name: "Etain (1 denier)", type: 'monnaie',
img: "systems/foundryvtt-reve-de-dragon/icons/objets/piece_etain_poisson.webp", img: "systems/foundryvtt-reve-de-dragon/icons/objets/piece_etain_poisson.webp",
data: { quantite: 0, valeur_deniers: 1, encombrement: 0.001, description: "" } system: { quantite: 0, valeur_deniers: 1, encombrement: 0.001, description: "" }
}, },
{ {
name: "Bronze (10 deniers)", type: 'monnaie', name: "Bronze (10 deniers)", type: 'monnaie',
img: "systems/foundryvtt-reve-de-dragon/icons/objets/piece_bronze_epees.webp", img: "systems/foundryvtt-reve-de-dragon/icons/objets/piece_bronze_epees.webp",
data: { quantite: 0, valeur_deniers: 10, encombrement: 0.002, description: "" } system: { quantite: 0, valeur_deniers: 10, encombrement: 0.002, description: "" }
}, },
{ {
name: "Argent (1 sol)", type: 'monnaie', name: "Argent (1 sol)", type: 'monnaie',
img: "systems/foundryvtt-reve-de-dragon/icons/objets/piece_argent_sol.webp", img: "systems/foundryvtt-reve-de-dragon/icons/objets/piece_argent_sol.webp",
data: { quantite: 0, valeur_deniers: 100, encombrement: 0.003, description: "" } system: { quantite: 0, valeur_deniers: 100, encombrement: 0.003, description: "" }
}, },
{ {
name: "Or (10 sols)", type: 'monnaie', name: "Or (10 sols)", type: 'monnaie',
img: "systems/foundryvtt-reve-de-dragon/icons/objets/piece_or_sol.webp", img: "systems/foundryvtt-reve-de-dragon/icons/objets/piece_or_sol.webp",
data: { quantite: 0, valeur_deniers: 1000, encombrement: 0.004, description: "" } system: { quantite: 0, valeur_deniers: 1000, encombrement: 0.004, description: "" }
} }
] ]
const VALEURS_STANDARDS = MONNAIES_STANDARD.map(it =>it.system.valeur_deniers);
export class Monnaie { export class Monnaie {
static isSystemMonnaie(item) { static isSystemMonnaie(item, items) {
let present = monnaiesData.find(monnaie => monnaie.data.valeur_deniers == Misc.data(item)?.data?.valeur_deniers); if (item.type == 'monnaie') {
return present; const valeur = item.system.valeur_deniers;
if (VALEURS_STANDARDS.includes(valeur)) {
const monnaiesDeValeur = items.filter(it => it.type == 'monnaie' && it.system.valeur_deniers == valeur)
return monnaiesDeValeur.length<=1;
}
}
return false;
} }
static monnaiesData() { static monnaiesData() {
return monnaiesData; return MONNAIES_STANDARD;
} }
static filtrerMonnaies(items) { static filtrerMonnaies(items) {
return items.filter(it => Misc.data(it).type == 'monnaie'); return items.filter(it => it.type == 'monnaie');
} }
static monnaiesManquantes(items) { static monnaiesManquantes(disponibles) {
const valeurs = Monnaie.filtrerMonnaies(items) const manquantes = MONNAIES_STANDARD.filter(standard => !disponibles.find(disponible => Monnaie.deValeur(disponible, standard.system?.valeur_deniers)));
.map(it => Misc.templateData(it).valeur_deniers); if (manquantes.length > 0) {
const manquantes = monnaiesData.filter(monnaie => !valeurs.find(v => v != Misc.templateData(monnaie).valeur_deniers)); console.error('monnaiesManquantes', manquantes, ' avec monnaies', disponibles, MONNAIES_STANDARD);
//const manquantes = monnaiesData.filter(monnaie => !valeurs.find(v => v != Misc.templateData(monnaie).valeur_deniers) ); }
//console.log("Valeurs : ", valeurs, manquantes); return manquantes;
return []; //manquantes;
} }
static deValeur(monnaie, v) { static deValeur(monnaie, valeur) {
return v != monnaie.data.valeur_deniers; return valeur == monnaie.system.valeur_deniers
} }
static arrondiDeniers(sols) { static arrondiDeniers(sols) {
@@ -56,6 +62,6 @@ export class Monnaie {
} }
static triValeurDenier() { static triValeurDenier() {
return Misc.ascending(item => Misc.data(item).data.valeur_deniers); return Misc.ascending(item => item.system.valeur_deniers)
} }
} }

View File

@@ -32,7 +32,7 @@ export class RdDItemSheet extends ItemSheet {
let buttons = super._getHeaderButtons(); let buttons = super._getHeaderButtons();
// Add "Post to chat" button // Add "Post to chat" button
// We previously restricted this to GM and editable items only. If you ever find this comment because it broke something: eh, sorry! // We previously restricted this to GM and editable items only. If you ever find this comment because it broke something: eh, sorry!
if ("cout" in Misc.templateData(this.object) && this.object.isVideOuNonConteneur()) { if ("cout" in this.item.system && this.item.isVideOuNonConteneur()) {
buttons.unshift({ buttons.unshift({
class: "vendre", class: "vendre",
icon: "fas fa-comments-dollar", icon: "fas fa-comments-dollar",
@@ -60,24 +60,25 @@ export class RdDItemSheet extends ItemSheet {
/* -------------------------------------------- */ /* -------------------------------------------- */
async getData() { async getData() {
const objectData = Misc.data(this.object)
let formData = { let formData = {
id: this.object.id, id: this.item.id,
title: objectData.name, title: this.item.name,
type: objectData.type, type: this.item.type,
img: objectData.img, img: this.item.img,
name: objectData.name, name: this.item.name,
data: objectData.data, system: this.item.system,
// TODO: v10 remove
data: this.item.system,
isGM: game.user.isGM, isGM: game.user.isGM,
actorId: this.actor?.id, actorId: this.actor?.id,
owner: this.document.isOwner, owner: this.item.isOwner,
editable: this.isEditable, editable: this.isEditable,
cssClass: this.isEditable ? "editable" : "locked", cssClass: this.isEditable ? "editable" : "locked",
isSoins: false isSoins: false
} }
if (this.actor) { if (this.actor) {
formData.isOwned = true; formData.isOwned = true;
if (objectData.type == 'conteneur') { if (this.item.type == 'conteneur') {
this.prepareConteneurData(formData); this.prepareConteneurData(formData);
} }
} }
@@ -93,20 +94,20 @@ export class RdDItemSheet extends ItemSheet {
console.log(formData.competences) console.log(formData.competences)
} }
if (formData.type == 'recettealchimique') { if (formData.type == 'recettealchimique') {
RdDAlchimie.processManipulation(objectData, this.actor && this.actor.id); RdDAlchimie.processManipulation(this.item, this.actor && this.actor.id);
} }
if (formData.type == 'gemme') { if (formData.type == 'gemme') {
formData.gemmeTypeList = RdDGemme.getGemmeTypeOptionList(); formData.gemmeTypeList = RdDGemme.getGemmeTypeOptionList();
RdDGemme.calculDataDerivees(formData.data); RdDGemme.calculDataDerivees(this.item);
} }
if (formData.type == 'potion') { if (formData.type == 'potion') {
if (this.dateUpdated) { if (this.dateUpdated) {
formData.data.prdate = this.dateUpdated; formData.system.prdate = this.dateUpdated;
this.dateUpdated = undefined; this.dateUpdated = undefined;
} }
RdDHerbes.updatePotionData(formData); RdDHerbes.updatePotionData(formData);
} }
if (formData.isOwned && formData.type == 'herbe' && (formData.data.categorie == 'Soin' || formData.data.categorie == 'Repos')) { if (formData.isOwned && formData.type == 'herbe' && (formData.system.categorie == 'Soin' || formData.system.categorie == 'Repos')) {
formData.isIngredientPotionBase = true; formData.isIngredientPotionBase = true;
} }
formData.bonusCaseList = RdDItemSort.getBonusCaseList(formData, true); formData.bonusCaseList = RdDItemSort.getBonusCaseList(formData, true);
@@ -116,11 +117,11 @@ export class RdDItemSheet extends ItemSheet {
/* -------------------------------------------- */ /* -------------------------------------------- */
prepareConteneurData(formData) { prepareConteneurData(formData) {
formData.itemsByType = Misc.classify(this.actor.items.map(i => foundry.utils.deepClone(i.data))); formData.itemsByType = Misc.classify(this.actor.items.map(i => foundry.utils.deepClone(i)))
RdDUtility.filterEquipementParType(formData); RdDUtility.filterEquipementParType(formData)
this.objetVersConteneur = RdDUtility.buildArbreDeConteneurs(formData.conteneurs, formData.objets); this.objetVersConteneur = RdDUtility.buildArbreDeConteneurs(formData.conteneurs, formData.objets);
formData.subItems = formData.conteneurs.find(it => it._id == this.object.id)?.subItems; formData.subItems = formData.conteneurs.find(it => it._id == this.item.id)?.subItems;
} }
@@ -129,15 +130,15 @@ export class RdDItemSheet extends ItemSheet {
activateListeners(html) { activateListeners(html) {
super.activateListeners(html); super.activateListeners(html);
if (this.object.type == 'conteneur') { if (this.item.type == 'conteneur') {
this.form.ondragstart = (event) => this._onDragStart(event); this.form.ondragstart = (event) => this._onDragStart(event);
this.form.ondrop = (event) => this._onDrop(event); this.form.ondrop = (event) => this._onDrop(event);
} }
let itemSheetDialog = this; let itemSheetDialog = this;
HtmlUtility._showControlWhen($(".item-cout"), ReglesOptionelles.isUsing('afficher-prix-joueurs') || game.user.isGM || !this.object.isOwned); HtmlUtility._showControlWhen($(".item-cout"), ReglesOptionelles.isUsing('afficher-prix-joueurs') || game.user.isGM || !this.item.isOwned);
HtmlUtility._showControlWhen($(".item-magique"), this.object.isMagique()); HtmlUtility._showControlWhen($(".item-magique"), this.item.isMagique());
// Everything below here is only needed if the sheet is editable // Everything below here is only needed if the sheet is editable
if (!this.options.editable) return; if (!this.options.editable) return;
@@ -146,8 +147,8 @@ export class RdDItemSheet extends ItemSheet {
html.find(".categorie").change(event => this._onSelectCategorie(event)); html.find(".categorie").change(event => this._onSelectCategorie(event));
html.find('.sheet-competence-xp').change((event) => { html.find('.sheet-competence-xp').change((event) => {
if (this.object.data.type == 'competence') { if (this.item.type == 'competence') {
RdDUtility.checkThanatosXP(this.object.data.name); RdDUtility.checkThanatosXP(this.item.name);
} }
}); });
@@ -182,7 +183,7 @@ export class RdDItemSheet extends ItemSheet {
if (actor) { if (actor) {
actor.effectuerTacheAlchimie(recetteId, tacheName, tacheData); actor.effectuerTacheAlchimie(recetteId, tacheName, tacheData);
} else { } else {
ui.notifications.info("Impossible trouver un actur pour réaliser cette tache Alchimique."); ui.notifications.info("Impossible trouver un acteur pour réaliser cette tache Alchimique.");
} }
}); });
@@ -196,7 +197,8 @@ export class RdDItemSheet extends ItemSheet {
}); });
html.find('.item-delete').click(async event => { html.find('.item-delete').click(async event => {
const li = RdDSheetUtility.getEventElement(event); const li = RdDSheetUtility.getEventElement(event);
RdDUtility.confirmerSuppression(this, li); const item = this.actor.getObjet(li.data("item-id"));
RdDUtility.confirmerSuppressionItem(this, item, li);
}); });
html.find('.item-vendre').click(async event => { html.find('.item-vendre').click(async event => {
const item = RdDSheetUtility.getItem(event, this.actor); const item = RdDSheetUtility.getItem(event, this.actor);
@@ -220,16 +222,16 @@ export class RdDItemSheet extends ItemSheet {
async _onSelectCategorie(event) { async _onSelectCategorie(event) {
event.preventDefault(); event.preventDefault();
if (this.object.isCompetence()) { if (this.item.isCompetence()) {
let level = RdDItemCompetence.getNiveauBase(event.currentTarget.value); let level = RdDItemCompetence.getNiveauBase(event.currentTarget.value);
Misc.templateData(this.object).base = level; this.item.system.base = level;
$("#base").val(level); $("#base").val(level);
} }
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
get template() { get template() {
let type = this.object.data.type; let type = this.item.type
return `systems/foundryvtt-reve-de-dragon/templates/item-${type}-sheet.html`; return `systems/foundryvtt-reve-de-dragon/templates/item-${type}-sheet.html`;
} }
@@ -240,7 +242,7 @@ export class RdDItemSheet extends ItemSheet {
// Données de bonus de cases ? // Données de bonus de cases ?
formData = RdDItemSort.buildBonusCaseStringFromFormData(formData); formData = RdDItemSort.buildBonusCaseStringFromFormData(formData);
return this.object.update(formData); return this.item.update(formData);
} }
async _onDragStart(event) { async _onDragStart(event) {
@@ -253,28 +255,28 @@ export class RdDItemSheet extends ItemSheet {
const dragData = { const dragData = {
actorId: this.actor.id, actorId: this.actor.id,
type: "Item", type: "Item",
data: item.data data: item.system
}; };
event.dataTransfer.setData("text/plain", JSON.stringify(dragData)); event.dataTransfer.setData("text/plain", JSON.stringify(dragData));
} }
async _onDrop(event) { async _onDrop(event) {
// Try to extract the data // Try to extract the dragData
let data; let dragData;
try { try {
data = JSON.parse(event.dataTransfer.getData('text/plain')); dragData = JSON.parse(event.dataTransfer.getData('text/plain'));
} catch (err) { } catch (err) {
return false; return false;
} }
const allowed = Hooks.call("dropActorSheetData", this.actor, this, data); const allowed = Hooks.call("dropActorSheetData", this.actor, this, dragData);
if (allowed === false) return; if (allowed === false) return;
// Handle different data types // Handle different dragData types
switch (data.type) { switch (dragData.type) {
case "Item": case "Item":
return this._onDropItem(event, data); return this._onDropItem(event, dragData);
} }
return super._onDrop(event); return super._onDrop(event);
} }
@@ -282,7 +284,7 @@ export class RdDItemSheet extends ItemSheet {
/* -------------------------------------------- */ /* -------------------------------------------- */
async _onDropItem(event, dragData) { async _onDropItem(event, dragData) {
if (this.actor) { if (this.actor) {
const dropParams = RdDSheetUtility.prepareItemDropParameters(this.object.id, this.actor.id, dragData, this.objetVersConteneur); const dropParams = RdDSheetUtility.prepareItemDropParameters(this.item.id, this.actor.id, dragData, this.objetVersConteneur);
await this.actor.processDropItem(dropParams); await this.actor.processDropItem(dropParams);
await this.render(true); await this.render(true);
} }

View File

@@ -40,17 +40,17 @@ export class RdDSigneDraconiqueItemSheet extends ItemSheet {
/* -------------------------------------------- */ /* -------------------------------------------- */
async getData() { async getData() {
const formData = duplicate(Misc.data(this.object)); const formData = duplicate(this.item);
mergeObject(formData, { mergeObject(formData, {
title: formData.name, title: formData.name,
isGM: game.user.isGM, isGM: game.user.isGM,
owner: this.document.isOwner, owner: this.actor.isOwner,
isOwned: this.actor ? true : false, isOwned: this.actor ? true : false,
actorId: this.actor?.id, actorId: this.actor?.id,
editable: this.isEditable, editable: this.isEditable,
cssClass: this.isEditable ? "editable" : "locked", cssClass: this.isEditable ? "editable" : "locked",
}); });
formData.tmrs = TMRUtility.listSelectedTMR(formData.data.typesTMR ?? []); formData.tmrs = TMRUtility.listSelectedTMR(formData.system.typesTMR ?? []);
return formData; return formData;
} }
@@ -68,21 +68,21 @@ export class RdDSigneDraconiqueItemSheet extends ItemSheet {
async setSigneAleatoire() { async setSigneAleatoire() {
const newSigne = await RdDItemSigneDraconique.randomSigneDraconique(); const newSigne = await RdDItemSigneDraconique.randomSigneDraconique();
this.object.update(newSigne); this.item.update(newSigne);
} }
async onSelectTmr(event) { async onSelectTmr(event) {
event.preventDefault(); event.preventDefault();
const selectedTMR = $(".select-tmr").val(); const selectedTMR = $(".select-tmr").val();
this.object.update({ 'data.typesTMR': selectedTMR }); this.item.update({ 'system.typesTMR': selectedTMR });
} }
async onValeurXpSort(event) { async onValeurXpSort(event) {
const codeReussite = event.currentTarget.attributes['data-typereussite']?.value ?? 0; const codeReussite = event.currentTarget.attributes['data-typereussite']?.value ?? 0;
const xp = Number(event.currentTarget.value); const xp = Number(event.currentTarget.value);
const oldValeur = Misc.templateData(this.object).valeur; const oldValeur = this.item.system.valeur;
const newValeur = RdDItemSigneDraconique.calculValeursXpSort(codeReussite, xp, oldValeur); const newValeur = RdDItemSigneDraconique.calculValeursXpSort(codeReussite, xp, oldValeur);
await this.object.update({ 'data.valeur': newValeur }); await this.item.update({ 'system.valeur': newValeur });
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@@ -13,25 +13,23 @@ const tableSignesIndicatifs = [
] ]
const DIFFICULTE_LECTURE_SIGNE_MANQUE = +11;
export class RdDItemSigneDraconique { export class RdDItemSigneDraconique {
static prepareSigneDraconiqueMeditation(meditation, rolled) { static prepareSigneDraconiqueMeditation(meditation, rolled) {
if (rolled.isSuccess != undefined) { return {
meditation = Misc.data(meditation); name: "de la " + meditation.name,
return { type: "signedraconique",
name: "de la " + meditation.name, img: meditation.img,
type: "signedraconique", system: {
img: meditation.img, typesTMR: [TMRUtility.typeTmrName(meditation.system.tmr)],
data: { difficulte: rolled.isSuccess ? RdDItemSigneDraconique.getDiffSigneMeditation(rolled.code) : DIFFICULTE_LECTURE_SIGNE_MANQUE,
typesTMR: [TMRUtility.typeTmrName(meditation.data.tmr)], ephemere: true,
difficulte: RdDItemSigneDraconique.getDiffSigneMeditation(rolled.code), duree: "1 round",
ephemere: true, valeur: rolled.isSuccess ? { "norm": 3, "sign": 5, "part": 10 } : { "norm": 0, "sign": 0, "part": 0 }
duree: "1 round", }
valeur: { "norm": 3, "sign": 5, "part": 10 } };
}
};
}
return undefined;
} }
static getDiffSigneMeditation(code) { static getDiffSigneMeditation(code) {
@@ -44,7 +42,7 @@ export class RdDItemSigneDraconique {
} }
static getXpSortSigneDraconique(code, signe) { static getXpSortSigneDraconique(code, signe) {
return Misc.data(signe).data.valeur[code] ?? 0; return Misc.toInt(signe.system.valeur[code] ?? 0);
} }
static calculValeursXpSort(qualite, valeur, avant) { static calculValeursXpSort(qualite, valeur, avant) {
@@ -76,7 +74,7 @@ export class RdDItemSigneDraconique {
name: await RdDItemSigneDraconique.randomSigneDescription(), name: await RdDItemSigneDraconique.randomSigneDescription(),
type: "signedraconique", type: "signedraconique",
img: defaultItemImg.signedraconique, img: defaultItemImg.signedraconique,
data: { system: {
typesTMR: await RdDItemSigneDraconique.randomTmrs(modele.nbCases), typesTMR: await RdDItemSigneDraconique.randomTmrs(modele.nbCases),
ephemere: options?.ephemere == undefined ? RdDDice.rollTotal("1d2") == 2 : options.ephemere, ephemere: options?.ephemere == undefined ? RdDDice.rollTotal("1d2") == 2 : options.ephemere,
duree: "1 round", duree: "1 round",

View File

@@ -7,25 +7,25 @@ export class RdDItemSort extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static isDifficulteVariable(sort) { static isDifficulteVariable(sort) {
return sort && (sort.data.difficulte.toLowerCase() == "variable"); return sort && (sort.system.difficulte.toLowerCase() == "variable");
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static isCoutVariable(sort) { static isCoutVariable(sort) {
return sort && (sort.data.ptreve.toLowerCase() == "variable" || sort.data.ptreve.indexOf("+") >= 0); return sort && (sort.system.ptreve.toLowerCase() == "variable" || sort.system.ptreve.indexOf("+") >= 0);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static setCoutReveReel(sort){ static setCoutReveReel(sort){
if (sort) { if (sort) {
sort.data.ptreve_reel = this.isCoutVariable(sort) ? 1 : sort.data.ptreve; sort.system.ptreve_reel = this.isCoutVariable(sort) ? 1 : sort.system.ptreve;
} }
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static getDifficulte(sort, variable) { static getDifficulte(sort, variable) {
if (sort && !RdDItemSort.isDifficulteVariable(sort)) { if (sort && !RdDItemSort.isDifficulteVariable(sort)) {
return Misc.toInt(sort.data.difficulte); return Misc.toInt(sort.system.difficulte);
} }
return variable; return variable;
} }
@@ -54,40 +54,40 @@ export class RdDItemSort extends Item {
static getBonusCaseList( item, newCase = false ) { static getBonusCaseList( item, newCase = false ) {
// Gestion spéciale case bonus // Gestion spéciale case bonus
if ( item.type == 'sort') { if ( item.type == 'sort') {
return this.buildBonusCaseList(item.data.bonuscase, newCase ); return this.buildBonusCaseList(item.system.bonuscase, newCase );
} }
return undefined; return undefined;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
/** Met à jour les données de formulaire /** Met à jour les données de formulaire
* si static des bonus de cases sont présents * si static des bonus de cases sont présents
* */ * */
static buildBonusCaseStringFromFormData( formData ) { static buildBonusCaseStringFromFormData( formData ) {
if ( formData.bonusValue ) { if ( formData.bonusValue ) {
let list = []; let list = [];
let caseCheck = {}; let caseCheck = {};
for(let i=0; i<formData.bonusValue.length; i++) { for(let i=0; i<formData.bonusValue.length; i++) {
let coord = formData.caseValue[i] || 'A1'; let coord = formData.caseValue[i] || 'A1';
coord = coord.toUpperCase(); coord = coord.toUpperCase();
if ( TMRUtility.verifyTMRCoord( coord ) ) { // Sanity check if ( TMRUtility.verifyTMRCoord( coord ) ) { // Sanity check
let bonus = formData.bonusValue[i] || 0; let bonus = formData.bonusValue[i] || 0;
if ( bonus > 0 && caseCheck[coord] == undefined ) { if ( bonus > 0 && caseCheck[coord] == undefined ) {
caseCheck[coord] = bonus; caseCheck[coord] = bonus;
list.push( coord+":"+bonus ); list.push( coord+":"+bonus );
}
} }
} }
formData.bonusValue = undefined;
formData.caseValue = undefined;
formData['data.bonuscase'] = list.toString(); // Reset
} }
return formData; formData.bonusValue = undefined;
formData.caseValue = undefined;
formData.system.bonuscase = list.toString(); // Reset
}
return formData;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static incrementBonusCase( actor, sort, coord ) { static incrementBonusCase( actor, sort, coord ) {
let bonusCaseList = this.buildBonusCaseList(sort.data.bonuscase, false); let bonusCaseList = this.buildBonusCaseList(sort.system.bonuscase, false);
//console.log("ITEMSORT", sort, bonusCaseList); //console.log("ITEMSORT", sort, bonusCaseList);
let found = false; let found = false;
@@ -106,12 +106,12 @@ export class RdDItemSort extends Item {
// Sauvegarde/update // Sauvegarde/update
let bonuscase = StringList.toString(); let bonuscase = StringList.toString();
//console.log("Bonus cae :", bonuscase); //console.log("Bonus cae :", bonuscase);
actor.updateEmbeddedDocuments('Item', [{ _id: sort._id, 'data.bonuscase': bonuscase }] ); actor.updateEmbeddedDocuments('Item', [{ _id: sort._id, 'system.bonuscase': bonuscase }] );
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static getCaseBonus( sort, coord) { static getCaseBonus( sort, coord) {
let bonusCaseList = this.buildBonusCaseList(sort.data.bonuscase, false); let bonusCaseList = this.buildBonusCaseList(sort.system.bonuscase, false);
for( let bc of bonusCaseList) { for( let bc of bonusCaseList) {
if (bc.case == coord) { // Case existante if (bc.case == coord) { // Case existante
return Number(bc.bonus); return Number(bc.bonus);

View File

@@ -1,6 +1,7 @@
import { DialogItemVente } from "./dialog-item-vente.js"; import { DialogItemVente } from "./dialog-item-vente.js";
import { Grammar } from "./grammar.js"; import { Grammar } from "./grammar.js";
import { Misc } from "./misc.js"; import { Misc } from "./misc.js";
import { RdDHerbes } from "./rdd-herbes.js";
import { RdDUtility } from "./rdd-utility.js"; import { RdDUtility } from "./rdd-utility.js";
const typesObjetsEquipement = ["objet", "arme", "armure", "gemme", "conteneur", "herbe", "ingredient", "livre", "potion", "munition", "nourritureboisson", "monnaie"] const typesObjetsEquipement = ["objet", "arme", "armure", "gemme", "conteneur", "herbe", "ingredient", "livre", "potion", "munition", "nourritureboisson", "monnaie"]
@@ -41,11 +42,11 @@ export const defaultItemImg = {
/* -------------------------------------------- */ /* -------------------------------------------- */
export class RdDItem extends Item { export class RdDItem extends Item {
constructor(data, context) { constructor(itemData, context) {
if (!data.img) { if (!itemData.img) {
data.img = defaultItemImg[data.type]; itemData.img = defaultItemImg[itemData.type];
} }
super(data, context); super(itemData, context);
} }
static getTypeObjetsEquipement() { static getTypeObjetsEquipement() {
@@ -57,61 +58,56 @@ export class RdDItem extends Item {
} }
isCompetence() { isCompetence() {
return Misc.data(this).type == 'competence'; return this.type == 'competence';
} }
isConteneur() { isConteneur() {
return Misc.data(this).type == 'conteneur'; return this.type == 'conteneur';
} }
isConteneurNonVide() { isConteneurNonVide() {
return this.isConteneur() && (Misc.templateData(this).contenu?.length ?? 0) > 0; return this.isConteneur() && (this.system.contenu?.length ?? 0) > 0;
} }
isConteneurVide() { isConteneurVide() {
return this.isConteneur() && (Misc.templateData(this).contenu?.length ?? 0) == 0; return this.isConteneur() && (this.system.contenu?.length ?? 0) == 0;
} }
isVideOuNonConteneur() { isVideOuNonConteneur() {
return !this.isConteneur() || (Misc.templateData(this).contenu?.length ?? 0) == 0; return !this.isConteneur() || (this.system.contenu?.length ?? 0) == 0;
} }
isAlcool() { isAlcool() {
const itemData = Misc.data(this); return this.type == 'nourritureboisson' && this.system.boisson && this.system.alcoolise;
return itemData.type == 'nourritureboisson' && itemData.data.boisson && itemData.data.alcoolise;
} }
isHerbeAPotion() { isHerbeAPotion() {
const itemData = Misc.data(this); return this.type == 'herbe' && (this.system.categorie == 'Soin' || this.system.categorie == 'Repos');
return itemData.type == 'herbe' && (itemData.data.categorie == 'Soin' || itemData.data.categorie == 'Repos');
} }
isPotion() { isPotion() {
return Misc.data(this).type == 'potion'; return this.type == 'potion';
} }
isEquipement() { isEquipement() {
return RdDItem.getTypeObjetsEquipement().includes(Misc.data(this).type); return RdDItem.getTypeObjetsEquipement().includes(this.type)
} }
isCristalAlchimique() { isCristalAlchimique() {
const itemData = Misc.data(this); return this.type == 'objet' && Grammar.toLowerCaseNoAccent(this.name) == 'cristal alchimique' && this.system.quantite > 0;
return itemData.type == 'objet' && Grammar.toLowerCaseNoAccent(itemData.name) == 'cristal alchimique' && itemData.data.quantite > 0;
} }
isMagique() { isMagique() {
return Misc.templateData(this).magique; return this.system.magique
} }
getEncTotal() { getEncTotal() {
const itemData = Misc.data(this); return Number(this.system.encombrement ?? 0) * Number(this.system.quantite ?? 1)
return Number(itemData.data.encombrement ?? 0) * Number(itemData.data.quantite ?? 1);
} }
getEnc() { getEnc() {
const itemData = Misc.data(this); switch (this.type) {
switch (itemData.type) {
case 'herbe': case 'herbe':
return encBrin; return encBrin;
} }
return itemData.data.encombrement ?? 0; return this.system.encombrement ?? 0;
} }
prepareDerivedData() { prepareDerivedData() {
@@ -122,54 +118,55 @@ export class RdDItem extends Item {
if (this.isPotion()) { if (this.isPotion()) {
this.prepareDataPotion() this.prepareDataPotion()
} }
const itemData = Misc.data(this); this.system.actionPrincipale = this.getActionPrincipale({ warnIfNot: false });
itemData.data.actionPrincipale = this.getActionPrincipale({ warnIfNot: false });
} }
} }
prepareDataPotion() { prepareDataPotion() {
const tplData = Misc.templateData(this); const categorie = Grammar.toLowerCaseNoAccent(this.system.categorie);
const categorie = Grammar.toLowerCaseNoAccent(tplData.categorie); this.system.magique = categorie.includes('enchante');
tplData.magique = categorie.includes('enchante'); if (this.system.magique) {
if (tplData.magique) {
if (categorie.includes('soin') || categorie.includes('repos')) { if (categorie.includes('soin') || categorie.includes('repos')) {
tplData.puissance = tplData.herbebonus * tplData.pr; // TODO: utiliser calculePointsRepos / calculePointsGuerison
this.system.puissance = RdDHerbes.calculePuissancePotion(this);
} }
} }
} }
_calculsEquipement() { _calculsEquipement() {
const tplData = Misc.templateData(this); const quantite = this.isConteneur() ? 1 : (this.system.quantite ?? 0);
const quantite = this.isConteneur() ? 1 : (tplData.quantite ?? 0);
const enc = this.getEnc(); const enc = this.getEnc();
if (enc != undefined) { if (enc != undefined) {
tplData.encTotal = Math.max(enc, 0) * quantite; this.system.encTotal = Math.max(enc, 0) * quantite;
} }
if (tplData.cout != undefined) { if (this.cout != undefined) {
tplData.prixTotal = Math.max(tplData.cout, 0) * quantite; this.system.prixTotal = Math.max(this.cout, 0) * quantite;
} }
} }
getActionPrincipale(options = { warnIfNot: true }) { getActionPrincipale(options = { warnIfNot: true }) {
const itemData = Misc.data(this); const warn = options.warnIfNot;
if (!this.isConteneur() && (itemData.data.quantite ?? 0) <= 0) { switch (this.type) {
if (options.warnIfNot) { case 'nourritureboisson': return this._actionOrWarnQuantiteZero(this.boisson ? 'Boire' : 'Manger', warn);
ui.notifications.warn(`Vous n'avez plus de ${itemData.name}.`); case 'potion': return this._actionOrWarnQuantiteZero('Boire', warn);
case 'livre': return this._actionOrWarnQuantiteZero('Lire', warn);
case 'conteneur': return this._actionOrWarnQuantiteZero('Ouvrir', warn);
case 'herbe': return this.isHerbeAPotion() ? this._actionOrWarnQuantiteZero('Décoction', warn) : undefined;
case 'queue': case 'ombre': return this.system.refoulement>0 ? 'Refouler' : undefined;
}
return undefined;
}
_actionOrWarnQuantiteZero(actionName, warn){
if ((this.system.quantite ?? 0) <= 0) {
if (warn) {
ui.notifications.warn(`Vous n'avez plus de ${this.name}.`);
} }
return undefined; return undefined;
} }
switch (itemData.type) { else {
case 'nourritureboisson': return itemData.data.boisson ? 'Boire' : 'Manger'; return actionName;
case 'potion': return 'Boire';
case 'livre': return 'Lire';
case 'conteneur': return 'Ouvrir';
} }
if (this.isHerbeAPotion()) { return 'Décoction'; }
if (options.warnIfNot) {
ui.notifications.warn(`Impossible d'utiliser un ${itemData.name}, aucune action associée définie.`);
}
return undefined;
} }
async diminuerQuantite(nombre, options = { diminuerQuantite: true, supprimerSiZero: false }) { async diminuerQuantite(nombre, options = { diminuerQuantite: true, supprimerSiZero: false }) {
@@ -178,23 +175,22 @@ export class RdDItem extends Item {
} }
async quantiteIncDec(nombre, options = { diminuerQuantite: true, supprimerSiZero: false }) { async quantiteIncDec(nombre, options = { diminuerQuantite: true, supprimerSiZero: false }) {
const itemData = Misc.data(this); const quantite = Number(this.system.quantite ?? -1);
const quantite = Number(itemData.data.quantite ?? -1);
if (quantite >= 0) { if (quantite >= 0) {
const reste = Math.max(quantite + Number(nombre), 0); const reste = Math.max(quantite + Number(nombre), 0);
if (reste == 0) { if (reste == 0) {
if (options.supprimerSiZero) { if (options.supprimerSiZero) {
ui.notifications.notify(`${itemData.name} supprimé de votre équipement`); ui.notifications.notify(`${this.name} supprimé de votre équipement`);
await this.delete(); await this.delete();
} }
else { else {
ui.notifications.notify(`Il ne vous reste plus de ${itemData.name}, vous pouvez le supprimer de votre équipement, ou trouver un moyen de vous en procurer.`); ui.notifications.notify(`Il ne vous reste plus de ${this.name}, vous pouvez le supprimer de votre équipement, ou trouver un moyen de vous en procurer.`);
await this.update({ "data.quantite": 0 }); await this.update({ "system.quantite": 0 });
} }
} }
else { else {
await this.update({ "data.quantite": reste }); await this.update({ "system.quantite": reste });
} }
} }
} }
@@ -202,22 +198,28 @@ export class RdDItem extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
// détermine si deux équipements sont similaires: de même type, et avec les même champs hormis la quantité // détermine si deux équipements sont similaires: de même type, et avec les même champs hormis la quantité
isEquipementSimilaire(other) { isEquipementSimilaire(other) {
const itemData = Misc.data(this);
const otherData = Misc.data(other);
const tplData = Misc.templateData(this);
const otherTplData = Misc.templateData(other);
if (!this.isEquipement()) return false; if (!this.isEquipement()) return false;
if (itemData.type != otherData.type) return false; let message = undefined;
if (itemData.name != otherData.name) return false; if (this.type != other.type) {
if (tplData.quantite == undefined) return false; message = `Impossible de regrouper ${this.type} avec ${other.type}`;
}
const differences = Object.entries(tplData).filter(([key, value]) => !['quantite', 'encTotal', 'prixTotal', 'cout'].includes(key)) else if (this.name != other.name) {
.filter(([key, value]) => value != otherTplData[key]); message = `Impossible de regrouper ${this.name} avec ${other.name}`;
if (differences.length > 0) { }
let message = `Impossible de regrouper les ${itemData.type} ${itemData.name}: `; else if (this.system.quantite == undefined) {
for (const [key, value] of differences) { message = `Impossible de regrouper des ${this.type}, ils ne sont pas empilables`;
message += `<br>${key}: ${value} vs ${otherTplData[key]}`; }
else {
const differences = Object.entries(this.system)
.filter(([key, value]) => !['quantite', 'encTotal', 'prixTotal', 'cout'].includes(key) && value != other.system[key]);
if (differences.length > 0) {
message = `Impossible de regrouper les ${this.type} ${this.name}: `;
for (const [key, value] of differences) {
message += `<br>${key}: ${value} vs ${other.system[key]}`;
}
} }
}
if (message){
ui.notifications.info(message) ui.notifications.info(message)
return false; return false;
} }
@@ -251,13 +253,13 @@ export class RdDItem extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
getProprietes() { getProprietes() {
return this[`_${Misc.data(this).type}ChatData`](); return this[`_${this.type}ChatData`]();
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async postItem(modeOverride) { async postItem(modeOverride) {
console.log(this); console.log(this);
let chatData = duplicate(Misc.data(this)); let chatData = duplicate(this);
const properties = this.getProprietes(); const properties = this.getProprietes();
chatData["properties"] = properties chatData["properties"] = properties
if (this.actor) { if (this.actor) {
@@ -282,7 +284,7 @@ export class RdDItem extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
_objetChatData() { _objetChatData() {
const tplData = Misc.templateData(this); const tplData = this.system
let properties = [].concat( let properties = [].concat(
RdDItem.propertyIfDefined('Résistance', tplData.resistance, tplData.resistance), RdDItem.propertyIfDefined('Résistance', tplData.resistance, tplData.resistance),
RdDItem.propertyIfDefined('Qualité', tplData.qualite, tplData.qualite), RdDItem.propertyIfDefined('Qualité', tplData.qualite, tplData.qualite),
@@ -293,7 +295,7 @@ export class RdDItem extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
_nourritureboissonChatData() { _nourritureboissonChatData() {
const tplData = Misc.templateData(this); const tplData = this.system
let properties = [].concat( let properties = [].concat(
RdDItem.propertyIfDefined('Sustentation', tplData.sust, tplData.sust > 0), RdDItem.propertyIfDefined('Sustentation', tplData.sust, tplData.sust > 0),
RdDItem.propertyIfDefined('Désaltère', tplData.desaltere, tplData.boisson), RdDItem.propertyIfDefined('Désaltère', tplData.desaltere, tplData.boisson),
@@ -306,7 +308,7 @@ export class RdDItem extends Item {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_armeChatData() { _armeChatData() {
const tplData = Misc.templateData(this); const tplData = this.system
let properties = [ let properties = [
`<b>Compétence</b>: ${tplData.competence}`, `<b>Compétence</b>: ${tplData.competence}`,
`<b>Dommages</b>: ${tplData.dommages}`, `<b>Dommages</b>: ${tplData.dommages}`,
@@ -318,7 +320,7 @@ export class RdDItem extends Item {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_conteneurChatData() { _conteneurChatData() {
const tplData = Misc.templateData(this); const tplData = this.system
let properties = [ let properties = [
`<b>Capacité</b>: ${tplData.capacite} Enc.`, `<b>Capacité</b>: ${tplData.capacite} Enc.`,
`<b>Encombrement</b>: ${tplData.encombrement}` `<b>Encombrement</b>: ${tplData.encombrement}`
@@ -327,7 +329,7 @@ export class RdDItem extends Item {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_munitionChatData() { _munitionChatData() {
const tplData = Misc.templateData(this); const tplData = this.system
let properties = [ let properties = [
`<b>Encombrement</b>: ${tplData.encombrement}` `<b>Encombrement</b>: ${tplData.encombrement}`
] ]
@@ -335,7 +337,7 @@ export class RdDItem extends Item {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_armureChatData() { _armureChatData() {
const tplData = Misc.templateData(this); const tplData = this.system
let properties = [ let properties = [
`<b>Protection</b>: ${tplData.protection}`, `<b>Protection</b>: ${tplData.protection}`,
`<b>Détérioration</b>: ${tplData.deterioration}`, `<b>Détérioration</b>: ${tplData.deterioration}`,
@@ -346,7 +348,7 @@ export class RdDItem extends Item {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_competenceChatData() { _competenceChatData() {
const tplData = Misc.templateData(this); const tplData = this.system
let properties = [ let properties = [
`<b>Catégorie</b>: ${tplData.categorie}`, `<b>Catégorie</b>: ${tplData.categorie}`,
`<b>Niveau</b>: ${tplData.niveau}`, `<b>Niveau</b>: ${tplData.niveau}`,
@@ -357,7 +359,7 @@ export class RdDItem extends Item {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_competencecreatureChatData() { _competencecreatureChatData() {
const tplData = Misc.templateData(this); const tplData = this.system
let properties = [ let properties = [
`<b>Catégorie</b>: ${tplData.categorie}`, `<b>Catégorie</b>: ${tplData.categorie}`,
`<b>Niveau</b>: ${tplData.niveau}`, `<b>Niveau</b>: ${tplData.niveau}`,
@@ -368,7 +370,7 @@ export class RdDItem extends Item {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_sortChatData() { _sortChatData() {
const tplData = Misc.templateData(this); const tplData = this.system
let properties = [ let properties = [
`<b>Draconic</b>: ${tplData.draconic}`, `<b>Draconic</b>: ${tplData.draconic}`,
`<b>Difficulté</b>: ${tplData.difficulte}`, `<b>Difficulté</b>: ${tplData.difficulte}`,
@@ -379,7 +381,7 @@ export class RdDItem extends Item {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_herbeChatData() { _herbeChatData() {
const tplData = Misc.templateData(this); const tplData = this.system
let properties = [ let properties = [
`<b>Milieu</b>: ${tplData.milieu}`, `<b>Milieu</b>: ${tplData.milieu}`,
`<b>Rareté</b>: ${tplData.rarete}`, `<b>Rareté</b>: ${tplData.rarete}`,
@@ -389,7 +391,7 @@ export class RdDItem extends Item {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_ingredientChatData() { _ingredientChatData() {
const tplData = Misc.templateData(this); const tplData = this.system
let properties = [ let properties = [
`<b>Milieu</b>: ${tplData.milieu}`, `<b>Milieu</b>: ${tplData.milieu}`,
`<b>Rareté</b>: ${tplData.rarete}`, `<b>Rareté</b>: ${tplData.rarete}`,
@@ -399,7 +401,7 @@ export class RdDItem extends Item {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_tacheChatData() { _tacheChatData() {
const tplData = Misc.templateData(this); const tplData = this.system
let properties = [ let properties = [
`<b>Caractéristique</b>: ${tplData.carac}`, `<b>Caractéristique</b>: ${tplData.carac}`,
`<b>Compétence</b>: ${tplData.competence}`, `<b>Compétence</b>: ${tplData.competence}`,
@@ -415,7 +417,7 @@ export class RdDItem extends Item {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_livreChatData() { _livreChatData() {
const tplData = Misc.templateData(this); const tplData = this.system
let properties = [ let properties = [
`<b>Compétence</b>: ${tplData.competence}`, `<b>Compétence</b>: ${tplData.competence}`,
`<b>Auteur</b>: ${tplData.auteur}`, `<b>Auteur</b>: ${tplData.auteur}`,
@@ -427,7 +429,7 @@ export class RdDItem extends Item {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_potionChatData() { _potionChatData() {
const tplData = Misc.templateData(this); const tplData = this.system
let properties = [ let properties = [
`<b>Rareté</b>: ${tplData.rarete}`, `<b>Rareté</b>: ${tplData.rarete}`,
`<b>Catégorie</b>: ${tplData.categorie}`, `<b>Catégorie</b>: ${tplData.categorie}`,
@@ -437,7 +439,7 @@ export class RdDItem extends Item {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_queueChatData() { _queueChatData() {
const tplData = Misc.templateData(this); const tplData = this.system
let properties = [ let properties = [
`<b>Refoulement</b>: ${tplData.refoulement}` `<b>Refoulement</b>: ${tplData.refoulement}`
] ]
@@ -445,7 +447,7 @@ export class RdDItem extends Item {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_ombreChatData() { _ombreChatData() {
const tplData = Misc.templateData(this); const tplData = this.system
let properties = [ let properties = [
`<b>Refoulement</b>: ${tplData.refoulement}` `<b>Refoulement</b>: ${tplData.refoulement}`
] ]
@@ -453,19 +455,19 @@ export class RdDItem extends Item {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_souffleChatData() { _souffleChatData() {
const tplData = Misc.templateData(this); const tplData = this.system
let properties = []; let properties = [];
return properties; return properties;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_teteChatData() { _teteChatData() {
const tplData = Misc.templateData(this); const tplData = this.system
let properties = []; let properties = [];
return properties; return properties;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_tarotChatData() { _tarotChatData() {
const tplData = Misc.templateData(this); const tplData = this.system
let properties = [ let properties = [
`<b>Concept</b>: ${tplData.concept}`, `<b>Concept</b>: ${tplData.concept}`,
`<b>Aspect</b>: ${tplData.aspect}`, `<b>Aspect</b>: ${tplData.aspect}`,
@@ -474,7 +476,7 @@ export class RdDItem extends Item {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_nombreastralChatData() { _nombreastralChatData() {
const tplData = Misc.templateData(this); const tplData = this.system
let properties = [ let properties = [
`<b>Valeur</b>: ${tplData.value}`, `<b>Valeur</b>: ${tplData.value}`,
`<b>Jour</b>: ${tplData.jourlabel}`, `<b>Jour</b>: ${tplData.jourlabel}`,
@@ -483,7 +485,7 @@ export class RdDItem extends Item {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_monnaieChatData() { _monnaieChatData() {
const tplData = Misc.templateData(this); const tplData = this.system
let properties = [ let properties = [
`<b>Valeur en Deniers</b>: ${tplData.valeur_deniers}`, `<b>Valeur en Deniers</b>: ${tplData.valeur_deniers}`,
`<b>Encombrement</b>: ${tplData.encombrement}` `<b>Encombrement</b>: ${tplData.encombrement}`
@@ -492,7 +494,7 @@ export class RdDItem extends Item {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_meditationChatData() { _meditationChatData() {
const tplData = Misc.templateData(this); const tplData = this.system
let properties = [ let properties = [
`<b>Thème</b>: ${tplData.theme}`, `<b>Thème</b>: ${tplData.theme}`,
`<b>Compétence</b>: ${tplData.competence}`, `<b>Compétence</b>: ${tplData.competence}`,
@@ -507,7 +509,7 @@ export class RdDItem extends Item {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_casetmrChatData() { _casetmrChatData() {
const tplData = Misc.templateData(this); const tplData = this.system
let properties = [ let properties = [
`<b>Coordonnée</b>: ${tplData.coord}`, `<b>Coordonnée</b>: ${tplData.coord}`,
`<b>Spécificité</b>: ${tplData.specific}` `<b>Spécificité</b>: ${tplData.specific}`
@@ -516,7 +518,7 @@ export class RdDItem extends Item {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_maladieChatData() { _maladieChatData() {
const tplData = Misc.templateData(this); const tplData = this.system
let properties let properties
if (tplData.identifie) { if (tplData.identifie) {
properties = [ properties = [
@@ -541,7 +543,7 @@ export class RdDItem extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
_gemmeChatData() { _gemmeChatData() {
const tplData = Misc.templateData(this); const tplData = this.system
let properties = [ let properties = [
`<b>Pureté</b>: ${tplData.purete}`, `<b>Pureté</b>: ${tplData.purete}`,
`<b>Taille</b>: ${tplData.taille}`, `<b>Taille</b>: ${tplData.taille}`,

View File

@@ -69,9 +69,9 @@ export class Misc {
} }
static classify(items, classifier = it => it.type) { static classify(items, classifier = it => it.type) {
let itemsBy = {}; let itemsBy = {}
Misc.classifyInto(itemsBy, items, classifier); Misc.classifyInto(itemsBy, items, classifier)
return itemsBy; return itemsBy
} }
static classifyFirst(items, classifier) { static classifyFirst(items, classifier) {
@@ -87,13 +87,13 @@ export class Misc {
static classifyInto(itemsBy, items, classifier = it => it.type) { static classifyInto(itemsBy, items, classifier = it => it.type) {
for (const item of items) { for (const item of items) {
const classification = classifier(item); const classification = classifier(item)
let list = itemsBy[classification]; let list = itemsBy[classification];
if (!list) { if (!list) {
list = []; list = []
itemsBy[classification] = list; itemsBy[classification] = list
} }
list.push(item); list.push(item)
} }
} }
@@ -106,20 +106,9 @@ export class Misc {
} }
static data(it) {
if (it instanceof Actor || it instanceof Item || it instanceof Combatant) {
return it.data;
}
return it;
}
static templateData(it) {
return Misc.data(it)?.data ?? {}
}
static getEntityTypeLabel(entity) { static getEntityTypeLabel(entity) {
const documentName = entity?.documentName; const documentName = entity?.documentName
const type = entity?.data.type; const type = entity?.type
if (documentName === 'Actor' || documentName === 'Item') { if (documentName === 'Actor' || documentName === 'Item') {
const label = CONFIG[documentName]?.typeLabels?.[type] ?? type; const label = CONFIG[documentName]?.typeLabels?.[type] ?? type;
return game.i18n.has(label) ? game.i18n.localize(label) : t; return game.i18n.has(label) ? game.i18n.localize(label) : t;
@@ -192,7 +181,7 @@ export class Misc {
if (!single) { if (!single) {
single = subset[0]; single = subset[0];
const choices = Misc.join(subset.map(it => options.mapper(it)), '<br>'); const choices = Misc.join(subset.map(it => options.mapper(it)), '<br>');
options.info(`Plusieurs choix de ${options.description}s possibles:<br>${choices}<br>Le premier sera choisi: ${mapToValue(single)}`); options.onMessage(`Plusieurs choix de ${options.description}s possibles:<br>${choices}<br>Le premier sera choisi: ${options.mapper(single)}`);
} }
return single; return single;
} }
@@ -211,7 +200,7 @@ export class Misc {
} }
value = Grammar.toLowerCaseNoAccent(value); value = Grammar.toLowerCaseNoAccent(value);
const subset = elements.filter(options.preFilter) const subset = elements.filter(options.preFilter)
.filter(it => Grammar.toLowerCaseNoAccent(options.mapper(it)).includes(value)); .filter(it => Grammar.toLowerCaseNoAccent(options.mapper(it))?.includes(value));
if (subset.length == 0) { if (subset.length == 0) {
options.onMessage(`Pas de ${options.description} correspondant à ${value}`); options.onMessage(`Pas de ${options.description} correspondant à ${value}`);
} }

View File

@@ -7,9 +7,9 @@ const matchOperationTerms = new RegExp(/@(\w*){([\w\-]+)}/i);
export class RdDAlchimie { export class RdDAlchimie {
/* -------------------------------------------- */ /* -------------------------------------------- */
static processManipulation(recetteData, actorId = undefined) { static processManipulation(recette, actorId = undefined) {
//console.log("CALLED", recette, recette.isOwned, actorId ); //console.log("CALLED", recette, recette.isOwned, actorId );
let manip = recetteData.data.manipulation; let manip = recette.system.manipulation;
let matchArray = manip.match(matchOperations); let matchArray = manip.match(matchOperations);
if (matchArray) { if (matchArray) {
for (let matchStr of matchArray) { for (let matchStr of matchArray) {
@@ -17,12 +17,12 @@ export class RdDAlchimie {
//console.log("RESULT ", result); //console.log("RESULT ", result);
if (result[1] && result[2]) { if (result[1] && result[2]) {
let commande = Misc.upperFirst(result[1]); let commande = Misc.upperFirst(result[1]);
let replacement = this[`_alchimie${commande}`](recetteData, result[2], actorId); let replacement = this[`_alchimie${commande}`](recette, result[2], actorId);
manip = manip.replace(result[0], replacement); manip = manip.replace(result[0], replacement);
} }
} }
} }
recetteData.data.manipulation_update = manip; recette.system.manipulation_update = manip;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@@ -12,23 +12,23 @@ export class RdDAstrologieJoueur extends Dialog {
/* -------------------------------------------- */ /* -------------------------------------------- */
static async create(actor, dialogConfig) { static async create(actor, dialogConfig) {
let data = { let dialogData = {
nombres: this.organizeNombres(actor), nombres: this.organizeNombres(actor),
dates: game.system.rdd.calendrier.getJoursSuivants(10), dates: game.system.rdd.calendrier.getJoursSuivants(10),
etat: actor.getEtatGeneral(), etat: actor.getEtatGeneral(),
ajustementsConditions: CONFIG.RDD.ajustementsConditions, ajustementsConditions: CONFIG.RDD.ajustementsConditions,
astrologie: RdDItemCompetence.findCompetence(actor.data.items, 'Astrologie') astrologie: RdDItemCompetence.findCompetence(actor.items, 'Astrologie')
} }
const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-astrologie-joueur.html', data); const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-astrologie-joueur.html', dialogData);
let options = { classes: ["rdddialog"], width: 600, height: 500, 'z-index': 99999 }; let options = { classes: ["rdddialog"], width: 600, height: 500, 'z-index': 99999 };
if (dialogConfig.options) { if (dialogConfig.options) {
mergeObject(options, dialogConfig.options, { overwrite: true }); mergeObject(options, dialogConfig.options, { overwrite: true });
} }
return new RdDAstrologieJoueur(html, actor, data); return new RdDAstrologieJoueur(html, actor, dialogData);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
constructor(html, actor, data) { constructor(html, actor, dialogData) {
let myButtons = { let myButtons = {
saveButton: { label: "Fermer", callback: html => this.quitDialog() } saveButton: { label: "Fermer", callback: html => this.quitDialog() }
@@ -41,7 +41,7 @@ export class RdDAstrologieJoueur extends Dialog {
super(dialogConf, dialogOptions); super(dialogConf, dialogOptions);
this.actor = actor; this.actor = actor;
this.dataNombreAstral = duplicate(data); this.dataNombreAstral = duplicate(dialogData);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@@ -49,12 +49,12 @@ export class RdDAstrologieJoueur extends Dialog {
let itemNombres = actor.listItemsData('nombreastral'); let itemNombres = actor.listItemsData('nombreastral');
let itemFiltered = {}; let itemFiltered = {};
for (let item of itemNombres) { for (let item of itemNombres) {
if (itemFiltered[item.data.jourindex]) { if (itemFiltered[item.system.jourindex]) {
itemFiltered[item.data.jourindex].listValues.push(item.data.value); itemFiltered[item.system.jourindex].listValues.push(item.system.value);
} else { } else {
itemFiltered[item.data.jourindex] = { itemFiltered[item.system.jourindex] = {
listValues: [item.data.value], listValues: [item.system.value],
jourlabel: item.data.jourlabel jourlabel: item.system.jourlabel
} }
} }
} }
@@ -63,9 +63,9 @@ export class RdDAstrologieJoueur extends Dialog {
/* -------------------------------------------- */ /* -------------------------------------------- */
requestJetAstrologie() { requestJetAstrologie() {
let data = { let socketData = {
id: this.actor.data._id, id: this.actor.id,
carac_vue: Misc.data(this.actor).data.carac['vue'].value, carac_vue: this.actor.system.carac['vue'].value,
etat: this.dataNombreAstral.etat, etat: this.dataNombreAstral.etat,
astrologie: this.dataNombreAstral.astrologie, astrologie: this.dataNombreAstral.astrologie,
conditions: $("#diffConditions").val(), conditions: $("#diffConditions").val(),
@@ -73,11 +73,11 @@ export class RdDAstrologieJoueur extends Dialog {
userId: game.user.id userId: game.user.id
} }
if (Misc.isUniqueConnectedGM()) { if (Misc.isUniqueConnectedGM()) {
game.system.rdd.calendrier.requestNombreAstral(data); game.system.rdd.calendrier.requestNombreAstral(socketData);
} else { } else {
game.socket.emit(SYSTEM_SOCKET_ID, { game.socket.emit(SYSTEM_SOCKET_ID, {
msg: "msg_request_nombre_astral", msg: "msg_request_nombre_astral",
data: data data: socketData
}); });
} }
this.close(); this.close();

View File

@@ -20,7 +20,7 @@ export class RdDBonus {
static isAjustementAstrologique(rollData) { static isAjustementAstrologique(rollData) {
return RdDCarac.isChance(rollData.selectedCarac) || return RdDCarac.isChance(rollData.selectedCarac) ||
rollData.selectedSort?.data.isrituel; rollData.selectedSort?.system.isrituel;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static isDefenseAttaqueFinesse(rollData) { static isDefenseAttaqueFinesse(rollData) {
@@ -68,23 +68,23 @@ export class RdDBonus {
} }
return isCauchemar ? "cauchemar" return isCauchemar ? "cauchemar"
: rollData.dmg?.mortalite : rollData.dmg?.mortalite
?? rollData.arme?.data.mortalite ?? rollData.arme?.system.mortalite
?? "mortel"; ?? "mortel";
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static _dmgArme(rollData) { static _dmgArme(rollData) {
if ( rollData.arme) { if ( rollData.arme) {
let dmgBase = rollData.arme.data.dommagesReels ?? Number(rollData.arme.data.dommages ?? 0); let dmgBase = rollData.arme.system.dommagesReels ?? Number(rollData.arme.system.dommages ?? 0);
//Le bonus dégats magiques ne peut pas faire dépasser le bonus de l'arme (cf p.278) //Le bonus dégats magiques ne peut pas faire dépasser le bonus de l'arme (cf p.278)
return dmgBase + Math.min(dmgBase, rollData.arme.data.magique ? rollData.arme.data.ecaille_efficacite : 0); return dmgBase + Math.min(dmgBase, rollData.arme.system.magique ? rollData.arme.system.ecaille_efficacite : 0);
} }
return 0; return 0;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static _peneration(rollData) { static _peneration(rollData) {
return parseInt(rollData.arme?.data.penetration ?? 0); return parseInt(rollData.arme?.system.penetration ?? 0);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@@ -223,9 +223,9 @@ export class RdDCalendrier extends Application {
checkMaladie( periode) { checkMaladie( periode) {
for (let actor of game.actors) { for (let actor of game.actors) {
if (actor.type == 'personnage') { if (actor.type == 'personnage') {
let maladies = actor.filterItems( item => (item.type == 'maladie' || (item.type == 'poison' && item.data.active) ) && item.data.periodicite.toLowerCase().includes(periode) ); let maladies = actor.items.find( item => (item.type == 'maladie' || (item.type == 'poison' && item.system.active) ) && item.system.periodicite.toLowerCase().includes(periode) );
for (let maladie of maladies) { for (let maladie of maladies) {
if ( maladie.data.identifie) { if ( maladie.system.identifie) {
ChatMessage.create({ content: `${actor.name} souffre de ${maladie.name} (${maladie.type}): vérifiez que les effets ne se sont pas aggravés !` }); ChatMessage.create({ content: `${actor.name} souffre de ${maladie.name} (${maladie.type}): vérifiez que les effets ne se sont pas aggravés !` });
} else { } else {
ChatMessage.create({ content: `${actor.name} souffre d'un mal inconnu (${maladie.type}): vérifiez que les effets ne se sont pas aggravés !` }); ChatMessage.create({ content: `${actor.name} souffre d'un mal inconnu (${maladie.type}): vérifiez que les effets ne se sont pas aggravés !` });
@@ -320,7 +320,7 @@ export class RdDCalendrier extends Application {
if (Misc.isUniqueConnectedGM()) { // Only once if (Misc.isUniqueConnectedGM()) { // Only once
console.log(request); console.log(request);
let jourDiff = this.getLectureAstrologieDifficulte(request.date); let jourDiff = this.getLectureAstrologieDifficulte(request.date);
let niveau = Number(request.astrologie.data.niveau) + Number(request.conditions) + Number(jourDiff) + Number(request.etat); let niveau = Number(request.astrologie.system.niveau) + Number(request.conditions) + Number(jourDiff) + Number(request.etat);
let rollData = { let rollData = {
caracValue: request.carac_vue, caracValue: request.carac_vue,
finalLevel: niveau, finalLevel: niveau,
@@ -444,9 +444,9 @@ export class RdDCalendrier extends Application {
/* -------------------------------------------- */ /* -------------------------------------------- */
updateDisplay() { updateDisplay() {
let data = this.fillCalendrierData(); let calendrier = this.fillCalendrierData();
// Rebuild data // Rebuild text du calendrier
let dateHTML = `Jour ${data.jourMois} de ${data.nomMois} (${data.nomSaison})` let dateHTML = `Jour ${calendrier.jourMois} de ${calendrier.nomMois} (${calendrier.nomSaison})`
if (game.user.isGM) { if (game.user.isGM) {
dateHTML = dateHTML + " - NA: " + (this.getCurrentNombreAstral() ?? "indéterminé"); dateHTML = dateHTML + " - NA: " + (this.getCurrentNombreAstral() ?? "indéterminé");
} }
@@ -454,13 +454,13 @@ export class RdDCalendrier extends Application {
handle.innerHTML = dateHTML; handle.innerHTML = dateHTML;
} }
for (let heure of document.getElementsByClassName("calendar-heure-texte")) { for (let heure of document.getElementsByClassName("calendar-heure-texte")) {
heure.innerHTML = data.nomHeure; heure.innerHTML = calendrier.nomHeure;
} }
for (const minute of document.getElementsByClassName("calendar-time-disp")) { for (const minute of document.getElementsByClassName("calendar-time-disp")) {
minute.innerHTML = `${data.minutesRelative} minutes`; minute.innerHTML = `${calendrier.minutesRelative} minutes`;
} }
for (const heureImg of document.getElementsByClassName("calendar-heure-img")) { for (const heureImg of document.getElementsByClassName("calendar-heure-img")) {
heureImg.src = data.iconHeure; heureImg.src = calendrier.iconHeure;
} }
} }

View File

@@ -101,35 +101,35 @@ export class RdDCarac {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static computeCarac(data) { static computeCarac(system) {
data.carac.force.value = Math.min(data.carac.force.value, parseInt(data.carac.taille.value) + 4); system.carac.force.value = Math.min(system.carac.force.value, parseInt(system.carac.taille.value) + 4);
data.carac.derobee.value = Math.floor(parseInt(((21 - data.carac.taille.value)) + parseInt(data.carac.agilite.value)) / 2); system.carac.derobee.value = Math.floor(parseInt(((21 - system.carac.taille.value)) + parseInt(system.carac.agilite.value)) / 2);
let bonusDomKey = Math.floor((parseInt(data.carac.force.value) + parseInt(data.carac.taille.value)) / 2); let bonusDomKey = Math.floor((parseInt(system.carac.force.value) + parseInt(system.carac.taille.value)) / 2);
bonusDomKey = Math.min(Math.max(bonusDomKey, 0), 32); // Clamp de securite bonusDomKey = Math.min(Math.max(bonusDomKey, 0), 32); // Clamp de securite
let tailleData = tableCaracDerivee[bonusDomKey]; let tailleData = tableCaracDerivee[bonusDomKey];
data.attributs.plusdom.value = tailleData.plusdom; system.attributs.plusdom.value = tailleData.plusdom;
data.attributs.sconst.value = RdDCarac.calculSConst(data.carac.constitution.value); system.attributs.sconst.value = RdDCarac.calculSConst(system.carac.constitution.value);
data.attributs.sust.value = tableCaracDerivee[Number(data.carac.taille.value)].sust; system.attributs.sust.value = tableCaracDerivee[Number(system.carac.taille.value)].sust;
data.attributs.encombrement.value = (parseInt(data.carac.force.value) + parseInt(data.carac.taille.value)) / 2; system.attributs.encombrement.value = (parseInt(system.carac.force.value) + parseInt(system.carac.taille.value)) / 2;
data.carac.melee.value = Math.floor((parseInt(data.carac.force.value) + parseInt(data.carac.agilite.value)) / 2); system.carac.melee.value = Math.floor((parseInt(system.carac.force.value) + parseInt(system.carac.agilite.value)) / 2);
data.carac.tir.value = Math.floor((parseInt(data.carac.vue.value) + parseInt(data.carac.dexterite.value)) / 2); system.carac.tir.value = Math.floor((parseInt(system.carac.vue.value) + parseInt(system.carac.dexterite.value)) / 2);
data.carac.lancer.value = Math.floor((parseInt(data.carac.tir.value) + parseInt(data.carac.force.value)) / 2); system.carac.lancer.value = Math.floor((parseInt(system.carac.tir.value) + parseInt(system.carac.force.value)) / 2);
data.sante.vie.max = Math.ceil((parseInt(data.carac.taille.value) + parseInt(data.carac.constitution.value)) / 2); system.sante.vie.max = Math.ceil((parseInt(system.carac.taille.value) + parseInt(system.carac.constitution.value)) / 2);
data.sante.vie.value = Math.min(data.sante.vie.value, data.sante.vie.max) system.sante.vie.value = Math.min(system.sante.vie.value, system.sante.vie.max)
data.sante.endurance.max = Math.max(parseInt(data.carac.taille.value) + parseInt(data.carac.constitution.value), parseInt(data.sante.vie.max) + parseInt(data.carac.volonte.value)); system.sante.endurance.max = Math.max(parseInt(system.carac.taille.value) + parseInt(system.carac.constitution.value), parseInt(system.sante.vie.max) + parseInt(system.carac.volonte.value));
data.sante.endurance.value = Math.min(data.sante.endurance.value, data.sante.endurance.max); system.sante.endurance.value = Math.min(system.sante.endurance.value, system.sante.endurance.max);
data.sante.fatigue.max = data.sante.endurance.max * 2; system.sante.fatigue.max = system.sante.endurance.max * 2;
data.sante.fatigue.value = Math.min(data.sante.fatigue.value, data.sante.fatigue.max); system.sante.fatigue.value = Math.min(system.sante.fatigue.value, system.sante.fatigue.max);
//Compteurs //Compteurs
data.reve.reve.max = data.carac.reve.value; system.reve.reve.max = system.carac.reve.value;
data.compteurs.chance.max = data.carac.chance.value; system.compteurs.chance.max = system.carac.chance.value;
} }

View File

@@ -1,5 +1,6 @@
import { ChatUtility } from "./chat-utility.js"; import { ChatUtility } from "./chat-utility.js";
import { HIDE_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js"; import { ENTITE_INCARNE, ENTITE_NONINCARNE, HIDE_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js";
import { Grammar } from "./grammar.js";
import { RdDItemArme } from "./item-arme.js"; import { RdDItemArme } from "./item-arme.js";
import { RdDItemCompetence } from "./item-competence.js"; import { RdDItemCompetence } from "./item-competence.js";
import { RdDItemCompetenceCreature } from "./item-competencecreature.js"; import { RdDItemCompetenceCreature } from "./item-competencecreature.js";
@@ -26,7 +27,7 @@ const premierRoundInit = [
{ pattern: 'epeegnome', init: 5.35 }, { pattern: 'epeegnome', init: 5.35 },
{ pattern: 'masse', init: 5.30 }, { pattern: 'masse', init: 5.30 },
{ pattern: 'gourdin', init: 5.25 }, { pattern: 'gourdin', init: 5.25 },
{ pattern: 'fléau', init: 5.20 }, { pattern: 'fleau', init: 5.20 },
{ pattern: 'dague', init: 5.15 }, { pattern: 'dague', init: 5.15 },
{ pattern: 'autre', init: 5.10 }, { pattern: 'autre', init: 5.10 },
]; ];
@@ -65,7 +66,7 @@ export class RdDCombatManager extends Combat {
/* -------------------------------------------- */ /* -------------------------------------------- */
async finDeRound(options = { terminer: false }) { async finDeRound(options = { terminer: false }) {
for (let combatant of this.data.combatants) { for (let combatant of this.combatants) {
if (combatant.actor) { if (combatant.actor) {
await combatant.actor.finDeRound(options); await combatant.actor.finDeRound(options);
} }
@@ -77,35 +78,30 @@ export class RdDCombatManager extends Combat {
/************************************************************************************/ /************************************************************************************/
async rollInitiative(ids, formula = undefined, messageOptions = {}) { async rollInitiative(ids, formula = undefined, messageOptions = {}) {
console.log(`${game.data.system.data.title} | Combat.rollInitiative()`, ids, formula, messageOptions); console.log(`${game.system.title} | Combat.rollInitiative()`, ids, formula, messageOptions);
// Structure input data
ids = typeof ids === "string" ? [ids] : ids; ids = typeof ids === "string" ? [ids] : ids;
const currentId = this.combatant._id; const currentId = this.combatant._id;
// calculate initiative // calculate initiative
for (let cId = 0; cId < ids.length; cId++) { for (let cId = 0; cId < ids.length; cId++) {
const combatant = this.combatants.get(ids[cId]); const combatant = this.combatants.get(ids[cId]);
//if (!c) return results; let rollFormula = formula ?? RdDCombatManager.formuleInitiative(2, 10, 0, 0);
if (!formula) {
let rollFormula = formula; // Init per default if (combatant.actor.type == 'creature' || combatant.actor.type == 'entite') {
if (!rollFormula) { const competence = combatant.actor.items.find(it => it.system.iscombat)
let armeCombat, competence; if (competence) {
if (combatant.actor.data.type == 'creature' || combatant.actor.data.type == 'entite') { rollFormula = RdDCombatManager.formuleInitiative(2, competence.system.carac_value, competence.system.niveau, 0);
for (const competenceItemData of combatant.actor.data.items) {
if (competenceItemData.data.data.iscombat) {
competence = duplicate(competenceItemData);
}
} }
rollFormula = "2+( (" + RdDCombatManager.calculInitiative(competence.data.niveau, competence.data.carac_value) + ")/100)";
} else { } else {
for (const itemData of combatant.actor.data.items) { const armeCombat = combatant.actor.itemTypes['arme'].find(it => it.system.equipe)
if (itemData.type == "arme" && itemData.data.equipe) { const compName = (armeCombat == undefined) ? "Corps à corps" : armeCombat.system.competence;
armeCombat = duplicate(itemData); const competence = RdDItemCompetence.findCompetence(combatant.actor.items, compName);
} if (competence) {
const carac = combatant.actor.system.carac[competence.system.defaut_carac].value;
const niveau = competence.system.niveau;
const bonusEcaille = (armeCombat?.system.magique) ? armeCombat.system.ecaille_efficacite : 0;
rollFormula = RdDCombatManager.formuleInitiative(2, carac, niveau, bonusEcaille);
} }
let compName = (armeCombat == undefined) ? "Corps à corps" : armeCombat.data.competence;
competence = RdDItemCompetence.findCompetence(combatant.actor.data.items, compName);
let bonusEcaille = (armeCombat && armeCombat.data.magique) ? armeCombat.data.ecaille_efficacite : 0;
rollFormula = "2+( (" + RdDCombatManager.calculInitiative(competence.data.niveau, Misc.data(combatant.actor).data.carac[competence.data.defaut_carac].value, bonusEcaille) + ")/100)";
} }
} }
//console.log("Combatat", c); //console.log("Combatat", c);
@@ -142,6 +138,10 @@ export class RdDCombatManager extends Combat {
return this; return this;
}; };
static formuleInitiative(rang, carac, niveau, bonusMalus) {
return `${rang} +( (${RdDCombatManager.calculInitiative(niveau, carac, bonusMalus)} )/100)`;
}
/* -------------------------------------------- */ /* -------------------------------------------- */
static calculInitiative(niveau, caracValue, bonusEcaille = 0) { static calculInitiative(niveau, caracValue, bonusEcaille = 0) {
let base = niveau + Math.floor(caracValue / 2); let base = niveau + Math.floor(caracValue / 2);
@@ -150,63 +150,77 @@ export class RdDCombatManager extends Combat {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
/** Retourne une liste triée d'armes avec le split arme1 main / arme 2 main */ /** Retourne une liste triée d'actions d'armes avec le split arme1 main / arme 2 main */
static finalizeArmeList(armes, competences, carac) { static listActionsArmes(armes, competences, carac) {
// Gestion des armes 1/2 mains // Gestion des armes 1/2 mains
let armesEquipe = []; let actionsArme = [];
for (const arme of armes) { for (const arme of armes) {
let armeData = duplicate(Misc.data(arme)); let action = duplicate(arme)
if (armeData.data.equipe) { if (action.system.equipe) {
let compData = competences.map(c => Misc.data(c)).find(c => c.name == armeData.data.competence); let compData = competences.find(c => c.name == action.system.competence)
armesEquipe.push(armeData); actionsArme.push(action);
armeData.data.dommagesReels = Number(armeData.data.dommages); action.action = 'attaque';
armeData.data.niveau = compData.data.niveau; action.system.dommagesReels = Number(action.system.dommages);
armeData.data.initiative = RdDCombatManager.calculInitiative(compData.data.niveau, carac[compData.data.defaut_carac].value); action.system.niveau = compData.system.niveau;
action.system.initiative = RdDCombatManager.calculInitiative(compData.system.niveau, carac[compData.system.defaut_carac].value);
// Dupliquer les armes pouvant être à 1 main et 2 mains en patchant la compétence // Dupliquer les armes pouvant être à 1 main et 2 mains en patchant la compétence
if (armeData.data.unemain && !armeData.data.deuxmains) { if (action.system.unemain && !action.system.deuxmains) {
armeData.data.mainInfo = "(1m)"; action.system.mainInfo = "(1m)";
} else if (!armeData.data.unemain && armeData.data.deuxmains) { } else if (!action.system.unemain && action.system.deuxmains) {
armeData.data.mainInfo = "(2m)"; action.system.mainInfo = "(2m)";
} else if (armeData.data.unemain && armeData.data.deuxmains) { } else if (action.system.unemain && action.system.deuxmains) {
armeData.data.mainInfo = "(1m)"; action.system.mainInfo = "(1m)";
const comp2m = armeData.data.competence.replace(" 1 main", " 2 mains"); // Replace ! const comp2m = action.system.competence.replace(" 1 main", " 2 mains"); // Replace !
const comp = Misc.data(competences.find(c => c.name == comp2m)); const comp = competences.find(c => c.name == comp2m)
const arme2main = duplicate(armeData); const arme2main = duplicate(action);
arme2main.data.mainInfo = "(2m)"; arme2main.system.mainInfo = "(2m)";
arme2main.data.niveau = comp.data.niveau; arme2main.system.niveau = comp.system.niveau;
arme2main.data.competence = comp2m; arme2main.system.competence = comp2m;
arme2main.data.initiative = RdDCombatManager.calculInitiative(arme2main.data.niveau, carac[comp.data.defaut_carac].value); arme2main.system.initiative = RdDCombatManager.calculInitiative(arme2main.system.niveau, carac[comp.system.defaut_carac].value);
armesEquipe.push(arme2main); actionsArme.push(arme2main);
const containsSlash = armeData.data.dommages.includes("/"); const containsSlash = action.system.dommages.includes("/");
if (containsSlash) { if (containsSlash) {
const tableauDegats = armeData.data.dommages.split("/"); const tableauDegats = action.system.dommages.split("/");
armeData.data.dommagesReels = Number(tableauDegats[0]); action.system.dommagesReels = Number(tableauDegats[0]);
arme2main.data.dommagesReels = Number(tableauDegats[1]); arme2main.system.dommagesReels = Number(tableauDegats[1]);
} }
else{ else{
ui.notifications.info("Les dommages de l'arme à 1/2 mains " + armeData.name + " ne sont pas corrects (ie sous la forme X/Y)"); ui.notifications.info("Les dommages de l'arme à 1/2 mains " + action.name + " ne sont pas corrects (ie sous la forme X/Y)");
} }
} }
} }
} }
return armesEquipe.sort(Misc.ascending(armeData => armeData.name + (armeData.data.mainInfo ?? ''))); return actionsArme.sort(Misc.ascending(armeData => armeData.name + (armeData.system.mainInfo ?? '')));
}
static listActionsPossessions(actor) {
return RdDCombatManager._indexActions(actor.getPossessions().map(p =>
{
return {
name: p.name,
action: 'conjurer',
system: {
competence: p.name,
possessionid: p.system.possessionid,
}
}
}));
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static buildListeActionsCombat(combatant) { static listActionsCombat(combatant) {
if (combatant.actor == undefined) { const actor = combatant.actor;
ui.notifications.warn(`Le combatant ${combatant.name} n'est pas associé à un acteur, impossible de déterminer ses actions de combat!`) let actions = RdDCombatManager.listActionsPossessions(actor);
return []; if (actions.length>0) {
return actions;
} }
const actorData = Misc.data(combatant.actor); let items = actor.items;
let items = combatant.actor.data.items; if (actor.isCreature()) {
let actions = []
if (combatant.actor.isCreature()) {
actions = actions.concat(items.filter(it => RdDItemCompetenceCreature.isCompetenceAttaque(it)) actions = actions.concat(items.filter(it => RdDItemCompetenceCreature.isCompetenceAttaque(it))
.map(competence => RdDItemCompetenceCreature.toArme(competence))); .map(competence => RdDItemCompetenceCreature.toActionArme(competence)));
} else { } else {
// Recupération des items 'arme' // Recupération des items 'arme'
let armes = items.filter(it => RdDItemArme.isArmeUtilisable(it)) let armes = items.filter(it => RdDItemArme.isArmeUtilisable(it))
@@ -214,14 +228,17 @@ export class RdDCombatManager extends Combat {
.concat(RdDItemArme.mainsNues()); .concat(RdDItemArme.mainsNues());
let competences = items.filter(it => it.type == 'competence'); let competences = items.filter(it => it.type == 'competence');
actions = actions.concat(RdDCombatManager.finalizeArmeList(armes, competences, actorData.data.carac)); actions = actions.concat(RdDCombatManager.listActionsArmes(armes, competences, actor.system.carac));
if (actorData.data.attributs.hautrevant.value) { if (actor.system.attributs.hautrevant.value) {
actions.push({ name: "Draconic", data: { initOnly: true, competence: "Draconic" } }); actions.push({ name: "Draconic", action: 'haut-reve', system: { initOnly: true, competence: "Draconic" } });
} }
} }
actions.push({ name: "Autre action", data: { initOnly: true, competence: "Autre action" } }); return RdDCombatManager._indexActions(actions);
}
static _indexActions(actions) {
for (let index = 0; index < actions.length; index++) { for (let index = 0; index < actions.length; index++) {
actions[index].index = index; actions[index].index = index;
} }
@@ -232,18 +249,18 @@ export class RdDCombatManager extends Combat {
static processPremierRoundInit() { static processPremierRoundInit() {
// Check if we have the whole init ! // Check if we have the whole init !
if (Misc.isUniqueConnectedGM() && game.combat.current.round == 1) { if (Misc.isUniqueConnectedGM() && game.combat.current.round == 1) {
let initMissing = game.combat.data.combatants.find(it => !it.initiative); let initMissing = game.combat.combatants.find(it => !it.initiative);
if (!initMissing) { // Premier round ! if (!initMissing) { // Premier round !
for (let combatant of game.combat.data.combatants) { for (let combatant of game.combat.combatants) {
let arme = combatant.initiativeData?.arme; let action = combatant.initiativeData?.arme;
//console.log("Parsed !!!", combatant, initDone, game.combat.current, arme); //console.log("Parsed !!!", combatant, initDone, game.combat.current, arme);
if (arme && arme.type == "arme") { if (action && action.type == "arme") {
for (let initData of premierRoundInit) { for (let initData of premierRoundInit) {
if (arme.data.initpremierround.toLowerCase().includes(initData.pattern)) { if (Grammar.toLowerCaseNoAccentNoSpace(action.system.initpremierround).includes(initData.pattern)) {
let msg = `<h4>L'initiative de ${combatant.actor.name} a été modifiée !</h4> let msg = `<h4>L'initiative de ${combatant.actor.name} a été modifiée !</h4>
<hr> <hr>
<div> <div>
Etant donné son ${arme.name}, son initative pour ce premier round est désormais de ${initData.init}. Etant donné son ${action.name}, son initative pour ce premier round est désormais de ${initData.init}.
</div>` </div>`
ChatMessage.create({ content: msg }); ChatMessage.create({ content: msg });
game.combat.setInitiative(combatant._id, initData.init); game.combat.setInitiative(combatant._id, initData.init);
@@ -281,7 +298,7 @@ export class RdDCombatManager extends Combat {
].concat(options); ].concat(options);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static rollInitiativeCompetence(combatantId, arme) { static rollInitiativeAction(combatantId, action) {
const combatant = game.combat.combatants.get(combatantId); const combatant = game.combat.combatants.get(combatantId);
if (combatant.actor == undefined) { if (combatant.actor == undefined) {
ui.notifications.warn(`Le combatant ${combatant.name} n'est pas associé à un acteur, impossible de déterminer ses actions de combat!`) ui.notifications.warn(`Le combatant ${combatant.name} n'est pas associé à un acteur, impossible de déterminer ses actions de combat!`)
@@ -299,34 +316,40 @@ export class RdDCombatManager extends Combat {
} else if (combatant.actor.getSurprise() == "demi") { } else if (combatant.actor.getSurprise() == "demi") {
initOffset = 0; initOffset = 0;
initInfo = "Demi Surprise" initInfo = "Demi Surprise"
} else if (arme.name == "Autre action") { } else if (action.action == 'conjurer') {
initOffset = 10;
caracForInit = combatant.actor.getReveActuel();
initInfo = "Possession"
} else if (action.action == 'autre') {
initOffset = 2; initOffset = 2;
initInfo = "Autre Action" initInfo = "Autre Action"
} else if (arme.name == "Draconic") { } else if (action.action == 'haut-reve') {
initOffset = 9; initOffset = 9;
initInfo = "Draconic" initInfo = "Draconic"
} else { } else {
compData = Misc.data(RdDItemCompetence.findCompetence(combatant.actor.data.items, arme.data.competence)); compData = RdDItemCompetence.findCompetence(combatant.actor.items, arme.system.competence);
compNiveau = compData.data.niveau; compNiveau = compData.system.niveau;
initInfo = arme.name + " / " + arme.data.competence; initInfo = action.name + " / " + action.system.competence;
if (combatant.actor.data.type == 'creature' || combatant.actor.data.type == 'entite') {
caracForInit = compData.data.carac_value; if (combatant.actor.type == 'creature' || combatant.actor.type == 'entite') {
if (compData.data.categorie == "lancer") { caracForInit = compData.system.carac_value;
initOffset = 7; if (compData.system.categorie == "lancer") {
} initOffset = 7;
else { }
initOffset = 5; else {
} initOffset = 5;
} else { }
caracForInit = Misc.data(combatant.actor).data.carac[compData.data.defaut_carac].value; } else {
initOffset = RdDCombatManager._baseInitOffset(compData.data.categorie, arme); caracForInit = combatant.actor.system.carac[compData.system.defaut_carac].value;
initOffset = RdDCombatManager._baseInitOffset(compData.system.categorie, action);
} }
} }
let malus = combatant.actor.getEtatGeneral(); // Prise en compte état général let malus = combatant.actor.getEtatGeneral(); // Prise en compte état général
// Cas des créatures et entités vs personnages // Cas des créatures et entités vs personnages
let rollFormula = initOffset + "+ ( (" + RdDCombatManager.calculInitiative(compNiveau, caracForInit) + " + " + malus + ") /100)"; let rollFormula = RdDCombatManager.formuleInitiative(initOffset, caracForInit, compNiveau, malus);
// Garder la trace de l'arme/compétence utilisée pour l'iniative // Garder la trace de l'arme/compétence utilisée pour l'iniative
combatant.initiativeData = { arme: arme } // pour reclasser l'init au round 0 combatant.initiativeData = { arme: action } // pour reclasser l'init au round 0
game.combat.rollInitiative(combatantId, rollFormula, { initInfo: initInfo }); game.combat.rollInitiative(combatantId, rollFormula, { initInfo: initInfo });
} }
@@ -338,7 +361,7 @@ export class RdDCombatManager extends Combat {
return 7; return 7;
} }
// Offset de principe pour les armes de jet // Offset de principe pour les armes de jet
switch (arme.data.cac) { switch (arme.system.cac) {
case "empoignade": return 3; case "empoignade": return 3;
case "pugilat": return 4; case "pugilat": return 4;
} }
@@ -349,16 +372,21 @@ export class RdDCombatManager extends Combat {
static displayInitiativeMenu(html, combatantId) { static displayInitiativeMenu(html, combatantId) {
console.log("Combatant ; ", combatantId); console.log("Combatant ; ", combatantId);
const combatant = game.combat.combatants.get(combatantId); const combatant = game.combat.combatants.get(combatantId);
let armesList = RdDCombatManager.buildListeActionsCombat(combatant); if (! (combatant?.actor) ) {
ui.notifications.warn(`Le combatant ${combatant.name ?? combatantId} n'est pas associé à un acteur, impossible de déterminer ses actions de combat!`)
return;
}
let actions = RdDCombatManager.listActionsCombat(combatant);
// Build the relevant submenu // Build the relevant submenu
if (armesList) { if (actions) {
let menuItems = []; let menuItems = [];
for (let arme of armesList) { for (let action of actions) {
menuItems.push({ menuItems.push({
name: arme.data.competence, name: action.system.competence,
icon: "<i class='fas fa-dice-d6'></i>", icon: "<i class='fas fa-dice-d6'></i>",
callback: target => { RdDCombatManager.rollInitiativeCompetence(combatantId, arme) } callback: target => { RdDCombatManager.rollInitiativeAction(combatantId, action) }
}); });
} }
new ContextMenu(html, ".directory-list", menuItems).render(); new ContextMenu(html, ".directory-list", menuItems).render();
@@ -387,7 +415,7 @@ export class RdDCombat {
/* -------------------------------------------- */ /* -------------------------------------------- */
static onUpdateCombat(combat, change, options, userId) { static onUpdateCombat(combat, change, options, userId) {
if (combat.data.round != 0 && combat.turns && combat.data.active) { if (combat.round != 0 && combat.turns && combat.active) {
RdDCombat.combatNouveauTour(combat); RdDCombat.combatNouveauTour(combat);
} }
} }
@@ -428,8 +456,8 @@ export class RdDCombat {
} }
else { else {
const defender = target?.actor; const defender = target?.actor;
const defenderTokenId = target?.data._id; const defenderTokenId = target?.id;
if ( defender.type == 'entite' && defender.data.data.definition.typeentite == 'nonincarne') { if ( defender.type == 'entite' && defender.system.definition.typeentite == ENTITE_NONINCARNE) {
ui.notifications.warn("Vous ne pouvez pas cibler une entité non incarnée !!!!"); ui.notifications.warn("Vous ne pouvez pas cibler une entité non incarnée !!!!");
} else { } else {
return this.create(attacker, defender, defenderTokenId, target) return this.create(attacker, defender, defenderTokenId, target)
@@ -465,15 +493,15 @@ export class RdDCombat {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static onMsgEncaisser(data) { static onMsgEncaisser(msg) {
let defender = canvas.tokens.get(data.defenderTokenId).actor; let defender = canvas.tokens.get(msg.defenderTokenId).actor;
if (Misc.isOwnerPlayerOrUniqueConnectedGM()) { if (Misc.isOwnerPlayerOrUniqueConnectedGM()) {
let attackerRoll = data.attackerRoll; let attackerRoll = msg.attackerRoll;
let attacker = data.attackerId ? game.actors.get(data.attackerId) : null; let attacker = msg.attackerId ? game.actors.get(msg.attackerId) : null;
defender.encaisserDommages(attackerRoll, attacker); defender.encaisserDommages(attackerRoll, attacker);
RdDCombat._deleteDefense(attackerRoll.passeArme); const rddCombat = RdDCombat.createForAttackerAndDefender(msg.attackerId, msg.defenderTokenId);
RdDCombat._deleteAttaque(data.attackerId); rddCombat?.removeChatMessageActionsPasseArme(attackerRoll.passeArme);
} }
} }
@@ -482,11 +510,8 @@ export class RdDCombat {
let defenderToken = canvas.tokens.get(msg.defenderTokenId); let defenderToken = canvas.tokens.get(msg.defenderTokenId);
if (defenderToken && Misc.isUniqueConnectedGM()) { if (defenderToken && Misc.isUniqueConnectedGM()) {
const rddCombat = RdDCombat.createForAttackerAndDefender(msg.attackerId, msg.defenderTokenId); const rddCombat = RdDCombat.createForAttackerAndDefender(msg.attackerId, msg.defenderTokenId);
if (rddCombat) { rddCombat?.removeChatMessageActionsPasseArme(msg.defenderRoll.passeArme);
const defenderRoll = msg.defenderRoll; rddCombat?._chatMessageDefense(msg.paramChatDefense, msg.defenderRoll);
rddCombat.removeChatMessageActionsPasseArme(defenderRoll.passeArme);
rddCombat._chatMessageDefense(msg.paramChatDefense, msg.defenderRoll);
}
} }
} }
@@ -533,8 +558,8 @@ export class RdDCombat {
this.attacker = attacker; this.attacker = attacker;
this.defender = defender; this.defender = defender;
this.target = target; this.target = target;
this.attackerId = this.attacker.data._id; this.attackerId = this.attacker.id;
this.defenderId = this.defender.data._id; this.defenderId = this.defender.id;
this.defenderTokenId = defenderTokenId; this.defenderTokenId = defenderTokenId;
} }
@@ -666,7 +691,7 @@ export class RdDCombat {
if (!await this.accorderEntite('avant-attaque')) { if (!await this.accorderEntite('avant-attaque')) {
return; return;
} }
if (arme.data.cac == 'empoignade' && this.attacker.isCombatTouche()) { if (arme.system.cac == 'empoignade' && this.attacker.isCombatTouche()) {
ChatMessage.create({ ChatMessage.create({
alias: this.attacker.name, alias: this.attacker.name,
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.attacker.name), whisper: ChatUtility.getWhisperRecipientsAndGMs(this.attacker.name),
@@ -709,7 +734,7 @@ export class RdDCombat {
_prepareAttaque(competence, arme) { _prepareAttaque(competence, arme) {
let rollData = { let rollData = {
passeArme: randomID(16), passeArme: randomID(16),
mortalite: arme?.data.mortalite, mortalite: arme?.system.mortalite,
coupsNonMortels: false, coupsNonMortels: false,
competence: competence, competence: competence,
surprise: this.attacker.getSurprise(true), surprise: this.attacker.getSurprise(true),
@@ -726,8 +751,8 @@ export class RdDCombat {
} }
else { else {
// sans armes: à mains nues // sans armes: à mains nues
const niveau = competence.data.niveau; const niveau = competence.system.niveau;
const init = RdDCombatManager.calculInitiative(niveau, Misc.templateData(this.attacker).carac['melee'].value); const init = RdDCombatManager.calculInitiative(niveau, this.attacker.system.carac['melee'].value);
rollData.arme = RdDItemArme.mainsNues({ niveau: niveau, initiative: init }); rollData.arme = RdDItemArme.mainsNues({ niveau: niveau, initiative: init });
} }
return rollData; return rollData;
@@ -740,9 +765,9 @@ export class RdDCombat {
// force toujours, sauf empoignade // force toujours, sauf empoignade
// finesse seulement en mélée, pour l'empoignade, ou si la difficulté libre est de -1 minimum // finesse seulement en mélée, pour l'empoignade, ou si la difficulté libre est de -1 minimum
// rapidité seulement en mêlée, si l'arme le permet, et si la difficulté libre est de -1 minimum // rapidité seulement en mêlée, si l'arme le permet, et si la difficulté libre est de -1 minimum
const isForce = !rollData.arme.data.empoignade; const isForce = !rollData.arme.system.empoignade;
const isFinesse = rollData.arme.data.empoignade || isMeleeDiffNegative; const isFinesse = rollData.arme.system.empoignade || isMeleeDiffNegative;
const isRapide = !rollData.arme.data.empoignade && isMeleeDiffNegative && rollData.arme.data.rapide; const isRapide = !rollData.arme.system.empoignade && isMeleeDiffNegative && rollData.arme.system.rapide;
// si un seul choix possible, le prendre // si un seul choix possible, le prendre
if (isForce && !isFinesse && !isRapide) { if (isForce && !isFinesse && !isRapide) {
return await this.choixParticuliere(rollData, "force"); return await this.choixParticuliere(rollData, "force");
@@ -774,10 +799,10 @@ export class RdDCombat {
async _onAttaqueNormale(attackerRoll) { async _onAttaqueNormale(attackerRoll) {
console.log("RdDCombat.onAttaqueNormale >>>", attackerRoll); console.log("RdDCombat.onAttaqueNormale >>>", attackerRoll);
attackerRoll.dmg = RdDBonus.dmg(attackerRoll, this.attacker.getBonusDegat(), this.defender.isEntiteCauchemar()); attackerRoll.dmg = RdDBonus.dmg(attackerRoll, this.attacker.getBonusDegat(), this.defender.isEntite());
let defenderRoll = { attackerRoll: attackerRoll, passeArme: attackerRoll.passeArme, show: {} } let defenderRoll = { attackerRoll: attackerRoll, passeArme: attackerRoll.passeArme, show: {} }
attackerRoll.show = { attackerRoll.show = {
cible: this.target ? this.defender.data.name : 'la cible', cible: this.target ? this.defender.system.name : 'la cible',
isRecul: (attackerRoll.particuliere == 'force' || attackerRoll.tactique == 'charge') isRecul: (attackerRoll.particuliere == 'force' || attackerRoll.tactique == 'charge')
} }
await RdDResolutionTable.displayRollData(attackerRoll, this.attacker, 'chat-resultat-attaque.html'); await RdDResolutionTable.displayRollData(attackerRoll, this.attacker, 'chat-resultat-attaque.html');
@@ -798,7 +823,7 @@ export class RdDCombat {
/* -------------------------------------------- */ /* -------------------------------------------- */
async _sendMessageDefense(attackerRoll, defenderRoll, essaisPrecedents = undefined) { async _sendMessageDefense(attackerRoll, defenderRoll, essaisPrecedents = undefined) {
console.log("RdDCombat._sendMessageDefense", attackerRoll, defenderRoll, essaisPrecedents, " / ", this.attacker, this.target, this.attackerId, attackerRoll.competence.data.categorie); console.log("RdDCombat._sendMessageDefense", attackerRoll, defenderRoll, essaisPrecedents, " / ", this.attacker, this.target, this.attackerId, attackerRoll.competence.system.categorie);
this.removeChatMessageActionsPasseArme(attackerRoll.passeArme); this.removeChatMessageActionsPasseArme(attackerRoll.passeArme);
if (essaisPrecedents) { if (essaisPrecedents) {
@@ -806,16 +831,16 @@ export class RdDCombat {
} }
// # utilisation esquive // # utilisation esquive
const corpsACorps = Misc.data(this.defender.getCompetence("Corps à corps", { onMessage: it => console.info(it, this.defender) })); const corpsACorps = this.defender.getCompetence("Corps à corps", { onMessage: it => console.info(it, this.defender) });
const esquives = duplicate(this.defender.getCompetences("esquive", { onMessage: it => console.info(it, this.defender) }).map(c => Misc.data(c))); const esquives = duplicate(this.defender.getCompetences("esquive", { onMessage: it => console.info(it, this.defender) }))
esquives.forEach(e => e.usages = e?.id ? this.defender.getItemUse(e.id) : 0); esquives.forEach(e => e.usages = e?.id ? this.defender.getItemUse(e.id) : 0);
const paramChatDefense = { const paramChatDefense = {
passeArme: attackerRoll.passeArme, passeArme: attackerRoll.passeArme,
essais: attackerRoll.essais, essais: attackerRoll.essais,
isPossession: this.isPossession(attackerRoll), isPossession: this.isPossession(attackerRoll),
defender: Misc.data(this.defender), defender: this.defender,
attacker: Misc.data(this.attacker), attacker: this.attacker,
attackerId: this.attackerId, attackerId: this.attackerId,
esquives: esquives, esquives: esquives,
defenderTokenId: this.defenderTokenId, defenderTokenId: this.defenderTokenId,
@@ -823,7 +848,7 @@ export class RdDCombat {
armes: this._filterArmesParade(this.defender, attackerRoll.competence, attackerRoll.arme), armes: this._filterArmesParade(this.defender, attackerRoll.competence, attackerRoll.arme),
diffLibre: attackerRoll.ajustements?.diffLibre?.value ?? 0, diffLibre: attackerRoll.ajustements?.diffLibre?.value ?? 0,
attaqueParticuliere: attackerRoll.particuliere, attaqueParticuliere: attackerRoll.particuliere,
attaqueCategorie: attackerRoll.competence.data.categorie, attaqueCategorie: attackerRoll.competence.system.categorie,
attaqueArme: attackerRoll.arme, attaqueArme: attackerRoll.arme,
surprise: this.defender.getSurprise(true), surprise: this.defender.getSurprise(true),
dmg: attackerRoll.dmg, dmg: attackerRoll.dmg,
@@ -855,8 +880,8 @@ export class RdDCombat {
// envoyer le message au destinataire // envoyer le message au destinataire
game.socket.emit(SYSTEM_SOCKET_ID, { game.socket.emit(SYSTEM_SOCKET_ID, {
msg: "msg_defense", data: { msg: "msg_defense", data: {
attackerId: this.attacker?.data._id, attackerId: this.attacker?.id,
defenderId: this.defender?.data._id, defenderId: this.defender?.id,
defenderTokenId: this.defenderTokenId, defenderTokenId: this.defenderTokenId,
defenderRoll: defenderRoll, defenderRoll: defenderRoll,
paramChatDefense: paramChatDefense, paramChatDefense: paramChatDefense,
@@ -867,13 +892,11 @@ export class RdDCombat {
/* -------------------------------------------- */ /* -------------------------------------------- */
_filterArmesParade(defender, competence) { _filterArmesParade(defender, competence) {
let items = defender.data.items; let items = defender.items.filter(it => RdDItemArme.isArmeUtilisable(it) || RdDItemCompetenceCreature.isCompetenceParade(it))
items = items.filter(it => RdDItemArme.isArmeUtilisable(it) || RdDItemCompetenceCreature.isCompetenceParade(it))
.map(Misc.data);
for (let item of items) { for (let item of items) {
item.data.nbUsage = defender.getItemUse(item._id); // Ajout du # d'utilisation ce round item.system.nbUsage = defender.getItemUse(item.id); // Ajout du # d'utilisation ce round
} }
switch (competence.data.categorie) { switch (competence.system.categorie) {
case 'tir': case 'tir':
case 'lancer': case 'lancer':
return items.filter(item => RdDItemArme.getCategorieParade(item) == 'boucliers') return items.filter(item => RdDItemArme.getCategorieParade(item) == 'boucliers')
@@ -892,7 +915,7 @@ export class RdDCombat {
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.attacker.name), whisper: ChatUtility.getWhisperRecipientsAndGMs(this.attacker.name),
content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-demande-attaque-etotal.html', { content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-demande-attaque-etotal.html', {
attackerId: this.attackerId, attackerId: this.attackerId,
attacker: Misc.data(this.attacker), attacker: this.attacker,
defenderTokenId: this.defenderTokenId, defenderTokenId: this.defenderTokenId,
essais: attackerRoll.essais essais: attackerRoll.essais
}) })
@@ -905,7 +928,7 @@ export class RdDCombat {
console.log("RdDCombat._onEchecTotal >>>", rollData); console.log("RdDCombat._onEchecTotal >>>", rollData);
const arme = rollData.arme; const arme = rollData.arme;
const avecArme = !['', 'sans-armes', 'armes-naturelles'].includes(arme?.data.categorie_parade ?? ''); const avecArme = !['', 'sans-armes', 'armes-naturelles'].includes(arme?.system.categorie_parade ?? '');
const action = (rollData.attackerRoll ? (arme ? "la parade" : "l'esquive") : "l'attaque"); const action = (rollData.attackerRoll ? (arme ? "la parade" : "l'esquive") : "l'attaque");
ChatUtility.createChatWithRollMode(this.defender.name, { ChatUtility.createChatWithRollMode(this.defender.name, {
content: `<strong>Maladresse à ${action}!</strong> ` + await RdDRollTables.getMaladresse({ arme: avecArme }) content: `<strong>Maladresse à ${action}!</strong> ` + await RdDRollTables.getMaladresse({ arme: avecArme })
@@ -924,7 +947,7 @@ export class RdDCombat {
console.log("RdDCombat.choixParticuliere >>>", rollData, choix); console.log("RdDCombat.choixParticuliere >>>", rollData, choix);
if (choix != "rapidite") { if (choix != "rapidite") {
this.attacker.incDecItemUse(rollData.arme._id); this.attacker.incDecItemUse(rollData.arme.id);
} }
this.removeChatMessageActionsPasseArme(rollData.passeArme); this.removeChatMessageActionsPasseArme(rollData.passeArme);
@@ -936,10 +959,10 @@ export class RdDCombat {
async parade(attackerRoll, armeParadeId) { async parade(attackerRoll, armeParadeId) {
const arme = this.defender.getArmeParade(armeParadeId); const arme = this.defender.getArmeParade(armeParadeId);
console.log("RdDCombat.parade >>>", attackerRoll, armeParadeId, arme); console.log("RdDCombat.parade >>>", attackerRoll, armeParadeId, arme);
const competence = Misc.templateData(arme)?.competence; const competence = arme?.system?.competence;
if (competence == undefined) if (competence == undefined)
{ {
console.error("Pas de compétence de parade associée à ", arme) ; console.error("Pas de compétence de parade associée à ", arme?.name, armeParadeId) ;
return; return;
} }
@@ -971,12 +994,12 @@ export class RdDCombat {
passeArme: attackerRoll.passeArme, passeArme: attackerRoll.passeArme,
diffLibre: attackerRoll.diffLibre, diffLibre: attackerRoll.diffLibre,
attackerRoll: attackerRoll, attackerRoll: attackerRoll,
competence: Misc.data(this.defender.getCompetence(competenceParade)), competence: this.defender.getCompetence(competenceParade),
arme: armeParade, arme: armeParade,
surprise: this.defender.getSurprise(true), surprise: this.defender.getSurprise(true),
needParadeSignificative: ReglesOptionelles.isUsing('categorieParade') && RdDItemArme.needParadeSignificative(attackerRoll.arme, armeParade), needParadeSignificative: ReglesOptionelles.isUsing('categorieParade') && RdDItemArme.needParadeSignificative(attackerRoll.arme, armeParade),
needResist: RdDItemArme.needArmeResist(attackerRoll.arme, armeParade), needResist: RdDItemArme.needArmeResist(attackerRoll.arme, armeParade),
carac: Misc.templateData(this.defender).carac, carac: this.defender.system.carac,
show: {} show: {}
}; };
@@ -1005,8 +1028,7 @@ export class RdDCombat {
await this.computeRecul(defenderRoll); await this.computeRecul(defenderRoll);
await this.computeDeteriorationArme(defenderRoll); await this.computeDeteriorationArme(defenderRoll);
await RdDResolutionTable.displayRollData(defenderRoll, this.defender, 'chat-resultat-parade.html'); await RdDResolutionTable.displayRollData(defenderRoll, this.defender, 'chat-resultat-parade.html');
this.removeChatMessageActionsPasseArme(defenderRoll.passeArme);
RdDCombat._deleteDefense(defenderRoll.passeArme);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@@ -1021,7 +1043,7 @@ export class RdDCombat {
/* -------------------------------------------- */ /* -------------------------------------------- */
async esquive(attackerRoll, compId, compName) { async esquive(attackerRoll, compId, compName) {
const esquive = Misc.data(this.defender.getCompetence(compId) ?? this.defender.getCompetence(compName)); const esquive = this.defender.getCompetence(compId) ?? this.defender.getCompetence(compName)
if (esquive == undefined) { if (esquive == undefined) {
ui.notifications.error(this.defender.name + " n'a pas de compétence " + compName); ui.notifications.error(this.defender.name + " n'a pas de compétence " + compName);
return; return;
@@ -1055,7 +1077,7 @@ export class RdDCombat {
competence: competence, competence: competence,
surprise: this.defender.getSurprise(true), surprise: this.defender.getSurprise(true),
surpriseDefenseur: this.defender.getSurprise(true), surpriseDefenseur: this.defender.getSurprise(true),
carac: Misc.templateData(this.defender).carac, carac: this.defender.system.carac,
show: {} show: {}
}; };
@@ -1077,7 +1099,7 @@ export class RdDCombat {
async _onEsquiveNormale(defenderRoll) { async _onEsquiveNormale(defenderRoll) {
console.log("RdDCombat._onEsquiveNormal >>>", defenderRoll); console.log("RdDCombat._onEsquiveNormal >>>", defenderRoll);
await RdDResolutionTable.displayRollData(defenderRoll, this.defender, 'chat-resultat-esquive.html'); await RdDResolutionTable.displayRollData(defenderRoll, this.defender, 'chat-resultat-esquive.html');
RdDCombat._deleteDefense(defenderRoll.passeArme); this.removeChatMessageActionsPasseArme(defenderRoll.passeArme);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@@ -1105,11 +1127,11 @@ export class RdDCombat {
const dmg = attackerRoll.dmg.dmgArme + attackerRoll.dmg.dmgActor; const dmg = attackerRoll.dmg.dmgArme + attackerRoll.dmg.dmgActor;
let arme = defenderRoll.arme; let arme = defenderRoll.arme;
let resistance = Misc.toInt(arme.data.resistance); let resistance = Misc.toInt(arme.system.resistance);
if (arme.data.magique) { if (arme.system.magique) {
defenderRoll.show.deteriorationArme = 'resiste'; // Par défaut defenderRoll.show.deteriorationArme = 'resiste'; // Par défaut
if (arme.data.resistance_magique == undefined) arme.data.resistance_magique = 0; // Quick fix if (arme.system.resistance_magique == undefined) arme.system.resistance_magique = 0; // Quick fix
if (dmg > arme.data.resistance_magique) { // Jet uniquement si dommages supérieur à résistance magique (cf. 274) if (dmg > arme.system.resistance_magique) { // Jet uniquement si dommages supérieur à résistance magique (cf. 274)
// Jet de résistance de l'arme de parade (p.132) // Jet de résistance de l'arme de parade (p.132)
let resistRoll = await RdDResolutionTable.rollData({ let resistRoll = await RdDResolutionTable.rollData({
caracValue: resistance, caracValue: resistance,
@@ -1117,11 +1139,11 @@ export class RdDCombat {
showDice: HIDE_DICE showDice: HIDE_DICE
}); });
if (!resistRoll.rolled.isSuccess) { if (!resistRoll.rolled.isSuccess) {
let perteResistance = (dmg - arme.data.resistance_magique) let perteResistance = (dmg - arme.system.resistance_magique)
resistance -= perteResistance; resistance -= perteResistance;
defenderRoll.show.deteriorationArme = resistance <= 0 ? 'brise' : 'perte'; defenderRoll.show.deteriorationArme = resistance <= 0 ? 'brise' : 'perte';
defenderRoll.show.perteResistance = perteResistance; defenderRoll.show.perteResistance = perteResistance;
this.defender.updateEmbeddedDocuments('Item', [{ _id: defenderRoll.arme._id, 'data.resistance': resistance }]); this.defender.updateEmbeddedDocuments('Item', [{ _id: defenderRoll.arme._id, 'system.resistance': resistance }]);
} }
} }
} else { } else {
@@ -1137,14 +1159,14 @@ export class RdDCombat {
resistance -= dmg; resistance -= dmg;
defenderRoll.show.deteriorationArme = resistance <= 0 ? 'brise' : 'perte'; defenderRoll.show.deteriorationArme = resistance <= 0 ? 'brise' : 'perte';
defenderRoll.show.perteResistance = dmg; defenderRoll.show.perteResistance = dmg;
this.defender.updateEmbeddedDocuments('Item', [{ _id: defenderRoll.arme._id, 'data.resistance': resistance }]); this.defender.updateEmbeddedDocuments('Item', [{ _id: defenderRoll.arme._id, 'system.resistance': resistance }]);
} }
} }
// Si l'arme de parade n'est pas un bouclier, jet de désarmement (p.132) // Si l'arme de parade n'est pas un bouclier, jet de désarmement (p.132)
if (ReglesOptionelles.isUsing('defenseurDesarme') && resistance > 0 && RdDItemArme.getCategorieParade(defenderRoll.arme) != 'boucliers') { if (ReglesOptionelles.isUsing('defenseurDesarme') && resistance > 0 && RdDItemArme.getCategorieParade(defenderRoll.arme) != 'boucliers') {
let desarme = await RdDResolutionTable.rollData({ let desarme = await RdDResolutionTable.rollData({
caracValue: this.defender.getForce(), caracValue: this.defender.getForce(),
finalLevel: Misc.toInt(defenderRoll.competence.data.niveau) - dmg, finalLevel: Misc.toInt(defenderRoll.competence.system.niveau) - dmg,
showDice: HIDE_DICE showDice: HIDE_DICE
}); });
defenderRoll.show.desarme = desarme.rolled.isEchec; defenderRoll.show.desarme = desarme.rolled.isEchec;
@@ -1187,7 +1209,7 @@ export class RdDCombat {
_computeImpactRecul(attaque) { _computeImpactRecul(attaque) {
const taille = this.defender.getTaille(); const taille = this.defender.getTaille();
const force = this.attacker.getForce(); const force = this.attacker.getForce();
const dommages = attaque.arme.data.dommagesReels ?? attaque.arme.data.dommages; const dommages = attaque.arme.system.dommagesReels ?? attaque.arme.system.dommages;
return taille - (force + dommages); return taille - (force + dommages);
} }
@@ -1217,7 +1239,6 @@ export class RdDCombat {
} }
}); });
} }
RdDCombat._deleteDefense(attackerRoll.passeArme);
this.removeChatMessageActionsPasseArme(attackerRoll.passeArme); this.removeChatMessageActionsPasseArme(attackerRoll.passeArme);
} }
@@ -1226,12 +1247,12 @@ export class RdDCombat {
async accorderEntite(when = 'avant-encaissement') { async accorderEntite(when = 'avant-encaissement') {
if (when != game.settings.get(SYSTEM_RDD, "accorder-entite-cauchemar") if (when != game.settings.get(SYSTEM_RDD, "accorder-entite-cauchemar")
|| this.defender == undefined || this.defender == undefined
|| !this.defender.isEntiteCauchemar() || !this.defender.isEntite([ENTITE_INCARNE])
|| this.defender.isEntiteCauchemarAccordee(this.attacker)) { || this.defender.isEntiteAccordee(this.attacker)) {
return true; return true;
} }
let rolled = await RdDResolutionTable.roll(this.attacker.getReveActuel(), - Number(Misc.templateData(this.defender).carac.niveau.value)); let rolled = await RdDResolutionTable.roll(this.attacker.getReveActuel(), - Number(this.defender.system.carac.niveau.value));
let message = { let message = {
content: "Jet de points actuels de rêve à " + rolled.finalLevel + RdDResolutionTable.explain(rolled) + "<br>", content: "Jet de points actuels de rêve à " + rolled.finalLevel + RdDResolutionTable.explain(rolled) + "<br>",
@@ -1252,25 +1273,25 @@ export class RdDCombat {
/* -------------------------------------------- */ /* -------------------------------------------- */
static async displayActorCombatStatus(combat, actor) { static async displayActorCombatStatus(combat, actor) {
let data = { let formData = {
combatId: combat._id, combatId: combat._id,
alias: actor.name, alias: actor.name,
etatGeneral: actor.getEtatGeneral(), etatGeneral: actor.getEtatGeneral(),
isSonne: actor.getSonne(), isSonne: actor.getSonne(),
blessuresStatus: actor.computeResumeBlessure(), blessuresStatus: actor.computeResumeBlessure(),
SConst: actor.getSConst(), SConst: actor.getSConst(),
actorId: actor.data._id, actorId: actor.id,
isGrave: false, isGrave: false,
isCritique: false isCritique: false
} }
if (actor.countBlessuresNonSoigneeByName("critiques") > 0) { // Pour éviter le cumul grave + critique if (actor.countBlessuresNonSoigneeByName("critiques") > 0) { // Pour éviter le cumul grave + critique
data.isCritique = true; formData.isCritique = true;
} else if (actor.countBlessuresNonSoigneeByName("graves") > 0) { } else if (actor.countBlessuresNonSoigneeByName("graves") > 0) {
data.isGrave = true; formData.isGrave = true;
} }
ChatUtility.createChatWithRollMode(actor.name, { ChatUtility.createChatWithRollMode(actor.name, {
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-turn-summary.html`, data) content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-turn-summary.html`, formData)
}); });
} }
} }

View File

@@ -7,6 +7,7 @@ import { RdDItemCompetence } from "./item-competence.js";
import { Misc } from "./misc.js"; import { Misc } from "./misc.js";
import { RdDCarac } from "./rdd-carac.js"; import { RdDCarac } from "./rdd-carac.js";
import { RdDDice } from "./rdd-dice.js"; import { RdDDice } from "./rdd-dice.js";
import { RdDMeteo } from "./rdd-meteo.js";
import { RdDNameGen } from "./rdd-namegen.js"; import { RdDNameGen } from "./rdd-namegen.js";
import { RdDResolutionTable } from "./rdd-resolution-table.js"; import { RdDResolutionTable } from "./rdd-resolution-table.js";
import { RdDRollResolutionTable } from "./rdd-roll-resolution-table.js"; import { RdDRollResolutionTable } from "./rdd-roll-resolution-table.js";
@@ -34,6 +35,7 @@ export class RdDCommands {
rddCommands.registerCommand({ path: ["/table", "souffle"], func: (content, msg, params) => RdDRollTables.getSouffle(true), descr: " Tire un Souffle de Dragon" }); rddCommands.registerCommand({ path: ["/table", "souffle"], func: (content, msg, params) => RdDRollTables.getSouffle(true), descr: " Tire un Souffle de Dragon" });
rddCommands.registerCommand({ path: ["/table", "comp"], func: (content, msg, params) => RdDRollTables.getCompetence(true), descr: "Tire une compétence au hasard" }); rddCommands.registerCommand({ path: ["/table", "comp"], func: (content, msg, params) => RdDRollTables.getCompetence(true), descr: "Tire une compétence au hasard" });
rddCommands.registerCommand({ path: ["/table", "tarot"], func: (content, msg, params) => RdDRollTables.getTarot(true), descr: "Tire une carte du Tarot Draconique" }); rddCommands.registerCommand({ path: ["/table", "tarot"], func: (content, msg, params) => RdDRollTables.getTarot(true), descr: "Tire une carte du Tarot Draconique" });
rddCommands.registerCommand({ path: ["/meteo"], func: (content, msg, params) => rddCommands.getMeteo(msg, params), descr: "Propose une météo marine" });
rddCommands.registerCommand({ path: ["/nom"], func: (content, msg, params) => RdDNameGen.getName(msg, params), descr: "Génère un nom aléatoire" }); rddCommands.registerCommand({ path: ["/nom"], func: (content, msg, params) => RdDNameGen.getName(msg, params), descr: "Génère un nom aléatoire" });
rddCommands.registerCommand({ rddCommands.registerCommand({
@@ -274,9 +276,11 @@ export class RdDCommands {
diff = 0; diff = 0;
} }
const caracName = params[0]; const caracName = params[0];
const compName = length > 1 ? Misc.join(params.slice(1, length), ' ') : undefined; let competence = length > 1 ? actors[0].getCompetence(Misc.join(params.slice(1, length), ' ')) : undefined;
for (let actor of actors) { if (competence) {
await actor.rollCaracCompetence(caracName, compName, diff); for (let actor of actors) {
await actor.rollCaracCompetence(caracName, competence.name, diff);
}
} }
return; return;
} }
@@ -354,7 +358,7 @@ export class RdDCommands {
async supprimerSignesDraconiquesEphemeres() { async supprimerSignesDraconiquesEphemeres() {
game.actors.forEach(actor => { game.actors.forEach(actor => {
const ephemeres = actor.filterItems(item => Misc.data(item).type = 'signedraconique' && Misc.data(item).data.ephemere) const ephemeres = actor.items.find(item => item.type = 'signedraconique' && item.system.ephemere)
.map(item => item.id); .map(item => item.id);
if (ephemeres.length > 0) { if (ephemeres.length > 0) {
actor.deleteEmbeddedDocuments("Item", ephemeres); actor.deleteEmbeddedDocuments("Item", ephemeres);
@@ -398,5 +402,8 @@ export class RdDCommands {
} }
return true; return true;
} }
async getMeteo(msg, params) {
return await RdDMeteo.getMeteo();
}
} }

View File

@@ -3,11 +3,11 @@ import { Misc } from "./misc.js";
export class RddCompendiumOrganiser { export class RddCompendiumOrganiser {
static init() { static init() {
Hooks.on('renderCompendium', async (pack, html, data) => RddCompendiumOrganiser.onRenderCompendium(pack, html, data)) Hooks.on('renderCompendium', async (pack, html, compendiumData) => RddCompendiumOrganiser.onRenderCompendium(pack, html, compendiumData))
} }
static async onRenderCompendium(compendium, html, data) { static async onRenderCompendium(compendium, html, compendiumData) {
console.log('onRenderCompendium', compendium, html, data); console.log('onRenderCompendium', compendium, html, compendiumData);
const pack = compendium.collection const pack = compendium.collection
if (pack.metadata.system === SYSTEM_RDD) { if (pack.metadata.system === SYSTEM_RDD) {
html.find('.directory-item').each((i, element) => { html.find('.directory-item').each((i, element) => {

View File

@@ -18,18 +18,19 @@ const tableGemmes = {
export class RdDGemme extends Item { export class RdDGemme extends Item {
static getGemmeTypeOptionList() { static getGemmeTypeOptionList() {
// TODO: look how to map object key-value pairs
let options = "" let options = ""
for (let gemmeKey in tableGemmes) { for (let gemmeKey in tableGemmes) {
let gemmeData = tableGemmes[gemmeKey]; options += `<option value="${gemmeKey}">${tableGemmes[gemmeKey].label}</option>`
options += `<option value="${gemmeKey}">${gemmeData.label}</option>`
} }
return options; return options;
} }
static calculDataDerivees(data) {
data.cout = (data.taille * data.purete) + data.qualite; static calculDataDerivees(gemme) {
data.inertie = 7 - data.purete; gemme.system.cout = (gemme.system.taille * gemme.system.purete) + gemme.system.qualite;
data.enchantabilite = data.taille - data.inertie; gemme.system.inertie = 7 - gemme.system.purete;
gemme.system.enchantabilite = gemme.system.taille - gemme.system.inertie;
} }
} }

View File

@@ -1,6 +1,4 @@
/* -------------------------------------------- */
import { RdDUtility } from "./rdd-utility.js"; import { RdDUtility } from "./rdd-utility.js";
import { Misc } from "./misc.js";
import { RdDCalendrier } from "./rdd-calendrier.js"; import { RdDCalendrier } from "./rdd-calendrier.js";
/* -------------------------------------------- */ /* -------------------------------------------- */
@@ -8,11 +6,11 @@ export class RdDHerbes extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static isHerbeSoin( botaniqueItem ) { static isHerbeSoin( botaniqueItem ) {
return Misc.templateData(botaniqueItem).categorie == 'Soin'; return botaniqueItem.categorie == 'Soin';
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static isHerbeRepos( botaniqueItem ) { static isHerbeRepos( botaniqueItem ) {
return Misc.templateData(botaniqueItem).categorie == 'Repos'; return botaniqueItem.categorie == 'Repos';
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@@ -22,12 +20,11 @@ export class RdDHerbes extends Item {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static buildHerbesList(listHerbes, max) { static buildHerbesList(listeHerbes, max) {
let list = {} let list = {}
for ( let herbe of listHerbes) { for ( let herbe of listeHerbes) {
let herbeData = Misc.templateData(herbe); let brins = max - herbe.system.niveau;
let brins = max - herbeData.niveau; list[herbe.system.name] = `${herbe.system.name} (Bonus: ${herbe.system.niveau}, Brins: ${brins})`;
list[herbe.data.name] = `${herbe.data.name} (Bonus: ${herbeData.niveau}, Brins: ${brins})`;
} }
list['Autre'] = 'Autre (Bonus: variable, Brins: variable)' list['Autre'] = 'Autre (Bonus: variable, Brins: variable)'
return list; return list;
@@ -39,36 +36,39 @@ export class RdDHerbes extends Item {
formData.herbesRepos = this.buildHerbesList(this.herbesRepos, 7); formData.herbesRepos = this.buildHerbesList(this.herbesRepos, 7);
formData.jourMoisOptions = RdDCalendrier.buildJoursMois(); formData.jourMoisOptions = RdDCalendrier.buildJoursMois();
formData.dateActuelle = game.system.rdd.calendrier.getDateFromIndex(); formData.dateActuelle = game.system.rdd.calendrier.getDateFromIndex();
formData.splitDate = game.system.rdd.calendrier.getNumericDateFromIndex(formData.data.prdate); formData.splitDate = game.system.rdd.calendrier.getNumericDateFromIndex(formData.system.prdate);
if (formData.data.categorie.includes('Soin') ) { if (formData.system.categorie.includes('Soin') ) {
formData.isHerbe = true; formData.isHerbe = true;
this.computeHerbeBonus(formData, this.herbesSoins, 12); this.computeHerbeBonus(formData, this.herbesSoins, 12);
} else if (formData.data.categorie.includes('Repos')) { } else if (formData.system.categorie.includes('Repos')) {
formData.isRepos = true; formData.isRepos = true;
this.computeHerbeBonus(formData, this.herbesRepos, 7); this.computeHerbeBonus(formData, this.herbesRepos, 7);
} }
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static calculePointsRepos( data ) { static calculePuissancePotion( potion ) {
return data.herbebonus * data.pr; return potion.system.herbebonus * potion.system.pr;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static calculePointsGuerison( data ){ static calculePointsRepos( potion ) {
return data.herbebonus * data.pr; return potion.system.herbebonus * potion.system.pr;
}
/* -------------------------------------------- */
static calculePointsGuerison( potion ){
return potion.system.herbebonus * potion.system.pr;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static computeHerbeBonus( formData, herbesList, max) { static computeHerbeBonus( formData, herbesList, max) {
if ( Number(formData.data.herbebrins) ) { if ( Number(formData.system.herbebrins) ) {
let herbe = herbesList.find(item => item.name.toLowerCase() == formData.data.herbe.toLowerCase() ); let herbe = herbesList.find(item => item.name.toLowerCase() == formData.system.herbe.toLowerCase() );
if( herbe ) { if( herbe ) {
let herbeData = Misc.templateData(herbe); let brinsBase = max - herbe.system.niveau;
let brinsBase = max - herbeData.niveau; formData.system.herbebonus = Math.max(herbe.system.niveau - Math.max(brinsBase - formData.system.herbebrins, 0), 0);
//console.log(herbeData, brinsBase, formData.data.herbebrins);
formData.data.herbebonus = Math.max(herbeData.niveau - Math.max(brinsBase - formData.data.herbebrins, 0), 0);
} }
} }
} }

View File

@@ -2,83 +2,99 @@ import { Misc } from "./misc.js";
export class RdDHotbar { export class RdDHotbar {
static async createMacro(item, command) {
let macro = await Macro.create({
name: item.name,
type: "script",
img: item.img,
command: command
}, { displaySheet: false })
return macro
}
/** /**
* Create a macro when dropping an entity on the hotbar * Create a macro when dropping an entity on the hotbar
* Item - open roll dialog for item * Item - open roll dialog for item
* Actor - open actor sheet * Actor - open actor sheet
* Journal - open journal sheet * Journal - open journal sheet
*/ */
static initDropbar( ) { static initDropbar() {
Hooks.on("hotbarDrop", async (bar, documentData, slot) => { Hooks.on("hotbarDrop", (bar, documentData, slot) => {
// Create item macro if rollable item - weapon, spell, prayer, trait, or skill
if (documentData.type == "Item") { // Create item macro if rollable item - weapon, spell, prayer, trait, or skill
if (documentData.data.type != "arme" && documentData.data.type != "competence" ) if (documentData.type == "Item") {
return let item = fromUuidSync(documentData.uuid)
let item = documentData.data if (item == undefined) {
let command = `game.system.rdd.RdDHotbar.rollMacro("${item.name}", "${item.type}");`; item = this.actor.items.get(documentData.uuid)
let macro = game.macros.contents.find(m => (m.name === item.name) && (m.command === command)); }
if (!macro) { console.log("DROP", documentData, item)
macro = await Macro.create({ if (!item || (item.type != "arme" && item.type != "competence")) {
name: item.name, return true
type: "script", }
img: item.img, let command = `game.system.rdd.RdDHotbar.rollMacro("${item.name}", "${item.type}");`;
command: command let macro = game.macros.contents.find(m => (m.name === item.name) && (m.command === command));
}, { displaySheet: false }) if (!macro) {
macro = this.createMacro(item, command)
}
game.user.assignHotbarMacro(macro, slot);
return false
} }
game.user.assignHotbarMacro(macro, slot);
} // Create a macro to open the actor sheet of the actor dropped on the hotbar
// Create a macro to open the actor sheet of the actor dropped on the hotbar /*else if (documentData.type == "Actor") {
else if (documentData.type == "Actor") {
let actor = game.actors.get(documentData.id); let actor = game.actors.get(documentData.id);
let command = `game.actors.get("${documentData.id}").sheet.render(true)` let command = `game.actors.get("${documentData.id}").sheet.render(true)`
let macro = game.macros.contents.find(m => (m.name === actor.name) && (m.command === command)); let macro = game.macros.contents.find(m => (m.name === actor.name) && (m.command === command));
if (!macro) { if (!macro) {
macro = await Macro.create({ macro = await Macro.create({
name: actor.data.name, name: actor.name,
type: "script", type: "script",
img: actor.data.img, img: actor.img,
command: command command: command
}, { displaySheet: false }) }, { displaySheet: false })
game.user.assignHotbarMacro(macro, slot); game.user.assignHotbarMacro(macro, slot);
} }
} }
// Create a macro to open the journal sheet of the journal dropped on the hotbar // Create a macro to open the journal sheet of the journal dropped on the hotbar
else if (documentData.type == "JournalEntry") { else if (documentData.type == "JournalEntry") {
let journal = game.journal.get(documentData.id); let journal = fromUuidSync(documentData.uuid)
let command = `game.journal.get("${documentData.id}").sheet.render(true)` let command = `game.journal.get("${documentData.id}").sheet.render(true)`
let macro = game.macros.contents.find(m => (m.name === journal.name) && (m.command === command)); let macro = game.macros.contents.find(m => (m.name === journal.name) && (m.command === command));
if (!macro) { if (!macro) {
macro = await Macro.create({ macro = await Macro.create({
name: journal.data.name, name: journal.name,
type: "script", type: "script",
img: "systems/foundryvtt-reve-de-dragon/icons/templates/icone_parchement_vierge.webp", img: "systems/foundryvtt-reve-de-dragon/icons/templates/icone_parchement_vierge.webp",
command: command command: command
}, { displaySheet: false }) }, { displaySheet: false })
game.user.assignHotbarMacro(macro, slot); game.user.assignHotbarMacro(macro, slot);
} }
} }*/
return false; return true;
}); });
} }
/** Roll macro */ /** Roll macro */
static rollMacro(itemName, itemType, bypassData) { static rollMacro(itemName, itemType, bypassData) {
const speaker = ChatMessage.getSpeaker(); const speaker = ChatMessage.getSpeaker();
let actor; let actor;
if (speaker.token) actor = game.actors.tokens[speaker.token]; if (speaker.token) actor = game.actors.tokens[speaker.token];
if (!actor) actor = game.actors.get(speaker.actor); if (!actor) actor = game.actors.get(speaker.actor);
let item = Misc.data(actor?.items.find(it => it.name === itemName && it.type == itemType)); let item = actor?.items.find(it => it.name === itemName && it.type == itemType) ?? undefined;
if (!item) return ui.notifications.warn(`Impossible de trouver l'objet de cette macro`); if (!item) {
return ui.notifications.warn(`Impossible de trouver l'objet de cette macro`);
// Trigger the item roll
switch (item.type) {
case "arme":
return actor.rollArme(item);
case "competence":
return actor.rollCompetence( itemName );
}
} }
// Trigger the item roll
switch (item.type) {
case "arme":
return actor.rollArme(item);
case "competence":
return actor.rollCompetence(itemName);
}
}
} }

View File

@@ -221,19 +221,20 @@ function messageDeBienvenue() {
// Register world usage statistics // Register world usage statistics
function registerUsageCount( registerKey ) { function registerUsageCount( registerKey ) {
if ( game.user.isGM ) { if ( game.user.isGM ) {
game.settings.register(registerKey, "world-key", { game.settings.register("world", "world-key", {
name: "Unique world key", name: "Unique world key",
scope: "world", scope: "world",
config: false, config: false,
default: "NONE",
type: String type: String
}); });
let worldKey = game.settings.get(registerKey, "world-key") let worldKey = game.settings.get("world", "world-key")
if ( worldKey == undefined || worldKey == "" ) { if ( worldKey == undefined || worldKey == "" ) {
worldKey = randomID(32) worldKey = randomID(32)
game.settings.set(registerKey, "world-key", worldKey ) game.settings.set("world", "world-key", worldKey )
} }
let regURL = `https://www.uberwald.me/fvtt_appcount/count.php?name="${registerKey}"&worldKey="${worldKey}"&version="${game.release.generation}.${game.release.build}"&system="${game.system.id}"&systemversion="${game.system.data.version}"` let regURL = `https://www.uberwald.me/fvtt_appcount/count.php?name="${registerKey}"&worldKey="${worldKey}"&version="${game.release.generation}.${game.release.build}"&system="${game.system.id}"&systemversion="${game.system.version}"`
$.ajax(regURL) $.ajax(regURL)
/* -------------------------------------------- */ /* -------------------------------------------- */
} }
@@ -291,8 +292,8 @@ async function migrationPngWebp_1_5_34() {
await Item.updateDocuments(itemsUpdates); await Item.updateDocuments(itemsUpdates);
await Actor.updateDocuments(actorsUpdates); await Actor.updateDocuments(actorsUpdates);
game.actors.forEach(actor => { game.actors.forEach(actor => {
if (actor.data.token?.img && actor.data.token.img.match(regexOldPngJpg)) { if (actor.token?.img && actor.token.img.match(regexOldPngJpg)) {
actor.update({ "token.img": convertImgToWebp(actor.data.token.img) }); actor.update({ "token.img": convertImgToWebp(actor.token.img) });
} }
const actorItemsToUpdate = prepareDocumentsImgUpdate(actor.items); const actorItemsToUpdate = prepareDocumentsImgUpdate(actor.items);
actor.updateEmbeddedDocuments('Item', actorItemsToUpdate); actor.updateEmbeddedDocuments('Item', actorItemsToUpdate);

134
module/rdd-meteo.js Normal file
View File

@@ -0,0 +1,134 @@
const vents = [
{ min: 0, max: 0, valeur: 'Calme' },
{ min: 1, max: 1, valeur: 'Légère brise' },
{ min: 2, max: 2, valeur: 'Jolie brise' },
{ min: 3, max: 3, valeur: 'Bonne brise' },
{ min: 4, max: 4, valeur: 'Vent frais' },
{ min: 5, max: 5, valeur: 'Coup de vent' },
{ min: 6, max: 6, valeur: 'Fort coup de vent' },
{ min: 7, max: 9, valeur: 'Tempête' },
{ min: 10, max: 13, valeur: 'Violente tempête' },
{ min: 14, valeur: 'Ouragan' },
]
const mers = [
{ min: 0, max: 0, valeur: 'Calme' },
{ min: 1, max: 1, valeur: 'Belle' },
{ min: 2, max: 2, valeur: 'Peu agitée' },
{ min: 3, max: 3, valeur: 'Agitée' },
{ min: 4, max: 4, valeur: 'Forte' },
{ min: 5, max: 6, valeur: 'Très forte' },
{ min: 7, max: 9, valeur: 'Grosse' },
{ min: 10, max: 13, valeur: 'Très grosse' },
{ min: 14, valeur: 'Énorme' },
]
const nuages = [
{ min: 0, max: 3, valeur: 'dégagé' },
{ min: 4, max: 6, valeur: 'passages nuageux' },
{ min: 7, max: 9, valeur: 'nuageux', },
{ min: 10, max: 10, valeur: 'brouillard' },
{ min: 11, max: 12, valeur: 'bruine' },
{ min: 13, valeur: 'très nuageux' },
]
const pluies = [
{ min: 0, max: 4, valeur: 'aucune' },
{ min: 5, max: 5, valeur: 'bruine, crachin, éparse' },
{ min: 6, max: 7, valeur: 'averses' },
{ min: 8, max: 10, valeur: 'pluvieux', },
{ min: 11, max: 13, valeur: 'forte pluie' },
{ min: 14, valeur: 'déluge' },
]
const temperatures = [
{ max: -14, valeur: 'glaciale' },
{ min: -13, max: -10, valeur: 'Très froide' },
{ min: -9, max: -7, valeur: 'froide' },
{ min: -6, max: -4, valeur: 'fraîche' },
{ min: -3, max: 3, valeur: 'de saison' },
{ min: 4, max: 6, valeur: 'élevée' },
{ min: 7, max: 9, valeur: 'chaude' },
{ min: 10, max: 13, valeur: 'torride' },
{ min: 14, valeur: 'caniculaire' },
]
export class RdDMeteo {
static async getForce() {
const roll = new Roll(`1dr`);
await roll.evaluate({ async: true });
return roll.total;
}
static async getPluie(nuage) {
return nuage <= 3 ? 0 : await RdDMeteo.getForce();
}
static async getTemperature() {
const degre = await RdDMeteo.getForce();
const rollChaudFroid = new Roll('1d2');
await rollChaudFroid.evaluate({ async: true });
const chaudFroid = rollChaudFroid.total == 1;
return chaudFroid.total ? degre : -degre;
}
static async getDirection(direction) {
const roll = new Roll(`1d16`);
await roll.evaluate({ async: true });
switch (roll.total % 16) {
case 0: return 'Nord';
case 1: return 'Nord Nord Est';
case 2: return 'Nord Est';
case 3: return 'Est Nord Est';
case 4: return 'Est';
case 5: return 'Est Sud Est';
case 6: return 'Sud Est';
case 7: return 'Sud Sud Est';
case 8: return 'Sud';
case 9: return 'Sud Sud Ouest';
case 10: return 'Sud Ouest';
case 11: return 'Ouest Sud Ouest';
case 12: return 'Ouest';
case 13: return 'Ouest Nord Ouest';
case 14: return 'Nord Ouest';
case 15: return 'Nord Nord Ouest';
}
return undefined;
}
static async getMeteo() {
const vent = await RdDMeteo.getForce();
const mer = await RdDMeteo.getForce();
const nuage = await RdDMeteo.getForce();
const pluie = await RdDMeteo.getPluie(nuage);
const temperature = await RdDMeteo.getTemperature();
const meteo = {
vent: { force: vent, direction: await RdDMeteo.getDirection(), },
mer: { force: mer, direction: await RdDMeteo.getDirection(), },
temperature: { force: temperature },
nuage: { force: nuage, },
pluie: { force: pluie },
}
meteo.vent.description = RdDMeteo.vent(meteo.vent.force);
meteo.mer.description = RdDMeteo.mer(meteo.mer.force),
meteo.temperature.description = RdDMeteo.temperature(meteo.temperature.force);
meteo.nuage.description = RdDMeteo.nuage(meteo.nuage.force);
meteo.pluie.description = RdDMeteo.pluie(meteo.pluie.force);
ChatMessage.create({
content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-resultat-meteo.html', meteo),
whisper: ChatMessage.getWhisperRecipients('GM')
});
}
static description(liste, force, valeur = it => it.valeur) {
let select = liste.find(it => (it.min == undefined || it.min <= force) && (it.max == undefined || force <= it.max));
return valeur(select ?? liste[0]);
}
static vent(force) { return this.description(vents, force); }
static mer(force) { return this.description(mers, force); }
static nuage(force) { return this.description(nuages, force); }
static pluie(force) { return this.description(pluies, force); }
static temperature(force) { return this.description(temperatures, force); }
}

View File

@@ -1,19 +1,29 @@
import { RdDActor } from "./actor.js";
import { Misc } from "./misc.js"; import { Misc } from "./misc.js";
import { RdDDice } from "./rdd-dice.js"; import { RdDDice } from "./rdd-dice.js";
const words = [ 'pore', 'pre', 'flor', 'lane', 'turlu', 'pin', 'a', 'alph', 'i', 'onse', 'iane', 'ane', 'zach', 'arri', 'ba', 'bo', 'bi', const words = ['pore', 'pre', 'flor', 'lane', 'turlu', 'pin', 'a', 'alph', 'i', 'onse', 'iane', 'ane', 'zach', 'arri', 'ba', 'bo', 'bi',
'alta', 'par', 'pir', 'zor', 'zir', 'de', 'pol', 'tran', 'no', 'la', 'al' , 'pul', 'one', 'ner', 'nur', 'mac', 'mery', 'alta', 'par', 'pir', 'zor', 'zir', 'de', 'pol', 'tran', 'no', 'la', 'al', 'pul', 'one', 'ner', 'nur', 'mac', 'mery',
'cat', 'do', 'di', 'der', 'er', 'el', 'far', 'fer', 'go', 'guer', 'hot', 'jor', 'jar', 'ji', 'kri', 'ket', 'lor', 'hur', 'cat', 'do', 'di', 'der', 'er', 'el', 'far', 'fer', 'go', 'guer', 'hot', 'jor', 'jar', 'ji', 'kri', 'ket', 'lor', 'hur',
'lar', 'lir', 'lu', 'pot', 'pro', 'pra', 'pit', 'qua', 'qui', 're', 'ral', 'sal', 'sen', 'ted', 'to', 'ta', 'lars', 'ver', 'lar', 'lir', 'lu', 'pot', 'pro', 'pra', 'pit', 'qua', 'qui', 're', 'ral', 'sal', 'sen', 'ted', 'to', 'ta', 'lars', 'ver',
'vin', 'ov', 'wal', 'ry', 'ly', '' ]; 'vin', 'ov', 'wal', 'ry', 'ly', ''];
/* -------------------------------------------- */ /* -------------------------------------------- */
export class RdDNameGen { export class RdDNameGen {
static async getName( msg, params ) { static async getName(msg, params) {
let name = Misc.upperFirst( await RdDDice.rollOneOf(words) + await RdDDice.rollOneOf(words) ) const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-command-nom.html`, {
//console.log(name); nom: Misc.upperFirst(await RdDDice.rollOneOf(words) + await RdDDice.rollOneOf(words))
ChatMessage.create( { content: `Nom : ${name}`, whisper: ChatMessage.getWhisperRecipients("GM") } ); });
ChatMessage.create({ content: html, whisper: ChatMessage.getWhisperRecipients("GM") });
} }
static async onCreerActeur(event) {
const button = event.currentTarget;
await RdDActor.create({
name: button.attributes['data-nom'].value,
type: button.attributes['data-type'].value
},
{renderSheet: true});
}
} }

View File

@@ -14,100 +14,86 @@ Donc la compétence Possession ne peut être démarrée que par le MJ.
export class RdDPossession { export class RdDPossession {
/* -------------------------------------------- */ /* -------------------------------------------- */
static init() { static init() {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static searchPossessionFromEntite( attacker, defender) { static searchPossessionFromEntite(attacker, defender) {
let poss = attacker.data.items.find( poss => poss.type == 'possession' && poss.data.data.possedeid == defender.data._id); let poss = attacker.items.find(poss => poss.type == 'possession' && poss.system.possedeid == defender.id);
if (!poss) { if (!poss) {
poss = defender.data.items.find( poss => poss.type == 'possession' && poss.data.data.possedeid == defender.data._id); poss = defender.items.find(poss => poss.type == 'possession' && poss.system.possedeid == defender.id);
} }
return poss && duplicate(poss) || undefined; return poss && duplicate(poss) || undefined;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static updateEtatPossession( possession ) { static updateEtatPossession(possession) {
possession.ptsConjuration = 0 possession.ptsConjuration = 0
possession.ptsPossession = 0 possession.ptsPossession = 0
console.log("Possession", possession) console.log("Possession", possession)
if ( possession.data.compteur > 0) { if (possession.system.compteur > 0) {
possession.ptsPossession = possession.data.compteur possession.ptsPossession = possession.system.compteur
} }
if ( possession.data.compteur < 0) { if (possession.system.compteur < 0) {
possession.ptsConjuration = Math.abs(possession.data.compteur) possession.ptsConjuration = Math.abs(possession.system.compteur)
} }
possession.isPosseder = false possession.isPosseder = false
possession.isConjurer = false possession.isConjurer = false
if (possession.ptsPossession >= 2 ) { if (possession.ptsPossession >= 2) {
possession.isPosseder = true possession.isPosseder = true
} }
if (possession.ptsConjuration >= 2 ) { if (possession.ptsConjuration >= 2) {
possession.isConjurer = true possession.isConjurer = true
} }
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static async resultConjuration( rollData) { static async resultConjuration(rollData) {
let actor = game.actors.get(rollData.possession.data.possedeid) let actor = game.actors.get(rollData.possession.system.possedeid)
if ( !rollData.rolled.isSuccess ) { if (!rollData.rolled.isSuccess) {
if( rollData.isECNIDefender) { if (rollData.isECNIDefender) {
rollData.possession.data.compteur-- rollData.possession.system.compteur--
} else { } else {
rollData.possession.data.compteur++ rollData.possession.system.compteur++
} }
let update = { _id: rollData.possession._id, "data.compteur": rollData.possession.data.compteur } let update = { _id: rollData.possession._id, "system.compteur": rollData.possession.system.compteur }
await actor.updateEmbeddedDocuments('Item', [update]) await actor.updateEmbeddedDocuments('Item', [update])
} }
this.updateEtatPossession(rollData.possession) this.updateEtatPossession(rollData.possession)
await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-possession.html') await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-possession.html')
if ( rollData.possession.isPosseder || rollData.possession.isConjurer) { if (rollData.possession.isPosseder || rollData.possession.isConjurer) {
actor.deleteEmbeddedDocuments("Item", [rollData.possession._id]) actor.deleteEmbeddedDocuments("Item", [rollData.possession._id])
} }
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static async onDefensePossession( attackerId, defenderId, possessionId) { static async onDefensePossession(attackerId, defenderId, possessionId) {
let attacker = game.actors.get(attackerId) let attacker = game.actors.get(attackerId)
let defender = game.actors.get(defenderId) let defender = game.actors.get(defenderId)
let possession = attacker.getPossession(possessionId) ?? defender.getPossession(possessionId) ;
let possession = attacker.items.find( item => item.type =='possession' && item.data.data.possessionid == possessionId) if (!possession) {
if ( !possession ) { ui.notifications.warn("Une erreur s'est produite : Aucune possession trouvée !!")
possession = defender.items.find( item => item.type =='possession' && item.data.data.possessionid == possessionId) return
if ( !possession) {
ui.notifications.warn("Une erreur s'est produite : Aucune possession trouvée !!")
return
}
} }
possession = duplicate(possession)
// Update for draconic roll // Update for draconic roll
let rollData = { let rollData = {
possession: possession mode: "conjuration",
isECNIDefender: defender.type == "entite",
possession: duplicate(possession),
attacker: attacker,
defender: defender,
competence: defender.getDraconicOuPossession(),
selectedCarac: defender.system.carac.reve,
forceCarac: { 'reve-actuel': { label: "Rêve Actuel", value: defender.getReveActuel() } }
} }
rollData.actor = defender rollData.competence.system.defaut_carac = 'reve-actuel'
if ( defender.type == "personnage") {
rollData.competence = duplicate(defender.getDraconicOrZero())
rollData.competence.data.defaut_carac = 'reve-actuel'
rollData.forceCarac = { 'reve-actuel': { label: "Rêve Actuel", value: defender.getReveActuel() } }
rollData.selectedCarac = defender.data.data.carac.reve
rollData.isECNIDefender = false
} else {
rollData.competence = duplicate(defender.getCompetence("Possession"))
rollData.competence.data.defaut_carac = "reve"
rollData.forceCarac = { 'reve': { label: "Rêve", value: defender.data.data.carac.reve.value } }
rollData.selectedCarac = defender.data.data.carac.reve
rollData.isECNIDefender = true
//RdDItemCompetenceCreature.setRollDataCreature( rollData )
}
rollData.mode = "conjuration"
rollData.possesseur = attacker.name
const dialog = await RdDRoll.create(defender, rollData, const dialog = await RdDRoll.create(defender, rollData,
{ {
html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-defense-possession.html', html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-defense-possession.html',
options: { height: 400 } options: { height: 450 }
}, },
{ {
name: 'conjurer', name: 'conjurer',
@@ -121,54 +107,38 @@ export class RdDPossession {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static async _onRollPossession( rollData, isSuccess ) { static async onAttaquePossession(attacker, competence, possession = undefined) {
let possession = rollData.possession
possession.isSuccess = isSuccess
this.updateEtatPossession( possession)
await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-possession.html');
}
/* -------------------------------------------- */
static async managePossession(attacker, competence, possession=undefined) {
const target = RdDCombat.getTarget() const target = RdDCombat.getTarget()
if (target == undefined) { if (target == undefined) {
ui.notifications.warn((game.user.targets?.size ?? 0) > 1 ui.notifications.warn((game.user.targets?.size ?? 0) > 1
? "Vous devez choisir <strong>une seule</strong> cible à posséder!" ? "Vous devez choisir <strong>une seule</strong> cible à posséder!"
: "Vous devez choisir une cible à posséder!"); : "Vous devez choisir une cible à posséder!");
return; return;
}
const defender = target.actor
if ( !possession) {
possession = this.searchPossessionFromEntite( attacker, defender)
if ( !possession) {
possession = await this.createPossession(attacker, defender)
}
} }
possession = duplicate(possession)
const defender = target.actor;
possession = duplicate(possession ?? this.searchPossessionFromEntite(attacker, defender) ??(await this.createPossession(attacker, defender)));
this.updateEtatPossession(possession) this.updateEtatPossession(possession)
let rollData = { let rollData = {
mode: "possession",
isECNIDefender: defender.type == "entite",
competence: competence, competence: competence,
possession: possession, possession: possession,
possede: defender.name, attacker: attacker,
possesseur: attacker.name, defender: defender
attackerId: attacker.data._id,
defenderId: defender.data._id,
mode: "possession"
}; };
if ( attacker.isCreature()) { if (attacker.isCreature()) {
RdDItemCompetenceCreature.setRollDataCreature(rollData) RdDItemCompetenceCreature.setRollDataCreature(rollData)
} }
const dialog = await RdDRoll.create( attacker, rollData, const dialog = await RdDRoll.create(attacker, rollData,
{ {
html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.html', html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.html',
options: { height: 540 } options: { height: 540 }
}, { }, {
name: 'jet-possession', name: 'jet-possession',
label: 'Possession: ', label: rollData.isECNIDefender ? 'Conjurer la possession' : 'Possession',
callbacks: [ callbacks: [
{ condition: r => (r.rolled.isSuccess), action: async r => await this._onRollPossession(r, true) }, { condition: r => (r.rolled.isSuccess), action: async r => await this._onRollPossession(r, true) },
{ condition: r => (r.rolled.isEchec), action: async r => await this._onRollPossession(r, false) }, { condition: r => (r.rolled.isEchec), action: async r => await this._onRollPossession(r, false) },
@@ -178,11 +148,18 @@ export class RdDPossession {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static async createPossession( attacker, defender ) { static async _onRollPossession(rollData, isSuccess) {
rollData.possession.isSuccess = isSuccess;
this.updateEtatPossession(rollData.possession);
await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-possession.html');
}
/* -------------------------------------------- */
static async createPossession(attacker, defender) {
let possessionData = { let possessionData = {
name: "Possession en cours de " + attacker.name, type: 'possession', name: "Possession en cours de " + attacker.name, type: 'possession',
img: "systems/foundryvtt-reve-de-dragon/icons/entites/possession2.webp", img: "systems/foundryvtt-reve-de-dragon/icons/entites/possession2.webp",
data: { description: "", typepossession: attacker.name, possede: false, possessionid: randomID(16), possesseurid: attacker.data._id, possedeid: defender.data._id, date: 0, compteur: 0 } system: { description: "", typepossession: attacker.name, possede: false, possessionid: randomID(16), possesseurid: attacker.id, possedeid: defender.id, date: 0, compteur: 0 }
} }
// Creates only the possession on the personnage side // Creates only the possession on the personnage side
let poss = await defender.createEmbeddedDocuments('Item', [possessionData]) let poss = await defender.createEmbeddedDocuments('Item', [possessionData])

View File

@@ -166,7 +166,7 @@ export class RdDResolutionTable {
if (rollData.selectedCarac?.label.toLowerCase().includes('chance')) { if (rollData.selectedCarac?.label.toLowerCase().includes('chance')) {
return true; return true;
} }
if (rollData.selectedSort?.data.isrituel) { if (rollData.selectedSort?.system.isrituel) {
return true; return true;
} }
return false; return false;

View File

@@ -1,3 +1,5 @@
import { ENTITE_BLURETTE, ENTITE_INCARNE, ENTITE_NONINCARNE } from "./constants.js";
/** /**
* Extend the base Dialog entity by defining a custom window to perform roll. * Extend the base Dialog entity by defining a custom window to perform roll.
* @extends {Dialog} * @extends {Dialog}
@@ -7,15 +9,19 @@ export class RdDEncaisser extends Dialog {
/* -------------------------------------------- */ /* -------------------------------------------- */
constructor(html, actor) { constructor(html, actor) {
// Common conf // Common conf
const buttonsCreatures = { let buttons = {};
"mortel": { label: "Mortel", callback: html => this.performEncaisser("mortel") }, if (!actor.isEntite()){
"non-mortel": { label: "Non-mortel", callback: html => this.performEncaisser("non-mortel") }, buttons = {
"sonne": { label: "Sonné", callback: html => this.actor.setSonne() }, "mortel": { label: "Mortel", callback: html => this.performEncaisser("mortel") },
}; "non-mortel": { label: "Non-mortel", callback: html => this.performEncaisser("non-mortel") },
const buttonsEntitesCauchemar = { "sonne": { label: "Sonné", callback: html => this.actor.setSonne() },
"cauchemar": { label: "cauchemar", callback: html => this.performEncaisser("cauchemar") } };
}; }
const buttons = actor.isEntiteCauchemar() ? buttonsEntitesCauchemar : buttonsCreatures; else if (actor.isEntite([ENTITE_BLURETTE, ENTITE_INCARNE])){
buttons = {
"cauchemar": { label: "cauchemar", callback: html => this.performEncaisser("cauchemar") }
}
}
let dialogConf = { let dialogConf = {
title: "Jet d'Encaissement", title: "Jet d'Encaissement",
@@ -24,7 +30,6 @@ export class RdDEncaisser extends Dialog {
default: "mortel" default: "mortel"
} }
let dialogOptions = { let dialogOptions = {
classes: ["rdddialog"], classes: ["rdddialog"],
width: 320, width: 320,

View File

@@ -38,25 +38,25 @@ export class RdDRoll extends Dialog {
/* -------------------------------------------- */ /* -------------------------------------------- */
static _setDefaultOptions(actor, rollData) { static _setDefaultOptions(actor, rollData) {
const actorData = Misc.data(actor); const actorData = actor.system
let defaultRollData = { let defaultRollData = {
alias: actor.name, alias: actor.name,
ajustementsConditions: CONFIG.RDD.ajustementsConditions, ajustementsConditions: CONFIG.RDD.ajustementsConditions,
difficultesLibres: CONFIG.RDD.difficultesLibres, difficultesLibres: CONFIG.RDD.difficultesLibres,
etat: actor.getEtatGeneral(), etat: actor.getEtatGeneral(),
moral: actor.getMoralTotal(), /* La valeur du moral pour les jets de volonté */ moral: actor.getMoralTotal(), /* La valeur du moral pour les jets de volonté */
carac: actorData.data.carac, carac: actorData.carac,
finalLevel: 0, finalLevel: 0,
diffConditions: 0, diffConditions: 0,
diffLibre: rollData.competence?.data.default_diffLibre ?? 0, diffLibre: rollData.competence?.system.default_diffLibre ?? 0,
malusArmureValue: actor.getMalusArmure(), malusArmureValue: actor.getMalusArmure(),
surencMalusFlag: actor.isPersonnage() ? (actorData.data.compteurs.surenc.value < 0) : false, surencMalusFlag: actor.isPersonnage() ? (actorData.compteurs.surenc.value < 0) : false,
surencMalusValue: actor.computeMalusSurEncombrement(), surencMalusValue: actor.computeMalusSurEncombrement(),
useMalusSurenc: false, useMalusSurenc: false,
useMoral: false, /* Est-ce que le joueur demande d'utiliser le moral ? Utile si le joueur change plusieurs fois de carac associée. */ useMoral: false, /* Est-ce que le joueur demande d'utiliser le moral ? Utile si le joueur change plusieurs fois de carac associée. */
perteMoralEchec: false, /* Pour l'affichage dans le chat */ perteMoralEchec: false, /* Pour l'affichage dans le chat */
use: { libre: true, conditions: true, surenc: false, encTotal: false }, use: { libre: true, conditions: true, surenc: false, encTotal: false },
isMalusEncombrementTotal: RdDItemCompetence.isMalusEncombrementTotal(rollData.competence), isMalusEncombrementTotal: rollData.competence ? RdDItemCompetence.isMalusEncombrementTotal(rollData.competence) : 0,
useMalusEncTotal: false, useMalusEncTotal: false,
encTotal: actor.getEncTotal(), encTotal: actor.getEncTotal(),
ajustementAstrologique: actor.ajustementAstrologique(), ajustementAstrologique: actor.ajustementAstrologique(),
@@ -67,7 +67,7 @@ export class RdDRoll extends Dialog {
} }
// Mini patch :Ajout du rêve actuel // Mini patch :Ajout du rêve actuel
if ( actorData.type == "personnage") { if ( actorData.type == "personnage") {
defaultRollData.carac["reve-actuel"] = actorData.data.reve.reve defaultRollData.carac["reve-actuel"] = actorData.reve.reve
} }
mergeObject(rollData, defaultRollData, { recursive: true, overwrite: false }); mergeObject(rollData, defaultRollData, { recursive: true, overwrite: false });
@@ -165,17 +165,17 @@ export class RdDRoll extends Dialog {
function onLoad() { function onLoad() {
let rollData = dialog.rollData; let rollData = dialog.rollData;
console.log(rollData); console.log('Ouverture RdDRoll', rollData);
// Update html, according to data // Update html, according to rollData
if (rollData.competence) { if (rollData.competence) {
const defaut_carac = Misc.templateData(rollData.competence).defaut_carac; const defaut_carac = rollData.competence.system.defaut_carac
// Set the default carac from the competence item // Set the default carac from the competence item
rollData.selectedCarac = rollData.carac[defaut_carac]; rollData.selectedCarac = rollData.carac[defaut_carac];
$("#carac").val(defaut_carac); $("#carac").val(defaut_carac);
} }
if (rollData.selectedSort) { if (rollData.selectedSort) {
dialog.setSelectedSort(rollData.selectedSort); dialog.setSelectedSort(rollData.selectedSort);
$(".draconic").val(rollData.selectedSort.data.listIndex); // Uniquement a la selection du sort, pour permettre de changer $(".draconic").val(rollData.selectedSort.system.listIndex); // Uniquement a la selection du sort, pour permettre de changer
} }
RdDItemSort.setCoutReveReel(rollData.selectedSort); RdDItemSort.setCoutReveReel(rollData.selectedSort);
$("#diffLibre").val(Misc.toInt(rollData.diffLibre)); $("#diffLibre").val(Misc.toInt(rollData.diffLibre));
@@ -221,7 +221,7 @@ export class RdDRoll extends Dialog {
}); });
html.find('#ptreve-variable').change((event) => { html.find('#ptreve-variable').change((event) => {
let ptreve = Misc.toInt(event.currentTarget.value); let ptreve = Misc.toInt(event.currentTarget.value);
this.rollData.selectedSort.data.ptreve_reel = ptreve; this.rollData.selectedSort.system.ptreve_reel = ptreve;
console.log("RdDRollSelectDialog - Cout reve", ptreve); console.log("RdDRollSelectDialog - Cout reve", ptreve);
this.updateRollResult(); this.updateRollResult();
}); });
@@ -271,21 +271,21 @@ export class RdDRoll extends Dialog {
async setSelectedSort(sort) { async setSelectedSort(sort) {
this.rollData.selectedSort = sort; // Update the selectedCarac this.rollData.selectedSort = sort; // Update the selectedCarac
this.rollData.competence = RdDItemCompetence.getVoieDraconic(this.rollData.draconicList, sort.data.draconic); this.rollData.competence = RdDItemCompetence.getVoieDraconic(this.rollData.draconicList, sort.system.draconic);
this.rollData.bonus = RdDItemSort.getCaseBonus(sort, this.rollData.tmr.coord); this.rollData.bonus = RdDItemSort.getCaseBonus(sort, this.rollData.tmr.coord);
this.rollData.diffLibre = RdDItemSort.getDifficulte(sort, -7); this.rollData.diffLibre = RdDItemSort.getDifficulte(sort, -7);
RdDItemSort.setCoutReveReel(sort); RdDItemSort.setCoutReveReel(sort);
const htmlSortDescription = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/partial-description-sort.html", { sort: sort }); const htmlSortDescription = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/partial-description-sort.html", { sort: sort });
$(".sort-ou-rituel").text(sort.data.isrituel ? "rituel" : "sort"); $(".sort-ou-rituel").text(sort.system.isrituel ? "rituel" : "sort");
$(".bonus-case").text(`${this.rollData.bonus}%`); $(".bonus-case").text(`${this.rollData.bonus}%`);
$(".details-sort").remove(); $(".details-sort").remove();
$(".description-sort").append(htmlSortDescription); $(".description-sort").append(htmlSortDescription);
$(".roll-draconic").val(sort.data.listIndex); $(".roll-draconic").val(sort.system.listIndex);
$(".div-sort-difficulte-fixe").text(Misc.toSignedString(sort.data.difficulte)); $(".div-sort-difficulte-fixe").text(Misc.toSignedString(sort.system.difficulte));
$(".div-sort-ptreve-fixe").text(sort.data.ptreve); $(".div-sort-ptreve-fixe").text(sort.system.ptreve);
const diffVariable = RdDItemSort.isDifficulteVariable(sort); const diffVariable = RdDItemSort.isDifficulteVariable(sort);
const coutVariable = RdDItemSort.isCoutVariable(sort); const coutVariable = RdDItemSort.isCoutVariable(sort);
HtmlUtility._showControlWhen($(".div-sort-non-rituel"), !sort.data.isrituel); HtmlUtility._showControlWhen($(".div-sort-non-rituel"), !sort.system.isrituel);
HtmlUtility._showControlWhen($(".div-sort-difficulte-var"), diffVariable); HtmlUtility._showControlWhen($(".div-sort-difficulte-var"), diffVariable);
HtmlUtility._showControlWhen($(".div-sort-difficulte-fixe"), !diffVariable); HtmlUtility._showControlWhen($(".div-sort-difficulte-fixe"), !diffVariable);
HtmlUtility._showControlWhen($(".div-sort-ptreve-var"), coutVariable); HtmlUtility._showControlWhen($(".div-sort-ptreve-var"), coutVariable);
@@ -294,7 +294,7 @@ export class RdDRoll extends Dialog {
async setSelectedSigneDraconique(signe){ async setSelectedSigneDraconique(signe){
this.rollData.signe = signe; this.rollData.signe = signe;
this.rollData.diffLibre = Misc.data(signe).data.difficulte, this.rollData.diffLibre = signe.system.difficulte,
$(".signe-difficulte").text(Misc.toSignedString(this.rollData.diffLibre)); $(".signe-difficulte").text(Misc.toSignedString(this.rollData.diffLibre));
} }
@@ -348,10 +348,10 @@ export class RdDRoll extends Dialog {
/* -------------------------------------------- */ /* -------------------------------------------- */
_computeDiffCompetence(rollData) { _computeDiffCompetence(rollData) {
if (rollData.competence) { if (rollData.competence) {
return Misc.toInt(rollData.competence.data.niveau); return Misc.toInt(rollData.competence.system.niveau);
} }
if (rollData.draconicList) { if (rollData.draconicList) {
return Misc.toInt(rollData.competence.data.niveau); return Misc.toInt(rollData.competence.system.niveau);
} }
return 0; return 0;
} }
@@ -388,7 +388,7 @@ export class RdDRoll extends Dialog {
return compName + " - " + rollData.selectedSort.name; return compName + " - " + rollData.selectedSort.name;
} }
// If a weapon is there, add it in the title // If a weapon is there, add it in the title
const niveau = Misc.toSignedString(rollData.competence.data.niveau); const niveau = Misc.toSignedString(rollData.competence.system.niveau)
if (compName == carac) { if (compName == carac) {
// cas des créatures // cas des créatures
return carac + " Niveau " + niveau return carac + " Niveau " + niveau

View File

@@ -10,21 +10,22 @@ export class RdDRollTables {
table = await pack.getDocument(entry._id); table = await pack.getDocument(entry._id);
} }
const draw = await table.draw({ displayChat: toChat, rollMode: "gmroll"}); const draw = await table.draw({ displayChat: toChat, rollMode: "gmroll"});
console.log("RdDRollTables", tableName, toChat, ":", draw); //console.log("RdDRollTables", tableName, toChat, ":", draw);
return draw.results.length > 0 ? draw.results[0] : undefined; return draw.results.length > 0 ? draw.results[0] : undefined;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static async drawItemFromRollTable(tableName, toChat = false) { static async drawItemFromRollTable(tableName, toChat = false) {
const drawResult = await RdDRollTables.genericGetTableResult(tableName, toChat); const drawResult = await RdDRollTables.genericGetTableResult(tableName, toChat);
const pack = game.packs.get(drawResult.data.collection); const pack = game.packs.get(drawResult.documentCollection)
return await pack.getDocument(drawResult.data.resultId); let doc = await pack.getDocument(drawResult.documentId)
return doc
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static async drawTextFromRollTable(tableName, toChat) { static async drawTextFromRollTable(tableName, toChat) {
const drawResult = await RdDRollTables.genericGetTableResult(tableName, toChat); const drawResult = await RdDRollTables.genericGetTableResult(tableName, toChat);
return drawResult.data.text; return drawResult.system.text;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@@ -21,14 +21,14 @@ export class RdDSheetUtility {
} }
static prepareItemDropParameters(destItemId, actorId, dragData, objetVersConteneur) { static prepareItemDropParameters(destItemId, actorId, dragData, objetVersConteneur) {
const itemId = dragData.id || dragData.data._id; const item = fromUuidSync(dragData.uuid)
return { return {
destId: destItemId, destId: destItemId,
targetActorId: actorId, targetActorId: actorId,
itemId: itemId, itemId: item.id,
sourceActorId: dragData.actorId, sourceActorId: item.actor?.id,
srcId: objetVersConteneur[itemId], srcId: objetVersConteneur[item.id],
onEnleverConteneur: () => { delete objetVersConteneur[itemId]; }, onEnleverConteneur: () => { delete objetVersConteneur[item.id]; },
onAjouterDansConteneur: (itemId, conteneurId) => { objetVersConteneur[itemId] = conteneurId; } onAjouterDansConteneur: (itemId, conteneurId) => { objetVersConteneur[itemId] = conteneurId; }
} }
} }
@@ -42,12 +42,12 @@ export class RdDSheetUtility {
} }
static async _onSplitItem(item, split, actor) { static async _onSplitItem(item, split, actor) {
if (split >= 1 && split < Misc.data(item).data.quantite) { if (split >= 1 && split < item.system.quantite) {
await item.diminuerQuantite(split); await item.diminuerQuantite(split);
const itemData = duplicate(Misc.data(item)); const splitItem = duplicate(item);
// todo: ajouter dans le même conteneur? // todo: ajouter dans le même conteneur?
itemData.data.quantite = split; splitItem.system.quantite = split;
await actor.createEmbeddedDocuments('Item', [itemData]) await actor.createEmbeddedDocuments('Item', [splitItem])
} }
} }
} }

View File

@@ -78,12 +78,12 @@ export class RdDTMRDialog extends Dialog {
/* -------------------------------------------- */ /* -------------------------------------------- */
loadCasesSpeciales() { loadCasesSpeciales() {
this.casesSpeciales = this.actor.data.items.filter(item => Draconique.isCaseTMR(item)); this.casesSpeciales = this.actor.items.filter(item => Draconique.isCaseTMR(item));
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
loadSortsReserve() { loadSortsReserve() {
this.sortsReserves = Misc.data(this.actor).data.reve.reserve.list; this.sortsReserves = this.actor.system.reve.reserve.list;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@@ -95,12 +95,15 @@ export class RdDTMRDialog extends Dialog {
createPixiSprites() { createPixiSprites() {
EffetsDraconiques.carteTmr.createSprite(this.pixiTMR); EffetsDraconiques.carteTmr.createSprite(this.pixiTMR);
this.updateTokens(); this.updateTokens();
this.demiReve = this._tokenDemiReve(); this.forceDemiRevePositionView();
this._updateDemiReve();
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_createTokens() { _createTokens() {
if (!this.isDemiReveCache()){
this.demiReve = this._tokenDemiReve();
this._trackToken(this.demiReve);
}
let tokens = this._getTokensCasesTmr() let tokens = this._getTokensCasesTmr()
.concat(this._getTokensRencontres()) .concat(this._getTokensRencontres())
.concat(this._getTokensSortsReserve()); .concat(this._getTokensSortsReserve());
@@ -141,26 +144,25 @@ export class RdDTMRDialog extends Dialog {
return EffetsDraconiques.rencontre.token(this.pixiTMR, rencontre, () => rencontre.coord); return EffetsDraconiques.rencontre.token(this.pixiTMR, rencontre, () => rencontre.coord);
} }
_tokenCaseSpeciale(casetmr) { _tokenCaseSpeciale(casetmr) {
const caseData = Misc.data(casetmr); const caseData = casetmr;
const draconique = Draconique.get(caseData.data.specific); const draconique = Draconique.get(caseData.system.specific);
return draconique?.token(this.pixiTMR, caseData, () => caseData.data.coord); return draconique?.token(this.pixiTMR, caseData, () => caseData.system.coord);
} }
_tokenSortEnReserve(sortEnReserve) { _tokenSortEnReserve(sortEnReserve) {
return EffetsDraconiques.sortReserve.token(this.pixiTMR, sortEnReserve.sort, () => sortEnReserve.coord); return EffetsDraconiques.sortReserve.token(this.pixiTMR, sortEnReserve.sort, () => sortEnReserve.coord);
} }
_tokenDemiReve() { _tokenDemiReve() {
const actorData = Misc.data(this.actor); return EffetsDraconiques.demiReve.token(this.pixiTMR, this.actor.system, () => this.actor.system.reve.tmrpos.coord);
return EffetsDraconiques.demiReve.token(this.pixiTMR, actorData, () => actorData.data.reve.tmrpos.coord);
} }
_updateDemiReve() { forceDemiRevePositionView() {
this.notifierResonanceSigneDraconique(this._getActorCoord()); this.notifierResonanceSigneDraconique(this._getActorCoord());
this._setTokenPosition(this.demiReve); this._trackToken(this.demiReve);
} }
_getActorCoord() { _getActorCoord() {
return Misc.data(this.actor).data.reve.tmrpos.coord; return this.actor.system.reve.tmrpos.coord;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@@ -244,12 +246,11 @@ export class RdDTMRDialog extends Dialog {
/* -------------------------------------------- */ /* -------------------------------------------- */
async updateValuesDisplay() { async updateValuesDisplay() {
const coord = this._getActorCoord(); const coord = this._getActorCoord();
const actorData = Misc.data(this.actor);
HtmlUtility._showControlWhen($(".lire-signe-draconique"), this.actor.isResonanceSigneDraconique(coord)); HtmlUtility._showControlWhen($(".lire-signe-draconique"), this.actor.isResonanceSigneDraconique(coord));
let ptsreve = document.getElementById("tmr-pointsreve-value"); let ptsreve = document.getElementById("tmr-pointsreve-value");
ptsreve.innerHTML = actorData.data.reve.reve.value; ptsreve.innerHTML = this.actor.system.reve.reve.value;
let tmrpos = document.getElementById("tmr-pos"); let tmrpos = document.getElementById("tmr-pos");
if (this.isDemiReveCache()) { if (this.isDemiReveCache()) {
@@ -262,12 +263,11 @@ export class RdDTMRDialog extends Dialog {
etat.innerHTML = this.actor.getEtatGeneral(); etat.innerHTML = this.actor.getEtatGeneral();
let refoulement = document.getElementById("tmr-refoulement-value"); let refoulement = document.getElementById("tmr-refoulement-value");
refoulement.innerHTML = actorData.data.reve.refoulement.value; refoulement.innerHTML = this.actor.system.reve.refoulement.value;
if (ReglesOptionelles.isUsing("appliquer-fatigue")) { if (ReglesOptionelles.isUsing("appliquer-fatigue")) {
let fatigueItem = document.getElementById("tmr-fatigue-table"); let fatigueItem = document.getElementById("tmr-fatigue-table");
//console.log("Refresh : ", actorData.data.sante.fatigue.value); fatigueItem.innerHTML = "<table class='table-fatigue'>" + RdDUtility.makeHTMLfatigueMatrix(this.actor.system.sante.fatigue.value, this.actor.system.sante.endurance.max).html() + "</table>";
fatigueItem.innerHTML = "<table class='table-fatigue'>" + RdDUtility.makeHTMLfatigueMatrix(actorData.data.sante.fatigue.value, actorData.data.sante.endurance.max).html() + "</table>";
} }
} }
@@ -336,6 +336,10 @@ export class RdDTMRDialog extends Dialog {
/* -------------------------------------------- */ /* -------------------------------------------- */
async choisirCasePortee(coord, portee) { async choisirCasePortee(coord, portee) {
if (this.actor.isTMRCache())
{
return;
}
// Récupère la liste des cases à portées // Récupère la liste des cases à portées
let locList = TMRUtility.getTMRPortee(coord, portee); let locList = TMRUtility.getTMRPortee(coord, portee);
this.colorierZoneRencontre(locList); this.colorierZoneRencontre(locList);
@@ -507,7 +511,7 @@ export class RdDTMRDialog extends Dialog {
const presentCite = this.casesSpeciales.find(c => EffetsDraconiques.presentCites.isCase(c, tmr.coord)); const presentCite = this.casesSpeciales.find(c => EffetsDraconiques.presentCites.isCase(c, tmr.coord));
if (presentCite) { if (presentCite) {
this.minimize(); this.minimize();
const caseData = Misc.data(presentCite); const caseData = presentCite;
EffetsDraconiques.presentCites.choisirUnPresent(caseData, (type => this._utiliserPresentCite(presentCite, type, tmr, postRencontre))); EffetsDraconiques.presentCites.choisirUnPresent(caseData, (type => this._utiliserPresentCite(presentCite, type, tmr, postRencontre)));
} }
return presentCite; return presentCite;
@@ -589,7 +593,7 @@ export class RdDTMRDialog extends Dialog {
maitrise: { verbe: 'maîtriser', action: 'Maîtriser le fleuve' } maitrise: { verbe: 'maîtriser', action: 'Maîtriser le fleuve' }
} }
rollData.double = EffetsDraconiques.isDoubleResistanceFleuve(this.actor) ? true : undefined, rollData.double = EffetsDraconiques.isDoubleResistanceFleuve(this.actor) ? true : undefined,
rollData.competence.data.defaut_carac = 'reve-actuel'; rollData.competence.system.defaut_carac = 'reve-actuel';
await this._rollMaitriseCaseHumide(rollData); await this._rollMaitriseCaseHumide(rollData);
} }
} }
@@ -714,7 +718,7 @@ export class RdDTMRDialog extends Dialog {
forceCarac: { 'reve-actuel': { label: "Rêve Actuel", value: this.actor.getReveActuel() } }, forceCarac: { 'reve-actuel': { label: "Rêve Actuel", value: this.actor.getReveActuel() } },
maitrise: { verbe: 'conquérir', action: options.action } maitrise: { verbe: 'conquérir', action: options.action }
}; };
rollData.competence.data.defaut_carac = 'reve-actuel'; rollData.competence.system.defaut_carac = 'reve-actuel';
await this._maitriserTMR(rollData, r => this._onResultatConquerir(r, options)); await this._maitriserTMR(rollData, r => this._onResultatConquerir(r, options));
} }
@@ -743,6 +747,7 @@ export class RdDTMRDialog extends Dialog {
/* -------------------------------------------- */ /* -------------------------------------------- */
async _maitriserTMR(rollData, callbackMaitrise) { async _maitriserTMR(rollData, callbackMaitrise) {
this.minimize(); // Hide this.minimize(); // Hide
rollData.isTMRCache = rollData.actor.isTMRCache();
const dialog = await RdDRoll.create(this.actor, rollData, const dialog = await RdDRoll.create(this.actor, rollData,
{ {
html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-maitrise-tmr.html', html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-maitrise-tmr.html',
@@ -867,56 +872,68 @@ export class RdDTMRDialog extends Dialog {
if (this.viewOnly) { if (this.viewOnly) {
return; return;
} }
let clickOddq = RdDTMRDialog._computeEventOddq(event.data.originalEvent); let clickOddq = RdDTMRDialog._computeEventOddq(event.data.originalEvent);
await this._onClickTMRPos(clickOddq); // Vérifier l'état des compteurs reve/fatigue/vie await this._onClickTMRPos(clickOddq); // Vérifier l'état des compteurs reve/fatigue/vie
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async _onClickTMRPos(clickOddq) { async _onClickTMRPos(clickOddq) {
if (this.isDemiReveCache()) {
ui.notifications.error(`Vous ne connaissez plus votre position dans les TMR.
Vous devez utiliser les boutons de direction pour vous déplacer.
Une fois que vous aurez retrouvé votre demi-rêve, demandez au gardien de vérifier et rendre les TMR visibles.
`);
return;
}
let currentOddq = TMRUtility.coordTMRToOddq(this._getActorCoord()); let currentOddq = TMRUtility.coordTMRToOddq(this._getActorCoord());
console.log("deplacerDemiReve >>>>", currentOddq, clickOddq);
let targetCoord = TMRUtility.oddqToCoordTMR(clickOddq); let targetCoord = TMRUtility.oddqToCoordTMR(clickOddq);
let currentCoord = TMRUtility.oddqToCoordTMR(currentOddq); let currentCoord = TMRUtility.oddqToCoordTMR(currentOddq);
// Validation de la case de destination (gestion du cas des rencontres qui peuvent téléporter) // Validation de la case de destination (gestion du cas des rencontres qui peuvent téléporter)
let deplacementType = this._calculDeplacement(targetCoord, currentCoord, currentOddq, clickOddq); let deplacementType = this._calculDeplacement(targetCoord, currentCoord, currentOddq, clickOddq);
// Si le deplacement est valide if (this.isDemiReveCache()) {
if (deplacementType == 'normal' || deplacementType == 'saut') { if (this.isTerreAttache(targetCoord)
await this._deplacerDemiReve(targetCoord, deplacementType); || (this.isCaseHumide(currentCoord) && this.isCaseHumide(targetCoord))
} else if (deplacementType == 'messager') { // Dans ce cas, ouverture du lancement de sort sur la case visée || deplacementType == 'changeur')
await this._messagerDemiReve(targetCoord); {
} else { // déplacement possible
ui.notifications.error("Vous ne pouvez pas vous déplacer que sur des cases adjacentes à votre position ou valides dans le cas d'une rencontre"); await this.actor.montreTMR();
console.log("STATUS :", this.rencontreState, this.currentRencontre); }
else
{
ui.notifications.error(`Vous ne connaissez plus votre position dans les TMR.
Vous devez utiliser les boutons de direction pour vous déplacer.
Une fois que vous aurez retrouvé votre demi-rêve, demandez au gardien de vérifier et rendre les TMR visibles.
`);
return;
}
} }
switch (deplacementType){
case 'normal':
await this._deplacerDemiReve(targetCoord, deplacementType);
break;
case 'messager':
await this._messagerDemiReve(targetCoord);
break;
case 'changeur':
case 'passeur':
await this._deplacerDemiReve(targetCoord, deplacementType);
break;
default:
ui.notifications.error("Vous ne pouvez pas vous déplacer que sur des cases adjacentes à votre position ou valides dans le cas d'une rencontre");
console.log("STATUS :", this.rencontreState, this.currentRencontre);
}
this.checkQuitterTMR(); this.checkQuitterTMR();
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_calculDeplacement(targetCoord, currentCoord, fromOddq, toOddq) { _calculDeplacement(targetCoord, currentCoord, fromOddq, toOddq) {
const isInArea = this.rencontreState == 'aucune' const isInArea = this.rencontreState == 'aucune'
? (this.isTerreAttache(targetCoord) || this.isConnaissanceFleuve(currentCoord, targetCoord) || TMRUtility.distanceOddq(fromOddq, toOddq) <= 1) ? (this.isTerreAttache(targetCoord) || this.isConnaissanceFleuve(currentCoord, targetCoord) || TMRUtility.distanceOddq(fromOddq, toOddq) <= 1)
: this.currentRencontre?.locList.find(coord => coord == targetCoord) ?? false : this.currentRencontre?.locList.find(coord => coord == targetCoord) ?? false
if (isInArea) { if (isInArea) {
switch (this.rencontreState) { switch (this.rencontreState) {
case 'aucune': return 'normal'; case 'aucune': return 'normal';
case 'messager': return 'messager'; case 'passeur': case 'changeur': case 'messager': return this.rencontreState;
case 'passeur': case 'changeur': return 'saut';
} }
} }
return 'erreur' return 'erreur';
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@@ -932,9 +949,8 @@ export class RdDTMRDialog extends Dialog {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
externalRefresh(tmrData) { externalRefresh() {
this.createPixiSprites(); this.createPixiSprites();
this.forceDemiRevePositionView();
this.updateValuesDisplay(); this.updateValuesDisplay();
this.updateTokens(); this.updateTokens();
console.log("TMR REFRESHED !!!"); console.log("TMR REFRESHED !!!");
@@ -946,23 +962,17 @@ export class RdDTMRDialog extends Dialog {
this.nettoyerRencontre(); this.nettoyerRencontre();
} }
let tmr = TMRUtility.getTMR(targetCoord); let tmr = TMRUtility.getTMR(targetCoord);
//console.log("deplacerDemiReve", tmr, this);
// Gestion cases spéciales type Trou noir, etc // Gestion cases spéciales type Trou noir, etc
tmr = await this.manageTmrInnaccessible(tmr); tmr = await this.manageTmrInnaccessible(tmr);
await this.actor.updateCoordTMR(tmr.coord); await this.actor.updateCoordTMR(tmr.coord);
this._updateDemiReve(); this.forceDemiRevePositionView();
if (ReglesOptionelles.isUsing("appliquer-fatigue")) { if (ReglesOptionelles.isUsing("appliquer-fatigue")) {
this.cumulFatigue += this.fatigueParCase; this.cumulFatigue += this.fatigueParCase;
} }
this.updateValuesDisplay(); this.updateValuesDisplay();
game.socket.emit(SYSTEM_SOCKET_ID, { this.actor.notifyRefreshTMR();
msg: "msg_tmr_move", data: {
actorId: this.actor.data._id,
tmrPos: Misc.data(this.actor).data.reve.tmrpos
}
});
if (deplacementType == 'normal') { // Pas de rencontres après un saut de type passeur/changeur/... if (deplacementType == 'normal') { // Pas de rencontres après un saut de type passeur/changeur/...
await this.manageRencontre(tmr, () => this.postRencontre(tmr)); await this.manageRencontre(tmr, () => this.postRencontre(tmr));
@@ -995,14 +1005,9 @@ export class RdDTMRDialog extends Dialog {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async forceDemiRevePositionView() { async positionnerDemiReve(coord) {
this._updateDemiReve();
}
/* -------------------------------------------- */
async forceDemiRevePosition(coord) {
await this.actor.updateCoordTMR(coord); await this.actor.updateCoordTMR(coord);
this._updateDemiReve(); this.forceDemiRevePositionView();
let tmr = TMRUtility.getTMR(coord); let tmr = TMRUtility.getTMR(coord);
await this.postRencontre(tmr); await this.postRencontre(tmr);
return tmr; return tmr;
@@ -1024,15 +1029,7 @@ export class RdDTMRDialog extends Dialog {
_getCaseRectangleCoord(coord) { _getCaseRectangleCoord(coord) {
return this.pixiTMR.getCaseRectangle(TMRUtility.coordTMRToOddq(coord)); return this.pixiTMR.getCaseRectangle(TMRUtility.coordTMRToOddq(coord));
} }
/* -------------------------------------------- */
_setTokenPosition(token) {
if (this.isDemiReveCache() && this.demiReve === token ) {
return;
}
this.pixiTMR.setPosition(token.sprite, TMRUtility.coordTMRToOddq(token.coordTMR()));
}
/* -------------------------------------------- */ /* -------------------------------------------- */
_removeTokens(filter) { _removeTokens(filter) {
const tokensToRemove = this.allTokens.filter(filter); const tokensToRemove = this.allTokens.filter(filter);
@@ -1040,10 +1037,13 @@ export class RdDTMRDialog extends Dialog {
this.pixiApp.stage.removeChild(token.sprite); this.pixiApp.stage.removeChild(token.sprite);
} }
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_trackToken(token) { _trackToken(token) {
if (this.demiReve === token && this.isDemiReveCache()) {
return;
}
this.pixiTMR.setPosition(token.sprite, TMRUtility.coordTMRToOddq(token.coordTMR()));
this.allTokens.push(token); this.allTokens.push(token);
this._setTokenPosition(token);
} }
} }

View File

@@ -8,7 +8,7 @@ export class RdDTokenHud {
static init() { static init() {
// Integration du TokenHUD // Integration du TokenHUD
Hooks.on('renderTokenHUD', (app, html, data) => { RdDTokenHud.addTokenHudExtensions(app, html, data._id) }); Hooks.on('renderTokenHUD', (app, html, token) => { RdDTokenHud.addTokenHudExtensions(app, html, token._id) });
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@@ -22,41 +22,64 @@ export class RdDTokenHud {
let token = canvas.tokens.get(tokenId); let token = canvas.tokens.get(tokenId);
let actor = token.actor; let actor = token.actor;
let combatant = game.combat.combatants.find(c => Misc.data(c).tokenId == tokenId); let combatant = game.combat.combatants.find(c => c.tokenId == tokenId);
if (! (combatant?.actor) ) {
ui.notifications.warn(`Le combatant ${token.name} n'est pas associé à un acteur, impossible de déterminer ses actions de combat!`)
return;
}
app.hasExtension = true; app.hasExtension = true;
let armesList = RdDCombatManager.buildListeActionsCombat(combatant); let actionsCombat = RdDCombatManager.listActionsCombat(combatant);
const hudData = { const hudData = {
combatant: combatant, armes: armesList, combatant: combatant,
commandes: [{ name: 'Initiative +1', command: 'inc', value: 0.01 }, { name: 'Initiative -1', command: 'dec', value: -0.01 }] actions: actionsCombat,
commandes: [
{ name: "Autre action", command: 'autre' },
{ name: 'Initiative +1', command: 'inc', value: 0.01 },
{ name: 'Initiative -1', command: 'dec', value: -0.01 }]
}; };
const controlIconCombat = html.find('.control-icon[data-action=combat]'); const controlIconCombat = html.find('.control-icon[data-action=combat]');
// initiative // initiative
await RdDTokenHud._configureSubMenu(controlIconCombat, 'systems/foundryvtt-reve-de-dragon/templates/hud-actor-init.html', hudData, await RdDTokenHud._configureSubMenu(controlIconCombat,
'systems/foundryvtt-reve-de-dragon/templates/hud-actor-init.html',
hudData,
(event) => { (event) => {
let initCommand = event.currentTarget.attributes['data-command'].value; let initCommand = event.currentTarget.attributes['data-command']?.value;
let combatantId = event.currentTarget.attributes['data-combatant-id'].value; let combatantId = event.currentTarget.attributes['data-combatant-id']?.value;
if (!initCommand) { if (initCommand) {
let armeIndex = event.currentTarget.attributes['data-arme-id'].value; RdDTokenHud._initiativeCommand(initCommand, combatantId);
let arme = armesList[armeIndex]; } else {
RdDCombatManager.rollInitiativeCompetence(combatantId, arme); let index = event.currentTarget.attributes['data-action-index'].value;
} else if (initCommand == 'inc') { let action = actionsCombat[index];
RdDCombatManager.incDecInit(combatantId, 0.01); RdDCombatManager.rollInitiativeAction(combatantId, action);
} else if (initCommand == 'dec') { }
RdDCombatManager.incDecInit(combatantId, -0.01);
}
}); });
const controlIconTarget = html.find('.control-icon[data-action=target]'); const controlIconTarget = html.find('.control-icon[data-action=target]');
// combat // combat
await RdDTokenHud._configureSubMenu(controlIconTarget, 'systems/foundryvtt-reve-de-dragon/templates/hud-actor-attaque.html', hudData, await RdDTokenHud._configureSubMenu(controlIconTarget, 'systems/foundryvtt-reve-de-dragon/templates/hud-actor-attaque.html', hudData,
(event) => { (event) => {
let armeIndex = event.currentTarget.attributes['data-arme-id'].value; const actionIndex = event.currentTarget.attributes['data-action-index']?.value;
actor.rollArme(armesList[armeIndex]); const action = actionsCombat[actionIndex];
if (action.action == 'conjurer') {
actor.conjurerPossession(actor.getPossession(action.system.possessionid));
}
else {
actor.rollArme(action);
}
}); });
} }
static _initiativeCommand(initCommand, combatantId) {
switch (initCommand) {
case 'inc': return RdDCombatManager.incDecInit(combatantId, 0.01);
case 'dec': return RdDCombatManager.incDecInit(combatantId, -0.01);
case 'autre': return RdDCombatManager.rollInitiativeAction(combatantId,
{ name: "Autre action", action: 'autre', system: { initOnly: true, competence: "Autre action" } });
}
}
/* -------------------------------------------- */ /* -------------------------------------------- */
static async addTokenHudExtensions(app, html, tokenId) { static async addTokenHudExtensions(app, html, tokenId) {
const controlIconCombat = html.find('.control-icon[data-action=combat]'); const controlIconCombat = html.find('.control-icon[data-action=combat]');

View File

@@ -11,6 +11,7 @@ import { RdDDice } from "./rdd-dice.js";
import { RdDItem } from "./item.js"; import { RdDItem } from "./item.js";
import { Monnaie } from "./item-monnaie.js"; import { Monnaie } from "./item-monnaie.js";
import { RdDPossession } from "./rdd-possession.js"; import { RdDPossession } from "./rdd-possession.js";
import { RdDNameGen } from "./rdd-namegen.js";
/* -------------------------------------------- */ /* -------------------------------------------- */
// This table starts at 0 -> niveau -10 // This table starts at 0 -> niveau -10
@@ -103,7 +104,7 @@ export class RdDUtility {
/* -------------------------------------------- */ /* -------------------------------------------- */
static async init() { static async init() {
Hooks.on("renderChatMessage", async (app, html, msg) => RdDUtility.onRenderChatMessage(app, html, msg)); Hooks.on("renderChatMessage", async (app, html, msg) => RdDUtility.onRenderChatMessage(app, html, msg));
Hooks.on('renderChatLog', (log, html, data) => RdDUtility.chatListeners(html)); Hooks.on('renderChatLog', (log, html, chatLog) => RdDUtility.chatListeners(html));
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@@ -120,11 +121,18 @@ export class RdDUtility {
'systems/foundryvtt-reve-de-dragon/templates/actor-sheet-oeuvre-partial.html', 'systems/foundryvtt-reve-de-dragon/templates/actor-sheet-oeuvre-partial.html',
'systems/foundryvtt-reve-de-dragon/templates/actor-liste-blessures-partial.html', 'systems/foundryvtt-reve-de-dragon/templates/actor-liste-blessures-partial.html',
'systems/foundryvtt-reve-de-dragon/templates/actor-blessure-partial.html', 'systems/foundryvtt-reve-de-dragon/templates/actor-blessure-partial.html',
'systems/foundryvtt-reve-de-dragon/templates/actor-sheet-queues.html',
// Conteneur/item in Actor sheet // Conteneur/item in Actor sheet
'systems/foundryvtt-reve-de-dragon/templates/actor-sheet-inventaire-conteneur.html', 'systems/foundryvtt-reve-de-dragon/templates/actor-sheet-inventaire.html',
'systems/foundryvtt-reve-de-dragon/templates/actor-sheet-item-queue.html',
'systems/foundryvtt-reve-de-dragon/templates/actor-sheet-inventaire-item.html',
"systems/foundryvtt-reve-de-dragon/templates/actor-sheet-inventaire-monnaie.html", "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-inventaire-monnaie.html",
'systems/foundryvtt-reve-de-dragon/templates/actor-sheet-liens-animaux.html',
'systems/foundryvtt-reve-de-dragon/templates/actor-sheet-liens-suivants.html',
'systems/foundryvtt-reve-de-dragon/templates/actor-sheet-liens-vehicules.html',
'systems/foundryvtt-reve-de-dragon/templates/actor-sheet-editor-notes-mj.html', 'systems/foundryvtt-reve-de-dragon/templates/actor-sheet-editor-notes-mj.html',
//Items //Items
'systems/foundryvtt-reve-de-dragon/templates/header-item.html',
'systems/foundryvtt-reve-de-dragon/templates/item-competence-sheet.html', 'systems/foundryvtt-reve-de-dragon/templates/item-competence-sheet.html',
'systems/foundryvtt-reve-de-dragon/templates/item-competencecreature-sheet.html', 'systems/foundryvtt-reve-de-dragon/templates/item-competencecreature-sheet.html',
'systems/foundryvtt-reve-de-dragon/templates/item-arme-sheet.html', 'systems/foundryvtt-reve-de-dragon/templates/item-arme-sheet.html',
@@ -221,8 +229,10 @@ export class RdDUtility {
]; ];
Handlebars.registerHelper('upperFirst', str => Misc.upperFirst(str ?? 'Null')); Handlebars.registerHelper('upperFirst', str => Misc.upperFirst(str ?? 'Null'));
Handlebars.registerHelper('lowerFirst', str => Misc.lowerFirst(str ?? 'Null'));
Handlebars.registerHelper('upper', str => str?.toUpperCase() ?? 'NULL'); Handlebars.registerHelper('upper', str => str?.toUpperCase() ?? 'NULL');
Handlebars.registerHelper('le', str => Grammar.articleDetermine(str)); Handlebars.registerHelper('le', str => Grammar.articleDetermine(str));
Handlebars.registerHelper('apostrophe', (article, str) => Grammar.apostrophe(article, str));
Handlebars.registerHelper('un', str => Grammar.articleIndetermine(str)); Handlebars.registerHelper('un', str => Grammar.articleIndetermine(str));
Handlebars.registerHelper('accord', (genre, ...args) => Grammar.accord(genre, args)); Handlebars.registerHelper('accord', (genre, ...args) => Grammar.accord(genre, args));
Handlebars.registerHelper('buildConteneur', (objet) => { return new Handlebars.SafeString(RdDUtility.buildConteneur(objet)); }); Handlebars.registerHelper('buildConteneur', (objet) => { return new Handlebars.SafeString(RdDUtility.buildConteneur(objet)); });
@@ -232,36 +242,38 @@ export class RdDUtility {
Handlebars.registerHelper('typeTmr-name', coord => TMRUtility.typeTmrName(coord)); Handlebars.registerHelper('typeTmr-name', coord => TMRUtility.typeTmrName(coord));
Handlebars.registerHelper('min', (...args) => Math.min(...args.slice(0, -1))); Handlebars.registerHelper('min', (...args) => Math.min(...args.slice(0, -1)));
Handlebars.registerHelper('sortCompetence', competences => competences.sort((a, b) => { Handlebars.registerHelper('filtreTriCompetences', competences => competences.filter(it => it.system.isVisible)
if (a.name.startsWith("Survie") && b.name.startsWith("Survie")) { .sort((a, b) => {
if (a.name.includes("Cité")) return -1; if (a.name.startsWith("Survie") && b.name.startsWith("Survie")) {
if (b.name.includes("Cité")) return 1; if (a.name.includes("Cité")) return -1;
if (a.name.includes("Extérieur")) return -1; if (b.name.includes("Cité")) return 1;
if (b.name.includes("Extérieur")) return 1; if (a.name.includes("Extérieur")) return -1;
if (b.name.includes("Extérieur")) return 1;
return a.name.localeCompare(b.name);
}
if (a.system.categorie.startsWith("melee") && b.system.categorie.startsWith("melee")) {
if (a.name.includes("Corps")) return -1;
if (b.name.includes("Corps")) return 1;
if (a.name.includes("Dague")) return -1;
if (b.name.includes("Dague")) return 1;
if (a.name.includes("Esquive")) return -1;
if (b.name.includes("Esquive")) return 1;
return a.name.localeCompare(b.name);
}
if (a.name.startsWith("Voie") && b.name.startsWith("Voie")) {
if (a.name.includes("Oniros")) return -1;
if (b.name.includes("Oniros")) return 1;
if (a.name.includes("Hypnos")) return -1;
if (b.name.includes("Hypnos")) return 1;
if (a.name.includes("Narcos")) return -1;
if (b.name.includes("Narcos")) return 1;
if (a.name.includes("Thanatos")) return -1;
if (b.name.includes("Thanatos")) return 1;
return a.name.localeCompare(b.name);
}
return a.name.localeCompare(b.name); return a.name.localeCompare(b.name);
} })
if (a.data.categorie.startsWith("melee") && b.data.categorie.startsWith("melee")) { );
if (a.name.includes("Corps")) return -1;
if (b.name.includes("Corps")) return 1;
if (a.name.includes("Dague")) return -1;
if (b.name.includes("Dague")) return 1;
if (a.name.includes("Esquive")) return -1;
if (b.name.includes("Esquive")) return 1;
return a.name.localeCompare(b.name);
}
if (a.name.startsWith("Voie") && b.name.startsWith("Voie")) {
if (a.name.includes("Oniros")) return -1;
if (b.name.includes("Oniros")) return 1;
if (a.name.includes("Hypnos")) return -1;
if (b.name.includes("Hypnos")) return 1;
if (a.name.includes("Narcos")) return -1;
if (b.name.includes("Narcos")) return 1;
if (a.name.includes("Thanatos")) return -1;
if (b.name.includes("Thanatos")) return 1;
return a.name.localeCompare(b.name);
}
return a.name.localeCompare(b.name);
}));
return loadTemplates(templatePaths); return loadTemplates(templatePaths);
} }
@@ -326,8 +338,8 @@ export class RdDUtility {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static checkNull(items) { static arrayOrEmpty(items) {
if (items && items.length) { if (items?.length) {
return items; return items;
} }
return []; return [];
@@ -360,44 +372,44 @@ export class RdDUtility {
RdDUtility.filterEquipementParType(formData); RdDUtility.filterEquipementParType(formData);
formData.sorts = this.checkNull(formData.itemsByType['sort']); formData.sorts = this.arrayOrEmpty(formData.itemsByType['sort']);
formData.signesdraconiques = this.checkNull(formData.itemsByType['signedraconique']); formData.signesdraconiques = this.arrayOrEmpty(formData.itemsByType['signedraconique']);
formData.queues = this.checkNull(formData.itemsByType['queue']); formData.queues = this.arrayOrEmpty(formData.itemsByType['queue']);
formData.souffles = this.checkNull(formData.itemsByType['souffle']); formData.souffles = this.arrayOrEmpty(formData.itemsByType['souffle']);
formData.ombres = this.checkNull(formData.itemsByType['ombre']); formData.ombres = this.arrayOrEmpty(formData.itemsByType['ombre']);
formData.tetes = this.checkNull(formData.itemsByType['tete']); formData.tetes = this.arrayOrEmpty(formData.itemsByType['tete']);
formData.taches = this.checkNull(formData.itemsByType['tache']); formData.taches = this.arrayOrEmpty(formData.itemsByType['tache']);
formData.meditations = this.checkNull(formData.itemsByType['meditation']); formData.meditations = this.arrayOrEmpty(formData.itemsByType['meditation']);
formData.chants = this.checkNull(formData.itemsByType['chant']); formData.chants = this.arrayOrEmpty(formData.itemsByType['chant']);
formData.danses = this.checkNull(formData.itemsByType['danse']); formData.danses = this.arrayOrEmpty(formData.itemsByType['danse']);
formData.musiques = this.checkNull(formData.itemsByType['musique']); formData.musiques = this.arrayOrEmpty(formData.itemsByType['musique']);
formData.oeuvres = this.checkNull(formData.itemsByType['oeuvre']); formData.oeuvres = this.arrayOrEmpty(formData.itemsByType['oeuvre']);
formData.jeux = this.checkNull(formData.itemsByType['jeu']); formData.jeux = this.arrayOrEmpty(formData.itemsByType['jeu']);
formData.recettescuisine = this.checkNull(formData.itemsByType['recettecuisine']); formData.recettescuisine = this.arrayOrEmpty(formData.itemsByType['recettecuisine']);
formData.recettesAlchimiques = this.checkNull(formData.itemsByType['recettealchimique']); formData.recettesAlchimiques = this.arrayOrEmpty(formData.itemsByType['recettealchimique']);
formData.maladies = this.checkNull(formData.itemsByType['maladie']); formData.maladies = this.arrayOrEmpty(formData.itemsByType['maladie']);
formData.poisons = this.checkNull(formData.itemsByType['poison']); formData.poisons = this.arrayOrEmpty(formData.itemsByType['poison']);
formData.possessions = this.checkNull(formData.itemsByType['possession']); formData.possessions = this.arrayOrEmpty(formData.itemsByType['possession']);
formData.maladiesPoisons = formData.maladies.concat(formData.poisons); formData.maladiesPoisons = formData.maladies.concat(formData.poisons);
formData.competences = (formData.itemsByType.competence ?? []).concat(formData.itemsByType.competencecreature ?? []); formData.competences = (formData.itemsByType.competence ?? []).concat(formData.itemsByType.competencecreature ?? []);
} }
static filterEquipementParType(formData) { static filterEquipementParType(formData) {
formData.conteneurs = this.checkNull(formData.itemsByType['conteneur']); formData.conteneurs = this.arrayOrEmpty(formData.itemsByType['conteneur']);
formData.materiel = this.checkNull(formData.itemsByType['objet']); formData.materiel = this.arrayOrEmpty(formData.itemsByType['objet']);
formData.armes = this.checkNull(formData.itemsByType['arme']); formData.armes = this.arrayOrEmpty(formData.itemsByType['arme']);
formData.armures = this.checkNull(formData.itemsByType['armure']); formData.armures = this.arrayOrEmpty(formData.itemsByType['armure']);
formData.munitions = this.checkNull(formData.itemsByType['munition']); formData.munitions = this.arrayOrEmpty(formData.itemsByType['munition']);
formData.livres = this.checkNull(formData.itemsByType['livre']); formData.livres = this.arrayOrEmpty(formData.itemsByType['livre']);
formData.potions = this.checkNull(formData.itemsByType['potion']); formData.potions = this.arrayOrEmpty(formData.itemsByType['potion']);
formData.ingredients = this.checkNull(formData.itemsByType['ingredient']); formData.ingredients = this.arrayOrEmpty(formData.itemsByType['ingredient']);
formData.herbes = this.checkNull(formData.itemsByType['herbe']); formData.herbes = this.arrayOrEmpty(formData.itemsByType['herbe']);
formData.monnaie = this.checkNull(formData.itemsByType['monnaie']); formData.monnaie = this.arrayOrEmpty(formData.itemsByType['monnaie']);
formData.monnaie.sort(Monnaie.triValeurDenier()); formData.monnaie.sort(Monnaie.triValeurDenier());
formData.nourritureboissons = this.checkNull(formData.itemsByType['nourritureboisson']); formData.nourritureboissons = this.arrayOrEmpty(formData.itemsByType['nourritureboisson']);
formData.gemmes = this.checkNull(formData.itemsByType['gemme']); formData.gemmes = this.arrayOrEmpty(formData.itemsByType['gemme']);
formData.objets = formData.conteneurs formData.objets = formData.conteneurs
.concat(formData.materiel) .concat(formData.materiel)
@@ -419,7 +431,7 @@ export class RdDUtility {
// Attribution des objets aux conteneurs // Attribution des objets aux conteneurs
for (let conteneur of conteneurs) { for (let conteneur of conteneurs) {
conteneur.subItems = []; conteneur.subItems = [];
for (let id of conteneur.data.contenu ?? []) { for (let id of conteneur.system.contenu ?? []) {
let objet = objets.find(objet => (id == objet._id)); let objet = objets.find(objet => (id == objet._id));
if (objet) { if (objet) {
objet.estContenu = true; // Permet de filtrer ce qui est porté dans le template objet.estContenu = true; // Permet de filtrer ce qui est porté dans le template
@@ -429,27 +441,26 @@ export class RdDUtility {
} }
} }
for (let conteneur of conteneurs) { for (let conteneur of conteneurs) {
conteneur.data.encTotal = RdDUtility.calculEncContenu(conteneur, objets); conteneur.system.encTotal = RdDUtility.calculEncContenu(conteneur, objets);
} }
return objetVersConteneur; return objetVersConteneur;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static calculEncContenu(conteneur, objets) { static calculEncContenu(conteneur, objets) {
const itemData = Misc.data(conteneur); const contenus = (conteneur.system.contenu ?? []).filter(id => id != undefined)
const contenuDatas = (itemData.data.contenu ?? []).filter(id => id != undefined) .map(id => objets.find(it => (id == it.id)))
.map(id => Misc.data(objets.find(it => (id == it._id))))
.filter(it => it); .filter(it => it);
let enc = Number(itemData.data.encombrement ?? 0) * Number(itemData.data.quantite ?? 1); let enc = Number(conteneur.system.encombrement ?? 0) * Number(conteneur.system.quantite ?? 1);
for (let itemData of contenuDatas) { for (let contenu of contenus) {
if (itemData.type == 'conteneur') { if (contenu.type == 'conteneur') {
enc += RdDUtility.calculEncContenu(itemData, objets); enc += RdDUtility.calculEncContenu(contenu, objets);
} }
else { else {
enc += Number(itemData.data.encombrement ?? 0) * Number(itemData.data.quantite ?? 1); enc += Number(contenu.system.encombrement ?? 0) * Number(contenu.system.quantite ?? 1)
} }
} }
return enc; return enc
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@@ -462,34 +473,32 @@ export class RdDUtility {
/** Construit la structure récursive des conteneurs, avec imbrication potentielle /** Construit la structure récursive des conteneurs, avec imbrication potentielle
* *
*/ */
static buildConteneur(objet, niveau) { static buildConteneur(objet, profondeur) {
if (!niveau) niveau = 1; if (!profondeur) profondeur = 1;
objet.niveau = niveau; objet.niveau = profondeur;
//console.log("OBJ:", objet); const isConteneur = objet.type == 'conteneur';
let str = Handlebars.partials['systems/foundryvtt-reve-de-dragon/templates/actor-sheet-inventaire-conteneur.html']({ item: objet }); const isOuvert = isConteneur && this.getAfficheContenu(objet._id);
if (objet.type == 'conteneur') { const isVide = isConteneur && objet.system.contenu.length == 0;
const afficherContenu = this.getAfficheContenu(objet._id); const conteneur = Handlebars.partials['systems/foundryvtt-reve-de-dragon/templates/actor-sheet-inventaire-item.html']({
str = str + RdDUtility.buildContenu(objet, niveau, afficherContenu); item: objet,
} vide: isVide,
return str; ouvert: isOuvert
});
const contenu = isConteneur ? RdDUtility.buildContenu(objet, profondeur, isOuvert) : '';
return conteneur + contenu;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static buildContenu(objet, niveau, afficherContenu) { static buildContenu(objet, profondeur, afficherContenu) {
if (!niveau) niveau = 1; if (!profondeur) profondeur = 1;
objet.niveau = niveau; objet.niveau = profondeur;
let strContenu = ""; const display = afficherContenu ? 'item-display-show' : 'item-display-hide';
//console.log("ITEM DISPLAYED", objet ); //console.log("ITEM DISPLAYED", objet );
if (afficherContenu) { let strContenu = `<ul class='item-list alterne-list ${display} list-item-margin${profondeur}'>`;
strContenu = "<ul class='item-list alterne-list item-display-show list-item-margin" + niveau + "'>";
} else {
strContenu = "<ul class='item-list alterne-list item-display-hide list-item-margin" + niveau + "'>";
}
for (let subItem of objet.subItems) { for (let subItem of objet.subItems) {
strContenu = strContenu + this.buildConteneur(subItem, niveau + 1); strContenu += this.buildConteneur(subItem, profondeur + 1);
} }
strContenu = strContenu + "</ul>"; return strContenu + "</ul>";
return strContenu;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@@ -647,9 +656,9 @@ export class RdDUtility {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static async responseNombreAstral(data) { static async responseNombreAstral(callData) {
let actor = game.actors.get(data.id); let actor = game.actors.get(callData.id);
actor.ajouteNombreAstral(data); actor.ajouteNombreAstral(callData);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@@ -666,7 +675,7 @@ export class RdDUtility {
case "msg_tmr_move": case "msg_tmr_move":
let actor = game.actors.get(sockmsg.data.actorId); let actor = game.actors.get(sockmsg.data.actorId);
if (actor.isOwner || game.user.isGM) { if (actor.isOwner || game.user.isGM) {
actor.refreshTMRView(sockmsg.data.tmrPos); actor.refreshTMRView();
} }
break; break;
} }
@@ -681,7 +690,7 @@ export class RdDUtility {
let coord = event.currentTarget.attributes['data-tmr-coord'].value; let coord = event.currentTarget.attributes['data-tmr-coord'].value;
let actorId = event.currentTarget.attributes['data-actor-id'].value; let actorId = event.currentTarget.attributes['data-actor-id'].value;
let actor = game.actors.get(actorId); let actor = game.actors.get(actorId);
actor.tmrApp.forceDemiRevePosition(coord); actor.tmrApp.positionnerDemiReve(coord);
}); });
// Gestion spécifique des sorts en réserve multiples (ie têtes) // Gestion spécifique des sorts en réserve multiples (ie têtes)
html.on("click", '#sort-reserve', event => { html.on("click", '#sort-reserve', event => {
@@ -692,7 +701,7 @@ export class RdDUtility {
actor.tmrApp.lancerSortEnReserve(coord, sortId); actor.tmrApp.lancerSortEnReserve(coord, sortId);
}); });
// gestion bouton tchat Acheter // gestion bouton tchat Possession
html.on("click", '.defense-possession', event => { html.on("click", '.defense-possession', event => {
let attackerId = event.currentTarget.attributes['data-attackerId'].value let attackerId = event.currentTarget.attributes['data-attackerId'].value
let defenderId = event.currentTarget.attributes['data-defenderId'].value let defenderId = event.currentTarget.attributes['data-defenderId'].value
@@ -702,6 +711,7 @@ export class RdDUtility {
// gestion bouton tchat Acheter // gestion bouton tchat Acheter
html.on("click", '.button-acheter', event => DialogItemAchat.onButtonAcheter(event)); html.on("click", '.button-acheter', event => DialogItemAchat.onButtonAcheter(event));
html.on("click", '.button-creer-acteur', event => RdDNameGen.onCreerActeur(event));
// Gestion du bouton payer // Gestion du bouton payer
html.on("click", '.payer-button', event => { html.on("click", '.payer-button', event => {
@@ -746,7 +756,7 @@ export class RdDUtility {
static getSelectedActor(msgPlayer = undefined) { static getSelectedActor(msgPlayer = undefined) {
if (canvas.tokens.controlled.length == 1) { if (canvas.tokens.controlled.length == 1) {
let token = canvas.tokens.controlled[0]; let token = canvas.tokens.controlled[0];
if (token.actor && token.data.actorLink) { if (token.actor) {
return token.actor; return token.actor;
} }
if (msgPlayer != undefined) { if (msgPlayer != undefined) {
@@ -769,7 +779,7 @@ export class RdDUtility {
static createMonnaie(name, valeur_deniers, img = "", enc = 0.01) { static createMonnaie(name, valeur_deniers, img = "", enc = 0.01) {
let piece = { let piece = {
name: name, type: 'monnaie', img: img, _id: randomID(16), name: name, type: 'monnaie', img: img, _id: randomID(16),
data: { dasystemta: {
quantite: 0, quantite: 0,
valeur_deniers: valeur_deniers, valeur_deniers: valeur_deniers,
encombrement: enc, encombrement: enc,
@@ -821,21 +831,17 @@ export class RdDUtility {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static confirmerSuppressionSubacteur(actorSheet, li) { static confirmerSuppression(sheet, htmlToDelete, options) {
let actorId = li.data("actor-id"); const d = new Dialog({
let actor = game.actors.get(actorId); title: options.title ?? 'Confirmer la suppression',
let msgTxt = "<p>Etes vous certain de vouloir supprimer le lien vers ce véhicule/monture/suivant : " + actor.data.name + " ?</p>"; content: `<p>Etes vous certain de vouloir supprimer ${options.supprimer ?? 'cet objet'} ?</p>`,
let d = new Dialog({
title: "Confirmer la suppression du lien",
content: msgTxt,
buttons: { buttons: {
delete: { delete: {
icon: '<i class="fas fa-check"></i>', icon: '<i class="fas fa-check"></i>',
label: "Supprimer le lien", label: options.deleteLabel ?? 'Supprimer',
callback: () => { callback: () => {
console.log("Delete : ", actorId); options.onDelete();
actorSheet.actor.removeSubacteur(actorId); RdDUtility.slideOnDelete(sheet, htmlToDelete);
li.slideUp(200, () => actorSheet.render(false));
} }
}, },
cancel: { cancel: {
@@ -849,11 +855,21 @@ export class RdDUtility {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static async confirmerSuppression(actorSheet, li) { static confirmerSuppressionSubacteur(sheet, subActor, htmlToDelete) {
let itemId = li.data("item-id"); RdDUtility.confirmerSuppression(sheet, htmlToDelete,{
let objet = actorSheet.actor.getObjet(itemId); supprimer: "le lien vers le véhicule/monture/suivant : " + subActor.name,
deleteLabel: "Supprimer le lien",
onDelete: () => {
console.log("Delete : ", subActor.id);
sheet.actor.removeSubacteur(subActor.id);
}
})
}
if (objet.type == 'monnaie' && Monnaie.isSystemMonnaie(objet)) { /* -------------------------------------------- */
static async confirmerSuppressionItem(sheet, item, htmlToDelete) {
const itemId = item.id;
if (Monnaie.isSystemMonnaie(item, sheet.actor.items)) {
ui.notifications.warn("Suppression des monnaies de base impossible"); ui.notifications.warn("Suppression des monnaies de base impossible");
return; return;
} }
@@ -865,8 +881,8 @@ export class RdDUtility {
label: "Supprimer l'objet", label: "Supprimer l'objet",
callback: () => { callback: () => {
console.log("Delete : ", itemId); console.log("Delete : ", itemId);
actorSheet.actor.deleteEmbeddedDocuments('Item', [itemId]); sheet.actor.deleteEmbeddedDocuments('Item', [itemId]);
li.slideUp(200, () => actorSheet.render(false)); RdDUtility.slideOnDelete(sheet, htmlToDelete);
} }
}, },
cancel: { cancel: {
@@ -874,16 +890,15 @@ export class RdDUtility {
label: "Annuler" label: "Annuler"
} }
} }
const docData = Misc.data(objet); if (item.type == 'conteneur' && item.system.contenu.length > 0) {
if (docData.type == 'conteneur' && docData.data.contenu.length > 0) {
msgTxt += "<br>Ce conteneur n'est pas vide. Choisissez l'option de suppression"; msgTxt += "<br>Ce conteneur n'est pas vide. Choisissez l'option de suppression";
buttons['deleteall'] = { buttons['deleteall'] = {
icon: '<i class="fas fa-check"></i>', icon: '<i class="fas fa-check"></i>',
label: "Supprimer le conteneur et tout son contenu", label: "Supprimer le conteneur et tout son contenu",
callback: () => { callback: () => {
console.log("Delete : ", itemId); console.log("Delete : ", itemId);
actorSheet.actor.deleteAllConteneur(itemId); sheet.actor.deleteAllConteneur(itemId);
li.slideUp(200, () => actorSheet.render(false)); RdDUtility.slideOnDelete(sheet, htmlToDelete);
} }
} }
} }
@@ -897,6 +912,10 @@ export class RdDUtility {
d.render(true); d.render(true);
} }
static slideOnDelete(sheet, htmlToDelete) {
return htmlToDelete.slideUp(200, () => sheet.render(false));
}
/* -------------------------------------------- */ /* -------------------------------------------- */
static afficherHeuresChanceMalchance(heureNaissance) { static afficherHeuresChanceMalchance(heureNaissance) {
if (game.user.isGM) { if (game.user.isGM) {

View File

@@ -19,9 +19,9 @@ import { ReglesOptionelles } from "./regles-optionelles.js";
*/ */
export const referenceAjustements = { export const referenceAjustements = {
competence: { competence: {
isUsed: (rollData, actor) => Misc.data(rollData.competence), isUsed: (rollData, actor) => rollData.competence,
getLabel: (rollData, actor) => Misc.data(rollData.competence)?.name, getLabel: (rollData, actor) => rollData.competence?.name,
getValue: (rollData, actor) => Misc.data(rollData.competence)?.data?.niveau, getValue: (rollData, actor) => rollData.competence?.system?.niveau,
}, },
meditation: { meditation: {
isUsed: (rollData, actor) => rollData.meditation, isUsed: (rollData, actor) => rollData.meditation,
@@ -33,7 +33,7 @@ export const referenceAjustements = {
getLabel: (rollData, actor) => rollData.selectedSort?.name ?? rollData.attackerRoll ? 'Imposée' : 'Libre', getLabel: (rollData, actor) => rollData.selectedSort?.name ?? rollData.attackerRoll ? 'Imposée' : 'Libre',
getValue: (rollData, actor) => rollData.selectedSort getValue: (rollData, actor) => rollData.selectedSort
? RdDItemSort.getDifficulte(rollData.selectedSort, rollData.diffLibre) ? RdDItemSort.getDifficulte(rollData.selectedSort, rollData.diffLibre)
: rollData.diffLibre ?? Misc.data(rollData.competence)?.data.default_diffLibre ?? 0 : rollData.diffLibre ?? rollData.competence?.system.default_diffLibre ?? 0
}, },
diffConditions: { diffConditions: {
isUsed: (rollData, actor) => rollData.diffConditions != undefined, isUsed: (rollData, actor) => rollData.diffConditions != undefined,
@@ -95,10 +95,10 @@ export const referenceAjustements = {
getDescr: (rollData, actor) => rollData.diviseurSignificative > 1 ? `Facteur significative <span class="rdd-diviseur">&times;${Misc.getFractionHtml(rollData.diviseurSignificative)}</span>` : '' getDescr: (rollData, actor) => rollData.diviseurSignificative > 1 ? `Facteur significative <span class="rdd-diviseur">&times;${Misc.getFractionHtml(rollData.diviseurSignificative)}</span>` : ''
}, },
isEcaille: { isEcaille: {
isVisible: (rollData, actor) => Misc.data(rollData.arme)?.data.magique && Number(Misc.data(rollData.arme)?.data.ecaille_efficacite) > 0, isVisible: (rollData, actor) => rollData.arme?.system.magique && Number(rollData.arme?.system.ecaille_efficacite) > 0,
isUsed: (rollData, actor) => Misc.data(rollData.arme)?.data.magique && Number(Misc.data(rollData.arme)?.data.ecaille_efficacite) > 0, isUsed: (rollData, actor) => rollData.arme?.system.magique && Number(rollData.arme?.system.ecaille_efficacite) > 0,
getLabel: (rollData, actor) => "Ecaille d'Efficacité: ", getLabel: (rollData, actor) => "Ecaille d'Efficacité: ",
getValue: (rollData, actor) => Math.max(Number(Misc.data(rollData.arme)?.data.ecaille_efficacite), 0), getValue: (rollData, actor) => Math.max(Number(rollData.arme?.system.ecaille_efficacite), 0),
}, },
finesse: { finesse: {
isUsed: (rollData, actor) => RdDBonus.isDefenseAttaqueFinesse(rollData), isUsed: (rollData, actor) => RdDBonus.isDefenseAttaqueFinesse(rollData),

View File

@@ -8,9 +8,14 @@ import { TMRType } from "./tmr-utility.js";
const typeRencontres = { const typeRencontres = {
messager: { messager: {
msgSucces: (rencData) => `Le ${rencData.rencontre.name} vous propose d'emmener le message de votre un sort à ${rencData.rencontre.force} cases ${rencData.tmr.label}.`, msgSucces: async (rencData) => {
msgEchec: (rencData) => `Le ${rencData.rencontre.name} est pressé et continue son chemin d'une traite sans vous accorder un regard.`, if (rencData.actor.isTMRCache()){
postSucces: (tmrDialog, rencData) => { return `Le ${rencData.rencontre.name} vous propose d'emmener le message de votre un sort, mais vous ne savez pas où vous êtes.`;
}
return `Le ${rencData.rencontre.name} vous propose d'emmener le message de votre un sort à ${rencData.rencontre.force} cases ${rencData.tmr.label}.`;
},
msgEchec: async (rencData)=> `Le ${rencData.rencontre.name} est pressé et continue son chemin d'une traite sans vous accorder un regard.`,
postSucces: async (tmrDialog, rencData) => {
tmrDialog.setStateRencontre(rencData.rencontre.type); tmrDialog.setStateRencontre(rencData.rencontre.type);
tmrDialog.choisirCasePortee(rencData.tmr.coord, rencData.rencontre.force); tmrDialog.choisirCasePortee(rencData.tmr.coord, rencData.rencontre.force);
}, },
@@ -28,9 +33,14 @@ const typeRencontres = {
}, },
passeur: { passeur: {
msgSucces: (rencData) => `Le ${rencData.rencontre.name} vous propose de vous transporter à ${rencData.rencontre.force} cases des ${rencData.tmr.label}.`, msgSucces: async (rencData) => {
msgEchec: (rencData) => `Le prix que demande le ${rencData.rencontre.name} est trop élevé, vous êtes réduit à poursuivre votre chemin par vos propres moyens.`, if (rencData.actor.isTMRCache()){
postSucces: (tmrDialog, rencData) => { return `Le ${rencData.rencontre.name} vous propose de vous transporter, mais vous ne savez pas où vous êtes.`;
}
return `Le ${rencData.rencontre.name} vous propose de vous transporter à ${rencData.rencontre.force} cases des ${rencData.tmr.label}.`;
},
msgEchec: async (rencData)=> `Le prix que demande le ${rencData.rencontre.name} est trop élevé, vous êtes réduit à poursuivre votre chemin par vos propres moyens.`,
postSucces: async (tmrDialog, rencData) => {
tmrDialog.setStateRencontre(rencData.rencontre.type); tmrDialog.setStateRencontre(rencData.rencontre.type);
tmrDialog.choisirCasePortee(rencData.tmr.coord, rencData.rencontre.force); tmrDialog.choisirCasePortee(rencData.tmr.coord, rencData.rencontre.force);
}, },
@@ -49,9 +59,9 @@ const typeRencontres = {
}, },
fleur: { fleur: {
msgSucces: (rencData) => `Vous cueillez la ${rencData.rencontre.name}, son parfum vous apporte ${rencData.rencontre.force} points de Rêve.`, msgSucces: async (rencData) => `Vous cueillez la ${rencData.rencontre.name}, son parfum vous apporte ${rencData.rencontre.force} points de Rêve.`,
msgEchec: (rencData) => `La ${rencData.rencontre.name} se fâne et disparaît entre vos doigts.`, msgEchec: async (rencData)=> `La ${rencData.rencontre.name} se fâne et disparaît entre vos doigts.`,
postSucces: (tmrDialog, rencData) => tmrDialog.actor.reveActuelIncDec(rencData.rencontre.force), postSucces: async (tmrDialog, rencData) => tmrDialog.actor.reveActuelIncDec(rencData.rencontre.force),
poesieSucces: { poesieSucces: {
reference: "L'Ennemi, Charles Baudelaire", reference: "L'Ennemi, Charles Baudelaire",
extrait: `Et qui sait si les fleurs nouvelles que je rêve extrait: `Et qui sait si les fleurs nouvelles que je rêve
@@ -66,9 +76,9 @@ const typeRencontres = {
}, },
mangeur: { mangeur: {
msgSucces: (rencData) => `Le ${rencData.rencontre.name} claque de sa machoire dans le vide avant de fuir.`, msgSucces: async (rencData) => `Le ${rencData.rencontre.name} claque de sa machoire dans le vide avant de fuir.`,
msgEchec: (rencData) => `Le ${rencData.rencontre.name} croque votre Rêve ! Il emporte ${rencData.rencontre.force} de vos points de rêve actuels`, msgEchec: async (rencData)=> `Le ${rencData.rencontre.name} croque votre Rêve ! Il emporte ${rencData.rencontre.force} de vos points de rêve actuels`,
postEchec: (tmrDialog, rencData) => tmrDialog.actor.reveActuelIncDec(-rencData.rencontre.force), postEchec: async (tmrDialog, rencData) => tmrDialog.actor.reveActuelIncDec(-rencData.rencontre.force),
poesieSucces: { poesieSucces: {
reference: "Conseil, Victor Hugo", reference: "Conseil, Victor Hugo",
extrait: `Rois ! la bure est souvent jalouse du velours. extrait: `Rois ! la bure est souvent jalouse du velours.
@@ -85,16 +95,17 @@ const typeRencontres = {
}, },
changeur: { changeur: {
msgSucces: (rencData) => `Le ${rencData.rencontre.name} vaincu accepte de vous déplacer sur une autre ${TMRType[rencData.tmr.type].name} de votre choix en échange de sa liberté.`, msgSucces: async (rencData) => `Le ${rencData.rencontre.name} vaincu accepte de vous déplacer sur une autre ${TMRType[rencData.tmr.type].name} de votre choix en échange de sa liberté.`,
msgEchec: (rencData) => { msgEchec: async (rencData) => `Le ${rencData.rencontre.name} vous embobine avec des promesses, et vous transporte sur une autre ${TMRType[rencData.tmr.type].name} sans attendre votre avis.`,
rencData.newTMR = TMRUtility.getTMRAleatoire(it => it.type = rencData.tmr.type); postSucces: async (tmrDialog, rencData) => {
return `Le ${rencData.rencontre.name} vous embobine avec des promesses, et vous transporte en ${rencData.newTMR.label} sans attendre votre avis.`;
},
postSucces: (tmrDialog, rencData) => {
tmrDialog.setStateRencontre(rencData.rencontre.type); tmrDialog.setStateRencontre(rencData.rencontre.type);
tmrDialog.choisirCaseType(rencData.tmr.type); tmrDialog.choisirCaseType(rencData.tmr.type);
}, },
postEchec: (tmrDialog, rencData) => tmrDialog.forceDemiRevePosition(rencData.newTMR.coord), postEchec: async (tmrDialog, rencData) => {
const newTMR = await TMRUtility.getTMRAleatoire(it => it.type == rencData.tmr.type && it.coord != rencData.tmr.coord);
await tmrDialog.actor.forcerPositionTMRInconnue(newTMR);
tmrDialog.positionnerDemiReve(newTMR.coord);
},
poesieSucces: { poesieSucces: {
reference: "Caligula - IIIème chant, Gérard de Nerval", reference: "Caligula - IIIème chant, Gérard de Nerval",
extrait: `Allez, que le caprice emporte extrait: `Allez, que le caprice emporte
@@ -111,9 +122,9 @@ const typeRencontres = {
}, },
briseur: { briseur: {
msgSucces: (rencData) => `Le ${rencData.rencontre.name} tente vainement de vous déconcentrer, avant de fuir sans demander son reste.`, msgSucces: async (rencData) => `Le ${rencData.rencontre.name} tente vainement de vous déconcentrer, avant de fuir sans demander son reste.`,
msgEchec: (rencData) => `Le ${rencData.rencontre.name} vous déconcentre au point de briser votre demi-rêve.`, msgEchec: async (rencData)=> `Le ${rencData.rencontre.name} vous déconcentre au point de briser votre demi-rêve.`,
postEchec: (tmrDialog, rencData) => tmrDialog.close(), postEchec: async (tmrDialog, rencData) => tmrDialog.close(),
poesieSucces: { poesieSucces: {
reference: "Rêve de Dragon, Denis Gerfaud", reference: "Rêve de Dragon, Denis Gerfaud",
extrait: `La légende affirme que ce sont les Gnomes qui furent extrait: `La légende affirme que ce sont les Gnomes qui furent
@@ -134,8 +145,8 @@ const typeRencontres = {
}, },
reflet: { reflet: {
msgSucces: (rencData) => `Le ${rencData.rencontre.name} s'estompe dans l'oubli.`, msgSucces: async (rencData) => `Le ${rencData.rencontre.name} s'estompe dans l'oubli.`,
msgEchec: (rencData) => `Vous êtes submergé par un ${rencData.rencontre.name}, les souvenirs vous retiennent tant qu'il ne sera pas vaincu!`, msgEchec: async (rencData)=> `Vous êtes submergé par un ${rencData.rencontre.name}, les souvenirs vous retiennent tant qu'il ne sera pas vaincu!`,
poesieSucces: { poesieSucces: {
reference: "Une charogne, Charles Baudelaire", reference: "Une charogne, Charles Baudelaire",
extrait: `Les formes s'effaçaient et n'étaient plus qu'un rêve, extrait: `Les formes s'effaçaient et n'étaient plus qu'un rêve,
@@ -152,9 +163,9 @@ const typeRencontres = {
}, },
passeurfou: { passeurfou: {
msgSucces: (rencData) => `Le ${rencData.rencontre.name} tente vainement de découvrir où vous avez caché vos réserves. Vous le chassez, et en déroute il part harceler un autre voyageur du rêve.`, msgSucces: async (rencData) => `Le ${rencData.rencontre.name} tente vainement de découvrir où vous avez caché vos réserves. Vous le chassez, et en déroute il part harceler un autre voyageur du rêve.`,
msgEchec: (rencData) => TMRRencontres.msgEchecPasseurFou(rencData), msgEchec: async (rencData)=> TMRRencontres.msgEchecPasseurFou(rencData),
postEchec: (tmrDialog, rencData) => TMRRencontres.postEchecPasseurFou(tmrDialog, rencData), postEchec: async (tmrDialog, rencData) => TMRRencontres.postEchecPasseurFou(tmrDialog, rencData),
poesieSucces: { poesieSucces: {
reference: "Un Fou et un Sage, Jean de La Fontaine", reference: "Un Fou et un Sage, Jean de La Fontaine",
extrait: `Certain Fou poursuivait à coups de pierre un Sage. extrait: `Certain Fou poursuivait à coups de pierre un Sage.
@@ -174,9 +185,9 @@ const typeRencontres = {
}, },
tbblanc: { tbblanc: {
msgSucces: (rencData) => `Le ${rencData.rencontre.name} souleve une poussière blanche, vous tenez bon, et il tourbillonne en s'éloignant.`, msgSucces: async (rencData) => `Le ${rencData.rencontre.name} souleve une poussière blanche, vous tenez bon, et il tourbillonne en s'éloignant.`,
msgEchec: (rencData) => `Le souffle du ${rencData.rencontre.name} vous déstabilise et vous emmène dans un nuage de poussière.`, msgEchec: async (rencData)=> `Le souffle du ${rencData.rencontre.name} vous déstabilise et vous emmène dans un nuage de poussière.`,
postEchec: (tmrDialog, rencData) => TMRRencontres.onPostEchecTourbillon(tmrDialog, rencData, 1), postEchec: async (tmrDialog, rencData) => TMRRencontres.onPostEchecTourbillon(tmrDialog, rencData, 1),
poesieSucces: { poesieSucces: {
reference: "Rêve de Dragon, Denis Gerfaud", reference: "Rêve de Dragon, Denis Gerfaud",
extrait: `Le Premier Âge fut appelé l'Âge des Dragons. Ce fut le commencement extrait: `Le Premier Âge fut appelé l'Âge des Dragons. Ce fut le commencement
@@ -191,9 +202,9 @@ const typeRencontres = {
}, },
tbnoir: { tbnoir: {
msgSucces: (rencData) => `Le ${rencData.rencontre.name} orageux vous enveloppe de fureur et d'éclairs, vous tenez bon face à la tempête qui s'éloigne sans vous éloigner de votre chemin.`, msgSucces: async (rencData) => `Le ${rencData.rencontre.name} orageux vous enveloppe de fureur et d'éclairs, vous tenez bon face à la tempête qui s'éloigne sans vous éloigner de votre chemin.`,
msgEchec: (rencData) => `Le ${rencData.rencontre.name} furieux vous secoue tel un fichu de paille malmené par les vents, et vous emporte dans la tourmente.`, msgEchec: async (rencData)=> `Le ${rencData.rencontre.name} furieux vous secoue tel un fichu de paille malmené par les vents, et vous emporte dans la tourmente.`,
postEchec: (tmrDialog, rencData) => TMRRencontres.onPostEchecTourbillon(tmrDialog, rencData, 2), postEchec: async (tmrDialog, rencData) => TMRRencontres.onPostEchecTourbillon(tmrDialog, rencData, 2),
poesieSucces: { poesieSucces: {
reference: "Rêve de Dragon, Denis Gerfaud", reference: "Rêve de Dragon, Denis Gerfaud",
extrait: `Car le Second Âge fut bel et bien celui des Magiciens. Durant cette période, les extrait: `Car le Second Âge fut bel et bien celui des Magiciens. Durant cette période, les
@@ -207,9 +218,9 @@ const typeRencontres = {
}, },
tbrouge: { tbrouge: {
msgSucces: (rencData) => `Le ${rencData.rencontre.name} s'abat avec violence mais vous êtes plus rapide et parvenez à lui échapper.`, msgSucces: async (rencData) => `Le ${rencData.rencontre.name} s'abat avec violence mais vous êtes plus rapide et parvenez à lui échapper.`,
msgEchec: (rencData) => `Le ${rencData.rencontre.name} vous frappe de milliers de morsure et vous malmène à travers les terres médianes.`, msgEchec: async (rencData)=> `Le ${rencData.rencontre.name} vous frappe de milliers de morsure et vous malmène à travers les terres médianes.`,
postEchec: (tmrDialog, rencData) => TMRRencontres.onPostEchecTourbillonRouge(tmrDialog, rencData), postEchec: async (tmrDialog, rencData) => TMRRencontres.onPostEchecTourbillonRouge(tmrDialog, rencData),
poesieSucces: { poesieSucces: {
reference: "Qu'est-ce de votre vie ? une bouteille molle, Jean-Baptiste Chassignet", reference: "Qu'est-ce de votre vie ? une bouteille molle, Jean-Baptiste Chassignet",
extrait: `Qu'est-ce de votre vie ? un tourbillon rouant extrait: `Qu'est-ce de votre vie ? un tourbillon rouant
@@ -228,10 +239,10 @@ const typeRencontres = {
}, },
rdd: { rdd: {
msgSucces: (rencData) => `A tout seigneur, tout honneur, vous faites face à un ${rencData.rencontre.name}. Vous le maîtrisez et récupérez ses rêves. Vous gagnez ses ${rencData.rencontre.force} points de rêve`, msgSucces: async (rencData) => `A tout seigneur, tout honneur, vous faites face à un ${rencData.rencontre.name}. Vous le maîtrisez et récupérez ses rêves. Vous gagnez ses ${rencData.rencontre.force} points de rêve`,
msgEchec: (rencData) => `A tout seigneur, tout honneur, vous faites face à un ${rencData.rencontre.name}. La rencontre tourne au cauchemar, dans la lutte épique, vous subissez ${rencData.rolled.isETotal ? 'deux queues' : 'une queue'} de dragon!`, msgEchec: async (rencData)=> `A tout seigneur, tout honneur, vous faites face à un ${rencData.rencontre.name}. La rencontre tourne au cauchemar, dans la lutte épique, vous subissez ${rencData.rolled.isETotal ? 'deux queues' : 'une queue'} de dragon!`,
postSucces: (tmrDialog, rencData) => TMRRencontres.onPostSuccessReveDeDragon(tmrDialog, rencData), postSucces: async (tmrDialog, rencData) => TMRRencontres.onPostSuccessReveDeDragon(tmrDialog, rencData),
postEchec: (tmrDialog, rencData) => TMRRencontres.onPostEchecReveDeDragon(tmrDialog, rencData), postEchec: async (tmrDialog, rencData) => TMRRencontres.onPostEchecReveDeDragon(tmrDialog, rencData),
poesieSucces: { poesieSucces: {
reference: "Rêve de Dragon, Denis Gerfaud", reference: "Rêve de Dragon, Denis Gerfaud",
extrait: `Le monde est Rêve de Dragons, mais nous ne savons extrait: `Le monde est Rêve de Dragons, mais nous ne savons
@@ -404,7 +415,7 @@ export class TMRRencontres {
static async gererRencontre(tmrDialog, rencData) { static async gererRencontre(tmrDialog, rencData) {
let gestion = TMRRencontres.getGestionRencontre(rencData.rencontre.type); let gestion = TMRRencontres.getGestionRencontre(rencData.rencontre.type);
if (rencData.rolled.isSuccess) { if (rencData.rolled.isSuccess) {
rencData.message = gestion.msgSucces(rencData); rencData.message = await gestion.msgSucces(rencData);
if (rencData.nbRounds > 1) { if (rencData.nbRounds > 1) {
rencData.message += ` Au total, vous avez passé ${rencData.nbRounds} rounds à vous battre!`; rencData.message += ` Au total, vous avez passé ${rencData.nbRounds} rounds à vous battre!`;
} }
@@ -412,7 +423,7 @@ export class TMRRencontres {
return gestion.postSucces; return gestion.postSucces;
} }
rencData.message = gestion.msgEchec(rencData); rencData.message = await gestion.msgEchec(rencData);
if (rencData.nbRounds > 1) { if (rencData.nbRounds > 1) {
rencData.message += ` Vous avez passé ${rencData.nbRounds} rounds à lutter!`; rencData.message += ` Vous avez passé ${rencData.nbRounds} rounds à lutter!`;
} }
@@ -422,7 +433,7 @@ export class TMRRencontres {
/* -------------------------------------------- */ /* -------------------------------------------- */
static async msgEchecPasseurFou(tmrData) { static async msgEchecPasseurFou(tmrData) {
tmrData.sortReserve = Misc.templateData(tmrData.actor).reve.reserve.list[0]; tmrData.sortReserve = tmrData.actor.system.reve.reserve.list[0];
if (tmrData.sortReserve) { if (tmrData.sortReserve) {
// Passeur fou positionne sur la case d'un ort en réserve // TODO : Choisir le sort le plus loin ou au hasard // Passeur fou positionne sur la case d'un ort en réserve // TODO : Choisir le sort le plus loin ou au hasard
tmrData.newTMR = TMRUtility.getTMR(tmrData.sortReserve.coord); tmrData.newTMR = TMRUtility.getTMR(tmrData.sortReserve.coord);
@@ -444,7 +455,7 @@ export class TMRRencontres {
if (tmrData.sortReserve) { if (tmrData.sortReserve) {
await tmrDialog.processSortReserve(tmrData.sortReserve); await tmrDialog.processSortReserve(tmrData.sortReserve);
} }
await tmrDialog.forceDemiRevePosition(tmrData.newTMR.coord); await tmrDialog.positionnerDemiReve(tmrData.newTMR.coord);
if (tmrData.sortReserve) { if (tmrData.sortReserve) {
tmrDialog.close(); tmrDialog.close();
} }
@@ -457,25 +468,25 @@ export class TMRRencontres {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static async onPostEchecTourbillonRouge(tmrDialog, data) { static async onPostEchecTourbillonRouge(tmrDialog, rencontre) {
await data.actor.reveActuelIncDec(-2); // -2 pts de Reve a chaque itération await rencontre.actor.reveActuelIncDec(-2); // -2 pts de Reve a chaque itération
TMRRencontres._toubillonner(tmrDialog, data.actor, 4); TMRRencontres._toubillonner(tmrDialog, rencontre.actor, 4);
await data.actor.santeIncDec("vie", -1); // Et -1 PV await rencontre.actor.santeIncDec("vie", -1); // Et -1 PV
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static async _toubillonner(tmrDialog, actor, cases) { static async _toubillonner(tmrDialog, actor, cases) {
let coord = Misc.templateData(actor).reve.tmrpos.coord; let coord = actor.system.reve.tmrpos.coord;
for (let i = 0; i < cases; i++) { for (let i = 0; i < cases; i++) {
coord = await TMRUtility.deplaceTMRAleatoire(actor, coord).coord; coord = await TMRUtility.deplaceTMRAleatoire(actor, coord).coord;
} }
await tmrDialog.forceDemiRevePosition(coord) await tmrDialog.positionnerDemiReve(coord)
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static async onPostSuccessReveDeDragon(tmrDialog, tmrData) { static async onPostSuccessReveDeDragon(tmrDialog, tmrData) {
if (tmrData.rolled.isPart) { if (tmrData.rolled.isPart) {
await tmrData.actor.appliquerAjoutExperience(tmrData, true); await tmrData.actor.appliquerAjoutExperience(tmrData);
} }
await tmrData.actor.resultCombatReveDeDragon(tmrData); await tmrData.actor.resultCombatReveDeDragon(tmrData);
} }

View File

@@ -2,7 +2,6 @@ import { TMRRencontres } from "./tmr-rencontres.js";
import { Misc } from "./misc.js"; import { Misc } from "./misc.js";
import { Grammar } from "./grammar.js"; import { Grammar } from "./grammar.js";
import { RdDDice } from "./rdd-dice.js"; import { RdDDice } from "./rdd-dice.js";
import { tmrConstants } from "./tmr-constants.js";
/* -------------------------------------------- */ /* -------------------------------------------- */
const TMRMapping = { const TMRMapping = {
@@ -12,7 +11,7 @@ const TMRMapping = {
D1: { type: "fleuve", label: "Fleuve de l'Oubli" }, D1: { type: "fleuve", label: "Fleuve de l'Oubli" },
E1: { type: "monts", label: "Monts de Kanaï" }, E1: { type: "monts", label: "Monts de Kanaï" },
F1: { type: "cite", label: "Cité Glauque" }, F1: { type: "cite", label: "Cité Glauque" },
G1: { type: "desolation", label: "Désolation de Demain" }, G1: { type: "desolation", label: "Désolation de Jamais" },
H1: { type: "lac", label: "Lac dAnticalme" }, H1: { type: "lac", label: "Lac dAnticalme" },
I1: { type: "plaines", label: "Plaines Grises" }, I1: { type: "plaines", label: "Plaines Grises" },
J1: { type: "monts", label: "Monts Fainéants" }, J1: { type: "monts", label: "Monts Fainéants" },
@@ -70,7 +69,7 @@ const TMRMapping = {
F5: { type: "cite", label: "Cité de Panople" }, F5: { type: "cite", label: "Cité de Panople" },
G5: { type: "pont", label: "Pont dIk" }, G5: { type: "pont", label: "Pont dIk" },
H5: { type: "desert", label: "Désert de Krane" }, H5: { type: "desert", label: "Désert de Krane" },
I5: { type: "desolation", label: "Désolation de Demain" }, I5: { type: "desolation", label: "Désolation de Toujours" },
J5: { type: "marais", label: "Marais de Jab" }, J5: { type: "marais", label: "Marais de Jab" },
K5: { type: "fleuve", label: "Fleuve de l'Oubli" }, K5: { type: "fleuve", label: "Fleuve de l'Oubli" },
L5: { type: "collines", label: "Collines Suaves" }, L5: { type: "collines", label: "Collines Suaves" },
@@ -86,9 +85,9 @@ const TMRMapping = {
H6: { type: "monts", label: "Monts Gurdes" }, H6: { type: "monts", label: "Monts Gurdes" },
I6: { type: "necropole", label: "Nécropole de Xotar" }, I6: { type: "necropole", label: "Nécropole de Xotar" },
J6: { type: "lac", label: "Lac dIaupe" }, J6: { type: "lac", label: "Lac dIaupe" },
K6: { type: "desolation", label: "Désolation de Demain" }, K6: { type: "desolation", label: "Désolation de Poor" },
L6: { type: "foret", label: "Forêt Gueuse" }, L6: { type: "foret", label: "Forêt Gueuse" },
M6: { type: "desolation", label: "Désolation de Demain" }, M6: { type: "desolation", label: "Désolation de Presque" },
A7: { type: "plaines", label: "Plaines de lArc" }, A7: { type: "plaines", label: "Plaines de lArc" },
B7: { type: "marais", label: "Marais Bluants" }, B7: { type: "marais", label: "Marais Bluants" },
@@ -124,7 +123,7 @@ const TMRMapping = {
D9: { type: "pont", label: "Pont dOrx" }, D9: { type: "pont", label: "Pont dOrx" },
E9: { type: "fleuve", label: "Fleuve de l'Oubli" }, E9: { type: "fleuve", label: "Fleuve de l'Oubli" },
F9: { type: "plaines", label: "Plaines de Foe" }, F9: { type: "plaines", label: "Plaines de Foe" },
G9: { type: "desolation", label: "Désolation de Demain" }, G9: { type: "desolation", label: "Désolation de Sel" },
H9: { type: "collines", label: "Collines de Noirseul" }, H9: { type: "collines", label: "Collines de Noirseul" },
I9: { type: "fleuve", label: "Fleuve de l'Oubli" }, I9: { type: "fleuve", label: "Fleuve de l'Oubli" },
J9: { type: "marais", label: "Marais Gronchants" }, J9: { type: "marais", label: "Marais Gronchants" },
@@ -146,10 +145,10 @@ const TMRMapping = {
L10: { type: "desert", label: "Désert de Nicrop" }, L10: { type: "desert", label: "Désert de Nicrop" },
M10: { type: "foret", label: "Forêt de Jajou" }, M10: { type: "foret", label: "Forêt de Jajou" },
A11: { type: "desolation", label: "Désolation de Demain" }, A11: { type: "desolation", label: "Désolation dHier" },
B11: { type: "cite", label: "Cité de Brilz" }, B11: { type: "cite", label: "Cité de Brilz" },
C11: { type: "pont", label: "Pont de Roï" }, C11: { type: "pont", label: "Pont de Roï" },
D11: { type: "desolation", label: "Désolation de Demain" }, D11: { type: "desolation", label: "Désolation de Partout" },
E11: { type: "lac", label: "Lac de Glinster" }, E11: { type: "lac", label: "Lac de Glinster" },
F11: { type: "cite", label: "Cité de Noape" }, F11: { type: "cite", label: "Cité de Noape" },
G11: { type: "fleuve", label: "Fleuve de l'Oubli" }, G11: { type: "fleuve", label: "Fleuve de l'Oubli" },
@@ -170,7 +169,7 @@ const TMRMapping = {
H12: { type: "collines", label: "Collines de Tooth" }, H12: { type: "collines", label: "Collines de Tooth" },
I12: { type: "gouffre", label: "Gouffre Abimeux" }, I12: { type: "gouffre", label: "Gouffre Abimeux" },
J12: { type: "cite", label: "Cité Folle" }, J12: { type: "cite", label: "Cité Folle" },
K12: { type: "desolation", label: "Désolation de Demain" }, K12: { type: "desolation", label: "Désolation dAmour" },
L12: { type: "plaines", label: "Plaines Venteuses" }, L12: { type: "plaines", label: "Plaines Venteuses" },
M12: { type: "collines", label: "Collines Révulsantes" }, M12: { type: "collines", label: "Collines Révulsantes" },
@@ -181,7 +180,7 @@ const TMRMapping = {
E13: { type: "plaines", label: "Plaines de Xnez" }, E13: { type: "plaines", label: "Plaines de Xnez" },
F13: { type: "foret", label: "Forêt des Cris" }, F13: { type: "foret", label: "Forêt des Cris" },
G13: { type: "plaines", label: "Plaines Calcaires" }, G13: { type: "plaines", label: "Plaines Calcaires" },
H13: { type: "desolation", label: "Désolation de Demain" }, H13: { type: "desolation", label: "Désolation de Rien" },
I13: { type: "monts", label: "Monts Bigleux" }, I13: { type: "monts", label: "Monts Bigleux" },
J13: { type: "gouffre", label: "Gouffre de Gromph" }, J13: { type: "gouffre", label: "Gouffre de Gromph" },
K13: { type: "foret", label: "Forêt de Kluth" }, K13: { type: "foret", label: "Forêt de Kluth" },
@@ -200,8 +199,8 @@ const TMRMapping = {
J14: { type: "desert", label: "Désert de Sank" }, J14: { type: "desert", label: "Désert de Sank" },
K14: { type: "necropole", label: "Nécropole dAntinéar" }, K14: { type: "necropole", label: "Nécropole dAntinéar" },
L14: { type: "plaines", label: "Plaines de Jislith" }, L14: { type: "plaines", label: "Plaines de Jislith" },
M14: { type: "desolation", label: "Désolation de Demain" }, M14: { type: "desolation", label: "Désolation dAprès" },
A15: { type: "cite", label: "Cité de Mielh" }, A15: { type: "cite", label: "Cité de Mielh" },
C15: { type: "plaines", label: "Plaines de Toué" }, C15: { type: "plaines", label: "Plaines de Toué" },
E15: { type: "foret", label: "Forêt des Furies" }, E15: { type: "foret", label: "Forêt des Furies" },

View File

@@ -32,14 +32,14 @@ export class Conquete extends Draconique {
} }
async _creerConquete(actor, queue) { async _creerConquete(actor, queue) {
let existants = actor.data.items.filter(it => this.isCase(it)).map(it => Misc.data(it).data.coord); let existants = actor.items.filter(it => this.isCase(it)).map(it => it.system.coord);
let possibles = TMRUtility.filterTMR(tmr => !TMRUtility.isCaseHumide(tmr) && !existants.includes(tmr.coord)); let possibles = TMRUtility.filterTMR(tmr => !TMRUtility.isCaseHumide(tmr) && !existants.includes(tmr.coord));
let conquete = await RdDDice.rollOneOf(possibles); let conquete = await RdDDice.rollOneOf(possibles);
await this.createCaseTmr(actor, 'Conquête: ' + conquete.label, conquete, queue.id); await this.createCaseTmr(actor, 'Conquête: ' + conquete.label, conquete, queue.id);
} }
async onActorDeleteCaseTmr(actor, casetmr) { async onActorDeleteCaseTmr(actor, casetmr) {
await actor.deleteEmbeddedDocuments('Item', [casetmr.data.sourceid]); await actor.deleteEmbeddedDocuments('Item', [casetmr.system.sourceid]);
} }
} }

View File

@@ -13,7 +13,7 @@ export class Debordement extends Draconique {
match(item) { return Draconique.isSouffleDragon(item) && Grammar.toLowerCaseNoAccent(item.name).includes('debordement'); } match(item) { return Draconique.isSouffleDragon(item) && Grammar.toLowerCaseNoAccent(item.name).includes('debordement'); }
manualMessage() { return false } manualMessage() { return false }
async onActorCreateOwned(actor, souffle) { async onActorCreateOwned(actor, souffle) {
const existants = actor.data.items.filter(it => this.isCase(it)).map(it => it.data.coord); const existants = actor.items.filter(it => this.isCase(it)).map(it => it.system.coord);
const tmr = await TMRUtility.getTMRAleatoire(it => !(TMRUtility.isCaseHumide(it) || existants.includes(it.coord))); const tmr = await TMRUtility.getTMRAleatoire(it => !(TMRUtility.isCaseHumide(it) || existants.includes(it.coord)));
await this.createCaseTmr(actor, 'Debordement: ' + tmr.label, tmr, souffle.id); await this.createCaseTmr(actor, 'Debordement: ' + tmr.label, tmr, souffle.id);
} }

View File

@@ -22,7 +22,7 @@ export class Desorientation extends Draconique {
} }
_typesPossibles(actor) { _typesPossibles(actor) {
const dejaDesorientes = Misc.distinct(actor.data.items.filter(it => this.isCase(it)).map(it => it.type)); const dejaDesorientes = Misc.distinct(actor.items.filter(it => this.isCase(it)).map(it => it.type));
return Object.keys(TMRType).filter(it => !dejaDesorientes.includes(it)); return Object.keys(TMRType).filter(it => !dejaDesorientes.includes(it));
} }
@@ -42,7 +42,7 @@ export class Desorientation extends Draconique {
} }
async _creerCasesTmr(actor, type, souffle) { async _creerCasesTmr(actor, type, souffle) {
const existants = actor.data.items.filter(it => this.isCase(it)).map(it => it.data.coord); const existants = actor.items.filter(it => this.isCase(it)).map(it => it.system.coord);
let tmrs = TMRUtility.filterTMR(it => it.type == type && !existants.includes(it.coord)); let tmrs = TMRUtility.filterTMR(it => it.type == type && !existants.includes(it.coord));
for (let tmr of tmrs) { for (let tmr of tmrs) {
await this.createCaseTmr(actor, 'Désorientation: ' + tmr.label, tmr, souffle.id); await this.createCaseTmr(actor, 'Désorientation: ' + tmr.label, tmr, souffle.id);

View File

@@ -9,13 +9,13 @@ const registeredEffects = [
* Définition des informations d'une "draconique" (queue, ombre, tête, souffle) qui influence les TMR * Définition des informations d'une "draconique" (queue, ombre, tête, souffle) qui influence les TMR
*/ */
export class Draconique { export class Draconique {
static isCaseTMR(itemData) { return itemData.type == 'casetmr'; } static isCaseTMR(item) { return item.type == 'casetmr'; }
static isQueueDragon(itemData) { return itemData.type == 'queue' || itemData.type == 'ombre'; } static isQueueDragon(item) { return item.type == 'queue' || item.type == 'ombre'; }
static isSouffleDragon(itemData) { return itemData.type == 'souffle'; } static isSouffleDragon(item) { return item.type == 'souffle'; }
static isTeteDragon(itemData) { return itemData.type == 'tete'; } static isTeteDragon(item) { return item.type == 'tete'; }
static isQueueSouffle(itemData) { return Draconique.isQueueDragon(itemData) || Draconique.isSouffleDragon(itemData); } static isQueueSouffle(item) { return Draconique.isQueueDragon(item) || Draconique.isSouffleDragon(item); }
tmrLabel(linkData) { return TMRUtility.getTMRLabel(linkData.data.coord); } tmrLabel(linkData) { return TMRUtility.getTMRLabel(linkData.system.coord); }
static register(draconique) { static register(draconique) {
registeredEffects[draconique.code()] = draconique; registeredEffects[draconique.code()] = draconique;
@@ -38,8 +38,7 @@ export class Draconique {
* @returns true si l'item correspond * @returns true si l'item correspond
*/ */
match(item) { match(item) {
const itemData = Misc.data(item); return Draconique.isQueueDragon(item) || Draconique.isSouffleDragon(item) || Draconique.isTeteDragon(item);
return Draconique.isQueueDragon(itemData) || Draconique.isSouffleDragon(itemData) || Draconique.isTeteDragon(itemData);
} }
/** /**
@@ -94,9 +93,8 @@ export class Draconique {
token[type ?? this.code()] = linkData; token[type ?? this.code()] = linkData;
pixiTMR.addTooltip(token.sprite, this.tooltip(linkData)); pixiTMR.addTooltip(token.sprite, this.tooltip(linkData));
return token; return token;
return sprite;
} }
/** /**
* factory d'élément graphique PIXI correpsondant à l'objet draconique * factory d'élément graphique PIXI correpsondant à l'objet draconique
* @param {*} pixiTMR instance de PixiTMR qui gère les tooltips, les méthodes de création de sprite standard, les clicks. * @param {*} pixiTMR instance de PixiTMR qui gère les tooltips, les méthodes de création de sprite standard, les clicks.
@@ -116,34 +114,32 @@ export class Draconique {
* @param {*} coord les coordonnées d'une case. Si undefined toute case du type correspondra, * @param {*} coord les coordonnées d'une case. Si undefined toute case du type correspondra,
*/ */
isCase(item, coord = undefined) { isCase(item, coord = undefined) {
const itemData = Misc.data(item); return Draconique.isCaseTMR(item) && item.system.specific == this.code() && (coord ? item.system.coord == coord : true);
return Draconique.isCaseTMR(itemData) && itemData.data.specific == this.code() && (coord ? itemData.data.coord == coord : true);
} }
find(list, coord = undefined) { find(list, coord = undefined) {
return list.find(c => this.isCase(Misc.data(c), coord)); return list.find(c => this.isCase(c, coord));
} }
async createCaseTmr(actor, label, tmr, sourceId = undefined) { async createCaseTmr(actor, label, tmr, sourceId = undefined) {
const casetmrData = { const casetmrData = {
name: label, type: 'casetmr', img: this.img(), name: label, type: 'casetmr', img: this.img(),
data: { coord: tmr.coord, specific: this.code(), sourceid: sourceId } system: { coord: tmr.coord, specific: this.code(), sourceid: sourceId }
}; };
await actor.createEmbeddedDocuments('Item', [casetmrData]); await actor.createEmbeddedDocuments('Item', [casetmrData]);
} }
async deleteCasesTmr(actor, draconique) { async deleteCasesTmr(actor, draconique) {
let caseTmrs = actor.data.items.filter(it => this.isCaseForSource(it, draconique)); let caseTmrs = actor.items.filter(it => this.isCaseForSource(it, draconique));
await actor.deleteEmbeddedDocuments('Item', caseTmrs.map(it => it.id)); await actor.deleteEmbeddedDocuments('Item', caseTmrs.map(it => it.id));
} }
isCaseForSource(item, draconique) { isCaseForSource(item, draconique) {
const itemData = Misc.data(item); return Draconique.isCaseTMR(item) && item.system.specific == this.code() && item.system.sourceid == draconique.id;
return Draconique.isCaseTMR(itemData) && itemData.data.specific == this.code() && itemData.data.sourceid == draconique.id;
} }
async onVisiteSupprimer(actor, tmr, onRemoveToken) { async onVisiteSupprimer(actor, tmr, onRemoveToken) {
let existants = actor.data.items.filter(it => this.isCase(it, tmr.coord)); let existants = actor.items.filter(it => this.isCase(it, tmr.coord));
await actor.deleteEmbeddedDocuments('Item', existants.map(it => it.id)); await actor.deleteEmbeddedDocuments('Item', existants.map(it => it.id));
for (let casetmr of existants) { for (let casetmr of existants) {
onRemoveToken(tmr, casetmr); onRemoveToken(tmr, casetmr);

View File

@@ -95,7 +95,7 @@ export class EffetsDraconiques {
/* -------------------------------------------- */ /* -------------------------------------------- */
static isSortImpossible(actor) { static isSortImpossible(actor) {
return actor.data.items.find(it => return actor.items.find(it =>
EffetsDraconiques.conquete.match(it) || EffetsDraconiques.conquete.match(it) ||
EffetsDraconiques.periple.match(it) || EffetsDraconiques.periple.match(it) ||
EffetsDraconiques.urgenceDraconique.match(it) || EffetsDraconiques.urgenceDraconique.match(it) ||
@@ -104,7 +104,7 @@ export class EffetsDraconiques {
} }
static isSortReserveImpossible(actor) { static isSortReserveImpossible(actor) {
return actor.data.items.find(it => return actor.items.find(it =>
EffetsDraconiques.conquete.match(it) || EffetsDraconiques.conquete.match(it) ||
EffetsDraconiques.periple.match(it) || EffetsDraconiques.periple.match(it) ||
EffetsDraconiques.pelerinage.match(it) EffetsDraconiques.pelerinage.match(it)
@@ -112,7 +112,7 @@ export class EffetsDraconiques {
} }
static filterItems(actor, filter, name) { static filterItems(actor, filter, name) {
return actor.data.items.filter(filter) return actor.filterItems(filter)
.filter(it => Grammar.includesLowerCaseNoAccent(it.name, name)); .filter(it => Grammar.includesLowerCaseNoAccent(it.name, name));
} }
@@ -150,11 +150,11 @@ export class EffetsDraconiques {
} }
static isPontImpraticable(actor) { static isPontImpraticable(actor) {
return actor.data.items.find(it => EffetsDraconiques.pontImpraticable.match(it)); return actor.items.find(it => EffetsDraconiques.pontImpraticable.match(it));
} }
static isUrgenceDraconique(actor) { static isUrgenceDraconique(actor) {
return actor.data.items.find(it => EffetsDraconiques.urgenceDraconique.match(it)); return actor.items.find(it => EffetsDraconiques.urgenceDraconique.match(it));
} }
static isPeage(actor) { static isPeage(actor) {

View File

@@ -30,7 +30,7 @@ export class FermetureCites extends Draconique {
} }
async _fermerLesCites(actor, souffle) { async _fermerLesCites(actor, souffle) {
let existants = actor.data.items.filter(it => this.isCase(it)).map(it => it.data.coord); let existants = actor.items.filter(it => this.isCase(it)).map(it => it.system.coord);
let ouvertes = TMRUtility.filterTMR(it => it.type == 'cite' && !existants.includes(it.coord)); let ouvertes = TMRUtility.filterTMR(it => it.type == 'cite' && !existants.includes(it.coord));
for (let tmr of ouvertes) { for (let tmr of ouvertes) {
await this.createCaseTmr(actor, 'Fermeture: ' + tmr.label, tmr, souffle.id); await this.createCaseTmr(actor, 'Fermeture: ' + tmr.label, tmr, souffle.id);

View File

@@ -33,7 +33,7 @@ export class Pelerinage extends Draconique {
} }
async onActorDeleteCaseTmr(actor, casetmr) { async onActorDeleteCaseTmr(actor, casetmr) {
await actor.deleteEmbeddedDocuments('Item', [casetmr.data.sourceid]); await actor.deleteEmbeddedDocuments('Item', [casetmr.system.sourceid]);
} }
} }

View File

@@ -25,7 +25,7 @@ export class PixiTMR {
for (const [name, img] of Object.entries(PixiTMR.textures)) { for (const [name, img] of Object.entries(PixiTMR.textures)) {
loader = loader.add(name, img); loader = loader.add(name, img);
} }
loader.onLoad.add((error, resaon) => { console.log("ERROR", error, resaon) }); loader.onError.add((error, reason) => { console.log("ERROR", error, reason) });
loader.load( (loader, resources) => { loader.load( (loader, resources) => {
onLoad(loader, resources); onLoad(loader, resources);
for (let onAnimate of this.callbacksOnAnimate) { for (let onAnimate of this.callbacksOnAnimate) {

View File

@@ -30,7 +30,7 @@ export class PresentCites extends Draconique {
} }
async _ajouterPresents(actor, tete) { async _ajouterPresents(actor, tete) {
let existants = actor.data.items.filter(it => this.isCase(it)).map(it => it.data.coord); let existants = actor.items.filter(it => this.isCase(it)).map(it => it.system.coord);
if (existants.length > 0) { if (existants.length > 0) {
ChatMessage.create({ ChatMessage.create({
whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name), whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name),

View File

@@ -12,8 +12,8 @@ export class ReserveExtensible extends Draconique {
match(item) { return Draconique.isTeteDragon(item) && Grammar.toLowerCaseNoAccent(item.name).includes("reserve extensible"); } match(item) { return Draconique.isTeteDragon(item) && Grammar.toLowerCaseNoAccent(item.name).includes("reserve extensible"); }
manualMessage() { return "Vous pouvez re-configurer votre Réserve extensible" } manualMessage() { return "Vous pouvez re-configurer votre Réserve extensible" }
async onActorCreateOwned(actor, tete) { async onActorCreateOwned(actor, tete) {
const existants = actor.data.items.filter(it => this.isCase(it)).map(it => it.data.coord); const existants = actor.items.filter(it => this.isCase(it)).map(it => it.system.coord);
const tmr = await TMRUtility.getTMRAleatoire(it => !(it.type == 'fleuve' || existants.includes(it.coord))); const tmr = await TMRUtility.getTMRAleatoire(it => !(it.type == 'fleuve' || existants.includes(it.system.coord)));
await this.createCaseTmr(actor, "Nouvelle Réserve extensible", tmr, tete.id); await this.createCaseTmr(actor, "Nouvelle Réserve extensible", tmr, tete.id);
} }

View File

@@ -13,8 +13,8 @@ export class TrouNoir extends Draconique {
manualMessage() { return false } manualMessage() { return false }
async onActorCreateOwned(actor, souffle) { async onActorCreateOwned(actor, souffle) {
const existants = actor.data.items.filter(it => this.isCase(it)).map(it => it.data.coord); const existants = actor.items.filter(it => this.isCase(it)).map(it => it.system.coord);
const tmr = await TMRUtility.getTMRAleatoire(it => !(TMRUtility.isCaseHumide(it) || existants.includes(it.coord))); const tmr = await TMRUtility.getTMRAleatoire(it => !(TMRUtility.isCaseHumide(it) || existants.includes(it.system.coord)));
await this.createCaseTmr(actor, 'Trou noir: ' + tmr.label, tmr, souffle.id); await this.createCaseTmr(actor, 'Trou noir: ' + tmr.label, tmr, souffle.id);
} }

View File

@@ -16,7 +16,7 @@ export class UrgenceDraconique extends Draconique {
match(item) { return Draconique.isQueueDragon(item) && Grammar.toLowerCaseNoAccent(item.name).includes('urgence draconique'); } match(item) { return Draconique.isQueueDragon(item) && Grammar.toLowerCaseNoAccent(item.name).includes('urgence draconique'); }
manualMessage() { return false } manualMessage() { return false }
async onActorCreateOwned(actor, queue) { async onActorCreateOwned(actor, queue) {
const coordSortsReserve = (Misc.templateData(actor).reve.reserve?.list.map(it => it.coord)) ?? []; const coordSortsReserve = (actor.system.reve.reserve?.list.map(it => it.coord)) ?? [];
if (coordSortsReserve.length == 0) { if (coordSortsReserve.length == 0) {
// La queue se transforme en idée fixe // La queue se transforme en idée fixe
const ideeFixe = await RdDRollTables.getIdeeFixe(); const ideeFixe = await RdDRollTables.getIdeeFixe();
@@ -37,7 +37,7 @@ export class UrgenceDraconique extends Draconique {
} }
async onActorDeleteCaseTmr(actor, casetmr) { async onActorDeleteCaseTmr(actor, casetmr) {
await actor.deleteEmbeddedDocuments('Item', [casetmr.data.sourceid]); await actor.deleteEmbeddedDocuments('Item', [casetmr.system.sourceid]);
} }
code() { return 'urgence' } code() { return 'urgence' }

File diff suppressed because one or more lines are too long

View File

@@ -65,7 +65,11 @@
--debug-box-shadow-blue: inset 0 0 2px blue; --debug-box-shadow-blue: inset 0 0 2px blue;
--debug-box-shadow-green: inset 0 0 2px green; --debug-box-shadow-green: inset 0 0 2px green;
/* =================== 3. some constants ============ */ /* =================== 3. some constants ============ */
--color-controls:rgba(0, 0, 0, 0.9);
--color-controls-hover:rgba(255, 255, 128, 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-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-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-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));
@@ -104,6 +108,9 @@
.strong-text{ .strong-text{
font-weight: bold; font-weight: bold;
} }
i:is(.fas, .far) {
font-size: smaller;
}
.tabs .item.active, .blessures-list li ul li:first-child:hover, a:hover { .tabs .item.active, .blessures-list li ul li:first-child:hover, a:hover {
text-shadow: 1px 0px 0px #ff6600; text-shadow: 1px 0px 0px #ff6600;
@@ -225,6 +232,26 @@ table {border: 1px solid #7a7971;}
flex-grow : 3; flex-grow : 3;
} }
/* Styles limited to foundryvtt-reve-de-dragon sheets */ /* Styles limited to foundryvtt-reve-de-dragon sheets */
.equipement-nom {
flex-grow : 4;
margin: 0;
justify-content: center;
text-align: left;
}
.equipement-detail {
margin: 0;
flex: 'flex-shrink' ;
align-items: center;
justify-content: center;
text-align: center;
}
.equipement-actions {
margin: 0;
flex-grow: 2;
align-items: center;
justify-content: center;
text-align: left;
}
.foundryvtt-reve-de-dragon .sheet-header { .foundryvtt-reve-de-dragon .sheet-header {
-webkit-box-flex: 0; -webkit-box-flex: 0;
@@ -266,14 +293,8 @@ table {border: 1px solid #7a7971;}
height: 8%; height: 8%;
max-height: 48px; max-height: 48px;
border-width: 0; border-width: 0;
border: 1px solid rgba(0, 0, 0, 0); border: 1px solid rgba(0, 0, 0, 0);
} }
.button-img:hover {
color: rgba(255, 255, 128, 0.7);
border: 1px solid rgba(255, 128, 0, 0.8);
cursor: pointer;
}
.button-effect-img { .button-effect-img {
vertical-align: baseline; vertical-align: baseline;
width: 16px; width: 16px;
@@ -281,9 +302,16 @@ table {border: 1px solid #7a7971;}
height: 16; height: 16;
border-width: 0; border-width: 0;
} }
.button-effect-img:hover { .small-button-direction {
color: rgba(255, 255, 128, 0.7); height: 32px;
border: 1px solid rgba(255, 128, 0, 0.8); width: 32px;
border: 0;
vertical-align: bottom;
}
:is(.button-img,.button-effect-img:hover,.small-button-direction):hover {
color: var(--color-controls-hover);
border: 1px solid var(--color-control-border-hover);
text-shadow: 1px 0px 0px #ff6600;
cursor: pointer; cursor: pointer;
} }
@@ -294,18 +322,6 @@ table {border: 1px solid #7a7971;}
vertical-align: bottom; vertical-align: bottom;
} }
.small-button-direction {
height: 32px;
width: 32px;
border: 0;
vertical-align: bottom;
}
.small-button-direction:hover {
color: rgba(255, 255, 128, 0.7);
border: 1px solid rgba(255, 128, 0, 0.8);
cursor: pointer;
}
.foundryvtt-reve-de-dragon .sheet-header .header-fields { .foundryvtt-reve-de-dragon .sheet-header .header-fields {
-webkit-box-flex: 1; -webkit-box-flex: 1;
-ms-flex: 1; -ms-flex: 1;
@@ -346,25 +362,25 @@ table {border: 1px solid #7a7971;}
flex-grow: 0; flex-grow: 0;
} }
.rdd.sheet .window-content .sheet-body .carac-list .competence { .rdd.sheet .window-content .sheet-body .carac-list .caracteristique {
flex-wrap: nowrap; flex-wrap: nowrap;
justify-content: stretch; justify-content: stretch;
} }
.rdd.sheet .window-content .sheet-body .carac-list .competence > .carac-label { .rdd.sheet .window-content .sheet-body .carac-list .caracteristique > .carac-label {
flex-basis: 50%; flex-basis: 50%;
} }
.rdd.sheet .window-content .sheet-body .carac-list .competence > .attribut-label { .rdd.sheet .window-content .sheet-body .carac-list .caracteristique > .attribut-label {
flex-basis: 50%; flex-basis: 50%;
} }
.rdd.sheet .window-content .sheet-body .carac-list .competence > .competence-value.total { .rdd.sheet .window-content .sheet-body .carac-list .caracteristique > .competence-value.total {
flex-grow: 1; flex-grow: 1;
text-align: right; text-align: right;
} }
.rdd.sheet .window-content .sheet-body .carac-list .competence > .utiliser-attribut { .rdd.sheet .window-content .sheet-body .carac-list .caracteristique > .utiliser-attribut {
flex-basis: available; flex-basis: available;
flex-grow: 1; flex-grow: 1;
} }
.rdd.sheet .window-content .sheet-body .carac-list .competence > * { .rdd.sheet .window-content .sheet-body .carac-list .caracteristique > * {
flex-basis: 13%; flex-basis: 13%;
flex-grow: 0; flex-grow: 0;
} }
@@ -469,13 +485,18 @@ table {border: 1px solid #7a7971;}
flex: 0 0 86px; flex: 0 0 86px;
text-align: right; text-align: right;
} }
.competence-list .item-controls { .competence-list .item-controls {
display: contents !important; display: contents !important;
} }
.competence-list .item-controls.hidden-controls { .competence-list .item-controls.hidden-controls {
display: none !important; display: none !important;
} }
.item-controls i:is(.fas,.far) {
color: var(--color-controls);
}
.item-controls i:is(.fas,.far):hover {
opacity: 0.7 ;
}
.rdddialog .dialog-roll-sort s{ .rdddialog .dialog-roll-sort s{
width: 600px; width: 600px;
@@ -567,7 +588,7 @@ table {border: 1px solid #7a7971;}
color: rgba(255, 255, 255, 0.75); color: rgba(255, 255, 255, 0.75);
background: rgba(255, 255, 255, 0.05); background: rgba(255, 255, 255, 0.05);
border: 0 none; border: 0 none;
margin-bottom: 0.25rem; margin-bottom: 0.2rem;
} }
.window-app .window-content, .window-app.sheet .window-content .sheet-body{ .window-app .window-content, .window-app.sheet .window-content .sheet-body{
@@ -601,7 +622,7 @@ section.sheet-body{padding: 0.25rem 0.5rem;}
nav.sheet-tabs .item { nav.sheet-tabs .item {
position: relative; position: relative;
padding: 0 0.25rem; padding: 0 0.2rem;
} }
nav.sheet-tabs .item:after { nav.sheet-tabs .item:after {
@@ -627,11 +648,15 @@ section.sheet-body:after {
.sheet header.sheet-header .flex-compteurs {text-align: right;} .sheet header.sheet-header .flex-compteurs {text-align: right;}
.sheet header.sheet-header .resource-content {width: 2rem;} .sheet header.sheet-header .resource-content {width: 2rem;}
.ctn-vie span, .ctn-endu span, .ctn-fatigue span, .ctn-reve span { .compteur span {
display: inline-block; display: inline-block;
text-align: left; text-align: left;
width: 2rem; width: 2rem;
} }
.compteur a i:is(.fas,.far):hover {
opacity: 0.7 ;
}
.select-diff { .select-diff {
display: inline-block; display: inline-block;
text-align: left; text-align: left;
@@ -644,17 +669,6 @@ section.sheet-body:after {
max-width: 90%; max-width: 90%;
} }
.plus-moins {
display: inline-block;
width: 1.25rem;
background: rgba(30, 25, 20, 1);
text-align: center;
border: 1px solid rgba(72, 46, 28, 1);
border-radius: 0.25rem;
line-height: 1.25rem;
color: rgba(255, 255, 255, 0.5);
}
.alchimie-tache { .alchimie-tache {
font-weight: bold; font-weight: bold;
background: rgb(182, 180, 179); background: rgb(182, 180, 179);
@@ -711,10 +725,13 @@ ul, ol {
ul, li { ul, li {
list-style-type: none; list-style-type: none;
} }
.sheet .caracteristique li {
margin: 0.1rem;
padding: 0.2rem;
}
.sheet li { .sheet li {
margin: 0.125rem; margin: 0.1rem;
padding: 0.25rem; padding: 0.1rem;
} }
.header-fields li { .header-fields li {
margin: 0; margin: 0;
@@ -731,23 +748,19 @@ ul, li {
background: rgb(160, 130, 100, 0.05); background: rgb(160, 130, 100, 0.05);
} }
.xp-level-up { .xp-level-up {
margin: 0.125rem; margin: 0.1rem;
box-shadow: inset 0px 0px 1px #00000096; box-shadow: inset 0px 0px 1px #00000096;
border-radius: 0.25rem; border-radius: 0.25rem;
padding: 0.125rem; padding: 0.1rem;
flex: 1 1 5rem; flex: 1 1 5rem;
background: var(--gradient-gold) !important; background: var(--gradient-gold) !important;
} }
.niveau-archetype { .niveau-archetype {
background: var(--gradient-silver-light) !important; background: var(--gradient-silver-light) !important;
} }
.fa-arrow-alt-circle-up.allouer-stress { .item-controls i.fas.allouer-stress.level-up {
color: rgba(83, 60, 14, 0.8); color: var(--color-gold);
} }
.fa-arrow-alt-circle-up.allouer-stress-level-up {
color: rgba(191, 149, 63, 0.8);
}
.blessures-list ul { .blessures-list ul {
display: flex; display: flex;
} }
@@ -766,18 +779,18 @@ ul, li {
font-weight: bold; font-weight: bold;
} }
.list-item { .list-item {
margin: 0.125rem; margin: 0.1rem;
box-shadow: inset 0px 0px 1px #00000096; box-shadow: inset 0px 0px 1px #00000096;
border-radius: 0.25rem; border-radius: 0.25rem;
padding: 0.125rem; padding: 0.1rem;
flex: 1 1 5rem; flex: 1 1 5rem;
display: flex !important; display: flex !important;
align-items: baseline !important; align-items: center !important;
} }
.table-row { .table-row {
margin: 0.125rem; margin: 0.1rem;
padding: 0.125rem; padding: 0.1rem;
flex: 1 1 5rem; flex: 1 1 5rem;
} }
@@ -801,28 +814,37 @@ ul, li {
background: rgb(200, 10, 100, 0.25); background: rgb(200, 10, 100, 0.25);
} }
.item-quantite { .item-column {
margin-left: 0.5rem; margin-left: 0.2rem;
margin-right: 0.2rem;
justify-content: center;
text-align: center;
} }
.list-item-margin1 { .list-item-margin1 {
margin-left: 1rem; margin-left: 0.5rem;
} }
.list-item-margin2 { .list-item-margin2 {
margin-left: 2rem; margin-left: 1rem;
} }
.list-item-margin3 { .list-item-margin3 {
margin-left: 3rem; margin-left: 1.5rem;
} }
.list-item-margin4 { .list-item-margin4 {
margin-left: 4rem; margin-left: 2rem;
}
.list-item-margin5 {
margin-left: 2.5rem;
}
.list-item-margin6 {
margin-left: 3rem;
} }
.sheet-competence-img { .sheet-competence-img {
width: 24px; width: 24px;
height: 24px; height: 24px;
flex-grow: 0; flex-grow: 0;
margin-right: 0.25rem; margin-right: 0.2rem;
vertical-align: bottom; vertical-align: bottom;
} }
.competence-column { .competence-column {
@@ -866,20 +888,20 @@ ul, li {
.competence-value { .competence-value {
flex-grow: 0; flex-grow: 0;
flex-basis: 2rem; flex-basis: 2rem;
margin-right: 0.25rem; margin-right: 0.2rem;
margin-left: 0.25rem; margin-left: 0.2rem;
} }
.description-value { .description-value {
flex-grow: 0; flex-grow: 0;
flex-basis: 4rem; flex-basis: 4rem;
margin-right: 0.25rem; margin-right: 0.2rem;
margin-left: 0.25rem; margin-left: 0.2rem;
} }
.competence-xp { .competence-xp {
flex-grow: 0; flex-grow: 0;
flex-basis: 2rem; flex-basis: 2rem;
margin-right: 0.25rem; margin-right: 0.2rem;
margin-left: 0.25rem; margin-left: 0.2rem;
} }
.blessures-title { .blessures-title {
font-weight: bold; font-weight: bold;
@@ -957,7 +979,7 @@ ul, li {
flex-basis: auto; flex-basis: auto;
padding: 0; padding: 0;
line-height: 1rem; line-height: 1rem;
margin: 0.25rem; margin: 0.2rem;
} }
.control-icon.tokenhudicon.right { .control-icon.tokenhudicon.right {
margin-left: 8px; margin-left: 8px;
@@ -975,7 +997,7 @@ ul, li {
border-left: none; border-left: none;
font-weight: 500; font-weight: 500;
font-size: 1rem; font-size: 1rem;
color: black; color: var(--color-controls);
padding-top: 5px; padding-top: 5px;
margin-right: 0px; margin-right: 0px;
width: 45px; width: 45px;
@@ -1075,7 +1097,7 @@ ul, li {
.sidebar-tab .directory-list .entity { .sidebar-tab .directory-list .entity {
border-top: 1px dashed rgba(0,0,0,0.25); border-top: 1px dashed rgba(0,0,0,0.25);
border-bottom: 0 none; border-bottom: 0 none;
padding: 0.25rem 0; padding: 0.2rem 0;
} }
.sidebar-tab .directory-list .entity:hover { .sidebar-tab .directory-list .entity:hover {
@@ -1153,11 +1175,11 @@ ul, li {
border-image-width: 4px; border-image-width: 4px;
border-image-outset: 0px; border-image-outset: 0px;
} }
#controls .control-tools { #controls .control-tools {
max-height: calc(100vh - 156px); max-height: calc(100vh - 156px);
height: auto; height: auto;
} }
#controls .scene-control.active, #controls .control-tool.active, #controls .scene-control:hover, #controls .control-tool:hover { #controls :is(.scene-control.active,.control-tool.active, .scene-control:hover, .control-tool:hover) {
background: rgba(72, 46, 28, 1); background: rgba(72, 46, 28, 1);
background-origin: padding-box; background-origin: padding-box;
border-image: url(img/ui/footer-button.webp) 10 repeat; border-image: url(img/ui/footer-button.webp) 10 repeat;
@@ -1343,8 +1365,8 @@ ul, li {
color: rgba(255, 255, 255, 0.5); color: rgba(255, 255, 255, 0.5);
} }
.calendar-btn:hover { .calendar-btn:hover {
color: rgba(255, 255, 128, 0.7); color: var(--color-controls-hover);
border: 1px solid rgba(255, 128, 0, 0.8); border: 1px solid var(--color-control-border-hover);
cursor: pointer; cursor: pointer;
} }

View File

@@ -1,38 +1,43 @@
{ {
"name": "foundryvtt-reve-de-dragon", "id": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon", "title": "Rêve de Dragon",
"description": "Rêve de Dragon RPG for FoundryVTT", "description": "Rêve de Dragon RPG for FoundryVTT",
"author": "LeRatierBretonnien",
"authors": [ "authors": [
{ {
"name": "LeRatierBretonnien" "name": "LeRatierBretonnien",
"flags": {}
}, },
{ {
"name": "VincentVK" "name": "VincentVK",
"flags": {}
}, },
{ {
"name": "Grendel" "name": "Grendel",
"flags": {}
}, },
{ {
"name": "Michael Nonne" "name": "Michael Nonne",
"flags": {}
}, },
{ {
"name": "Mandar" "name": "Mandar",
"flags": {}
}, },
{ {
"name": "Fred" "name": "Fred",
"flags": {}
}, },
{ {
"name": "Fab" "name": "Fab",
"flags": {}
} }
], ],
"url": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/", "url": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/",
"license": "LICENSE.txt", "license": "LICENSE.txt",
"flags": {}, "version": "10.0.15",
"version": "1.5.75", "compatibility": {
"minimumCoreVersion": "0.8.0", "minimum": "10"
"compatibleCoreVersion": "9", },
"scripts": [],
"esmodules": [ "esmodules": [
"module/rdd-main.js" "module/rdd-main.js"
], ],
@@ -44,12 +49,13 @@
"lang": "en", "lang": "en",
"name": "English", "name": "English",
"path": "lang/fr.json", "path": "lang/fr.json",
"unreal": "this is a trick" "flags": {}
}, },
{ {
"lang": "fr", "lang": "fr",
"name": "Français", "name": "Français",
"path": "lang/fr.json" "path": "lang/fr.json",
"flags": {}
} }
], ],
"packs": [ "packs": [
@@ -57,453 +63,278 @@
"name": "competences", "name": "competences",
"label": "Compétences", "label": "Compétences",
"system": "foundryvtt-reve-de-dragon", "system": "foundryvtt-reve-de-dragon",
"module": "foundryvtt-reve-de-dragon", "path": "packs/competences.db",
"path": "./packs/competences.db",
"type": "Item", "type": "Item",
"tags": [ "private": false,
"item", "flags": {}
"compétences"
],
"entity": "Item",
"private": false
}, },
{ {
"name": "arts-et-divertissements", "name": "arts-et-divertissements",
"label": "Arts et Divertissements", "label": "Arts et Divertissements",
"system": "foundryvtt-reve-de-dragon", "system": "foundryvtt-reve-de-dragon",
"module": "foundryvtt-reve-de-dragon", "path": "packs/arts-et-divertissements.db",
"path": "./packs/arts-et-divertissements.db",
"type": "Item", "type": "Item",
"tags": [ "private": false,
"recette", "flags": {}
"cuisine",
"danse",
"musique",
"chant",
"jeux"
],
"entity": "Item",
"private": false
}, },
{ {
"name": "competences-creatures", "name": "competences-creatures",
"label": "Compétences de Créatures", "label": "Compétences de Créatures",
"system": "foundryvtt-reve-de-dragon", "system": "foundryvtt-reve-de-dragon",
"module": "foundryvtt-reve-de-dragon", "path": "packs/competences-creatures.db",
"path": "./packs/competences-creatures.db",
"type": "Item", "type": "Item",
"tags": [ "private": false,
"item", "flags": {}
"compétences",
"créatures"
],
"entity": "Item",
"private": false
}, },
{ {
"name": "competences-entites", "name": "competences-entites",
"label": "Compétences des Entités", "label": "Compétences des Entités",
"system": "foundryvtt-reve-de-dragon", "system": "foundryvtt-reve-de-dragon",
"module": "foundryvtt-reve-de-dragon", "path": "packs/competences-entites.db",
"path": "./packs/competences-entites.db",
"type": "Item", "type": "Item",
"tags": [ "private": false,
"item", "flags": {}
"compétences",
"entités"
],
"entity": "Item",
"private": false
}, },
{ {
"name": "sorts-oniros", "name": "sorts-oniros",
"label": "Sorts d'Oniros", "label": "Sorts d'Oniros",
"system": "foundryvtt-reve-de-dragon", "system": "foundryvtt-reve-de-dragon",
"module": "foundryvtt-reve-de-dragon", "path": "packs/sorts-oniros.db",
"path": "./packs/sorts-oniros.db",
"type": "Item", "type": "Item",
"tags": [ "private": false,
"item", "flags": {}
"sorts"
],
"entity": "Item",
"private": false
}, },
{ {
"name": "sorts-hypnos", "name": "sorts-hypnos",
"label": "Sorts d'Hypnos", "label": "Sorts d'Hypnos",
"system": "foundryvtt-reve-de-dragon", "system": "foundryvtt-reve-de-dragon",
"module": "foundryvtt-reve-de-dragon", "path": "packs/sorts-hypnos.db",
"path": "./packs/sorts-hypnos.db",
"type": "Item", "type": "Item",
"tags": [ "private": false,
"item", "flags": {}
"sorts"
],
"entity": "Item",
"private": false
}, },
{ {
"name": "sorts-narcos", "name": "sorts-narcos",
"label": "Sorts de Narcos", "label": "Sorts de Narcos",
"system": "foundryvtt-reve-de-dragon", "system": "foundryvtt-reve-de-dragon",
"module": "foundryvtt-reve-de-dragon", "path": "packs/sorts-narcos.db",
"path": "./packs/sorts-narcos.db",
"type": "Item", "type": "Item",
"tags": [ "private": false,
"item", "flags": {}
"sorts"
],
"entity": "Item",
"private": false
}, },
{ {
"name": "sorts-thanatos", "name": "sorts-thanatos",
"label": "Sorts de Thanatos", "label": "Sorts de Thanatos",
"system": "foundryvtt-reve-de-dragon", "system": "foundryvtt-reve-de-dragon",
"module": "foundryvtt-reve-de-dragon", "path": "packs/sorts-thanatos.db",
"path": "./packs/sorts-thanatos.db",
"type": "Item", "type": "Item",
"tags": [ "private": false,
"item", "flags": {}
"sorts"
],
"entity": "Item",
"private": false
}, },
{ {
"name": "equipement", "name": "equipement",
"label": "Equipement", "label": "Equipement",
"system": "foundryvtt-reve-de-dragon", "system": "foundryvtt-reve-de-dragon",
"module": "foundryvtt-reve-de-dragon", "path": "packs/equipement.db",
"path": "./packs/equipement.db",
"type": "Item", "type": "Item",
"tags": [ "private": false,
"item", "flags": {}
"équipement",
"objet"
],
"entity": "Item",
"private": false
}, },
{ {
"name": "maladies-et-poisons", "name": "maladies-et-poisons",
"label": "Maladies & Poisons", "label": "Maladies & Poisons",
"system": "foundryvtt-reve-de-dragon", "system": "foundryvtt-reve-de-dragon",
"module": "foundryvtt-reve-de-dragon", "path": "packs/maladies-et-poisons.db",
"path": "./packs/maladies-et-poisons.db",
"type": "Item", "type": "Item",
"tags": [ "private": false,
"maladie", "flags": {}
"poison"
],
"entity": "Item",
"private": false
}, },
{ {
"name": "rappel-des-regles", "name": "rappel-des-regles",
"label": "Rappels des Règles", "label": "Rappels des Règles",
"system": "foundryvtt-reve-de-dragon", "system": "foundryvtt-reve-de-dragon",
"module": "foundryvtt-reve-de-dragon", "path": "packs/rappel-des-regles.db",
"path": "./packs/rappel-des-regles.db",
"type": "JournalEntry", "type": "JournalEntry",
"tags": [ "private": false,
"journal", "flags": {}
"règles"
],
"entity": "JournalEntry",
"private": false
}, },
{ {
"name": "queues-de-dragon", "name": "queues-de-dragon",
"label": "Queues de Dragon", "label": "Queues de Dragon",
"system": "foundryvtt-reve-de-dragon", "system": "foundryvtt-reve-de-dragon",
"module": "foundryvtt-reve-de-dragon", "path": "packs/queues-de-dragon.db",
"path": "./packs/queues-de-dragon.db",
"type": "Item", "type": "Item",
"tags": [ "private": false,
"item", "flags": {}
"queue"
],
"entity": "Item",
"private": false
}, },
{ {
"name": "ombres-de-thanatos", "name": "ombres-de-thanatos",
"label": "Ombres de Thanatos", "label": "Ombres de Thanatos",
"system": "foundryvtt-reve-de-dragon", "system": "foundryvtt-reve-de-dragon",
"module": "foundryvtt-reve-de-dragon", "path": "packs/ombres-de-thanatos.db",
"path": "./packs/ombres-de-thanatos.db",
"type": "Item", "type": "Item",
"tags": [ "private": false,
"item", "flags": {}
"ombre"
],
"entity": "Item",
"private": false
}, },
{ {
"name": "souffles-de-dragon", "name": "souffles-de-dragon",
"label": "Souffles de Dragon", "label": "Souffles de Dragon",
"system": "foundryvtt-reve-de-dragon", "system": "foundryvtt-reve-de-dragon",
"module": "foundryvtt-reve-de-dragon", "path": "packs/souffles-de-dragon.db",
"path": "./packs/souffles-de-dragon.db",
"type": "Item", "type": "Item",
"tags": [ "private": false,
"item", "flags": {}
"souffle"
],
"entity": "Item",
"private": false
}, },
{ {
"name": "tarot-draconique", "name": "tarot-draconique",
"label": "Tarot Draconique", "label": "Tarot Draconique",
"system": "foundryvtt-reve-de-dragon", "system": "foundryvtt-reve-de-dragon",
"module": "foundryvtt-reve-de-dragon", "path": "packs/tarot-draconique.db",
"path": "./packs/tarot-draconique.db",
"type": "Item", "type": "Item",
"tags": [ "private": false,
"item", "flags": {}
"tarot"
],
"entity": "Item",
"private": false
}, },
{ {
"name": "tetes-de-dragon-pour-haut-revants", "name": "tetes-de-dragon-pour-haut-revants",
"label": "Têtes de Dragon (Hauts-Rêvants)", "label": "Têtes de Dragon (Hauts-Rêvants)",
"system": "foundryvtt-reve-de-dragon", "system": "foundryvtt-reve-de-dragon",
"module": "foundryvtt-reve-de-dragon", "path": "packs/tetes-de-dragon-pour-haut-revants.db",
"path": "./packs/tetes-de-dragon-pour-haut-revants.db",
"type": "Item", "type": "Item",
"tags": [ "private": false,
"item", "flags": {}
"tête"
],
"entity": "Item",
"private": false
}, },
{ {
"name": "tetes-de-dragon-pour-tous-personnages", "name": "tetes-de-dragon-pour-tous-personnages",
"label": "Têtes de Dragon (Tous Personnages)", "label": "Têtes de Dragon (Tous Personnages)",
"system": "foundryvtt-reve-de-dragon", "system": "foundryvtt-reve-de-dragon",
"module": "foundryvtt-reve-de-dragon", "path": "packs/tetes-de-dragon-pour-tous-personnages.db",
"path": "./packs/tetes-de-dragon-pour-tous-personnages.db",
"type": "Item", "type": "Item",
"tags": [ "private": false,
"item", "flags": {}
"tête"
],
"entity": "Item",
"private": false
}, },
{ {
"name": "tables-diverses", "name": "tables-diverses",
"label": "Tables Diverses", "label": "Tables Diverses",
"system": "foundryvtt-reve-de-dragon", "system": "foundryvtt-reve-de-dragon",
"module": "foundryvtt-reve-de-dragon", "path": "packs/tables-diverses.db",
"path": "./packs/tables-diverses.db",
"type": "RollTable", "type": "RollTable",
"tags": [ "private": false,
"table", "flags": {}
"tables"
],
"entity": "RollTable",
"private": false
}, },
{ {
"name": "animaux", "name": "animaux",
"label": "Animaux", "label": "Animaux",
"system": "foundryvtt-reve-de-dragon", "system": "foundryvtt-reve-de-dragon",
"module": "foundryvtt-reve-de-dragon", "path": "packs/animaux.db",
"path": "./packs/animaux.db",
"type": "Actor", "type": "Actor",
"tags": [ "private": false,
"animaux", "flags": {}
"creature"
],
"entity": "Actor",
"private": false
}, },
{ {
"name": "voyageurs", "name": "voyageurs",
"label": "Voyageurs", "label": "Voyageurs",
"system": "foundryvtt-reve-de-dragon", "system": "foundryvtt-reve-de-dragon",
"module": "foundryvtt-reve-de-dragon", "path": "packs/voyageurs.db",
"path": "./packs/voyageurs.db",
"type": "Actor", "type": "Actor",
"tags": [ "private": false,
"voyageur", "flags": {}
"profils"
],
"entity": "Actor",
"private": false
}, },
{ {
"name": "vehicules", "name": "vehicules",
"label": "Véhicules", "label": "Véhicules",
"system": "foundryvtt-reve-de-dragon", "system": "foundryvtt-reve-de-dragon",
"module": "foundryvtt-reve-de-dragon", "path": "packs/vehicules.db",
"path": "./packs/vehicules.db",
"type": "Actor", "type": "Actor",
"tags": [ "private": false,
"vehicule", "flags": {}
"bateau",
"charett",
"chariot",
"carriole",
"barque"
],
"entity": "Actor",
"private": false
}, },
{ {
"name": "archetypes", "name": "archetypes",
"label": "Archetypes PNJs", "label": "Archetypes PNJs",
"system": "foundryvtt-reve-de-dragon", "system": "foundryvtt-reve-de-dragon",
"module": "foundryvtt-reve-de-dragon", "path": "packs/archetypes.db",
"path": "./packs/archetypes.db",
"type": "Actor", "type": "Actor",
"tags": [ "private": false,
"archetype", "flags": {}
"pnj"
],
"entity": "Actor",
"private": false
}, },
{ {
"name": "humanoides", "name": "humanoides",
"label": "Humanoïdes", "label": "Humanoïdes",
"system": "foundryvtt-reve-de-dragon", "system": "foundryvtt-reve-de-dragon",
"module": "foundryvtt-reve-de-dragon", "path": "packs/humanoides.db",
"path": "./packs/humanoides.db",
"type": "Actor", "type": "Actor",
"tags": [ "private": false,
"humanoides", "flags": {}
"pnj"
],
"entity": "Actor",
"private": false
}, },
{ {
"name": "entites", "name": "entites",
"label": "Entités de Cauchemar", "label": "Entités de Cauchemar",
"system": "foundryvtt-reve-de-dragon", "system": "foundryvtt-reve-de-dragon",
"module": "foundryvtt-reve-de-dragon", "path": "packs/entites-de-cauchemar.db",
"path": "./packs/entites-de-cauchemar.db",
"type": "Actor", "type": "Actor",
"tags": [ "private": false,
"entités", "flags": {}
"entite",
"cauchemar",
"ecni",
"eni"
],
"entity": "Actor",
"private": false
}, },
{ {
"name": "invocations", "name": "invocations",
"label": "Invocation d'Hypnos", "label": "Invocation d'Hypnos",
"system": "foundryvtt-reve-de-dragon", "system": "foundryvtt-reve-de-dragon",
"module": "foundryvtt-reve-de-dragon", "path": "packs/invocations.db",
"path": "./packs/invocations.db",
"type": "Actor", "type": "Actor",
"tags": [ "private": false,
"hypnos", "flags": {}
"invocation"
],
"entity": "Actor",
"private": false
}, },
{ {
"name": "botanique", "name": "botanique",
"label": "Botanique", "label": "Botanique",
"system": "foundryvtt-reve-de-dragon", "system": "foundryvtt-reve-de-dragon",
"module": "foundryvtt-reve-de-dragon", "path": "packs/botanique.db",
"path": "./packs/botanique.db",
"type": "Item", "type": "Item",
"tags": [ "private": false,
"plantes", "flags": {}
"champignons",
"herbes"
],
"entity": "Item",
"private": false
}, },
{ {
"name": "taches-courantes", "name": "taches-courantes",
"label": "Tâches courantes", "label": "Tâches courantes",
"system": "foundryvtt-reve-de-dragon", "system": "foundryvtt-reve-de-dragon",
"module": "foundryvtt-reve-de-dragon", "path": "packs/taches-courantes.db",
"path": "./packs/taches-courantes.db",
"type": "Item", "type": "Item",
"tags": [ "private": false,
"taches" "flags": {}
],
"entity": "Item",
"private": false
}, },
{ {
"name": "meditations-et-ecrits", "name": "meditations-et-ecrits",
"label": "Méditations et Ecrits", "label": "Méditations et Ecrits",
"system": "foundryvtt-reve-de-dragon", "system": "foundryvtt-reve-de-dragon",
"module": "foundryvtt-reve-de-dragon", "path": "packs/meditations-et-ecrits.db",
"path": "./packs/meditations-et-ecrits.db",
"type": "Item", "type": "Item",
"tags": [ "private": false,
"meditations", "flags": {}
"méditations",
"livres",
"livre",
"méditation",
"écrits",
"écrit"
],
"entity": "Item",
"private": false
}, },
{ {
"name": "recettes-alchimiques", "name": "recettes-alchimiques",
"label": "Recettes Alchimiques", "label": "Recettes Alchimiques",
"system": "foundryvtt-reve-de-dragon", "system": "foundryvtt-reve-de-dragon",
"module": "foundryvtt-reve-de-dragon", "path": "packs/recettes-alchimiques.db",
"path": "./packs/recettes-alchimiques.db",
"type": "Item", "type": "Item",
"tags": [ "private": false,
"recettes", "flags": {}
"recette",
"alchimie",
"alchimique",
"potion"
],
"entity": "Item",
"private": false
}, },
{ {
"name": "scenes-rdd", "name": "scenes-rdd",
"label": "Scenes Reve de Dragon", "label": "Scenes Reve de Dragon",
"system": "foundryvtt-reve-de-dragon", "system": "foundryvtt-reve-de-dragon",
"module": "foundryvtt-reve-de-dragon", "path": "packs/scenes-rdd.db",
"path": "./packs/scenes-rdd.db",
"type": "Scene", "type": "Scene",
"tags": [ "private": false,
"ecran", "flags": {}
"scene"
],
"entity": "Scene",
"private": false
} }
], ],
"system": [],
"dependencies": [],
"socket": true, "socket": true,
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v1.5/system.json", "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-1.5.75.zip", "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.0.15.zip",
"protected": false,
"gridDistance": 1, "gridDistance": 1,
"gridUnits": "m", "gridUnits": "m",
"primaryTokenAttribute": "sante.vie", "primaryTokenAttribute": "sante.vie",
"secondaryTokenAttribute": "sante.endurance" "secondaryTokenAttribute": "sante.endurance"
} }

View File

@@ -1,5 +1,5 @@
<tr class="table-row alterne-row item" data-blessure-type="{{gravite}}" data-attribute={{key}} data-blessure-index="{{key}}" > <tr class="table-row alterne-row item" data-blessure-type="{{gravite}}" data-attribute={{key}} data-blessure-index="{{key}}" >
<td class="item-control blessure-control" title="Blessure {{title}}" data-blessure-active="{{bless.active}}"> <td class="blessure-control" title="Blessure {{title}}" data-blessure-active="{{bless.active}}">
{{#if bless.active}} {{#if bless.active}}
<i class="fas fa-skull-crossbones blessure-active-{{gravite}}" name="blessure-{{gravite}}-{{key}}-active"></i> <i class="fas fa-skull-crossbones blessure-active-{{gravite}}" name="blessure-{{gravite}}-{{key}}-active"></i>
{{else}} {{else}}

View File

@@ -41,50 +41,49 @@
<div class="grid grid-2col"> <div class="grid grid-2col">
<div class="flex-group-left flexcol"> <div class="flex-group-left flexcol">
<ol class="carac-list alterne-list"> <ol class="carac-list alterne-list">
{{#each data.carac as |carac key|}} {{#each system.carac as |carac key|}}
<li class="flexrow list-item" data-attribute="{{key}}"> <li class="flexrow list-item" data-attribute="{{key}}">
{{#if (eq key 'taille')}} {{#if (eq key 'taille')}}
<span class="carac-label flexrow" name="data.carac.{{key}}.label">{{carac.label}}</span> <span class="carac-label flexrow" name="system.carac.{{key}}.label">{{carac.label}}</span>
{{else}} {{else}}
<span class="carac-label flexrow" name="data.carac.{{key}}.label"><a <span class="carac-label flexrow" name="system.carac.{{key}}.label"><a
name={{key}}>{{carac.label}}</a></span> name={{key}}>{{carac.label}}</a></span>
{{/if}} {{/if}}
<input class="competence-value flexrow" type="text" name="data.carac.{{key}}.value" <input class="competence-value flexrow" type="text" name="system.carac.{{key}}.value"
value="{{carac.value}}" data-dtype="{{carac.type}}" /> value="{{carac.value}}" data-dtype="{{carac.type}}" />
</li> </li>
{{/each}} {{/each}}
<li class="flexrow"> <li class="flexrow">
<span class="carac-label" name="carac-total">Total Caractéristiques</span> <span class="carac-label" name="carac-total">Total Caractéristiques</span>
{{log 'data-actor-creature' this}}
<span class="competence-value" name="carac-total-value">{{calc.caracTotal}}</span> <span class="competence-value" name="carac-total-value">{{calc.caracTotal}}</span>
</li> </li>
</ol> </ol>
</div> </div>
<div class="flex-group-left flexcol"> <div class="flex-group-left flexcol">
<ol class="carac-list alterne-list"> <ol class="carac-list alterne-list">
{{#each data.attributs as |attr key|}} {{#each system.attributs as |attr key|}}
<li class="flexrow list-item" data-attribute="{{key}}"> <li class="flexrow list-item" data-attribute="{{key}}">
<span class="carac-label" name="data.attributs.{{key}}.label">{{attr.label}}</span> <span class="carac-label" name="system.attributs.{{key}}.label">{{attr.label}}</span>
<input type="text" name="data.attributs.{{key}}.value" value="{{attr.value}}" data-dtype="{{attr.type}}" /> <input type="text" name="system.attributs.{{key}}.value" value="{{attr.value}}" data-dtype="{{attr.type}}" />
</li> </li>
{{/each}} {{/each}}
<li class="flexrow list-item" data-attribute="vie"> <li class="flexrow list-item" data-attribute="vie">
<span class="competence-label" name="data.sante.vie.label">Vie</span> <span class="competence-label" name="system.sante.vie.label">Vie</span>
<span class="flexrow" > <span class="flexrow" >
<input type="text" name="data.sante.vie.value" value="{{data.sante.vie.value}}" data-dtype="Number" /> / <input type="text" name="system.sante.vie.value" value="{{system.sante.vie.value}}" data-dtype="Number" /> /
<input type="text" name="data.sante.vie.max" value="{{data.sante.vie.max}}" data-dtype="Number" /> <input type="text" name="system.sante.vie.max" value="{{system.sante.vie.max}}" data-dtype="Number" />
</span> </span>
</li> </li>
<li class="flexrow list-item" data-attribute="endurance"> <li class="flexrow list-item" data-attribute="endurance">
<span class="competence-label" name="data.sante.endurance.label">Endurance</span> <span class="competence-label" name="system.sante.endurance.label">Endurance</span>
<span class="flexrow" > <span class="flexrow" >
<input type="text" name="data.sante.endurance.value" value="{{data.sante.endurance.value}}" data-dtype="Number" /> / <input type="text" name="system.sante.endurance.value" value="{{system.sante.endurance.value}}" data-dtype="Number" /> /
<input type="text" name="data.sante.endurance.max" value="{{data.sante.endurance.max}}" data-dtype="Number" /> <input type="text" name="system.sante.endurance.max" value="{{system.sante.endurance.max}}" data-dtype="Number" />
</span> </span>
</li> </li>
<li class="flexrow list-item" data-attribute="etat"> <li class="flexrow list-item" data-attribute="etat">
<span class="competence-label" name="data.compteurs.etat.label">Etat Général</span> <span class="competence-label" name="system.compteurs.etat.label">Etat Général</span>
<input type="text" value="{{data.compteurs.etat.value}}" disabled /> <input type="text" value="{{system.compteurs.etat.value}}" disabled />
</li> </li>
</ol> </ol>
</div> </div>
@@ -103,14 +102,14 @@
<span class="competence-label">{{comp.name}}</span> <span class="competence-label">{{comp.name}}</span>
</a> </a>
<input class="competence-value creature-carac" type="text" compname="{{comp.name}}" <input class="competence-value creature-carac" type="text" compname="{{comp.name}}"
value="{{comp.data.carac_value}}" data-dtype="number" /> value="{{comp.system.carac_value}}" data-dtype="number" />
<input class="competence-value creature-niveau" type="text" compname="{{comp.name}}" <input class="competence-value creature-niveau" type="text" compname="{{comp.name}}"
value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number" /> value="{{numberFormat comp.system.niveau decimals=0 sign=true}}" data-dtype="number" />
<input class="competence-value creature-dommages" type="text" compname="{{comp.name}}" <input class="competence-value creature-dommages" type="text" compname="{{comp.name}}"
value="{{numberFormat comp.data.dommages decimals=0 sign=true}}" data-dtype="number" /> value="{{numberFormat comp.system.dommages decimals=0 sign=true}}" data-dtype="number" />
<div class="item-controls"> <div class="item-controls">
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a> <a class="item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a> <a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div> </div>
</li> </li>
{{/each}} {{/each}}
@@ -127,35 +126,7 @@
{{!-- Equipment Tab --}} {{!-- Equipment Tab --}}
<div class="tab items" data-group="primary" data-tab="items"> <div class="tab items" data-group="primary" data-tab="items">
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-inventaire.html"}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-inventaire-monnaie.html" monnaie=monnaie}}
<span class="item-name"><h4>Equipement porté</h4></span>
<span class="item-name">Encombrement total/max : {{numberFormat calc.encTotal decimals=2}} / {{data.attributs.encombrement.value}} <b>{{calc.surEncombrementMessage}}</b></span> -
<span class="item-name"><a class="creer-un-objet">Créer un objet</a></span>
{{#if options.isGM}}
<span class="item-name"> - <a id="nettoyer-conteneurs">Vider tout les conteneurs</a></span>
{{/if}}
<ul class="item-list alterne-list">
<li class="competence-header flexrow">
<img class="sheet-competence-img" src="{{img}}" title="Equipement"/>
<span class="competence-title flex-grow">Nom</span>
<span class="competence-title">Q.</span>
<span class="competence-title">Enc.</span>
<span class="competence-title flex-grow">Equiper/Editer/Suppr.</span>
</li>
{{#each objets as |item id|}}
{{#unless item.estContenu}}
{{#if (ne item.type 'conteneur')}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-inventaire-conteneur.html" item=item }}
{{/if}}
{{/unless}}
{{/each}}
{{#each conteneurs as |conteneur id|}}
{{buildConteneur this}}
{{/each}}
</ul>
</div> </div>
{{!-- Biography Tab --}} {{!-- Biography Tab --}}
@@ -163,12 +134,12 @@
<div class="form-group"> <div class="form-group">
<span class="item-name"><h4>Race</h4></span> <span class="item-name"><h4>Race</h4></span>
<input type="text" name="data.race" value="{{data.race}}" data-dtype="String" /> <input type="text" name="system.race" value="{{system.race}}" data-dtype="String" />
</div> </div>
<div class="form-group editor"> <div class="form-group editor">
<span class="item-name"><h4>Description</h4> <span class="item-name"><h4>Description</h4>
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}} {{editor system.description target="system.description" button=true owner=owner editable=true}}
</div> </div>
{{>"systems/foundryvtt-reve-de-dragon/templates/actor-sheet-editor-notes-mj.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/actor-sheet-editor-notes-mj.html"}}

View File

@@ -28,19 +28,19 @@
{{!-- Carac Tab --}} {{!-- Carac Tab --}}
<div class="tab items" data-group="primary" data-tab="carac"> <div class="tab items" data-group="primary" data-tab="carac">
<div class="grid grid-2col"> <div class="grid grid-2col">
<div class="flex-group-left flexcol"> <div class="flex-group-left flexcol">
<ol class="carac-list alterne-list"> <ol class="carac-list alterne-list">
{{#each data.carac as |carac key|}} {{#each system.carac as |carac key|}}
<li class="competence flexrow list-item" data-attribute="{{key}}"> <li class="caracteristique flexrow list-item" data-attribute="{{key}}">
{{#if (eq key 'taille')}} {{#if (eq key 'taille')}}
<span class="carac-label flexrow" name="data.carac.{{key}}.label">{{carac.label}}</span> <span class="carac-label flexrow" name="system.carac.{{key}}.label">{{carac.label}}</span>
{{else}} {{else}}
<span class="carac-label flexrow" name="data.carac.{{key}}.label"><a <span class="carac-label flexrow" name="system.carac.{{key}}.label"><a
name={{key}}>{{carac.label}}</a></span> name={{key}}>{{carac.label}}</a></span>
{{/if}} {{/if}}
<input class="competence-value flexrow" type="text" name="data.carac.{{key}}.value" <input class="competence-value flexrow" type="text" name="system.carac.{{key}}.value"
value="{{carac.value}}" data-dtype="{{carac.type}}" /> value="{{carac.value}}" data-dtype="{{carac.type}}" />
</li> </li>
{{/each}} {{/each}}
@@ -50,37 +50,38 @@
<div class="flex-group-left flexcol"> <div class="flex-group-left flexcol">
<ol class="carac-list alterne-list"> <ol class="carac-list alterne-list">
<li class="competence flexrow list-item"> <li class="caracteristique flexrow list-item">
<span class="carac-label flexrow" name="catEntite">Catégorie : </span> <span class="carac-label flexrow" name="catEntite">Catégorie : </span>
<select name="data.definition.categorieentite" value="{{data.definition.categorieentite}}" data-dtype="String"> <select name="system.definition.categorieentite" value="{{system.definition.categorieentite}}" data-dtype="String">
{{#select data.definition.categorieentite}} {{#select system.definition.categorieentite}}
<option value="cauchemar">Cauchemar</option> <option value="cauchemar">Cauchemar</option>
<option value="reve">Rêve</option> <option value="reve">Rêve</option>
{{/select}} {{/select}}
</select> </select>
</li> </li>
<li class="competence flexrow list-item"> <li class="caracteristique flexrow list-item">
<span class="carac-label flexrow" name="typeEntite">Type d'entité : </span> <span class="carac-label flexrow" name="typeEntite">Type d'entité : </span>
<select name="data.definition.typeentite" value="{{data.definition.typeentite}}" data-dtype="String"> <select name="system.definition.typeentite" value="{{system.definition.typeentite}}" data-dtype="String">
{{#select data.definition.typeentite}} {{#select system.definition.typeentite}}
<option value="incarne">Incarnée</option> <option value="incarne">Incarnée</option>
<option value="nonincarne">Non Incarnée</option> <option value="nonincarne">Non Incarnée</option>
<option value="blurette">Blurette</option>
{{/select}} {{/select}}
</select> </select>
</li> </li>
{{#each data.attributs as |attr key|}} {{#each system.attributs as |attr key|}}
<li class="competence flexrow list-item" data-attribute="{{key}}"> <li class="caracteristique flexrow list-item" data-attribute="{{key}}">
<span class="carac-label flexrow" name="data.attributs.{{key}}.label">{{attr.label}} : </span> <span class="carac-label flexrow" name="system.attributs.{{key}}.label">{{attr.label}} : </span>
<span><input class="attribut-value flexrow" type="text" name="data.attributs.{{key}}.value" <span><input class="attribut-value flexrow" type="text" name="system.attributs.{{key}}.value"
value="{{attr.value}}" data-dtype="{{attr.type}}" /></span> value="{{attr.value}}" data-dtype="{{attr.type}}" /></span>
</li> </li>
{{/each}} {{/each}}
<li class="competence flexrow list-item" data-attribute="endurance"> <li class="caracteristique flexrow list-item" data-attribute="endurance">
<span class="competence-label flexrow" name="data.sante.endurance.label">Endurance : </span> <span class="competence-label flexrow" name="system.sante.endurance.label">Endurance : </span>
<span><input class="sante-value flexrow" type="text" name="data.sante.endurance.value" <span><input class="sante-value flexrow" type="text" name="system.sante.endurance.value"
value="{{data.sante.endurance.value}}" data-dtype="Number" /></span><span>/ </span> value="{{system.sante.endurance.value}}" data-dtype="Number" /></span><span>/ </span>
<span><input class="sante-value flexrow" type="text" name="data.sante.endurance.max" <span><input class="sante-value flexrow" type="text" name="system.sante.endurance.max"
value="{{data.sante.endurance.max}}" data-dtype="Number" /></span> value="{{system.sante.endurance.max}}" data-dtype="Number" /></span>
</li> </li>
</ol> </ol>
</div> </div>
@@ -89,9 +90,7 @@
{{!-- Compétences Tab --}} {{!-- Compétences Tab --}}
<div class="tab competences" data-group="primary" data-tab="competences"> <div class="tab competences" data-group="primary" data-tab="competences">
<div class="flexcol"> <div class="flexcol">
<div class="flex-group-left flexcol competence-column"> <div class="flex-group-left flexcol competence-column">
<ol class="item-list alterne-list"> <ol class="item-list alterne-list">
{{#each competences as |comp key|}} {{#each competences as |comp key|}}
@@ -99,46 +98,43 @@
<img class="sheet-competence-img" src="{{comp.img}}" /> <img class="sheet-competence-img" src="{{comp.img}}" />
<span class="competence-label"><a>{{comp.name}}</a></span> <span class="competence-label"><a>{{comp.name}}</a></span>
<input class="competence-value creature-carac" type="text" compname="{{comp.name}}" <input class="competence-value creature-carac" type="text" compname="{{comp.name}}"
value="{{comp.data.carac_value}}" data-dtype="number" /> value="{{comp.system.carac_value}}" data-dtype="number" />
<input class="competence-value creature-niveau" type="text" compname="{{comp.name}}" <input class="competence-value creature-niveau" type="text" compname="{{comp.name}}"
value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number" /> value="{{numberFormat comp.system.niveau decimals=0 sign=true}}" data-dtype="number" />
<input class="competence-value creature-dommages" type="text" compname="{{comp.name}}" <input class="competence-value creature-dommages" type="text" compname="{{comp.name}}"
value="{{numberFormat comp.data.dommages decimals=0 sign=true}}" data-dtype="number" /> value="{{numberFormat comp.system.dommages decimals=0 sign=true}}" data-dtype="number" />
<div class="item-controls"> <div class="item-controls">
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a> <a class="item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a> <a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ol>
</div>
<div class="flex-group-left flexcol competence-column">
<ol class="item-list alterne-list">
{{#each possessions as |possession key|}}
<li class="item flexrow list-item" data-item-id="{{possession._id}}">
<img class="sheet-competence-img" src="{{possession.img}}" />
<span class="competence-label">{{possession.name}}</span>
<div class="item-controls">
<a class="item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div> </div>
</li> </li>
{{/each}} {{/each}}
</ol> </ol>
<div class="flex-group-left flexcol competence-column">
<ol class="item-list alterne-list">
{{#each possessions as |possession key|}}
<li class="item flexrow list-item" data-item-id="{{possession._id}}">
<img class="sheet-competence-img" src="{{possession.img}}" />
<span class="competence-label">{{possession.name}}</span>
<div class="item-controls">
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ol>
</div> </div>
</div> </div>
</div> </div>
{{!-- Biography Tab --}} {{!-- Biography Tab --}}
<div class="tab description" data-group="primary" data-tab="description"> <div class="tab description" data-group="primary" data-tab="description">
<div class="form-group editor"> <div class="form-group editor">
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}} {{editor system.description target="system.description" button=true owner=owner editable=true}}
</div> </div>
{{>"systems/foundryvtt-reve-de-dragon/templates/actor-sheet-editor-notes-mj.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/actor-sheet-editor-notes-mj.html"}}
</div> </div>
</div>
</section> </section>
</form> </form>

View File

@@ -13,15 +13,15 @@
</thead> </thead>
<tbody> <tbody>
<tr class="table-row alterne-row" ><td/><td colspan="4">Légères</td></tr> <tr class="table-row alterne-row" ><td/><td colspan="4">Légères</td></tr>
{{#each data.blessures.legeres.liste as |bless key|}} {{#each system.blessures.legeres.liste as |bless key|}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-blessure-partial.html" bless=bless key=key gravite="legere" title="Légère"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-blessure-partial.html" bless=bless key=key gravite="legere" title="Légère"}}
{{/each}} {{/each}}
<tr class="table-row alterne-row"><td/><td colspan="4">Graves</td></tr> <tr class="table-row alterne-row"><td/><td colspan="4">Graves</td></tr>
{{#each data.blessures.graves.liste as |bless key|}} {{#each system.blessures.graves.liste as |bless key|}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-blessure-partial.html" bless=bless key=key gravite="grave" title="Grave"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-blessure-partial.html" bless=bless key=key gravite="grave" title="Grave"}}
{{/each}} {{/each}}
<tr class="table-row alterne-row"><td/><td colspan="4">Critiques</td></tr> <tr class="table-row alterne-row"><td/><td colspan="4">Critiques</td></tr>
{{#each data.blessures.critiques.liste as |bless key|}} {{#each system.blessures.critiques.liste as |bless key|}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-blessure-partial.html" bless=bless key=key gravite="critique" title="Critique"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-blessure-partial.html" bless=bless key=key gravite="critique" title="Critique"}}
{{/each}} {{/each}}
</tbody> </tbody>

View File

@@ -1,27 +1,31 @@
<header class="competence-header flexrow"> {{#if competences}}
<span class="competence-title">{{categorie}}</span> <div class="flex-shrink">
</header> <header class="competence-header flexrow">
<ul class="item-list alterne-list competence-list"> <span class="competence-title">{{categorie}}</span>
{{#if @root.options.vueDetaillee}} </header>
<li class="item flexrow list-item "> <ul class="item-list alterne-list competence-list">
{{#if @root.options.vueDetaillee}}
<span class="competence-label"></span> <li class="item flexrow list-item ">
<span class="competence-value" >Niv.</span>
<span class="competence-xp">xp</span> <span class="competence-label"></span>
{{#if (eq categorie 'Draconic')}} <span class="competence-value" >Niv.</span>
<span class="competence-xp-sort">sort</span> <span class="competence-xp">xp</span>
{{/if}} {{#if (eq categorie 'Draconic')}}
<div class="item-controls"> <span class="competence-xp-sort">sort</span>
<i class="far fa-arrow-alt-circle-up"></i>
<span class="competence-archetype">Arch</span>
<i class="far fa-edit"></i>
{{#if @root.options.isGM}}
<i class="far fa-trash"></i>
{{/if}} {{/if}}
</div> <div class="item-controls">
</li> <i class="far fa-arrow-alt-circle-up"></i>
{{/if}} <span class="competence-archetype">Arch</span>
{{#each competences as |comp key|}} <i class="far fa-edit"></i>
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-competence-partial.html" comp}} {{#if @root.options.isGM}}
{{/each}} <i class="far fa-trash"></i>
</ul> {{/if}}
</div>
</li>
{{/if}}
{{#each competences as |comp key|}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-competence-partial.html" comp}}
{{/each}}
</ul>
</div>
{{/if}}

View File

@@ -1,49 +1,49 @@
{{#if visible}} {{#if system.isVisible}}
<li class="item flexrow list-item {{#if data.isLevelUp}}xp-level-up tooltip{{/if}}" data-item-id="{{_id}}"> <li class="item flexrow list-item {{#if system.isLevelUp}}xp-level-up tooltip{{/if}}" data-item-id="{{_id}}">
<a class="competence-label" name="{{name}}"> <a class="competence-label" name="{{name}}">
<img class="sheet-competence-img" src="{{img}}"/> <img class="sheet-competence-img" src="{{img}}"/>
<span class="competence-label">{{name}}</span> <span class="competence-label">{{name}}</span>
</a> </a>
{{#if data.isLevelUp}} {{#if system.isLevelUp}}
<span class="tooltiptext ttt-xp">Vous pouvez dépenser {{data.xpNext}} points d'Experience pour augmenter de 1 votre compétence {{name}}</span> <span class="tooltiptext ttt-xp">Vous pouvez dépenser {{system.xpNext}} points d'Experience pour augmenter de 1 votre compétence {{name}}</span>
<a class="item-control competence-xp-augmenter" compname="{{name}}" title="Augmenter"> <a class="competence-xp-augmenter" compname="{{name}}" title="Augmenter">
<i class="fas fa-arrow-alt-circle-up"></i> <i class="fas fa-arrow-alt-circle-up"></i>
</a> </a>
{{/if}} {{/if}}
<input class="competence-value" type="text" compname="{{name}}" name="comp-value-{{name}}" <input class="competence-value" type="text" compname="{{name}}" name="comp-value-{{name}}"
value="{{numberFormat data.niveau decimals=0 sign=true}}" data-dtype="number" value="{{numberFormat system.niveau decimals=0 sign=true}}" data-dtype="number"
{{#unless @root.options.editCaracComp}}disabled{{/unless}} /> {{#unless @root.options.editCaracComp}}disabled{{/unless}} />
<span class="competence-xp tooltip"> <span class="competence-xp tooltip">
<input class="competence-xp " type="text" compname="{{name}}" name="comp-xp-{{name}}" <input class="competence-xp " type="text" compname="{{name}}" name="comp-xp-{{name}}"
value="{{numberFormat data.xp decimals=0 sign=false}}" data-dtype="number" value="{{numberFormat system.xp decimals=0 sign=false}}" data-dtype="number"
{{#unless @root.options.editCaracComp}}disabled{{/unless}} /> {{#unless @root.options.editCaracComp}}disabled{{/unless}} />
<span class="tooltiptext left-competence ttt-xp">Vous devez acquérir {{data.xpNext}} points d'Experience pour augmenter de 1 votre compétence {{name}}</span> <span class="tooltiptext left-competence ttt-xp">Vous devez acquérir {{system.xpNext}} points d'Experience pour augmenter de 1 votre compétence {{name}}</span>
</span> </span>
{{#if (eq data.categorie 'draconic')}} {{#if (eq system.categorie 'draconic')}}
<input class="competence-xp-sort" type="text" compname="{{name}}" name="comp-xp-sort-{{name}}" <input class="competence-xp-sort" type="text" compname="{{name}}" name="comp-xp-sort-{{name}}"
value="{{numberFormat data.xp_sort decimals=0 sign=false}}" data-dtype="number" value="{{numberFormat system.xp_sort decimals=0 sign=false}}" data-dtype="number"
{{#unless @root.options.editCaracComp}}disabled{{/unless}}/> {{#unless @root.options.editCaracComp}}disabled{{/unless}}/>
{{/if}} {{/if}}
{{#if @root.options.vueDetaillee}} {{#if @root.options.vueDetaillee}}
<div class="item-controls"> <div class="item-controls">
{{#if data.stressXpMax}} {{#if system.stressXpMax}}
<a class="item-control competence-stress-augmenter" compname="{{name}}" <a class="competence-stress-augmenter" compname="{{name}}"
title="Dépenser {{data.stressXpMax}} points de stress {{#if data.isStressLevelUp}} pour augmenter d'un niveau {{/if}}"> title="Dépenser {{system.stressXpMax}} points de stress {{#if system.isStressLevelUp}} pour augmenter d'un niveau {{/if}}">
<i class="fas fa-arrow-alt-circle-up allouer-stress{{#if data.isStressLevelUp}}-level-up{{/if}}"></i> <i class="fas fa-arrow-alt-circle-up allouer-stress{{#if system.isStressLevelUp}}-level-up{{/if}}"></i>
</a> </a>
{{else}} {{else}}
<i class="far fa-circle"></i> <i class="far fa-circle"></i>
{{/if}} {{/if}}
<input class="competence-archetype niveau-archetype" type="text" compname="{{name}}" name="comp-archetype-{{name}}" <input class="competence-archetype niveau-archetype" type="text" compname="{{name}}" name="comp-archetype-{{name}}"
value="{{numberFormat data.niveau_archetype decimals=0 sign=true}}" data-dtype="number" value="{{numberFormat system.niveau_archetype decimals=0 sign=true}}" data-dtype="number"
{{#unless @root.options.editCaracComp}}disabled{{/unless}} /> {{#unless @root.options.editCaracComp}}disabled{{/unless}} />
<a class="item-control item-edit" title="Modifier"><i class="fas fa-edit"></i></a> <a class="item-edit" title="Modifier"><i class="fas fa-edit"></i></a>
{{#if @root.options.isGM}} {{#if @root.options.isGM}}
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a> <a class="item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
{{/if}} {{/if}}
</div> </div>
{{/if}} {{/if}}

View File

@@ -1,6 +1,6 @@
{{#if options.isGM}} {{#if options.isGM}}
<h3>Notes du MJ : </h3> <h3>Notes du MJ : </h3>
<div class="form-group editor"> <div class="form-group editor">
{{editor content=data.notesmj target="data.notesmj" button=true owner=owner editable=editable}} {{editor system.notesmj target="system.notesmj" button=true owner=owner editable=editable}}
</div> </div>
{{/if}} {{/if}}

View File

@@ -1,32 +1,52 @@
<li class="item flexrow list-item" data-item-id="{{item._id}}" draggable="true"> <li class="item flexrow list-item" data-item-id="{{item._id}}" draggable="true">
<img class="sheet-competence-img" src="{{item.img}}" title="{{item.name}}"/>
{{#if (eq item.type 'conteneur')}} {{#if (eq item.type 'conteneur')}}
<span class="item-name conteneur-name flex-grow"><a data-item-id="{{item._id}}">+{{item.name}}</a></span> <span class="sheet-competence-img conteneur-name">
{{#if vide}}
<i class="far fa-square"></i>
{{else}}
<a data-item-id="{{item._id}}">
{{#if ouvert}}
<i class="far fa-minus-square"></i>
<!-- <i class="far fa-caret-square-down"></i> -->
{{else}}
<i class="far fa-plus-square"></i>
<!-- <i class="fas fa-caret-square-right"></i> -->
{{/if}}
</a>
{{/if}}
</span>
<span class="item-name conteneur-name flex-grow">
<a data-item-id="{{item._id}}">
<img class="sheet-competence-img" src="{{item.img}}" title="{{item.name}}"/>
{{item.name}}
</a>
</span>
{{else}} {{else}}
<img class="sheet-competence-img" src="{{item.img}}" title="{{item.name}}"/>
<span class="item-name flex-grow">{{item.name}}</span> <span class="item-name flex-grow">{{item.name}}</span>
{{/if}} {{/if}}
<span class="item-quantite">{{item.data.quantite}} <span class="item-quantite">{{item.system.quantite}}
{{#if (gt item.data.quantite 1)}} {{#if (gt item.system.quantite 1)}}
<a class="item-control item-split" title="Séparer"><i class="fas fa-unlink"></i></a> <a class="item-control item-split" title="Séparer"><i class="fas fa-unlink"></i></a>
{{/if}} {{/if}}
</span> </span>
<span class="item-quantite">{{numberFormat item.data.encTotal decimals=2}}</span> <span class="item-quantite">{{numberFormat item.system.encTotal decimals=2}}</span>
<div class="item-controls flex-grow"> <div class="item-controls flex-grow">
{{#unless item.estContenu}} {{#unless item.estContenu}}
{{#if (ne item.type 'conteneur')}} {{#if (ne item.type 'conteneur')}}
<a class="item-control item-equip" title="Equiper">{{#if item.data.equipe}}<i class="fas fa-hand-rock"></i>{{else}}<i class="far fa-hand-paper"></i>{{/if}}</a> <a class="item-control item-equip" title="Equiper">{{#if item.system.equipe}}<i class="fas fa-hand-rock"></i>{{else}}<i class="far fa-hand-paper"></i>{{/if}}</a>
{{/if}} {{/if}}
{{/unless}} {{/unless}}
<a class="item-control item-edit" title="Editer"><i class="fas fa-edit"></i></a> <a class="item-control item-edit" title="Editer"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a> <a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
{{#if (or (eq item.type 'arme') (eq item.type 'conteneur') item.data.quantite)}} {{#if (or (eq item.type 'arme') (eq item.type 'conteneur') item.system.quantite)}}
&nbsp; &nbsp;
<a class="item-control item-vendre" title="Vendre ou donner"><i class="fas fa-comments-dollar"></i></a> <a class="item-control item-vendre" title="Vendre ou donner"><i class="fas fa-comments-dollar"></i></a>
{{/if}} {{/if}}
<a class="item-control item-montrer" title="Montrer"><i class="fas fa-comment"></i></a> <a class="item-control item-montrer" title="Montrer"><i class="fas fa-comment"></i></a>
{{#if item.data.actionPrincipale}} {{#if item.system.actionPrincipale}}
<a class="item-name item-action">{{item.data.actionPrincipale}}</a> <a class="item-name item-action">{{item.system.actionPrincipale}}</a>
{{/if}} {{/if}}
</div> </div>
</li> </li>

View File

@@ -0,0 +1,48 @@
<li class="item flexrow list-item" data-item-id="{{item._id}}" draggable="true">
<span class="equipement-nom {{#if (eq item.type 'conteneur')}}conteneur-name{{/if}} ">
{{#if (eq item.type 'conteneur')}}
{{#if vide}}
<i class="far fa-square"></i>
{{else}}
<a data-item-id="{{item._id}}">
{{#if ouvert}}
<i class="far fa-minus-square"></i>
{{else}}
<i class="far fa-plus-square"></i>
{{/if}}
</a>
{{/if}}
<a data-item-id="{{item._id}}">
<img class="sheet-competence-img" src="{{item.img}}" title="{{item.name}}"/>
<span>{{item.name}}</span>
</a>
{{else}}
<img class="sheet-competence-img" src="{{item.img}}" title="{{item.name}}"/>
<span>{{item.name}}</span>
{{/if}}
</span>
<span class="equipement-detail">{{item.system.quantite}}
{{#if (gt item.system.quantite 1)}}
<a class="item-split" title="Séparer"><i class="fas fa-unlink"></i></a>
{{/if}}
</span>
<span class="equipement-detail">{{numberFormat item.system.encTotal decimals=2}}</span>
<span class="equipement-actions item-controls">
{{#unless item.estContenu}}
{{#if (ne item.type 'conteneur')}}
<a class="item-equip" title="Equiper">{{#if item.system.equipe}}<i class="fas fa-hand-rock"></i>{{else}}<i class="far fa-hand-paper"></i>{{/if}}</a>
{{/if}}
{{/unless}}
<a class="item-edit" title="Editer"><i class="fas fa-edit"></i></a>
<a class="item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
&nbsp;
{{#if (or (eq item.type 'arme') (eq item.type 'conteneur') item.system.quantite)}}
<a class="item-vendre" title="Vendre ou donner"><i class="fas fa-comments-dollar"></i></a>
{{/if}}
<a class="item-montrer" title="Montrer"><i class="fas fa-comment"></i></a>
{{#if item.actionPrincipale}}
<a class="item-action">{{item.actionPrincipale}}</a>
{{/if}}
</span>
</li>

View File

@@ -3,16 +3,26 @@
{{#each monnaie as |piece id|}} {{#each monnaie as |piece id|}}
<li class="item flexrow list-item" data-item-id="{{piece._id}}"> <li class="item flexrow list-item" data-item-id="{{piece._id}}">
<img class="sheet-competence-img" src="{{piece.img}}" title="{{piece.name}}"/> <img class="sheet-competence-img" src="{{piece.img}}" title="{{piece.name}}"/>
<span class="competence-title competence-label">{{piece.name}}</span> <span class="equipement-nom">{{piece.name}}</span>
<span class="competence-title competence-label">{{piece.data.quantite}}</span> <span class="equipement-detail item-controls">
<span class="competence-title"> <a class="monnaie-moins"><i class="fas fa-minus-square"></i></a>
<a class="monnaie-plus plus-moins">+</a> </span>
<a class="monnaie-moins plus-moins">-</a> <span class="equipement-detail">
<span>{{piece.system.quantite}}</span>
</span>
<span class="equipement-detail item-controls">
<a class="monnaie-plus"><i class="fas fa-plus-square"></i></a>
</span>
<!-- <span class="equipement-detail">
<span class="flex-shrink"><a class="monnaie-moins"><i class="fas fa-minus-square"></i></a></span>
<span>{{piece.system.quantite}}</span>
<span class="flex-shrink"><a class="monnaie-plus"><i class="fas fa-plus-square"></i></a></span>
</span> -->
<span class="equipement-actions item-controls">
<a class="item-edit" title="Editer"><i class="fas fa-edit"></i></a>
<a class="item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</span> </span>
<div class="item-controls flex-shrink">
<a class="item-control item-edit" title="Editer"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li> </li>
{{/each}} {{/each}}
</ul> </ul>

View File

@@ -0,0 +1,26 @@
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-inventaire-monnaie.html" monnaie=monnaie}}
<span class="item-name"><h4>Equipement</h4></span>
<span class="item-name">Encombrement total/max : {{numberFormat calc.encTotal decimals=2}} / {{system.attributs.encombrement.value}} <b>{{calc.surEncombrementMessage}}</b></span> -
<span class="item-name"><a class="creer-un-objet">Créer un objet</a></span>
{{#if options.isGM}}
<span class="item-name"> - <a id="nettoyer-conteneurs">Vider tout les conteneurs</a></span>
{{/if}}
<ul class="item-list alterne-list">
<li class="competence-header flexrow">
<span class="equipement-nom">Nom</span>
<span class="equipement-detail">Q.</span>
<span class="equipement-detail">Enc.</span>
<span class="equipement-actions">Actions</span>
</li>
{{#each objets as |item id|}}
{{#unless item.estContenu}}
{{#if (ne item.type 'conteneur')}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-inventaire-item.html" item=item vide=true ouvert=true }}
{{/if}}
{{/unless}}
{{/each}}
{{#each conteneurs as |conteneur id|}}
{{buildConteneur this}}
{{/each}}
</ul>

View File

@@ -0,0 +1,9 @@
<li class="item flexrow" data-attribute={{key}} data-item-id="{{queue._id}}">
<span class="display-label flex-grow"><a>{{queue.name}}</a></span>
<div class="item-controls">
<a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
{{#if queue.system.refoulement}}
<a class="item-action">Refouler</a>
{{/if}}
</div>
</li>

View File

@@ -0,0 +1,12 @@
<span class="item-name"><h4>Compagnons animaux</h4></span>
<ul class="item-list alterne-list">
{{#each subacteurs.montures as |monture id|}}
<li class="item flexrow list-item" data-actor-id="{{monture.id}}">
<img class="sheet-competence-img" src="{{monture.img}}" title="{{monture.name}}"/>
<span class="subacteur-label"><a>{{monture.name}}</a></span>
<div class="flex-shrink">
<a class="subacteur-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>

View File

@@ -0,0 +1,12 @@
<span class="item-name"><h4>Suivants</h4></span>
<ul class="item-list alterne-list">
{{#each subacteurs.suivants as |suivant id|}}
<li class="item flexrow list-item" data-actor-id="{{suivant.id}}">
<img class="sheet-competence-img" src="{{suivant.img}}" title="{{suivant.name}}"/>
<span class="competence-title subacteur-label"><a>{{suivant.name}}</a></span>
<div class="item-controls flex-shrink">
<a class="subacteur-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>

View File

@@ -0,0 +1,15 @@
<span class="item-name"><h4>Véhicules</h4></span>
<ul class="item-list alterne-list">
{{#each subacteurs.vehicules as |vehicule id|}}
<li class="item flexrow list-item" data-actor-id="{{vehicule.id}}">
<img class="sheet-competence-img" src="{{vehicule.img}}" title="{{vehicule.name}}"/>
<span class="flex-grow subacteur-label"><a>{{vehicule.name}}</a></span>
<span>{{vehicule.categorie}}</span>
<span>{{vehicule.structure}}</span>
<div class="flex-shrink">
<a class="subacteur-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>

View File

@@ -1,11 +1,11 @@
<li class="item flexrow list-item" data-item-id="{{oeuvre._id}}"> <li class="item flexrow list-item" data-item-id="{{oeuvre._id}}">
<span>{{upperFirst typeOeuvre}}</span> <span>{{upperFirst typeOeuvre}}</span>
<span class="competence-title {{classOeuvre}}"> <span class="competence-title {{classOeuvre}}">
<a>{{oeuvre.name}} (niveau {{oeuvre.data.niveau}})</a> <a>{{oeuvre.name}} (niveau {{oeuvre.system.niveau}})</a>
</span> </span>
<div class="item-controls"> <div class="item-controls">
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a> <a class="item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a> <a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div> </div>
</li> </li>

View File

@@ -0,0 +1,15 @@
{{#if (or queues.length ombres.length)}}
<h3>
{{#if queues.length}}Queues de Dragon{{/if}}
{{#if (and queues.length ombres.length)}} et {{/if}}
{{#if ombres.length}}Ombres de Thanatos{{/if}}
:</h3>
<ul class="flex-group-left">
{{#each queues as |queue key|}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-item-queue.html" queue=queue key=key}}
{{/each}}
{{#each ombres as |ombre key|}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-item-queue.html" queue=ombre key=key}}
{{/each}}
</ul>
{{/if}}

View File

@@ -10,40 +10,40 @@
<div class="flexrow"> <div class="flexrow">
<ul class="flex-group-center flex-compteurs"> <ul class="flex-group-center flex-compteurs">
<li> <li>
<label class="ctn-vie"> <label class="compteur">
<a class="jet-vie">Vie</a> <a class="jet-vie">Vie</a>
<a class="vie-moins plus-moins">-</a> <a class="vie-moins"><i class="fas fa-minus-square"></i></a>
<input class="resource-content" type="text" name="data.sante.vie.value" value="{{data.sante.vie.value}}" data-dtype="Number"/> <input class="resource-content" type="text" name="system.sante.vie.value" value="{{system.sante.vie.value}}" data-dtype="Number"/>
<span>/ {{data.sante.vie.max}}</span> <span>/ {{system.sante.vie.max}}</span>
<a class="vie-plus plus-moins">+</a> <a class="vie-plus"><i class="fas fa-plus-square"></i></a>
</label> </label>
</li> </li>
<li> <li>
<label class="ctn-endu"> <label class="compteur">
<a class="jet-endurance">Endurance</a> <a class="jet-endurance">Endurance</a>
<a class="endurance-moins plus-moins">-</a> <a class="endurance-moins"><i class="fas fa-minus-square"></i></a>
<input class="resource-content" type="text" name="data.sante.endurance.value" value="{{data.sante.endurance.value}}" data-dtype="Number"/> <input class="resource-content" type="text" name="system.sante.endurance.value" value="{{system.sante.endurance.value}}" data-dtype="Number"/>
<span>/ {{data.sante.endurance.max}}</span> <span>/ {{system.sante.endurance.max}}</span>
<a class="endurance-plus plus-moins">+</a> <a class="endurance-plus"><i class="fas fa-plus-square"></i></a>
</label> </label>
</li> </li>
<li> <li>
<label class="appliquerFatigue ctn-fatigue tooltip"> <label class="appliquerFatigue compteur tooltip">
<span class="tooltiptext ttt-fatigue">{{{calc.fatigue.html}}}</span> <span class="tooltiptext ttt-fatigue">{{{calc.fatigue.html}}}</span>
Fatigue Fatigue
<a class="fatigue-moins plus-moins">-</a> <a class="fatigue-moins"><i class="fas fa-minus-square"></i></a>
<input class="resource-content" id="fatigue-value" type="text" name="data.sante.fatigue.value" value="{{data.sante.fatigue.value}}" data-dtype="Number" /> <input class="resource-content" id="fatigue-value" type="text" name="system.sante.fatigue.value" value="{{system.sante.fatigue.value}}" data-dtype="Number" />
<span>/ {{data.sante.fatigue.max}}</span> <span>/ {{system.sante.fatigue.max}}</span>
<a class="fatigue-plus plus-moins">+</a> <a class="fatigue-plus"><i class="fas fa-plus-square"></i></a>
</label> </label>
</li> </li>
<li> <li>
<label class="ctn-reve"> <label class="compteur">
<span class="ptreve-actuel"><a>Rêve</a></span> <span class="ptreve-actuel"><a>Rêve</a></span>
<a class="ptreve-actuel-moins plus-moins">-</a> <a class="ptreve-actuel-moins"><i class="fas fa-minus-square"></i></a>
<input class="resource-content" id="pointsreve-value" type="text" name="data.reve.reve.value" value="{{data.reve.reve.value}}" data-dtype="Number" /> <input class="resource-content" id="pointsreve-value" type="text" name="system.reve.reve.value" value="{{system.reve.reve.value}}" data-dtype="Number" />
<span>/ {{data.reve.seuil.value}}</span> <span>/ {{system.reve.seuil.value}}</span>
<a class="ptreve-actuel-plus plus-moins">+</a> <a class="ptreve-actuel-plus"><i class="fas fa-plus-square"></i></a>
</label> </label>
</li> </li>
</ul> </ul>
@@ -52,7 +52,7 @@
<span class="encaisser-direct"><a title="Encaisser des dommages"><img class="button-img" src="icons/svg/bones.svg" alt="Encaisser des dommages"/></a></span> <span class="encaisser-direct"><a title="Encaisser des dommages"><img class="button-img" src="icons/svg/bones.svg" alt="Encaisser des dommages"/></a></span>
<span class="gm-only remise-a-neuf"><a title="Remise à neuf"><img class="button-img" src="icons/svg/regen.svg" alt="Remise à neuf"/></a></span> <span class="gm-only remise-a-neuf"><a title="Remise à neuf"><img class="button-img" src="icons/svg/regen.svg" alt="Remise à neuf"/></a></span>
<span class="repos"><a title="Repos"><img class="button-img" src="icons/svg/sleep.svg" alt="Se reposer"/></a></span> <span class="repos"><a title="Repos"><img class="button-img" src="icons/svg/sleep.svg" alt="Se reposer"/></a></span>
{{#if data.attributs.hautrevant.value}} {{#if system.attributs.hautrevant.value}}
<span class="monte-tmr"><a title="Montée dans les Terres M&eacute;dianes !" {{#if hautreve.isDemiReve}}disabled{{/if}}><img class="button-img" src="systems/foundryvtt-reve-de-dragon/styles/img/ui/icon-tmr-normal.svg" alt="Montée dans les Terres M&eacute;dianes !"/></a></span> <span class="monte-tmr"><a title="Montée dans les Terres M&eacute;dianes !" {{#if hautreve.isDemiReve}}disabled{{/if}}><img class="button-img" src="systems/foundryvtt-reve-de-dragon/styles/img/ui/icon-tmr-normal.svg" alt="Montée dans les Terres M&eacute;dianes !"/></a></span>
<span class="monte-tmr-rapide"><a title="Montée accélérée dans les Terres M&eacute;dianes !"><img class="button-img" src="systems/foundryvtt-reve-de-dragon/styles/img/ui/icon-tmr-rapide.svg" alt="Montée accélérée dans les Terres M&eacute;dianes !"/></a></span> <span class="monte-tmr-rapide"><a title="Montée accélérée dans les Terres M&eacute;dianes !"><img class="button-img" src="systems/foundryvtt-reve-de-dragon/styles/img/ui/icon-tmr-rapide.svg" alt="Montée accélérée dans les Terres M&eacute;dianes !"/></a></span>
<span class="visu-tmr"><a title="Regarder les Terres M&eacute;dianes"><img class="button-img" src="systems/foundryvtt-reve-de-dragon/styles/img/ui/icon-tmr-view.svg" alt="Regarder les Terres M&eacute;dianes"/></a></span> <span class="visu-tmr"><a title="Regarder les Terres M&eacute;dianes"><img class="button-img" src="systems/foundryvtt-reve-de-dragon/styles/img/ui/icon-tmr-view.svg" alt="Regarder les Terres M&eacute;dianes"/></a></span>
@@ -65,8 +65,8 @@
<span>{{calc.resumeBlessures}}</span> <span>{{calc.resumeBlessures}}</span>
</div> </div>
<div class="flexrow"> <div class="flexrow">
<span>{{data.compteurs.etat.label}}: {{data.compteurs.etat.value}}</span> <span>{{system.compteurs.etat.label}}: {{system.compteurs.etat.value}}</span>
<span>{{data.compteurs.surenc.label}}: {{data.compteurs.surenc.value}}</span> <span>{{system.compteurs.surenc.label}}: {{system.compteurs.surenc.value}}</span>
</div> </div>
<div class="flexrow"> <div class="flexrow">
{{>"systems/foundryvtt-reve-de-dragon/templates/actor-sheet-effects-partial.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/actor-sheet-effects-partial.html"}}
@@ -100,38 +100,38 @@
<div class="grid grid-2col"> <div class="grid grid-2col">
<div class="flex-group-left flexcol"> <div class="flex-group-left flexcol">
<ul class="carac-list alterne-list"> <ul class="carac-list alterne-list">
{{#each data.carac as |carac key|}} {{#each system.carac as |carac key|}}
{{#if carac.isLevelUp}} {{#if carac.isLevelUp}}
<li class="competence flexrow item-list xp-level-up" data-attribute="{{key}}"> <li class="caracteristique flexrow item-list xp-level-up" data-attribute="{{key}}">
{{else}} {{else}}
<li class="competence flexrow list-item" data-attribute="{{key}}"> <li class="caracteristique flexrow list-item" data-attribute="{{key}}">
{{/if}} {{/if}}
{{#if (eq key 'taille')}} {{#if (eq key 'taille')}}
<span class="carac-label" name="data.carac.{{key}}.label">{{carac.label}}</span> <span class="carac-label" name="system.carac.{{key}}.label">{{carac.label}}</span>
<input class="carac-value" type="text" name="data.carac.{{key}}.value" value="{{carac.value}}" data-dtype="{{carac.type}}" {{#unless @root.options.editCaracComp}}disabled{{/unless}} /> <input class="carac-value" type="text" name="system.carac.{{key}}.value" value="{{carac.value}}" data-dtype="{{carac.type}}" {{#unless @root.options.editCaracComp}}disabled{{/unless}} />
<label class="carac-xp"/> <label class="carac-xp"/>
{{else}} {{else}}
{{#if carac.derivee}} {{#if carac.derivee}}
<span class="carac-label" name="data.carac.{{key}}.label"> <a name={{key}}>{{carac.label}}</a></span> <span class="carac-label" name="system.carac.{{key}}.label"> <a name={{key}}>{{carac.label}}</a></span>
<label class="competence-value">{{carac.value}}</label> <label class="competence-value">{{carac.value}}</label>
<label class="carac-xp"/> <label class="carac-xp"/>
{{else}} {{else}}
{{#if carac.isLevelUp}} {{#if carac.isLevelUp}}
<span class="carac-label tooltip" name="data.carac.{{key}}.label"> <span class="carac-label tooltip" name="system.carac.{{key}}.label">
<span class="tooltiptext ttt-xp"> <span class="tooltiptext ttt-xp">
Vous pouvez dépenser {{carac.xpNext}} points d'Experience pour augmenter de 1 votre caractéristique {{carac.label}} Vous pouvez dépenser {{carac.xpNext}} points d'Experience pour augmenter de 1 votre caractéristique {{carac.label}}
</span> </span>
<a name={{key}}>{{carac.label}}</a></span> <a name={{key}}>{{carac.label}}</a></span>
{{else}} {{else}}
<span class="carac-label tooltip" name="data.carac.{{key}}.label"><a name={{key}}>{{carac.label}}</a></span> <span class="carac-label tooltip" name="system.carac.{{key}}.label"><a name={{key}}>{{carac.label}}</a></span>
{{/if}} {{/if}}
<input class="carac-value" type="text" name="data.carac.{{key}}.value" value="{{carac.value}}" data-dtype="{{carac.type}}" {{#unless @root.options.editCaracComp}}disabled{{/unless}} /> <input class="carac-value" type="text" name="system.carac.{{key}}.value" value="{{carac.value}}" data-dtype="{{carac.type}}" {{#unless @root.options.editCaracComp}}disabled{{/unless}} />
<span class="carac-xp tooltip"> <span class="carac-xp tooltip">
<input class="carac-xp" type="text" name="data.carac.{{key}}.xp" value="{{carac.xp}}" data-dtype="number" {{#unless @root.options.editCaracComp}}disabled{{/unless}} /> <input class="carac-xp" type="text" name="system.carac.{{key}}.xp" value="{{carac.xp}}" data-dtype="number" {{#unless @root.options.editCaracComp}}disabled{{/unless}} />
<span class="tooltiptext ttt-xp">Vous devez acquérir {{carac.xpNext}} points d'Experience pour augmenter de 1 votre {{carac.label}}</span> <span class="tooltiptext ttt-xp">Vous devez acquérir {{carac.xpNext}} points d'Experience pour augmenter de 1 votre {{carac.label}}</span>
</span> </span>
{{#if carac.isLevelUp}} {{#if carac.isLevelUp}}
<a class="item-control carac-xp-augmenter" name="augmenter.{{key}}" title="Augmenter"> <a class="carac-xp-augmenter" name="augmenter.{{key}}" title="Augmenter">
<i class="fas fa-arrow-alt-circle-up"></i> <i class="fas fa-arrow-alt-circle-up"></i>
</a> </a>
{{/if}} {{/if}}
@@ -139,27 +139,27 @@
{{/if}} {{/if}}
</li> </li>
{{/each}} {{/each}}
<li class="competence flexrow"> <li class="caracteristique flexrow">
<span class="carac-label" name="carac-total">Total Caractéristiques </span> <span class="carac-label" name="carac-total">Total Caractéristiques </span>
<span class="competence-value total" name="carac-total-value">{{calc.caracTotal}} </span> <span class="competence-value total" name="carac-total-value">{{calc.caracTotal}} </span>
</li> </li>
</ul> </ul>
</div> </div>
<div class="flex-group-left flexcol" > <div class="flex-group-left flexcol" >
<ul class="carac-list"> <ul class="carac-list">
<li class="competence flexrow list-item"> <li class="caracteristique flexrow list-item">
<span class="carac-label" name="beaute">Beauté&nbsp;:</span> <span class="carac-label" name="beaute">Beauté&nbsp;:</span>
<input class="description-value" type="text" name="data.beaute" value="{{data.beaute}}" data-dtype="String" {{#unless @root.options.editCaracComp}}disabled{{/unless}}/> <input class="description-value" type="text" name="system.beaute" value="{{system.beaute}}" data-dtype="String" {{#unless @root.options.editCaracComp}}disabled{{/unless}}/>
<label class="carac-xp"/> <label class="carac-xp"/>
</li> </li>
{{#each data.attributs as |attr key|}} {{#each system.attributs as |attr key|}}
{{#unless (eq key 'hautrevant')}} {{#unless (eq key 'hautrevant')}}
<li class="competence flexrow list-item" data-attribute="{{key}}"> <li class="caracteristique flexrow list-item" data-attribute="{{key}}">
<span class="carac-label" name="data.attributs.{{key}}.label">{{attr.label}}&nbsp;:</span> <span class="carac-label" name="system.attributs.{{key}}.label">{{attr.label}}&nbsp;:</span>
{{#if (eq key 'protection')}} {{#if (eq key 'protection')}}
<input class="description-value" id="attribut-protection-edit" type="text" name="{{key}}" value="{{attr.value}}" data-dtype="number"/> <input class="description-value" id="attribut-protection-edit" type="text" name="{{key}}" value="{{attr.value}}" data-dtype="number"/>
{{else}} {{else}}
<input class="description-value" type="text" disabled name="data.attributs.{{key}}." value="{{attr.value}}" data-dtype="number"/> <input class="description-value" type="text" disabled name="system.attributs.{{key}}." value="{{attr.value}}" data-dtype="number"/>
{{/if}} {{/if}}
<label class="carac-xp"/> <label class="carac-xp"/>
</li> </li>
@@ -167,19 +167,19 @@
{{/each}} {{/each}}
</ul> </ul>
<ul class="carac-list alterne-list"> <ul class="carac-list alterne-list">
<li class="competence flexrow list-item"> <li class="caracteristique flexrow list-item">
<span class="attribut-label chance-actuelle"><a>Chance actuelle</a></span> <span class="attribut-label chance-actuelle"><a>Chance actuelle</a></span>
<input class="description-value compteur-edit" type="text" name="chance" value="{{data.compteurs.chance.value}}" data-dtype="number"/> <input class="description-value compteur-edit" type="text" name="chance" value="{{system.compteurs.chance.value}}" data-dtype="number"/>
<span class="utiliser-attribut" style="padding-left: 5px"><a class="item-control chance-appel">Utiliser</a></span> <span class="utiliser-attribut" style="padding-left: 5px"><a class="chance-appel">Utiliser</a></span>
</li> </li>
{{#each data.compteurs as |compteur key|}} {{#each system.compteurs as |compteur key|}}
{{#if (eq compteur.label 'Chance')}} {{#if (eq compteur.label 'Chance')}}
{{else if (eq compteur.label 'Experience')}} {{else if (eq compteur.label 'Experience')}}
{{else if compteur.isInput}} {{else if compteur.isInput}}
<li class="competence flexrow list-item"> <li class="caracteristique flexrow list-item">
<span class="attribut-label">{{compteur.label}}</span> <span class="attribut-label">{{compteur.label}}</span>
{{#if (eq compteur.label 'Ethylisme')}} {{#if (eq compteur.label 'Ethylisme')}}
<select class="description-value" name="data.compteurs.ethylisme.value" id="ethylisme" data-dtype="Number"> <select class="description-value" name="system.compteurs.ethylisme.value" id="ethylisme" data-dtype="Number">
{{#select compteur.value}} {{#select compteur.value}}
{{>"systems/foundryvtt-reve-de-dragon/templates/niveau-ethylisme.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/niveau-ethylisme.html"}}
{{/select}} {{/select}}
@@ -189,9 +189,9 @@
{{/if}} {{/if}}
<span class="utiliser-attribut" style="padding-left: 5px"> <span class="utiliser-attribut" style="padding-left: 5px">
{{#if compteur.isStress}} {{#if compteur.isStress}}
<a class="item-control stress-test" title="Transformer">Transformer</a> <a class="stress-test" title="Transformer">Transformer</a>
{{else if (eq compteur.label 'Ethylisme')}} {{else if (eq compteur.label 'Ethylisme')}}
<a class="item-control ethylisme-test" id="ethylisme-test" title="Jet d'Ethylisme">Boire</a> <a class="ethylisme-test" id="ethylisme-test" title="Jet d'Ethylisme">Boire</a>
{{else if (eq compteur.label 'Moral')}} {{else if (eq compteur.label 'Moral')}}
<a class="moral-malheureux" title="Jet de moral situation malheureuse"><img class="small-button-container" src="systems/foundryvtt-reve-de-dragon/icons/moral-malheureux.svg" alt="Jet de moral situation malheureuse"/></a> <a class="moral-malheureux" title="Jet de moral situation malheureuse"><img class="small-button-container" src="systems/foundryvtt-reve-de-dragon/icons/moral-malheureux.svg" alt="Jet de moral situation malheureuse"/></a>
<a class="moral-neutre" title="Jet de moral situation neutre"><img class="small-button-container" src="systems/foundryvtt-reve-de-dragon/icons/moral-neutre.svg" alt="Jet de moral situation neutre"/></a> <a class="moral-neutre" title="Jet de moral situation neutre"><img class="small-button-container" src="systems/foundryvtt-reve-de-dragon/icons/moral-neutre.svg" alt="Jet de moral situation neutre"/></a>
@@ -215,11 +215,9 @@
<span><a class="lock-unlock-sheet"><img class="small-button-container" <span><a class="lock-unlock-sheet"><img class="small-button-container"
src="systems/foundryvtt-reve-de-dragon/icons/{{#if options.editCaracComp}}unlocked.svg{{else}}locked.svg{{/if}}" alt="blocker/débloquer"> src="systems/foundryvtt-reve-de-dragon/icons/{{#if options.editCaracComp}}unlocked.svg{{else}}locked.svg{{/if}}" alt="blocker/débloquer">
{{#if options.editCaracComp}}Verrouiller{{else}}Déverrouiller{{/if}}</a></span> {{#if options.editCaracComp}}Verrouiller{{else}}Déverrouiller{{/if}}</a></span>
<span class="flexrow"> <span>
<i class="fas fa-search"></i> <input class="recherche flex-grow" type="text" value="{{options.recherche.text}}" name="recherche"
<input class="cherchercompetence" type="text" value="{{options.cherchercompetence}}" name="cherchercompetence" size="8" data-dtype="String" placeholder="chercher"/>
size="8" data-dtype="String" placeholder="chercher"/>
<span></span>
</span> </span>
<span><a class="show-hide-competences"><img class="small-button-container" <span><a class="show-hide-competences"><img class="small-button-container"
src="systems/foundryvtt-reve-de-dragon/icons/{{#if options.showCompNiveauBase}}no-filter.svg{{else}}filter.svg{{/if}}" alt="filter/montrer tout"> src="systems/foundryvtt-reve-de-dragon/icons/{{#if options.showCompNiveauBase}}no-filter.svg{{else}}filter.svg{{/if}}" alt="filter/montrer tout">
@@ -232,25 +230,25 @@
</div> </div>
<div class="grid grid-2col"> <div class="grid grid-2col">
<div class="flex-group-left flexcol competence-column"> <div class="flex-group-left flexcol competence-column">
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(sortCompetence competenceByCategory.generale) categorie="Compétences générales"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(filtreTriCompetences competenceByCategory.generale) categorie="Compétences générales"}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(sortCompetence competenceByCategory.particuliere) categorie="Compétences Particulières"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(filtreTriCompetences competenceByCategory.particuliere) categorie="Compétences Particulières"}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(sortCompetence competenceByCategory.specialisee) categorie="Compétences Spécialisées"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(filtreTriCompetences competenceByCategory.specialisee) categorie="Compétences Spécialisées"}}
</div> </div>
<div class="flex-group-left flexcol competence-column"> <div class="flex-group-left flexcol competence-column">
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(sortCompetence competenceByCategory.melee) categorie="Compétences de Mêlée"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(filtreTriCompetences competenceByCategory.melee) categorie="Compétences de Mêlée"}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(sortCompetence competenceByCategory.tir) categorie="Compétences de Tir"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(filtreTriCompetences competenceByCategory.tir) categorie="Compétences de Tir"}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(sortCompetence competenceByCategory.lancer) categorie="Compétences de Lancer"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(filtreTriCompetences competenceByCategory.lancer) categorie="Compétences de Lancer"}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(sortCompetence competenceByCategory.connaissance) categorie="Connaissances"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(filtreTriCompetences competenceByCategory.connaissance) categorie="Connaissances"}}
{{#if (or data.attributs.hautrevant.value options.vueDetaillee)}} {{#if (or system.attributs.hautrevant.value options.vueDetaillee)}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(sortCompetence competenceByCategory.draconic) categorie="Draconic"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(filtreTriCompetences competenceByCategory.draconic) categorie="Draconic"}}
{{/if}} {{/if}}
<div> <div>
<ul class="item-list"> <ul class="item-list">
<li class="item flexrow"> <li class="item flexrow">
<span class="generic-label">Stress transformé</span> <span class="generic-label">Stress transformé</span>
<input class="compteur-edit" type="text" name="experience" value="{{data.compteurs.experience.value}}" data-dtype="number" size="3"/> <input class="compteur-edit" type="text" name="experience" value="{{system.compteurs.experience.value}}" data-dtype="number" size="3"/>
</li> </li>
<li class="item flexrow"> <li class="item flexrow">
@@ -286,7 +284,7 @@
</li> </li>
{{#each combat as |arme key|}} {{#each combat as |arme key|}}
<li class="item flexrow list-item" data-item-id="{{arme._id}}" <li class="item flexrow list-item" data-item-id="{{arme._id}}"
data-arme-name="{{arme.name}}" data-competence-name="{{arme.data.competence}}" > data-arme-name="{{arme.name}}" data-competence-name="{{arme.system.competence}}" >
<span class="arme-label"> <span class="arme-label">
<a> <a>
{{#if arme.img}} {{#if arme.img}}
@@ -295,24 +293,23 @@
<span>{{arme.name}}</span> <span>{{arme.name}}</span>
</a> </a>
</span> </span>
<span class="arme-initiative"><a>{{arme.data.initiative}}</a></span> <span class="arme-initiative"><a>{{arme.system.initiative}}</a></span>
<span class="competence-label">{{arme.data.competence}}</span> <span class="competence-label">{{arme.system.competence}}</span>
<span class="competence-value">{{numberFormat arme.data.niveau decimals=0 sign=true}}</span> <span class="competence-value">{{numberFormat arme.system.niveau decimals=0 sign=true}}</span>
<span class="competence-value">{{numberFormat arme.data.dommagesReels decimals=0 sign=true}}</span> <span class="competence-value">{{numberFormat arme.system.dommagesReels decimals=0 sign=true}}</span>
</li> </li>
{{/each}} {{/each}}
{{#each esquives as |esq key|}} {{#each esquives as |esq key|}}
<li class="item flexrow list-item"> <li class="item flexrow list-item" data-item-id="{{esq._id}}">
<span class="competence-label"> <span class="competence-label">
<a class="competence-label" name="{{esq.name}}"> <a class="competence-label" name="{{esq.name}}">
<img class="sheet-competence-img" src="{{esq.img}}"/> <img class="sheet-competence-img" src="{{esq.img}}"/>
<span>{{esq.name}}</span> <span>{{esq.name}}</span>
{{log esq}}
</a> </a>
</span> </span>
<span class="arme-initiative"></span> <span class="arme-initiative"></span>
<span class="competence-label"></span> <span class="competence-label"></span>
<span class="competence-value">{{numberFormat esq.data.niveau decimals=0 sign=true}}</span> <span class="competence-value">{{numberFormat esq.system.niveau decimals=0 sign=true}}</span>
<span class="competence-value"></span> <span class="competence-value"></span>
</li> </li>
{{/each}} {{/each}}
@@ -322,6 +319,7 @@
{{!-- Liste de blessures --}} {{!-- Liste de blessures --}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-liste-blessures-partial.html" this}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-liste-blessures-partial.html" this}}
{{#if maladiesPoisons.length}}
{{!-- Maladies & Poison --}} {{!-- Maladies & Poison --}}
<h3 class="blessures-title">Maladies & Poisons:</h3> <h3 class="blessures-title">Maladies & Poisons:</h3>
<ul class="item-list alterne-list"> <ul class="item-list alterne-list">
@@ -334,7 +332,7 @@
{{#each maladiesPoisons as |maladie key|}} {{#each maladiesPoisons as |maladie key|}}
<li class="item flexrow list-item" data-item-id="{{maladie._id}}"> <li class="item flexrow list-item" data-item-id="{{maladie._id}}">
<span class="competence-label"> <span class="competence-label">
{{#if (or @root.options.isGM maladie.data.identifie)}} {{#if (or @root.options.isGM maladie.system.identifie)}}
{{maladie.name}} {{maladie.name}}
{{else}} {{else}}
Inconnue Inconnue
@@ -342,41 +340,43 @@
</span> </span>
<span class="competence-label">{{maladie.type}}</span> <span class="competence-label">{{maladie.type}}</span>
<span class="competence-label"> <span class="competence-label">
{{#if (or @root.options.isGM maladie.data.remedesconnus)}} {{#if (or @root.options.isGM maladie.system.remedesconnus)}}
{{maladie.data.remedes}} {{maladie.system.remedes}}
{{else}} {{else}}
Remèdes Inconnus Remèdes Inconnus
{{/if}} {{/if}}
</span> </span>
<div class="item-controls"> <div class="item-controls">
<a class="item-control item-edit" title="Modifier"><i class="fas fa-edit"></i></a> <a class="item-edit" title="Modifier"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a> <a class="item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div> </div>
</li> </li>
{{/each}} {{/each}}
</ul> </ul>
{{/if}}
{{!-- Possession --}} {{#if possessions.length}}
<h3 class="blessures-title">Possession:</h3> {{!-- Possession --}}
<ul class="item-list alterne-list"> <h3 class="blessures-title">Possession:</h3>
<li class="competence-header flexrow"> <ul class="item-list alterne-list">
<span class="competence-title flex-grow competence-label">Nom</span> <li class="competence-header flexrow">
<span class="competence-title competence-label">Type</span> <span class="competence-title flex-grow competence-label">Nom</span>
</li> <span class="competence-title competence-label">Type</span>
</li>
{{#each possessions as |possession key|}} {{#each possessions as |possession key|}}
<li class="item flexrow list-item" data-item-id="{{possession._id}}"> <li class="item flexrow list-item" data-item-id="{{possession._id}}">
<span class="competence-label"> <span class="competence-label">
<a class="sheet-possession-attack">{{possession.name}} (Conjurer)</a> <a class="sheet-possession-attack">{{possession.name}} (Conjurer)</a>
</span> </span>
<span class="competence-label">{{possession.data.type}}</span> <span class="competence-label">{{possession.system.type}}</span>
<div class="item-controls"> <div class="item-controls">
<a class="item-control item-edit" title="Modifier"><i class="fas fa-edit"></i></a> <a class="item-edit" title="Modifier"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a> <a class="item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div> </div>
</li> </li>
{{/each}} {{/each}}
</ul> </ul>
{{/if}}
</div> </div>
{{!-- Connaissances Tab --}} {{!-- Connaissances Tab --}}
@@ -385,12 +385,12 @@
<ul class="item-list alterne-list"> <ul class="item-list alterne-list">
{{#each taches as |tache id|}} {{#each taches as |tache id|}}
<li class="item flexrow list-item" data-item-id="{{tache._id}}"><span class="competence-title tache-label"><a>{{tache.name}} <li class="item flexrow list-item" data-item-id="{{tache._id}}"><span class="competence-title tache-label"><a>{{tache.name}}
({{tache.data.points_de_tache_courant}}{{#if ({{tache.system.points_de_tache_courant}}{{#if
(or @root.options.isGM (not tache.data.cacher_points_de_tache)) (or @root.options.isGM (not tache.system.cacher_points_de_tache))
}}/{{tache.data.points_de_tache}}{{/if}})</a></span> }}/{{tache.system.points_de_tache}}{{/if}})</a></span>
<div class="item-controls flex-shrink"> <div class="item-controls flex-shrink">
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a> <a class="item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a> <a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div> </div>
</li> </li>
{{/each}} {{/each}}
@@ -408,7 +408,7 @@
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-oeuvre-partial.html" oeuvre=danse typeOeuvre="Danse" classOeuvre="danse-label"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-oeuvre-partial.html" oeuvre=danse typeOeuvre="Danse" classOeuvre="danse-label"}}
{{/each}} {{/each}}
{{#each oeuvres as |oeuvre id|}} {{#each oeuvres as |oeuvre id|}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-oeuvre-partial.html" oeuvre=oeuvre typeOeuvre=oeuvre.data.competence classOeuvre="oeuvre-label"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-oeuvre-partial.html" oeuvre=oeuvre typeOeuvre=oeuvre.system.competence classOeuvre="oeuvre-label"}}
{{/each}} {{/each}}
{{#each recettescuisine as |recette id|}} {{#each recettescuisine as |recette id|}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-oeuvre-partial.html" oeuvre=recette typeOeuvre="Recette de cuisine" classOeuvre="recettecuisine-label"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-oeuvre-partial.html" oeuvre=recette typeOeuvre="Recette de cuisine" classOeuvre="recettecuisine-label"}}
@@ -417,10 +417,10 @@
<h3>Jeux :</h3> <h3>Jeux :</h3>
<ul class="item-list alterne-list"> <ul class="item-list alterne-list">
{{#each jeux as |jeu id|}} {{#each jeux as |jeu id|}}
<li class="item flexrow list-item" data-item-id="{{jeu._id}}"><span class="competence-title jeu-label"><a>{{jeu.name}} (base {{jeu.data.base}})</a></span> <li class="item flexrow list-item" data-item-id="{{jeu._id}}"><span class="competence-title jeu-label"><a>{{jeu.name}} (base {{jeu.system.base}})</a></span>
<div class="item-controls flex-shrink"> <div class="item-controls flex-shrink">
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a> <a class="item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a> <a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div> </div>
</li> </li>
{{/each}} {{/each}}
@@ -430,8 +430,8 @@
{{#each recettesAlchimiques as |recette id|}} {{#each recettesAlchimiques as |recette id|}}
<li class="item flexrow list-item" data-item-id="{{recette._id}}"><span class="competence-title recette-label item-edit"><a>{{recette.name}}</a></span> <li class="item flexrow list-item" data-item-id="{{recette._id}}"><span class="competence-title recette-label item-edit"><a>{{recette.name}}</a></span>
<div class="item-controls flex-shrink"> <div class="item-controls flex-shrink">
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a> <a class="item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a> <a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div> </div>
</li> </li>
{{/each}} {{/each}}
@@ -444,13 +444,13 @@
{{!-- hautreve Tab --}} {{!-- hautreve Tab --}}
<div class="tab hautreve " data-group="primary" data-tab="hautreve" style="height:200px"> <div class="tab hautreve " data-group="primary" data-tab="hautreve" style="height:200px">
<div> <div>
{{#if data.attributs.hautrevant.value}} {{#if system.attributs.hautrevant.value}}
<h3>Haut rêvant</h3> <h3>Haut rêvant</h3>
{{else}} {{else}}
<h3>Vous n'avez pas le don de haut-rêve! Il faut attribuer la Tête de Dragon 'Don de Haut Rêve' si votre personnage est ou devient Haut-Rêvant.</h3> <h3>Vous n'avez pas le don de haut-rêve! Il faut attribuer la Tête de Dragon 'Don de Haut Rêve' si votre personnage est ou devient Haut-Rêvant.</h3>
{{/if}} {{/if}}
<ul class="item-list"> <ul class="item-list">
{{#if data.attributs.hautrevant.value}} {{#if system.attributs.hautrevant.value}}
{{#if options.isGM}} {{#if options.isGM}}
<li class="item flexrow"> <li class="item flexrow">
<span> <span>
@@ -464,23 +464,23 @@
<li class="item flexrow"> <li class="item flexrow">
{{#if options.isGM}} {{#if options.isGM}}
<span class="competence-label flex-shrink">Demi rêve : <span class="competence-label flex-shrink">Demi rêve :
<span>{{caseTmr-label data.reve.tmrpos.coord}}</span> <span>{{caseTmr-label system.reve.tmrpos.coord}}</span>
</span> </span>
<span> <span>
<input class="competence-value" type="text" name="data.reve.tmrpos.coord" value="{{data.reve.tmrpos.coord}}" data-dtype="String"/> <input class="competence-value" type="text" name="system.reve.tmrpos.coord" value="{{system.reve.tmrpos.coord}}" data-dtype="String"/>
</span> </span>
{{else}} {{else}}
<span class="competence-label flex-shrink">Demi rêve : <span class="competence-label flex-shrink">Demi rêve :
{{#unless hautreve.cacheTMR}} {{#unless hautreve.cacheTMR}}
<span>{{caseTmr-label data.reve.tmrpos.coord}}</span> <span>{{caseTmr-label system.reve.tmrpos.coord}}</span>
{{/unless}} {{/unless}}
</span> </span>
<span> <span>
{{#if hautreve.cacheTMR}} {{#if hautreve.cacheTMR}}
?? ??
{{else}} {{else}}
{{data.reve.tmrpos.coord}} {{system.reve.tmrpos.coord}}
{{/if}} {{/if}}
</span> </span>
{{/if}} {{/if}}
@@ -490,9 +490,9 @@
<span class="competence-label">Seuil de Rêve :</span> <span class="competence-label">Seuil de Rêve :</span>
<span> <span>
{{#if options.isGM}} {{#if options.isGM}}
<input class="seuil-reve-value" type="text" name="data.reve.seuil.value" value="{{data.reve.seuil.value}}" data-dtype="Number"/> <input class="seuil-reve-value" type="text" name="system.reve.seuil.value" value="{{system.reve.seuil.value}}" data-dtype="Number"/>
{{else}} {{else}}
{{data.reve.seuil.value}} {{system.reve.seuil.value}}
{{/if}} {{/if}}
</span> </span>
</li> </li>
@@ -500,147 +500,138 @@
<span class="competence-label">Refoulement : </span> <span class="competence-label">Refoulement : </span>
<span> <span>
{{#if options.isGM}} {{#if options.isGM}}
<input class="competence-value" type="text" name="data.reve.refoulement.value" value="{{data.reve.refoulement.value}}" data-dtype="Number"/> <input class="competence-value" type="text" name="system.reve.refoulement.value" value="{{system.reve.refoulement.value}}" data-dtype="Number"/>
{{else}} {{else}}
{{data.reve.refoulement.value}} {{system.reve.refoulement.value}}
{{/if}} {{/if}}
</span> </span>
</li> </li>
</ul> </ul>
</div> </div>
<hr> <hr>
{{#if data.attributs.hautrevant.value}}
{{#if options.isGM}}
<h3>Signes draconiques</h3>
<ul class="item-list alterne-list">
{{#each signesdraconiques as |signe key|}}
<li class="item list-item flexrow" data-item-id="{{signe._id}}" data-attribute="{{key}}">
<span class="display-label flex-grow"> <a data-item-id="{{signe._id}}">{{signe.name}}</a></span>
<span class="flex-shrink">{{signe.data.difficulte}}</span>
<div class="item-controls flex-shrink">
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
{{/if}}
<h3>Sorts:</h3>
<ul class="item-list alterne-list">
{{#each sorts as |sort key|}}
<li class="item list-item flexrow" data-item-id="{{sort._id}}" data-attribute="{{key}}">
<span class="display-label flex-grow"> <a data-item-id="{{sort._id}}">{{sort.name}}</a></span>
<span>{{sort.data.draconic}} / {{sort.data.difficulte}}</span>
<div class="item-controls flex-shrink">
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
<h3>Sorts en Réserve:</h3>
<ul class="item-list alterne-list">
{{#each hautreve.sortsReserve as |reserve key|}}
<li class="item list-item flexrow" data-item-id="{{reserve._id}}" data-attribute="{{key}}">
<img class="sheet-competence-img" src="{{reserve.sort.img}}" />
<span class="display-label flex-grow">{{reserve.sort.name}}</span>
<span class="flex-shrink">r{{reserve.sort.data.ptreve_reel}}</span>
<span class="flex-shrink">{{reserve.coord}}</span>
<span>{{caseTmr-label reserve.coord}}</span>
<div class="item-controls flex-shrink">
<a class="item-control item-delete flex-shrink" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
<h3>Méditations:</h3>
<ul class="item-list">
{{#each meditations as |meditation key|}}
<li class="item flexrow" data-item-id="{{meditation._id}}" data-attribute="{{key}}">
<span class="meditation-label flex-grow"><a data-item-id="{{meditation._id}}">{{meditation.name}} - {{meditation.data.competence}}</a></span>
<div class="item-controls flex-shrink">
<a class="item-control item-edit" title="Editer"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
<hr>
{{/if}}
{{!-- Queues, Souffles, Tetes, Ombre --}} {{!-- Queues, Souffles, Tetes, Ombre --}}
<h3>Queues:</h3> {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-queues.html"}}
<ul class="flex-group-left"> {{#if souffles.length}}
{{#each queues as |queue key|}}
<li class="item flexrow" data-attribute={{key}} data-item-id="{{queue._id}}">
<span class="display-label flex-grow"><a data-item-id="{{queue._id}}">{{queue.name}}</a></span>
<div class="item-controls flex-shrink">
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
<h3>Souffles:</h3> <h3>Souffles:</h3>
<ul class="item-list"> <ul class="item-list">
{{#each souffles as |souffle key|}} {{#each souffles as |souffle key|}}
<li class="item flexrow" data-attribute={{key}} data-item-id="{{souffle._id}}"> <li class="item flexrow" data-attribute={{key}} data-item-id="{{souffle._id}}">
<span class="display-label flex-grow"><a data-item-id="{{souffle._id}}">{{souffle.name}}</a></span> <span class="display-label flex-grow"><a data-item-id="{{souffle._id}}">{{souffle.name}}</a></span>
<div class="item-controls flex-shrink"> <div class="item-controls flex-shrink">
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a> <a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div> </div>
</li> </li>
{{/each}} {{/each}}
</ul> </ul>
{{/if}}
{{#if tetes.length}}
<h3>Tetes:</h3> <h3>Tetes:</h3>
<ul class="item-list"> <ul class="item-list">
{{#each tetes as |tete key|}} {{#each tetes as |tete key|}}
<li class="item flexrow" data-attribute={{key}} data-item-id="{{tete._id}}"> <li class="item flexrow" data-attribute={{key}} data-item-id="{{tete._id}}">
<span class="display-label flex-grow"><a data-item-id="{{tete._id}}">{{tete.name}}</a></span> <span class="display-label flex-grow"><a data-item-id="{{tete._id}}">{{tete.name}}</a></span>
<div class="item-controls flex-shrink"> <div class="item-controls flex-shrink">
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a> <a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div> </div>
</li> </li>
{{/each}} {{/each}}
</ul> </ul>
<h3>Ombres de Thanatos:</h3> {{/if}}
<ul class="item-list"> {{#if system.attributs.hautrevant.value}}
{{#each ombres as |ombre key|}} {{#if (and options.isGM signesdraconiques.length)}}
<li class="item flexrow" data-attribute={{key}} data-item-id="{{ombre._id}}"> <h3>Signes draconiques</h3>
<span class="display-label flex-grow"><a data-item-id="{{ombre._id}}">{{ombre.name}}</a></span> <ul class="item-list alterne-list">
<div class="item-controls flex-shrink"> {{#each signesdraconiques as |signe key|}}
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a> <li class="item list-item flexrow" data-item-id="{{signe._id}}" data-attribute="{{key}}">
</div> <span class="display-label flex-grow"> <a data-item-id="{{signe._id}}">{{signe.name}}</a></span>
</li> <span class="flex-shrink">{{signe.system.difficulte}}</span>
{{/each}} <div class="item-controls flex-shrink">
</ul> <a class="item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
{{#if data.attributs.hautrevant.value}} </div>
</li>
{{/each}}
</ul>
{{/if}}
{{#if hautreve.rencontres.length}}
<h3>Rencontres présentes:</h3>
<ul class="item-list">
{{#each hautreve.rencontres as |rencontre key|}}
<li class="item flexrow" data-item-id="{{key}}" data-attribute="{{key}}">
<span class="display-label"><a data-item-id="{{key}}">{{rencontre.name}} r{{rencontre.force}}</a></span>
<span class="flex-shrink">{{rencontre.coord}} - {{caseTmr-label rencontre.coord}}</span>
{{#if rencontre.date}}
<span>{{upperFirst rencontre.heure}}, le {{rencontre.date}}</span>
{{/if}}
<div class="item-controls flex-shrink">
<a class="rencontre-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
{{/if}}
{{#if hautreve.sortsReserve.length}}
<h3>Sorts en Réserve:</h3>
<ul class="item-list alterne-list">
{{#each hautreve.sortsReserve as |reserve key|}}
<li class="item list-item flexrow" data-index="{{key}}">
<img class="sheet-competence-img" src="{{reserve.sort.img}}" />
<span class="display-label">{{reserve.sort.name}} r{{reserve.sort.system.ptreve_reel}}</span>
<span>{{reserve.coord}} - {{caseTmr-label reserve.coord}}</span>
<div class="item-controls flex-shrink">
<a class="sort-reserve-delete flex-shrink" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
{{/if}}
<hr>
<h3>Sorts:</h3>
<ul class="item-list alterne-list">
{{#each sorts as |sort key|}}
<li class="item list-item flexrow" data-item-id="{{sort._id}}" data-attribute="{{key}}">
<span class="display-label flex-grow">
<a data-item-id="{{sort._id}}">{{sort.name}}
- {{#if sort.system.caseTMRspeciale}}{{sort.system.caseTMRspeciale}}{{else}}{{upperFirst sort.system.caseTMR}}{{/if}}
</a>
</span>
<span>{{sort.system.draconic}} / {{sort.system.difficulte}}</span>
<div class="item-controls flex-shrink">
<a class="item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
<h3>Méditations:</h3>
<ul class="item-list">
{{#each meditations as |meditation key|}}
<li class="item flexrow" data-item-id="{{meditation._id}}" data-attribute="{{key}}">
<span class="meditation-label flex-grow"><a data-item-id="{{meditation._id}}">{{meditation.name}} - {{meditation.system.competence}}</a></span>
<div class="item-controls flex-shrink">
<a class="item-edit" title="Editer"><i class="fas fa-edit"></i></a>
<a class="item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
<hr> <hr>
<h3>Rencontres présentes:</h3> {{#if hautreve.casesTmr}}
<ul class="item-list"> <h3>Cases Spéciales:</h3>
{{#each hautreve.rencontres as |rencontre key|}} <ul class="item-list">
<li class="item flexrow" data-item-id="{{key}}" data-attribute="{{key}}"> {{#each hautreve.casesTmr as |casetmr key|}}
<span class="display-label"><a data-item-id="{{key}}">{{rencontre.name}} - {{rencontre.coord}}</a></span> <li class="item flexrow" data-item-id="{{casetmr._id}}" data-attribute="{{key}}">
<span class="flex-shrink">{{caseTmr-label rencontre.coord}}</span> <span class="display-label"><a data-item-id="{{casetmr._id}}">{{casetmr.name}}</a></span>
{{#if rencontre.date}} <span>{{casetmr.system.coord}} - {{caseTmr-label casetmr.system.coord}}</span>
<span>Le {{rencontre.date}} à {{rencontre.heure}}</span> <div class="item-controls flex-shrink">
{{/if}} <a class="item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
<div class="item-controls flex-shrink"> </div>
<a class="item-control rencontre-delete" title="Supprimer"><i class="fas fa-trash"></i></a> </li>
</div> {{/each}}
</li> </ul>
{{/each}} {{/if}}
</ul>
<hr>
<h3>Cases Spéciales:</h3>
<ul class="item-list">
{{#each hautreve.casesTmr as |casetmr key|}}
<li class="item flexrow" data-item-id="{{casetmr._id}}" data-attribute="{{key}}">
<span class="display-label"><a data-item-id="{{casetmr._id}}">{{casetmr.name}}</a></span>
<div class="item-controls flex-shrink">
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
<br><br> <br><br>
{{/if}} {{/if}}
</div> </div>
@@ -648,79 +639,10 @@
{{!-- Equipment Tab --}} {{!-- Equipment Tab --}}
<div class="tab items" data-group="primary" data-tab="items"> <div class="tab items" data-group="primary" data-tab="items">
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-inventaire-monnaie.html" monnaie=monnaie}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-inventaire.html"}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-liens-animaux.html"}}
<span class="item-name"><h4>Equipement porté</h4></span> {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-liens-suivants.html"}}
<div> {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-liens-vehicules.html"}}
<span class="item-name">Encombrement total/max : {{numberFormat calc.encTotal decimals=2}} / {{data.attributs.encombrement.value}} <b>{{calc.surEncombrementMessage}}</b></span> -
<span class="item-name">Estimation de l'équipement : {{numberFormat calc.prixTotalEquipement decimals=2}} Sols</span>
</div>
<div>
<span class="item-name"><a class="creer-un-objet">Créer un objet</a></span>
{{#if options.isGM}}
<span class="item-name"> - <a id="nettoyer-conteneurs">Vider tout les conteneurs</a></span>
{{/if}}
</div>
<ul class="item-list alterne-list">
<li class="competence-header flexrow">
<img class="sheet-competence-img" src="{{img}}" title="Equipement"/>
<span class="competence-title flex-grow">Nom</span>
<span class="competence-title">Q.</span>
<span class="competence-title">Enc.</span>
<span class="competence-title flex-grow">Equiper/Editer/Suppr.</span>
</li>
{{#each objets as |item id|}}
{{#unless item.estContenu}}
{{#if (ne item.type 'conteneur')}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-inventaire-conteneur.html" item=item }}
{{/if}}
{{/unless}}
{{/each}}
{{#each conteneurs as |conteneur id|}}
{{buildConteneur this}}
{{/each}}
</ul>
<span class="item-name"><h4>Compagnons animaux</h4></span>
<ul class="item-list alterne-list">
{{#each subacteurs.montures as |monture id|}}
<li class="item flexrow list-item" data-actor-id="{{monture.id}}">
<img class="sheet-competence-img" src="{{monture.img}}" title="{{monture.name}}"/>
<span class="competence-title subacteur-label"><a>{{monture.name}}</a></span>
<div class="item-controls flex-shrink">
<a class="item-control subacteur-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
<span class="item-name"><h4>Véhicules</h4></span>
<ul class="item-list alterne-list">
{{#each subacteurs.vehicules as |vehicule id|}}
<li class="item flexrow list-item" data-actor-id="{{vehicule.id}}">
<img class="sheet-competence-img" src="{{vehicule.img}}" title="{{vehicule.name}}"/>
<span class="competence-title subacteur-label"><a>{{vehicule.name}}</a></span>
<span class="competence-title">{{vehicule.categorie}}</span>
<span class="competence-title">{{vehicule.structure}}</span>
<div class="item-controls flex-shrink">
<a class="item-control subacteur-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
<span class="item-name"><h4>Suivants</h4></span>
<ul class="item-list alterne-list">
{{#each subacteurs.suivants as |suivant id|}}
<li class="item flexrow list-item" data-actor-id="{{suivant.id}}">
<img class="sheet-competence-img" src="{{suivant.img}}" title="{{suivant.name}}"/>
<span class="competence-title subacteur-label"><a>{{suivant.name}}</a></span>
<div class="item-controls flex-shrink">
<a class="item-control subacteur-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
</div> </div>
@@ -729,50 +651,50 @@
<article class="flexrow"> <article class="flexrow">
<ul class="item-list alterne-list"> <ul class="item-list alterne-list">
<li class="item flexrow list-item"> <li class="item flexrow list-item">
<label for="data.race">Race :</label> <label for="system.race">Race :</label>
<input class="flex-grow" type="text" name="data.race" value="{{data.race}}" data-dtype="String"/> <input class="flex-grow" type="text" name="system.race" value="{{system.race}}" data-dtype="String"/>
</li> </li>
<li class="item flexrow list-item"> <li class="item flexrow list-item">
<label for="data.sexe">Sexe :</label> <label for="system.sexe">Sexe :</label>
<input class="flex-grow" type="text" name="data.sexe" value="{{data.sexe}}" data-dtype="String"/> <input class="flex-grow" type="text" name="system.sexe" value="{{system.sexe}}" data-dtype="String"/>
</li> </li>
<li class="item flexrow list-item"> <li class="item flexrow list-item">
<label for="data.age">Age :</label> <label for="system.age">Age :</label>
<input class="flex-grow" type="text" name="data.age" value="{{data.age}}" data-dtype="String"/> <input class="flex-grow" type="text" name="system.age" value="{{system.age}}" data-dtype="String"/>
</li> </li>
<li class="item flexrow list-item"> <li class="item flexrow list-item">
<label for="data.poids">Poids :</label> <label for="system.poids">Poids :</label>
<input class="flex-grow" type="text" name="data.poids" value="{{data.poids}}" data-dtype="String"/> <input class="flex-grow" type="text" name="system.poids" value="{{system.poids}}" data-dtype="String"/>
</li> </li>
<li class="item flexrow list-item"> <li class="item flexrow list-item">
<label for="data.taille">Taille :</label> <label for="system.taille">Taille :</label>
<input class="flex-grow" type="text" name="data.taille" value="{{data.taille}}" data-dtype="String"/> <input class="flex-grow" type="text" name="system.taille" value="{{system.taille}}" data-dtype="String"/>
</li> </li>
</ul> </ul>
<ul class="item-list alterne-list"> <ul class="item-list alterne-list">
<li class="item flexrow list-item"> <li class="item flexrow list-item">
<label for="data.main">Main directrice :</label> <label for="system.main">Main directrice :</label>
<input type="text" name="data.main" value="{{data.main}}" data-dtype="String"/> <input type="text" name="system.main" value="{{system.main}}" data-dtype="String"/>
</li> </li>
<li class="item flexrow list-item"> <li class="item flexrow list-item">
<label for="data.heure">Heure de naissance :</label> <label for="system.heure">Heure de naissance :</label>
<select type="text" name="data.heure" value="{{data.heure}}" data-dtype="String"> <select type="text" name="system.heure" value="{{system.heure}}" data-dtype="String">
{{#select data.heure}} {{#select system.heure}}
{{>"systems/foundryvtt-reve-de-dragon/templates/heures-select-option.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/heures-select-option.html"}}
{{/select}} {{/select}}
</select> </select>
</li> </li>
<li class="item flexrow list-item"> <li class="item flexrow list-item">
<label>Beauté :</label> <label>Beauté :</label>
<input type="text" value="{{data.beaute}}" data-dtype="String" disabled/> <input type="text" value="{{system.beaute}}" data-dtype="String" disabled/>
</li> </li>
<li class="item flexrow list-item"> <li class="item flexrow list-item">
<label for="data.cheveux">Cheveux :</label> <label for="system.cheveux">Cheveux :</label>
<input class="flex-grow" type="text" name="data.cheveux" value="{{data.cheveux}}" data-dtype="String"/> <input class="flex-grow" type="text" name="system.cheveux" value="{{system.cheveux}}" data-dtype="String"/>
</li> </li>
<li class="item flexrow list-item"> <li class="item flexrow list-item">
<label for="data.yeux">Yeux :</label> <label for="system.yeux">Yeux :</label>
<input class="flex-grow" type="text" name="data.yeux" value="{{data.yeux}}" data-dtype="String"/> <input class="flex-grow" type="text" name="system.yeux" value="{{system.yeux}}" data-dtype="String"/>
</li> </li>
</ul> </ul>
</article> </article>
@@ -780,16 +702,16 @@
<article class="flexcol"> <article class="flexcol">
<h3>Biographie : </h3> <h3>Biographie : </h3>
<div class="form-group editor"> <div class="form-group editor">
{{editor content=data.biographie target="data.biographie" button=true owner=owner editable=editable}} {{editor system.biographie target="system.biographie" button=true owner=owner editable=editable}}
</div> </div>
<h3>Notes : </h3> <h3>Notes : </h3>
<div class="form-group editor"> <div class="form-group editor">
{{editor content=data.notes target="data.notes" button=true owner=owner editable=editable}} {{editor system.notes target="system.notes" button=true owner=owner editable=editable}}
</div> </div>
<h3>Journal d'Experience</h3> <h3>Journal d'Experience</h3>
<div class="form-group editor"> <div class="form-group editor">
<ul class="item-list alterne-list"> <ul class="item-list alterne-list">
{{#each data.experiencelog as |xp key|}} {{#each system.experiencelog as |xp key|}}
<li class="item flexrow list-item"> <li class="item flexrow list-item">
<label class="flex-shrink">{{xp.mode}} </label> <label class="flex-shrink">{{xp.mode}} </label>
<label class="flex-grow">{{xp.valeur}} {{xp.raison}} </label> <label class="flex-grow">{{xp.valeur}} {{xp.raison}} </label>

View File

@@ -25,41 +25,41 @@
<div class="grid grid-2col"> <div class="grid grid-2col">
<div class="flex-group-left flexcol"> <div class="flex-group-left flexcol">
<ol class="carac-list alterne-list"> <ol class="carac-list alterne-list">
<li class="competence flexrow list-item" data-attribute="{{key}}"> <li class="caracteristique flexrow list-item" data-attribute="{{key}}">
<span class="carac-label flexrow" name="categorie">Catégorie</span> <span class="carac-label flexrow" name="categorie">Catégorie</span>
<select name="data.categorie" class="categorie" data-dtype="String"> <select name="system.categorie" class="categorie" data-dtype="String">
{{#select data.categorie}} {{#select system.categorie}}
{{>"systems/foundryvtt-reve-de-dragon/templates/enum-categorie-vehicule.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/enum-categorie-vehicule.html"}}
{{/select}} {{/select}}
</select> </select>
</li> </li>
<li class="competence flexrow list-item" data-attribute="{{key}}"> <li class="caracteristique flexrow list-item" data-attribute="{{key}}">
<span class="carac-label flexrow" name="categorie">Résistance</span> <span class="carac-label flexrow" name="categorie">Résistance</span>
<input class="competence-value flexrow" type="text" name="data.resistance" value="{{data.resistance}}" data-dtype="Number" /> <input class="competence-value flexrow" type="text" name="system.resistance" value="{{system.resistance}}" data-dtype="Number" />
</li> </li>
<li class="competence flexrow list-item" data-attribute="{{key}}"> <li class="caracteristique flexrow list-item" data-attribute="{{key}}">
<span class="carac-label flexrow" name="categorie">Structure</span> <span class="carac-label flexrow" name="categorie">Structure</span>
<input class="competence-value flexrow" type="text" name="data.structure" value="{{data.structure}}" data-dtype="Number" /> <input class="competence-value flexrow" type="text" name="system.structure" value="{{system.structure}}" data-dtype="Number" />
</li> </li>
<li class="competence flexrow list-item" data-attribute="{{key}}"> <li class="caracteristique flexrow list-item" data-attribute="{{key}}">
<span class="carac-label flexrow" name="categorie">Vitesse</span> <span class="carac-label flexrow" name="categorie">Vitesse</span>
<input class="competence-value flexrow" type="text" name="data.vitesse" value="{{data.vitesse}}" data-dtype="String" /> <input class="competence-value flexrow" type="text" name="system.vitesse" value="{{system.vitesse}}" data-dtype="String" />
</li> </li>
<li class="competence flexrow list-item" data-attribute="{{key}}"> <li class="caracteristique flexrow list-item" data-attribute="{{key}}">
<span class="carac-label flexrow" name="categorie">Bonus</span> <span class="carac-label flexrow" name="categorie">Bonus</span>
<input class="competence-value flexrow" type="text" name="data.bonus" value="{{data.bonus}}" data-dtype="String" /> <input class="competence-value flexrow" type="text" name="system.bonus" value="{{system.bonus}}" data-dtype="String" />
</li> </li>
<li class="competence flexrow list-item" data-attribute="{{key}}"> <li class="caracteristique flexrow list-item" data-attribute="{{key}}">
<span class="carac-label flexrow" name="categorie">Manoeuvrabilité</span> <span class="carac-label flexrow" name="categorie">Manoeuvrabilité</span>
<input class="competence-value flexrow" type="text" name="data.manoeuvrabilite" value="{{data.manoeuvrabilite}}" data-dtype="String" /> <input class="competence-value flexrow" type="text" name="system.manoeuvrabilite" value="{{system.manoeuvrabilite}}" data-dtype="String" />
</li> </li>
<li class="competence flexrow list-item" data-attribute="{{key}}"> <li class="caracteristique flexrow list-item" data-attribute="{{key}}">
<span class="carac-label flexrow" name="categorie">Equipage</span> <span class="carac-label flexrow" name="categorie">Equipage</span>
<input class="competence-value flexrow" type="text" name="data.equipage" value="{{data.equipage}}" data-dtype="Number" /> <input class="competence-value flexrow" type="text" name="system.equipage" value="{{system.equipage}}" data-dtype="Number" />
</li> </li>
<li class="competence flexrow list-item" data-attribute="{{key}}"> <li class="caracteristique flexrow list-item" data-attribute="{{key}}">
<span class="carac-label flexrow" name="categorie">Capacité d'Encombrement</span> <span class="carac-label flexrow" name="categorie">Capacité d'Encombrement</span>
<input class="competence-value flexrow" type="text" name="data.capacite_encombrement" value="{{data.capacite_encombrement}}" data-dtype="Number" /> <input class="competence-value flexrow" type="text" name="system.capacite_encombrement" value="{{system.capacite_encombrement}}" data-dtype="Number" />
</li> </li>
</ol> </ol>
</div> </div>
@@ -69,51 +69,13 @@
{{!-- Equipment Tab --}} {{!-- Equipment Tab --}}
<div class="tab items" data-group="primary" data-tab="items"> <div class="tab items" data-group="primary" data-tab="items">
{{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-inventaire-monnaie.html" monnaie=monnaie}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-inventaire.html"}}
<span class="item-name"><h4>Equipement chargé</h4></span>
<span class="item-name">Encombrement total/max : {{numberFormat calc.encTotal decimals=2}} / {{data.capacite_encombrement}} <b>{{calc.surEncombrementMessage}}</b></span> -
<span class="item-name"><a class="creer-un-objet">Créer un objet</a></span>
{{#if options.isGM}}
<span class="item-name"> - <a id="nettoyer-conteneurs">Vider tout les conteneurs</a></span>
{{/if}}
<ul class="item-list alterne-list">
<li class="competence-header flexrow">
<img class="sheet-competence-img" src="{{img}}" title="Equipement"/>
<span class="competence-title competence-label flex-grow">Nom</span>
<span class="competence-title competence-label">Q.</span>
<span class="competence-title competence-value">Enc.</span>
<span class="competence-title competence-value">Equiper/Editer/Suppr.</span>
</li>
{{#each objets as |item id|}}
{{#unless item.estContenu}}
{{#if (ne item.type 'conteneur')}}
<li class="item flexrow list-item" data-item-id="{{item._id}}">
<img class="sheet-competence-img" src="{{item.img}}" title="{{item.name}}"/>
<span class="item-name flex-grow">{{item.name}}</span>
<span class="item-quantite">{{item.data.quantite}}</span>
<span class="item-quantite">{{numberFormat item.data.encTotal decimals=2}}</span>
<div class="item-controls">
<a class="item-control item-equip" title="Equiper">{{#if item.data.equipe}}<i class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
<a class="item-control item-edit" title="Editer"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/if}}
{{/unless}}
{{/each}}
{{#each conteneurs as |conteneur id|}}
{{buildConteneur this}}
{{/each}}
</ul>
</div>
{{!-- Biography Tab --}} {{!-- Biography Tab --}}
<div class="tab description" data-group="primary" data-tab="description"> <div class="tab description" data-group="primary" data-tab="description">
<div class="form-group editor"> <div class="form-group editor">
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}} {{editor content=system.description target="system.description" button=true owner=owner editable=editable}}
</div> </div>
{{>"systems/foundryvtt-reve-de-dragon/templates/actor-sheet-editor-notes-mj.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/actor-sheet-editor-notes-mj.html"}}
</div> </div>

View File

@@ -6,4 +6,4 @@
{{#if vendeur}}à {{vendeur.name}}{{/if}}: {{#if vendeur}}à {{vendeur.name}}{{/if}}:
{{quantiteTotal}} {{item.name}} pour {{prixTotal}} sols. {{quantiteTotal}} {{item.name}} pour {{prixTotal}} sols.
</p> </p>
{{> "systems/foundryvtt-reve-de-dragon/templates/chat-description.html" item.data}} {{> "systems/foundryvtt-reve-de-dragon/templates/chat-description.html" item.system}}

View File

@@ -0,0 +1,16 @@
<h4>Proposition de nom: {{nom}}</h4>
<span class="chat-card-button-area">
<a class="button-creer-acteur chat-card-button"
data-nom='{{nom}}'
data-type='personnage'
>
Créer un Personnage</a>
</span>
<span class="chat-card-button-area">
<a class="button-creer-acteur chat-card-button"
data-nom='{{nom}}'
data-type='creature'>
Créer une créature</a>
</span>

View File

@@ -1,16 +1,16 @@
<img class="chat-icon" src="{{img}}" alt="potion de repos" /> <img class="chat-icon" src="{{img}}" alt="potion de repos" />
<h4> <h4>
{{alias}} a bu une <strong>{{name}}{{#if data.magique}} enchantée{{/if}}</strong> {{alias}} a bu une <strong>{{name}}{{#if system.magique}} enchantée{{/if}}</strong>
</h4> </h4>
<hr> <hr>
<div> <div>
{{#if data.magique}} {{#if system.magique}}
Le Jet de Résistance est {{#if rolled.isSuccess}}réussi{{else}}échoué{{/if}}. Le Jet de Résistance est {{#if rolled.isSuccess}}réussi{{else}}échoué{{/if}}.
{{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.html"}} {{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.html"}}
{{/if}} {{/if}}
<br>Les effets de la potions sont à gérer manuellement, en fonction de sa nature <br>Les effets de la potions sont à gérer manuellement, en fonction de sa nature
{{#if data.magique}} {{#if system.magique}}
{{#if rolled.isEchec}}et de son enchantement ({{data.pr}} Points de Rêve) {{#if rolled.isEchec}}et de son enchantement ({{system.pr}} Points de Rêve)
{{else}}son enchantement n'a pas d'effet {{else}}son enchantement n'a pas d'effet
{{/if}} {{/if}}
{{/if}}. {{/if}}.

View File

@@ -1,27 +1,27 @@
<img class="chat-icon" src="{{img}}" alt="potion de repos" /> <img class="chat-icon" src="{{img}}" alt="potion de repos" />
<h4> <h4>
{{alias}} a bu une <strong>{{name}}{{#if data.magique}} enchantée{{/if}}</strong> {{alias}} a bu une <strong>{{name}}{{#if system.magique}} enchantée{{/if}}</strong>
</h4> </h4>
<hr> <hr>
<div> <div>
{{#if data.magique}} {{#if system.magique}}
Le Jet de Résistance est {{#if rolled.isSuccess}}réussi{{else}}échoué{{/if}}. Le Jet de Résistance est {{#if rolled.isSuccess}}réussi{{else}}échoué{{/if}}.
{{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.html"}} {{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.html"}}
{{#if rolled.isEchec}} {{#if rolled.isEchec}}
<br>La potion fait effet ! <br>La potion fait effet !
{{alias}} a perdu 1 point de rêve et s'endort pour {{guerisonDureeValue}} {{guerisonDureeUnite}} et {{alias}} a perdu 1 point de rêve et s'endort pour {{guerisonDureeValue}} {{guerisonDureeUnite}} et
se récupère {{caseFatigueReel}} cases de fatigue.<br> se récupère {{caseFatigueReel}} cases de fatigue.<br>
{{#if data.reposalchimique}} {{#if system.reposalchimique}}
De plus, la potion étant alchimique, {{alias}} est en aphasie pendant cette durée. De plus, la potion étant alchimique, {{alias}} est en aphasie pendant cette durée.
{{#if aphasiePermanente}} {{#if aphasiePermanente}}
Malheureusement, l'aphasie est permanente tant que {{alias}} ne réussit pas un jet de VOLONTE à 0 à Chateau Dormant (le moral compte). Malheureusement, l'aphasie est permanente tant que {{alias}} ne réussit pas un jet de VOLONTE à 0 à Chateau Dormant (le moral compte).
{{/if}} {{/if}}
{{/if}} {{/if}}
{{else}} {{else}}
<br>La potion ne fait pas effet ! Elle vous octroie tout de même un bonus de {{data.herbebonus}} segments de fatigue récupérés en plus à la fin de Chateau Dormant (à gérer manuellement). <br>La potion ne fait pas effet ! Elle vous octroie tout de même un bonus de {{system.herbebonus}} segments de fatigue récupérés en plus à la fin de Chateau Dormant (à gérer manuellement).
{{/if}} {{/if}}
{{else}} {{else}}
Une fois consommée (vers fin Lyre), elle vous octroie un bonus de {{data.herbebonus}} segments de fatigue récupérés en plus à la fin de Chateau Dormant (à gérer manuellement). Une fois consommée (vers fin Lyre), elle vous octroie un bonus de {{system.herbebonus}} segments de fatigue récupérés en plus à la fin de Chateau Dormant (à gérer manuellement).
{{/if}} {{/if}}
<br>La potion a été supprimée de l'équipement. <br>La potion a été supprimée de l'équipement.
</div> </div>

View File

@@ -1,10 +1,10 @@
<img class="chat-icon" src="{{img}}" alt="potion de soin" /> <img class="chat-icon" src="{{img}}" alt="potion de soin" />
<h4> <h4>
{{alias}} a bu une <strong>{{name}}{{#if data.magique}} enchantée{{/if}}</strong> {{alias}} a bu une <strong>{{name}}{{#if system.magique}} enchantée{{/if}}</strong>
</h4> </h4>
<hr> <hr>
<div> <div>
{{#if data.magique}} {{#if system.magique}}
Le Jet de Résistance est {{#if rolled.isSuccess}}réussi{{else}}échoué{{/if}}. Le Jet de Résistance est {{#if rolled.isSuccess}}réussi{{else}}échoué{{/if}}.
{{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.html"}} {{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.html"}}
{{#if rolled.isEchec}} {{#if rolled.isEchec}}
@@ -16,10 +16,10 @@
{{/each}} {{/each}}
</ul> </ul>
{{else}} {{else}}
<br>La potion ne fait pas effet ! Lors de votre prochain jet de récupération à Chateau Dormant, vous bénéficierez d'un bonus de {{data.herbebonus}} (appliqué automatiquement). <br>La potion ne fait pas effet ! Lors de votre prochain jet de récupération à Chateau Dormant, vous bénéficierez d'un bonus de {{system.herbebonus}} (appliqué automatiquement).
{{/if}} {{/if}}
{{else}} {{else}}
Lors de votre prochain jet de récupération à Chateau Dormant, vous bénéficierez d'un bonus de {{data.herbebonus}} (appliqué automatiquement). Lors de votre prochain jet de récupération à Chateau Dormant, vous bénéficierez d'un bonus de {{system.herbebonus}} (appliqué automatiquement).
{{/if}} {{/if}}
<br>La potion a été supprimée de l'équipement. <br>La potion a été supprimée de l'équipement.
</div> </div>

View File

@@ -8,7 +8,7 @@
</a> </a>
<br> <br>
{{/unless}} {{/unless}}
{{#if (gt attacker.data.compteurs.destinee.value 0)}} {{#if (gt attacker.system.compteurs.destinee.value 0)}}
<a class='chat-card-button' id='appel-destinee-attaque' data-attackerId='{{attackerId}}' <a class='chat-card-button' id='appel-destinee-attaque' data-attackerId='{{attackerId}}'
data-defenderTokenId='{{defenderTokenId}}'>Utiliser la destinée</a> data-defenderTokenId='{{defenderTokenId}}'>Utiliser la destinée</a>
</a> </a>

View File

@@ -26,7 +26,7 @@
<br> <br>
{{/if}} {{/if}}
{{#if (eq defender.type 'personnage')}} {{#if (eq defender.type 'personnage')}}
{{#if (gt defender.data.compteurs.destinee.value 0)}} {{#if (gt defender.system.compteurs.destinee.value 0)}}
<a class='chat-card-button' id='appel-destinee-defense' data-attackerId='{{attackerId}}' <a class='chat-card-button' id='appel-destinee-defense' data-attackerId='{{attackerId}}'
data-defenderTokenId='{{defenderTokenId}}'>Utiliser la destinée</a> data-defenderTokenId='{{defenderTokenId}}'>Utiliser la destinée</a>
</a> </a>
@@ -38,14 +38,14 @@
{{#each armes as |arme key|}} {{#each armes as |arme key|}}
<a class='chat-card-button' id='parer-button' data-attackerId='{{../attackerId}}' data-defenderTokenId='{{../defenderTokenId}}' <a class='chat-card-button' id='parer-button' data-attackerId='{{../attackerId}}' data-defenderTokenId='{{../defenderTokenId}}'
data-armeid='{{arme._id}}'> data-armeid='{{arme._id}}'>
Parer avec {{arme.name}} à {{../diffLibre }}{{#if arme.data.nbUsage}} (Utilisations : {{arme.data.nbUsage}}){{/if}} Parer avec {{arme.name}} à {{../diffLibre }}{{#if arme.system.nbUsage}} (Utilisations : {{arme.system.nbUsage}}){{/if}}
</a> </a>
<br> <br>
{{/each}} {{/each}}
{{#if mainsNues}} {{#if mainsNues}}
<a class='chat-card-button' id='parer-button' data-attackerId='{{attackerId}}' data-defenderTokenId='{{defenderTokenId}}' <a class='chat-card-button' id='parer-button' data-attackerId='{{attackerId}}' data-defenderTokenId='{{defenderTokenId}}'
data-armeid='{{arme._id}}' data-competence='{{arme.data.competence}}'> data-armeid='{{arme._id}}' data-competence='{{arme.system.competence}}'>
Parer à mains nues à {{diffLibre}}{{#if arme.data.nbUsage}} (Utilisations : {{arme.data.nbUsage}}){{/if}} Parer à mains nues à {{diffLibre}}{{#if arme.system.nbUsage}} (Utilisations : {{arme.system.nbUsage}}){{/if}}
</a> </a>
<br> <br>
{{/if}} {{/if}}

View File

@@ -1,6 +1,6 @@
<img class="chat-icon" src="{{herbe.img}}" alt="fabrication" /> <img class="chat-icon" src="{{herbe.img}}" alt="fabrication" />
<h4> <h4>
{{alias}} a fabriqué une potion de {{herbe.data.categorie}} de {{herbe.name}}, avec {{herbe.nbBrins}} brins. {{alias}} a fabriqué une potion de {{herbe.system.categorie}} de {{herbe.name}}, avec {{herbe.nbBrins}} brins.
</h4> </h4>
<hr> <hr>
<div> <div>

View File

@@ -1,6 +1,6 @@
<img class="chat-icon" src="{{competence.img}}" alt="{{oeuvre.data.competence}}" /> <img class="chat-icon" src="{{competence.img}}" alt="{{oeuvre.system.competence}}" />
<h4> <h4>
{{alias}} tente de chanter : {{oeuvre.name}} (niveau {{oeuvre.data.niveau}}) {{alias}} tente de chanter : {{oeuvre.name}} (niveau {{oeuvre.system.niveau}})
</h4> </h4>
{{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.html"}} {{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.html"}}
<hr> <hr>
@@ -12,4 +12,4 @@
{{/if}} {{/if}}
{{> "systems/foundryvtt-reve-de-dragon/templates/chat-info-appel-au-moral.html"}} {{> "systems/foundryvtt-reve-de-dragon/templates/chat-info-appel-au-moral.html"}}
</div> </div>
{{> "systems/foundryvtt-reve-de-dragon/templates/chat-description.html" oeuvre.data}} {{> "systems/foundryvtt-reve-de-dragon/templates/chat-description.html" oeuvre.system}}

View File

@@ -1,6 +1,6 @@
<img class="chat-icon" src="{{competence.img}}" alt="{{oeuvre.data.competence}}" /> <img class="chat-icon" src="{{competence.img}}" alt="{{oeuvre.system.competence}}" />
<h4> <h4>
{{alias}} tente de danser : {{oeuvre.name}} (niveau {{oeuvre.data.niveau}}) {{alias}} tente de danser : {{oeuvre.name}} (niveau {{oeuvre.system.niveau}})
</h4> </h4>
{{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.html"}} {{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.html"}}
<hr> <hr>
@@ -12,4 +12,4 @@
{{/if}} {{/if}}
{{> "systems/foundryvtt-reve-de-dragon/templates/chat-info-appel-au-moral.html"}} {{> "systems/foundryvtt-reve-de-dragon/templates/chat-info-appel-au-moral.html"}}
</div> </div>
{{> "systems/foundryvtt-reve-de-dragon/templates/chat-description.html" oeuvre.data}} {{> "systems/foundryvtt-reve-de-dragon/templates/chat-description.html" oeuvre.system}}

View File

@@ -1,4 +1,4 @@
<img class="chat-icon" src="{{competence.img}}" alt="{{oeuvre.data.competence}}" /> <img class="chat-icon" src="{{competence.img}}" alt="{{oeuvre.system.competence}}" />
<h4> <h4>
{{alias}} joue à : {{oeuvre.name}} {{alias}} joue à : {{oeuvre.name}}
</h4> </h4>
@@ -12,4 +12,4 @@
{{/if}} {{/if}}
{{> "systems/foundryvtt-reve-de-dragon/templates/chat-info-appel-au-moral.html"}} {{> "systems/foundryvtt-reve-de-dragon/templates/chat-info-appel-au-moral.html"}}
</div> </div>
{{> "systems/foundryvtt-reve-de-dragon/templates/chat-description.html" oeuvre.data}} {{> "systems/foundryvtt-reve-de-dragon/templates/chat-description.html" oeuvre.system}}

View File

@@ -1,6 +1,11 @@
<img class="chat-icon" src="{{competence.img}}" alt="{{competence.name}}"/> <img class="chat-icon" src="{{competence.img}}" alt="{{competence.name}}"/>
<h4 data-categorie="tmr" data-actor-id="{{actor._id}}"> <h4 data-categorie="tmr" data-actor-id="{{actor._id}}">
{{alias}} tente de {{maitrise.verbe}} {{le tmr.genre}} {{tmr.label}} ({{tmr.coord}}) {{alias}} tente de {{maitrise.verbe}} {{le tmr.genre}}
{{#if isTMRCache}}
{{caseTmr-type tmr.coord}}
{{else}}
{{tmr.label}} ({{tmr.coord}})
{{/if}}
</h4> </h4>
{{#if previous}} {{#if previous}}
{{#with previous}} {{#with previous}}
@@ -11,15 +16,20 @@
{{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.html"}} {{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.html"}}
<hr> <hr>
<span> <span>
{{#if rolled.isSuccess}} {{alias}}
{{alias}} parvient à {{maitrise.verbe}} {{le tmr.genre}} {{tmr.label}} ! {{#if rolled.isSuccess}}parvient à{{else}}échoue à{{/if}}
{{maitrise.verbe}} {{le tmr.genre}}
{{#if isTMRCache}}
{{caseTmr-type tmr.coord}}
{{else}} {{else}}
{{alias}} échoue à {{maitrise.verbe}} {{le tmr.genre}} {{tmr.label}}. {{tmr.label}} ({{tmr.coord}})
{{alias}} <strong>quitte les Terres Médianes</strong> ! {{/if}}!
{{#if souffle}} {{#if rolled.isEchec}}
<br>De plus, son échec total lui fait subir un Souffle de Dragon : {{souffle.name}} {{alias}} <strong>quitte les Terres Médianes</strong> !
{{#if souffle}}
<br>De plus, son échec total lui fait subir un Souffle de Dragon : {{souffle.name}}
{{/if}}
{{/if}} {{/if}}
{{/if}}
</span> </span>
{{#if poesie}} {{#if poesie}}
<hr> <hr>

View File

@@ -6,7 +6,7 @@
<hr> <hr>
<div> <div>
{{#if rolled.isSuccess}} {{#if rolled.isSuccess}}
{{alias}} aperçoit un signe draconique éphémère, qu'il faut aller lire en <strong>{{typeTmr-name meditation.data.tmr}}</strong>. {{alias}} aperçoit un signe draconique éphémère, qu'il faut aller lire en <strong>{{typeTmr-name meditation.system.tmr}}</strong>.
{{else}} {{else}}
La méditation de {{alias}} ne porte pas ses fruits, il ne distingue aucun signe Draconique. La méditation de {{alias}} ne porte pas ses fruits, il ne distingue aucun signe Draconique.
{{/if}} {{/if}}

Some files were not shown because too many files have changed in this diff Show More