From c3a44665c52f8c880a2310aa53733b84ee193a6e Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 4 Oct 2024 00:28:05 +0200 Subject: [PATCH 01/10] Load handlebars dans app-personnage-aleatoire --- module/actor/random/app-personnage-aleatoire.js | 5 +++++ module/rdd-main.js | 2 ++ module/rdd-utility.js | 1 - 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/module/actor/random/app-personnage-aleatoire.js b/module/actor/random/app-personnage-aleatoire.js index 79d01576..47888d69 100644 --- a/module/actor/random/app-personnage-aleatoire.js +++ b/module/actor/random/app-personnage-aleatoire.js @@ -25,6 +25,11 @@ const RANDOM_VALUES = { } export class AppPersonnageAleatoire extends FormApplication { + static preloadHandlebars() { + loadTemplates([ + 'systems/foundryvtt-reve-de-dragon/templates/actor/random/champ-aleatoire.hbs', + ]) + } static get defaultOptions() { return foundry.utils.mergeObject(super.defaultOptions, { diff --git a/module/rdd-main.js b/module/rdd-main.js index ec6c5221..36e090fc 100644 --- a/module/rdd-main.js +++ b/module/rdd-main.js @@ -67,6 +67,7 @@ import { RdDTMRDialog } from "./rdd-tmr-dialog.js" //import { RdDActorExportSheet } from "./actor/actor-export-sheet.js" import { OptionsAvancees } from "./settings/options-avancees.js" import { ExportScriptarium } from "./actor/export-scriptarium/export-scriptarium.js" +import { AppPersonnageAleatoire } from "./actor/random/app-personnage-aleatoire.js" /** * RdD system @@ -119,6 +120,7 @@ export class SystemReveDeDragon { // preload handlebars templates RdDUtility.preloadHandlebarsTemplates() + AppPersonnageAleatoire.preloadHandlebars() /* -------------------------------------------- */ this.initSystemSettings() diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 086c0fff..661d9cf8 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -169,7 +169,6 @@ export class RdDUtility { 'systems/foundryvtt-reve-de-dragon/templates/actor/liens-vehicules.hbs', 'systems/foundryvtt-reve-de-dragon/templates/actor/commerce-inventaire.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/commerce-inventaire-item.html', - 'systems/foundryvtt-reve-de-dragon/templates/actor/random/champ-aleatoire.hbs', //Items 'systems/foundryvtt-reve-de-dragon/templates/scripts/autocomplete-script.hbs', 'systems/foundryvtt-reve-de-dragon/templates/scripts/autocomplete.hbs', From f116003d6f941d7eecd36d53aaac1f979604a91c Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 4 Oct 2024 21:08:44 +0200 Subject: [PATCH 02/10] Fix: vente depuis les compendiums/Objets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On peut de nouveau vendre des items sans propriétaire, depuis les compendiums ou depuis l'onglet des Objets --- changelog.md | 3 +++ module/achat-vente/dialog-item-vente.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 66c097cf..8f0d9bc4 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,7 @@ # 12.0 +## 12.0.12 - L'étalage d'Astrobazzarh +- On peut de nouveau vendre des items sans propriétaire, depuis les compendiums ou depuis l'onglet des Objets + ## 12.0.11 - Le scriptorium d'Astrobazzarh - ajout d'un bouton pour générer les éléments de description d'un personnage - ajout du logo en background dans la liste des systèmes Foundry diff --git a/module/achat-vente/dialog-item-vente.js b/module/achat-vente/dialog-item-vente.js index 07b1bad2..edcda255 100644 --- a/module/achat-vente/dialog-item-vente.js +++ b/module/achat-vente/dialog-item-vente.js @@ -9,7 +9,7 @@ export class DialogItemVente extends Dialog { const venteData = { item: item, alias: item.actor?.name ?? game.user.name, - vendeurId: item.actor.id, + vendeurId: item.actor?.id, prixOrigine: item.calculerPrixCommercant(), prixUnitaire: item.calculerPrixCommercant(), prixLot: item.calculerPrixCommercant(), From e91eea532d4c22bd9d0746e89d2fda51ca79f5be Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sat, 5 Oct 2024 00:37:55 +0200 Subject: [PATCH 03/10] Ajout feuille encart MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Feuille de PNJ au format des encarts Scriptarium. Aucune possibilité de jets de dés pour l'instant. --- changelog.md | 3 +- .../export-scriptarium/actor-export-sheet.js | 49 +++++++++ .../export-scriptarium/export-scriptarium.js | 9 +- module/actor/export-scriptarium/mapping.js | 91 ++++++++++++---- module/item-sort.js | 36 ++++-- module/rdd-main.js | 3 +- styles/simple.css | 7 +- .../export-scriptarium/actor-export-sheet.hbs | 103 ++++++++++++++++++ templates/actor/export-scriptarium/arme.hbs | 15 +++ .../export-scriptarium/carac-derivee.hbs | 1 + templates/actor/export-scriptarium/carac.hbs | 1 + .../actor/export-scriptarium/esquive.hbs | 10 ++ .../actor/export-scriptarium/protection.hbs | 7 ++ templates/actor/export-scriptarium/sort.hbs | 11 ++ 14 files changed, 304 insertions(+), 42 deletions(-) create mode 100644 module/actor/export-scriptarium/actor-export-sheet.js create mode 100644 templates/actor/export-scriptarium/actor-export-sheet.hbs create mode 100644 templates/actor/export-scriptarium/arme.hbs create mode 100644 templates/actor/export-scriptarium/carac-derivee.hbs create mode 100644 templates/actor/export-scriptarium/carac.hbs create mode 100644 templates/actor/export-scriptarium/esquive.hbs create mode 100644 templates/actor/export-scriptarium/protection.hbs create mode 100644 templates/actor/export-scriptarium/sort.hbs diff --git a/changelog.md b/changelog.md index 8f0d9bc4..20967d6b 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,7 @@ # 12.0 ## 12.0.12 - L'étalage d'Astrobazzarh -- On peut de nouveau vendre des items sans propriétaire, depuis les compendiums ou depuis l'onglet des Objets +- Fix: On peut de nouveau vendre des items sans propriétaire, depuis les compendiums ou depuis l'onglet des Objets +- Début de Feuille PNJ au format des encarts Scriptarium ## 12.0.11 - Le scriptorium d'Astrobazzarh - ajout d'un bouton pour générer les éléments de description d'un personnage diff --git a/module/actor/export-scriptarium/actor-export-sheet.js b/module/actor/export-scriptarium/actor-export-sheet.js new file mode 100644 index 00000000..bfe4a8c3 --- /dev/null +++ b/module/actor/export-scriptarium/actor-export-sheet.js @@ -0,0 +1,49 @@ +import { RdDActorSheet } from "../../actor-sheet.js" +import { SYSTEM_RDD } from "../../constants.js"; +import { Misc } from "../../misc.js"; +import { ExportScriptarium } from "./export-scriptarium.js"; +import { Mapping } from "./mapping.js"; + +export class RdDActorExportSheet extends RdDActorSheet { + static async init() { + await loadTemplates([ + "systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs", + "systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs", + "systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac-derivee.hbs", + "systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/esquive.hbs", + "systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/protection.hbs", + "systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs", + ]) + Actors.registerSheet(SYSTEM_RDD, RdDActorExportSheet, { types: ["personnage"], makeDefault: false, label: "Feuille d'encart" }) + } + static get defaultOptions() { + return foundry.utils.mergeObject(RdDActorSheet.defaultOptions, { + template: "systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/actor-export-sheet.hbs", + width: 550, + showCompNiveauBase: false, + vueArchetype: false, + }, { inplace: false }) + } + + constructor(actor, options) { + super(actor, options) + } + + async getData() { + const formData = await super.getData() + const values = Mapping.getAsObject(this.actor); + // Add any structured, precomputed list of data + formData.export = values + return formData + } + + activateListeners(html) { + super.activateListeners(html); + this.html.find('.button-export').click(async event => { + + ExportScriptarium.INSTANCE.exportActors([this.actor], + `${this.actor.uuid}-${this.actor.name}` + ) + }) + } +} diff --git a/module/actor/export-scriptarium/export-scriptarium.js b/module/actor/export-scriptarium/export-scriptarium.js index 42710c70..aea110e7 100644 --- a/module/actor/export-scriptarium/export-scriptarium.js +++ b/module/actor/export-scriptarium/export-scriptarium.js @@ -12,14 +12,13 @@ export class ExportScriptarium { } constructor() { - this.mapping = Mapping.getMapping() Hooks.on("getActorDirectoryFolderContext", (actorDirectory, menus) => { ExportScriptarium.INSTANCE.onActorDirectoryMenu(actorDirectory, menus) }) Hooks.on("getActorDirectoryEntryContext", (actorDirectory, menus) => { ExportScriptarium.INSTANCE.onActorDirectoryMenu(actorDirectory, menus) }) } onActorDirectoryMenu(actorDirectory, menus) { menus.push({ - name: 'Export Personnages', + name: 'Export Personnages ', icon: IMG_SCRIPTARIUM, condition: (target) => game.user.isGM && OptionsAvancees.isUsing(EXPORT_CSV_SCRIPTARIUM) && @@ -59,12 +58,12 @@ export class ExportScriptarium { } getHeaderLine() { - return this.mapping.map(it => it.column) + return Mapping.getColumns() } getActorLine(actor) { - const context = Mapping.prepareContext(actor) - return this.mapping.map(it => it.getter(actor, context)) + const values = Mapping.getValues(actor) + return values .map(it => this.$escapeQuotes(it)) .map(it => it.replaceAll("\n", " ").replaceAll("\r", "")) } diff --git a/module/actor/export-scriptarium/mapping.js b/module/actor/export-scriptarium/mapping.js index 5f8d6237..e0e7a7d7 100644 --- a/module/actor/export-scriptarium/mapping.js +++ b/module/actor/export-scriptarium/mapping.js @@ -6,6 +6,7 @@ import { ITEM_TYPES } from "../../item.js" import { Misc } from "../../misc.js" import { RdDTimestamp } from "../../time/rdd-timestamp.js" import { RdDBonus } from "../../rdd-bonus.js" +import { TMRType } from "../../tmr-utility.js" const CATEGORIES_COMPETENCES = [ @@ -37,11 +38,11 @@ const NIVEAU_BASE = { class ColumnMappingFactory { static createMappingArme(part, i) { - return { column: `arme-${part}-${i}`, getter: (actor, context) => Mapping.getArme(actor, context, part, i) } + return { column: `arme_${part}_${i}`, getter: (actor, context) => Mapping.getArme(actor, context, part, i) } } static createMappingSort(part, i) { - return { column: `sort-${part}-${i}`, getter: (actor, context) => Mapping.getSort(actor, context, part, i) } + return { column: `sort_${part}_${i}`, getter: (actor, context) => Mapping.getSort(actor, context, part, i) } } } @@ -51,40 +52,40 @@ const TABLEAU_ARMES = [...Array(NB_ARMES).keys()] const TABLEAU_SORTS = [...Array(NB_SORTS).keys()] const MAPPING_BASE = [ - { column: "ID", getter: (actor, context) => actor.id }, + { column: "ID", colName: 'ID', getter: (actor, context) => actor.id }, { column: "name", getter: (actor, context) => actor.name }, - { column: "metier", getter: (actor, context) => actor.system.metier }, - // { column: "biographie", getter: (actor, context) => actor.system.biographie }, + { column: "metier", colName: 'Métier', getter: (actor, context) => actor.system.metier }, + { column: "biographie", colName: 'Biographie', getter: (actor, context) => actor.system.biographie }, { column: "taille", getter: (actor, context) => actor.system.carac.taille.value }, { column: "apparence", getter: (actor, context) => actor.system.carac.apparence.value }, { column: "constitution", getter: (actor, context) => actor.system.carac.constitution.value }, { column: "force", getter: (actor, context) => actor.system.carac.force.value }, - { column: "agilite", getter: (actor, context) => actor.system.carac.agilite.value }, - { column: "dexterite", getter: (actor, context) => actor.system.carac.dexterite.value }, + { column: "agilite", colName: 'Agilité', getter: (actor, context) => actor.system.carac.agilite.value }, + { column: "dexterite", colName: 'Dextérité', getter: (actor, context) => actor.system.carac.dexterite.value }, { column: "vue", getter: (actor, context) => actor.system.carac.vue.value }, - { column: "ouie", getter: (actor, context) => actor.system.carac.ouie.value }, - { column: "odoratgout", getter: (actor, context) => actor.system.carac.odoratgout.value }, - { column: "volonte", getter: (actor, context) => actor.system.carac.volonte.value }, + { column: "ouie", colName: 'Ouïe', getter: (actor, context) => actor.system.carac.ouie.value }, + { column: "odoratgout", colName: 'Odo-goût', getter: (actor, context) => actor.system.carac.odoratgout.value }, + { column: "volonte", colName: 'Volonté', getter: (actor, context) => actor.system.carac.volonte.value }, { column: "intellect", getter: (actor, context) => actor.system.carac.intellect.value }, { column: "empathie", getter: (actor, context) => actor.system.carac.empathie.value }, - { column: "reve", getter: (actor, context) => actor.system.carac.reve.value }, + { column: "reve", colName: 'Rêve', getter: (actor, context) => actor.system.carac.reve.value }, { column: "chance", getter: (actor, context) => actor.system.carac.chance.value }, - { column: "melee", getter: (actor, context) => actor.system.carac.melee.value }, + { column: "melee", colName: 'Mêlée', getter: (actor, context) => actor.system.carac.melee.value }, { column: "tir", getter: (actor, context) => actor.system.carac.tir.value }, { column: "lancer", getter: (actor, context) => actor.system.carac.lancer.value }, - { column: "derobee", getter: (actor, context) => actor.system.carac.derobee.value }, + { column: "derobee", colName: 'Dérobée', getter: (actor, context) => actor.system.carac.derobee.value }, { column: "vie", getter: (actor, context) => actor.system.sante.vie.max }, - { column: "plusdom", getter: (actor, context) => actor.system.attributs.plusdom.value }, - { column: "protectionnaturelle", getter: (actor, context) => actor.system.attributs.protection.value }, + { column: "plusdom", colName: '+dom', getter: (actor, context) => actor.system.attributs.plusdom.value }, + { column: "protectionnaturelle", colName: 'Protection naturelle', getter: (actor, context) => actor.system.attributs.protection.value > 0 ? actor.system.attributs.protection.value : '' }, { column: "endurance", getter: (actor, context) => actor.system.sante.endurance.max }, { column: "description", getter: (actor, context) => Mapping.getDescription(actor) }, { column: "armure", getter: (actor, context) => Mapping.getArmure(actor, context) }, { column: "protection", getter: (actor, context) => Mapping.getProtectionArmure(actor, context) }, - { column: "malus-armure", getter: (actor, context) => Mapping.getMalusArmure(actor, context) }, + { column: "malus_armure", getter: (actor, context) => Mapping.getMalusArmure(actor, context) }, { column: "esquive", getter: (actor, context) => Mapping.getEsquive(context) }, - { column: "esquive-armure", getter: (actor, context) => Mapping.getEsquiveArmure(context) }, + { column: "esquive_armure", getter: (actor, context) => Mapping.getEsquiveArmure(context) }, { column: "competences", getter: (actor, context) => Mapping.getCompetences(actor, CATEGORIES_COMPETENCES) }, - { column: "draconic", getter: (actor, context) => Mapping.getCompetences(actor, CATEGORIES_DRACONIC) }, + { column: "draconic", getter: (actor, context) => Mapping.getCompetences(actor, CATEGORIES_DRACONIC) }, ] const MAPPING_ARMES = TABLEAU_ARMES.map(i => ColumnMappingFactory.createMappingArme('name', i)) @@ -104,6 +105,27 @@ export class Mapping { return MAPPING } + static getColumns() { + return MAPPING.map(it => it.column) + } + + static getValues(actor) { + const context = Mapping.prepareContext(actor) + return MAPPING.map(it => it.getter(actor, context)) + } + static getAsObject(actor) { + const context = Mapping.prepareContext(actor) + return Object.fromEntries(MAPPING.map(it => [it.column, { + colName: it.colName ?? it.column, + value: it.getter(actor, context) + }])) + } + + static getValues(actor) { + const context = Mapping.prepareContext(actor) + return MAPPING.map(it => it.getter(actor, context)) + } + static prepareContext(actor) { return { armes: Mapping.prepareArmes(actor), @@ -190,12 +212,16 @@ export class Mapping { } static prepareSorts(actor) { - return actor.itemTypes[ITEM_TYPES.sort].map(it => Mapping.prepareSort(it)) + const codeVoies = Mapping.getCompetencesCategorie(actor, CATEGORIES_DRACONIC) + .map(it => RdDItemSort.getVoieCode(it)) + + return actor.itemTypes[ITEM_TYPES.sort].map(it => Mapping.prepareSort(it, codeVoies)) + .sort(Misc.ascending(it => `${it.voie} : ${it.description}`)) } - static prepareSort(sort) { + static prepareSort(sort, voies) { return { - voie: RdDItemSort.getCodeDraconic(sort), + voie: RdDItemSort.getCodeDraconic(sort, voies), description: Mapping.descriptionSort(sort), bonus: Mapping.bonusCase(sort) } @@ -203,8 +229,18 @@ export class Mapping { static descriptionSort(sort) { const ptSeuil = Array(sort.system.coutseuil).map(it => '*') - const caseTMR = sort.system.caseTMRspeciale.length > 0 ? sort.system.caseTMRspeciale : sort.system.caseTMR - return `${sort.name}${ptSeuil} (${caseTMR}) R${sort.system.difficulte} r${sort.system.ptreve}` + const caseTMR = sort.system.caseTMRspeciale.length > 0 ? Mapping.toVar(sort.system.caseTMRspeciale) : Misc.upperFirst(TMRType[sort.system.caseTMR].name) + const ptreve = Mapping.addSpaceToNonNumeric(sort.system.ptreve) + const diff = Mapping.addSpaceToNonNumeric(sort.system.difficulte) + return `${sort.name}${ptSeuil} (${caseTMR}) R${diff} r${ptreve}` + } + + static addSpaceToNonNumeric(value) { + return Number.isNumeric(value) ? value : ' ' + Mapping.toVar(value) + } + + static toVar(value) { + return value.replace('variable', 'var') } static bonusCase(sort) { @@ -237,7 +273,14 @@ export class Mapping { } static getProtectionArmure(actor, context) { - return Number(context?.armure?.protection ?? 0) + Number(actor.system.attributs.protection.value) + const protection = Number(actor.system.attributs.protection.value) + if (context?.armure?.protection == undefined) { + return protection + } + if (Number.isNumeric(context?.armure?.protection)) { + return Number(context?.armure?.protection ?? 0) + protection + } + return context?.armure.protection + (protection > 0 ? `+${protection}` : '') } static getMalusArmure(actor, context) { diff --git a/module/item-sort.js b/module/item-sort.js index be1a2f66..0baf8e5e 100644 --- a/module/item-sort.js +++ b/module/item-sort.js @@ -5,12 +5,12 @@ import { Misc } from "./misc.js"; import { TMRUtility } from "./tmr-utility.js"; const VOIES_DRACONIC = [ - { code: 'O', label: "Voie d'Oniros", short: 'Oniros' }, - { code: 'H', label: "Voie d'Hypnos", short: 'Hypnos' }, - { code: 'N', label: "Voie de Narcos", short: 'Narcos' }, - { code: 'T', label: "Voie de Thanatos", short: 'Thanatos' }, - { code: 'O/H/N/T', label: "Oniros/Hypnos/Narcos/Thanatos", short: 'Oniros/Hypnos/Narcos/Thanatos' }, - { code: 'O/H/N', label: "Oniros/Hypnos/Narcos" } + { code: 'O', label: "Voie d'Oniros", short: 'Oniros', ordre: 'a' }, + { code: 'H', label: "Voie d'Hypnos", short: 'Hypnos', ordre: 'b' }, + { code: 'N', label: "Voie de Narcos", short: 'Narcos', ordre: 'c' }, + { code: 'T', label: "Voie de Thanatos", short: 'Thanatos', ordre: 'd' }, + { code: 'O/H/N/T', label: "Oniros/Hypnos/Narcos/Thanatos", short: 'Oniros/Hypnos/Narcos/Thanatos', ordre: 'e' }, + { code: 'O/H/N', label: "Oniros/Hypnos/Narcos", short: "Oniros/Hypnos/Narcos", ordre: 'f' } ] /* -------------------------------------------- */ @@ -27,17 +27,33 @@ export class RdDItemSort extends Item { return [RdDItemCompetence.getVoieDraconic(draconicList, sort.system.draconic)]; } - static getCodeDraconic(sort) { + static getOrdreCode(code) { + return (VOIES_DRACONIC.find(it => it.code == code)?.ordre ?? '?') + } + + static getVoieCode(voie) { + return VOIES_DRACONIC.find(it => voie.name.includes(it.short))?.code ?? '?' + } + + static getCodeDraconic(sort, voies = ['O', 'H', 'N', 'T']) { switch (Grammar.toLowerCaseNoAccent(sort.name)) { case "lecture d'aura": case "detection d'aura": - return 'O/H/N/T' + return RdDItemSort.$voiesConnues('O/H/N/T', voies) case "annulation de magie": - return 'O/H/N' + return RdDItemSort.$voiesConnues('O/H/N', voies) } const voie = VOIES_DRACONIC.find(it => it.label.includes(sort.system.draconic)) return voie?.code ?? sort.system.draconic } + + + static $voiesConnues(voiesSort, voies) { + const codes = voies.filter(it => voiesSort.includes(it)) + .sort(Misc.ascending(it => RdDItemSort.getOrdreCode(it))) + return Misc.join(codes ?? [''], '/'); + } + /* -------------------------------------------- */ static isDifficulteVariable(sort) { return sort && (sort.system.difficulte.toLowerCase() == "variable"); @@ -67,7 +83,7 @@ export class RdDItemSort extends Item { static buildBonusCaseList(bonuscase, newCase) { const list = RdDItemSort.bonuscaseStringToList(bonuscase) if (newCase) { - list.push({ case: "Nouvelle", bonus: 0 }) + list.push({ case: "Nouvelle", bonus: 0 }) } return list; } diff --git a/module/rdd-main.js b/module/rdd-main.js index 36e090fc..4e955e53 100644 --- a/module/rdd-main.js +++ b/module/rdd-main.js @@ -68,6 +68,7 @@ import { RdDTMRDialog } from "./rdd-tmr-dialog.js" import { OptionsAvancees } from "./settings/options-avancees.js" import { ExportScriptarium } from "./actor/export-scriptarium/export-scriptarium.js" import { AppPersonnageAleatoire } from "./actor/random/app-personnage-aleatoire.js" +import { RdDActorExportSheet } from "./actor/export-scriptarium/actor-export-sheet.js" /** * RdD system @@ -160,12 +161,12 @@ export class SystemReveDeDragon { // Register sheet application classes Actors.unregisterSheet("core", ActorSheet) Actors.registerSheet(SYSTEM_RDD, RdDCommerceSheet, { types: ["commerce"], makeDefault: true }) - //Actors.registerSheet(SYSTEM_RDD, RdDActorExportSheet, { types: ["personnage"], makeDefault: false }) Actors.registerSheet(SYSTEM_RDD, RdDActorSheet, { types: ["personnage"], makeDefault: true }) Actors.registerSheet(SYSTEM_RDD, RdDCreatureSheet, { types: ["creature"], makeDefault: true }) Actors.registerSheet(SYSTEM_RDD, RdDActorVehiculeSheet, { types: ["vehicule"], makeDefault: true }) Actors.registerSheet(SYSTEM_RDD, RdDActorEntiteSheet, { types: ["entite"], makeDefault: true }) Items.unregisterSheet("core", ItemSheet) + await RdDActorExportSheet.init() RdDItemSheet.register(RdDSigneDraconiqueItemSheet) RdDItemSheet.register(RdDRencontreItemSheet) diff --git a/styles/simple.css b/styles/simple.css index 77a3b277..9e5d6299 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -326,7 +326,7 @@ table {border: 1px solid #7a7971;} display: grid; grid-column: span 2 / span 2; grid-template-columns: repeat(2, minmax(0, 1fr)); - gap: 10px; + gap: 30px; margin: 10px 0; padding: 0; } @@ -411,6 +411,11 @@ table {border: 1px solid #7a7971;} text-align: left; } +.flex-group-top { + vertical-align: top; + align-self: start; +} + .flex-group-right { -webkit-box-pack: end; -ms-flex-pack: end; diff --git a/templates/actor/export-scriptarium/actor-export-sheet.hbs b/templates/actor/export-scriptarium/actor-export-sheet.hbs new file mode 100644 index 00000000..90cb7389 --- /dev/null +++ b/templates/actor/export-scriptarium/actor-export-sheet.hbs @@ -0,0 +1,103 @@ +
+
+
+

{{name}}

+ Export +
+
+
+
+ {{export.name.value}}{{#if export.description.value}}, {{export.description.value}}{{/if}} +
+
+
+
+ {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" export.taille}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" export.apparence}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" export.constitution}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" export.force}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" export.agilite}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" export.dexterite}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" export.vue}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" export.ouie}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" export.odoratgout}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" export.volonte}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" export.empathie}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" export.intellect}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" export.reve}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs" export.chance}} +
+
+ {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac-derivee.hbs" export.melee}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac-derivee.hbs" export.tir}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac-derivee.hbs" export.lancer}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac-derivee.hbs" export.derobee}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac-derivee.hbs" export.vie}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac-derivee.hbs" export.endurance}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac-derivee.hbs" export.plusdom}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/protection.hbs" export}} +
+
+
+
+ {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs" name=' ' niveau='Niv' init='Init' dommages='+dom'}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs" name=export.arme_name_0.value niveau=export.arme_niveau_0.value init=export.arme_init_0.value dommages=export.arme_dommages_0.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs" name=export.arme_name_1.value niveau=export.arme_niveau_1.value init=export.arme_init_1.value dommages=export.arme_dommages_1.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs" name=export.arme_name_2.value niveau=export.arme_niveau_2.value init=export.arme_init_2.value dommages=export.arme_dommages_2.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs" name=export.arme_name_3.value niveau=export.arme_niveau_3.value init=export.arme_init_3.value dommages=export.arme_dommages_3.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs" name=export.arme_name_4.value niveau=export.arme_niveau_4.value init=export.arme_init_4.value dommages=export.arme_dommages_4.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs" name=export.arme_name_5.value niveau=export.arme_niveau_5.value init=export.arme_init_5.value dommages=export.arme_dommages_5.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs" name=export.arme_name_6.value niveau=export.arme_niveau_6.value init=export.arme_init_6.value dommages=export.arme_dommages_6.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs" name=export.arme_name_7.value niveau=export.arme_niveau_7.value init=export.arme_init_7.value dommages=export.arme_dommages_7.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs" name=export.arme_name_8.value niveau=export.arme_niveau_8.value init=export.arme_init_8.value dommages=export.arme_dommages_8.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs" name=export.arme_name_9.value niveau=export.arme_niveau_9.value init=export.arme_init_9.value dommages=export.arme_dommages_9.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/esquive.hbs" name='Esquive' niveau=export.esquive.value}} + {{#if (gt export.malue_armure.value 0)}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/esquive.hbs" name='Esquive (avec armure)' niveau=export.esquive_armure.value}} + {{/if}} +
+
+
+ {{export.competences.value}} +
+
+
+ {{export.draconic.value}} +
+
+
+ {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs" voie=export.sort_voie_0.value description=export.sort_description_0.value bonus=export.sort_bonus_0.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs" voie=export.sort_voie_1.value description=export.sort_description_1.value bonus=export.sort_bonus_1.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs" voie=export.sort_voie_2.value description=export.sort_description_2.value bonus=export.sort_bonus_2.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs" voie=export.sort_voie_3.value description=export.sort_description_3.value bonus=export.sort_bonus_3.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs" voie=export.sort_voie_4.value description=export.sort_description_4.value bonus=export.sort_bonus_4.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs" voie=export.sort_voie_5.value description=export.sort_description_5.value bonus=export.sort_bonus_5.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs" voie=export.sort_voie_6.value description=export.sort_description_6.value bonus=export.sort_bonus_6.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs" voie=export.sort_voie_7.value description=export.sort_description_7.value bonus=export.sort_bonus_7.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs" voie=export.sort_voie_8.value description=export.sort_description_8.value bonus=export.sort_bonus_8.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs" voie=export.sort_voie_9.value description=export.sort_description_9.value bonus=export.sort_bonus_9.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs" voie=export.sort_voie_10.value description=export.sort_description_10.value bonus=export.sort_bonus_10.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs" voie=export.sort_voie_11.value description=export.sort_description_11.value bonus=export.sort_bonus_11.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs" voie=export.sort_voie_12.value description=export.sort_description_12.value bonus=export.sort_bonus_12.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs" voie=export.sort_voie_13.value description=export.sort_description_13.value bonus=export.sort_bonus_13.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs" voie=export.sort_voie_14.value description=export.sort_description_14.value bonus=export.sort_bonus_14.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs" voie=export.sort_voie_15.value description=export.sort_description_15.value bonus=export.sort_bonus_15.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs" voie=export.sort_voie_16.value description=export.sort_description_16.value bonus=export.sort_bonus_16.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs" voie=export.sort_voie_17.value description=export.sort_description_17.value bonus=export.sort_bonus_17.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs" voie=export.sort_voie_18.value description=export.sort_description_18.value bonus=export.sort_bonus_18.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs" voie=export.sort_voie_19.value description=export.sort_description_19.value bonus=export.sort_bonus_19.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs" voie=export.sort_voie_20.value description=export.sort_description_20.value bonus=export.sort_bonus_20.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs" voie=export.sort_voie_21.value description=export.sort_description_21.value bonus=export.sort_bonus_21.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs" voie=export.sort_voie_22.value description=export.sort_description_22.value bonus=export.sort_bonus_22.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs" voie=export.sort_voie_23.value description=export.sort_description_23.value bonus=export.sort_bonus_23.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs" voie=export.sort_voie_24.value description=export.sort_description_24.value bonus=export.sort_bonus_24.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs" voie=export.sort_voie_25.value description=export.sort_description_25.value bonus=export.sort_bonus_25.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs" voie=export.sort_voie_26.value description=export.sort_description_26.value bonus=export.sort_bonus_26.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs" voie=export.sort_voie_27.value description=export.sort_description_27.value bonus=export.sort_bonus_27.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs" voie=export.sort_voie_28.value description=export.sort_description_28.value bonus=export.sort_bonus_28.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs" voie=export.sort_voie_29.value description=export.sort_description_29.value bonus=export.sort_bonus_29.value}} +
 
+
 
+
+
+
\ No newline at end of file diff --git a/templates/actor/export-scriptarium/arme.hbs b/templates/actor/export-scriptarium/arme.hbs new file mode 100644 index 00000000..dee9e508 --- /dev/null +++ b/templates/actor/export-scriptarium/arme.hbs @@ -0,0 +1,15 @@ +{{#if name}} +
+
{{upperFirst name}}
+
+
{{niveau}}
+ {{#if init}} +
{{init}}
+
{{dommages}}
+ {{else}} +
+
+ {{/if}} +
+
+{{/if}} diff --git a/templates/actor/export-scriptarium/carac-derivee.hbs b/templates/actor/export-scriptarium/carac-derivee.hbs new file mode 100644 index 00000000..fa325e3c --- /dev/null +++ b/templates/actor/export-scriptarium/carac-derivee.hbs @@ -0,0 +1 @@ +
{{upperFirst colName}}
{{value}}
diff --git a/templates/actor/export-scriptarium/carac.hbs b/templates/actor/export-scriptarium/carac.hbs new file mode 100644 index 00000000..ce846e88 --- /dev/null +++ b/templates/actor/export-scriptarium/carac.hbs @@ -0,0 +1 @@ +
{{upper colName}}
{{value}}
diff --git a/templates/actor/export-scriptarium/esquive.hbs b/templates/actor/export-scriptarium/esquive.hbs new file mode 100644 index 00000000..8effa703 --- /dev/null +++ b/templates/actor/export-scriptarium/esquive.hbs @@ -0,0 +1,10 @@ +{{#if name}} +
+
{{upperFirst name}}
+
+
{{niveau}}
+
+
+
+
+{{/if}} diff --git a/templates/actor/export-scriptarium/protection.hbs b/templates/actor/export-scriptarium/protection.hbs new file mode 100644 index 00000000..15ac8712 --- /dev/null +++ b/templates/actor/export-scriptarium/protection.hbs @@ -0,0 +1,7 @@ +{{#if protectionnaturelle.value}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac-derivee.hbs" protectionnaturelle}} +{{/if}} +{{>"systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac-derivee.hbs" protection}} +{{#if armure.value}} +
{{armure.value}}
+{{/if}} diff --git a/templates/actor/export-scriptarium/sort.hbs b/templates/actor/export-scriptarium/sort.hbs new file mode 100644 index 00000000..543a6213 --- /dev/null +++ b/templates/actor/export-scriptarium/sort.hbs @@ -0,0 +1,11 @@ +{{#if voie}} +
+
{{voie}}
+
{{upperFirst description}}
+ {{#if bonus}} +
{{bonus}}
+ {{else}} +
+ {{/if}} +
+{{/if}} From d439d7363687535f265afc0dbb67b8b5b2a3ad7d Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sat, 5 Oct 2024 00:40:31 +0200 Subject: [PATCH 04/10] Version 12.0.12 --- system.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system.json b/system.json index c24b1675..6489564b 100644 --- a/system.json +++ b/system.json @@ -1,8 +1,8 @@ { "id": "foundryvtt-reve-de-dragon", "title": "Rêve de Dragon", - "version": "12.0.11", - "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-12.0.11.zip", + "version": "12.0.12", + "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-12.0.12.zip", "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v11/system.json", "changelog": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/branch/v11/changelog.md", "compatibility": { From 40b0d7e6dc26797e53bc48d0071db704896aa4f6 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sat, 5 Oct 2024 12:41:28 +0200 Subject: [PATCH 05/10] =?UTF-8?q?Jets=20de=20carac/comp=C3=A9tences=20sur?= =?UTF-8?q?=20feuille=20encart?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog.md | 2 + module/actor/base-actor-reve-sheet.js | 4 +- module/actor/base-actor-reve.js | 3 ++ .../export-scriptarium/actor-export-sheet.js | 40 +++++++++++++++-- module/actor/export-scriptarium/mapping.js | 8 ++-- styles/simple.css | 4 +- templates/actor/carac-main.html | 4 +- templates/actor/combat.html | 2 +- templates/actor/comp-creature.html | 2 +- templates/actor/competence.html | 2 +- .../export-scriptarium/actor-export-sheet.hbs | 44 +++++++++---------- .../export-scriptarium/carac-derivee.hbs | 2 +- templates/actor/export-scriptarium/carac.hbs | 5 ++- .../actor/export-scriptarium/competences.hbs | 10 +++++ 14 files changed, 91 insertions(+), 41 deletions(-) create mode 100644 templates/actor/export-scriptarium/competences.hbs diff --git a/changelog.md b/changelog.md index 20967d6b..04d5b726 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,8 @@ ## 12.0.12 - L'étalage d'Astrobazzarh - Fix: On peut de nouveau vendre des items sans propriétaire, depuis les compendiums ou depuis l'onglet des Objets - Début de Feuille PNJ au format des encarts Scriptarium + - support des jets de caractéristiques + - support des jets de compétences ## 12.0.11 - Le scriptorium d'Astrobazzarh - ajout d'un bouton pour générer les éléments de description d'un personnage diff --git a/module/actor/base-actor-reve-sheet.js b/module/actor/base-actor-reve-sheet.js index 901c7423..ad3e5dea 100644 --- a/module/actor/base-actor-reve-sheet.js +++ b/module/actor/base-actor-reve-sheet.js @@ -25,8 +25,8 @@ export class RdDBaseActorReveSheet extends RdDBaseActorSheet { if (!this.options.editable) return; this.html.find('.encaisser-direct').click(async event => this.actor.encaisser()) - this.html.find('.carac-label a').click(async event => this.actor.rollCarac(Grammar.toLowerCaseNoAccent(event.currentTarget.attributes.name.value))); - this.html.find('a.competence-label').click(async event => this.actor.rollCompetence(RdDSheetUtility.getItemId(event))); + this.html.find('.roll-carac').click(async event => this.actor.rollCarac(Grammar.toLowerCaseNoAccent(event.currentTarget.attributes.name.value))); + this.html.find('.roll-competence').click(async event => this.actor.rollCompetence(RdDSheetUtility.getItemId(event))); this.html.find('.endurance-plus').click(async event => this.actor.santeIncDec("endurance", 1)); this.html.find('.endurance-moins').click(async event => this.actor.santeIncDec("endurance", -1)); diff --git a/module/actor/base-actor-reve.js b/module/actor/base-actor-reve.js index 60ebb6f1..f695cce1 100644 --- a/module/actor/base-actor-reve.js +++ b/module/actor/base-actor-reve.js @@ -296,6 +296,9 @@ export class RdDBaseActorReve extends RdDBaseActor { /* -------------------------------------------- */ async rollCarac(caracName, jetResistance = undefined) { + if (Grammar.equalsInsensitive(caracName, 'taille')){ + return + } RdDEmpoignade.checkEmpoignadeEnCours(this) let selectedCarac = this.getCaracByName(caracName) await this.openRollDialog({ diff --git a/module/actor/export-scriptarium/actor-export-sheet.js b/module/actor/export-scriptarium/actor-export-sheet.js index bfe4a8c3..dd2cd2e5 100644 --- a/module/actor/export-scriptarium/actor-export-sheet.js +++ b/module/actor/export-scriptarium/actor-export-sheet.js @@ -2,7 +2,7 @@ import { RdDActorSheet } from "../../actor-sheet.js" import { SYSTEM_RDD } from "../../constants.js"; import { Misc } from "../../misc.js"; import { ExportScriptarium } from "./export-scriptarium.js"; -import { Mapping } from "./mapping.js"; +import { CATEGORIES_COMPETENCES, CATEGORIES_DRACONIC, Mapping } from "./mapping.js"; export class RdDActorExportSheet extends RdDActorSheet { static async init() { @@ -10,6 +10,7 @@ export class RdDActorExportSheet extends RdDActorSheet { "systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/arme.hbs", "systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac.hbs", "systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/carac-derivee.hbs", + "systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/competences.hbs", "systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/esquive.hbs", "systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/protection.hbs", "systems/foundryvtt-reve-de-dragon/templates/actor/export-scriptarium/sort.hbs", @@ -31,12 +32,45 @@ export class RdDActorExportSheet extends RdDActorSheet { async getData() { const formData = await super.getData() - const values = Mapping.getAsObject(this.actor); // Add any structured, precomputed list of data - formData.export = values + formData.export = this.getMappingValues(); + formData.competences = this.getCompetences(CATEGORIES_COMPETENCES) + formData.draconic = this.getCompetences(CATEGORIES_DRACONIC) return formData } + getMappingValues() { + const context = Mapping.prepareContext(this.actor) + return Object.fromEntries(Mapping.getMapping().map(it => [it.column, { + colName: it.colName ?? it.column, + column: it.column, + value: it.getter(this.actor, context) + }])) + } + + getCompetences(categories) { + const competences = Mapping.getCompetencesCategorie(this.actor, categories) + if (competences.length == 0) { + return '' + } + const byCategories = Mapping.competencesByCategoriesByNiveau(competences, categories) + const listByCategories = Object.values(byCategories) + .map(it => it.competencesParNiveau) + .map(byNiveau => { + const niveaux = Object.keys(byNiveau).map(it => Number(it)).sort(Misc.ascending()) + if (niveaux.length == 0) { + return undefined + } + const listCategorieByNiveau = niveaux.map(niveau => { + const list = byNiveau[niveau].sort(Misc.ascending(it => it.name)) + return {niveau, list} + }) + return Misc.concat(listCategorieByNiveau) + }).filter(it => it != undefined) + + return Misc.concat(listByCategories) + } + activateListeners(html) { super.activateListeners(html); this.html.find('.button-export').click(async event => { diff --git a/module/actor/export-scriptarium/mapping.js b/module/actor/export-scriptarium/mapping.js index e0e7a7d7..eb79530b 100644 --- a/module/actor/export-scriptarium/mapping.js +++ b/module/actor/export-scriptarium/mapping.js @@ -9,13 +9,13 @@ import { RdDBonus } from "../../rdd-bonus.js" import { TMRType } from "../../tmr-utility.js" -const CATEGORIES_COMPETENCES = [ +export const CATEGORIES_COMPETENCES = [ "generale", "particuliere", "specialisee", "connaissance", ] -const CATEGORIES_DRACONIC = [ +export const CATEGORIES_DRACONIC = [ "draconic", ] @@ -306,8 +306,8 @@ export class Mapping { if (competences.length == 0) { return '' } - const byCartegories = Mapping.competencesByCategoriesByNiveau(competences, categories) - const txtByCategories = Object.values(byCartegories) + const byCategories = Mapping.competencesByCategoriesByNiveau(competences, categories) + const txtByCategories = Object.values(byCategories) .map(it => it.competencesParNiveau) .map(byNiveau => { const niveaux = Object.keys(byNiveau).map(it => Number(it)).sort(Misc.ascending()) diff --git a/styles/simple.css b/styles/simple.css index 9e5d6299..92ec5536 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -680,6 +680,7 @@ input:is(.blessure-premiers_soins, .blessure-soins_complets) { } .carac-label { + font-weight: bold; flex-basis: 40%; } .rdd.sheet .window-content .sheet-body .carac-list .caracteristique > .utiliser-attribut { @@ -1188,9 +1189,6 @@ ul.chat-list li:nth-child(odd) { padding: 0.5rem; cursor: pointer; } -.carac-label { - font-weight: bold; -} .list-item { margin: 0.1rem; box-shadow: inset 0px 0px 1px #00000096; diff --git a/templates/actor/carac-main.html b/templates/actor/carac-main.html index c842223e..8f31c909 100644 --- a/templates/actor/carac-main.html +++ b/templates/actor/carac-main.html @@ -7,7 +7,7 @@