From ce8616c34efd9bc9a469358e7ca0ca458740c546 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Mon, 2 Dec 2024 22:07:20 +0100 Subject: [PATCH 1/3] =?UTF-8?q?Merge=20comp=C3=A9tences=20cr=C3=A9atures/e?= =?UTF-8?q?ntit=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Les deux compendiums n'avaient pas de raison d'être séparés --- module/settings/system-compendiums.js | 18 ++++++----- ...tencecreature_Attaque_18wcei5hlEInsBFO.yml | 9 +++--- ...eature_Bouclier_Lourd_QGULMUoC9JXFze0r.yml | 9 +++--- ...cecreature_Bras_Galet_WsYnwR8GcOxfuCI0.yml | 11 ++++--- ...reature_Corps___Corps_c0I93Q53i4ZmxpyT.yml | 8 ++--- ...petencecreature_Crocs_db8E8HwROw1ZcwRR.yml | 9 +++--- ...petencecreature_Dague_qilRzXpVaGceNmQp.yml | 6 ++-- ...creature_Ep_e_B_tarde_gPOQd9NI7AFH0whX.yml | 11 ++++--- ...tencecreature_Esquive_CYpxxf1uTa78NWR9.yml | 4 +-- ...etencecreature_Parade_3Crwg8cx2JOb697T.yml | 13 ++++---- ...cecreature_Possession_9u16zxXRurCtxuOX.yml | 2 +- ...cecreature_Possession_duVgxI3Cdko0KzAj.yml | 29 ------------------ ...cecreature_Tentacules_D9cBJ3EJPYLnABiJ.yml | 8 ++--- ...creature_Tron_onneuse_h9ASt4vrvEgxfj7j.yml | 6 ++-- ...ompetencecreature_Bec_d5SZ09sFaG3cL2Rg.yml | 29 ------------------ ...tencecreature_Esquive_0Ms9iKxqigNNpZEx.yml | 29 ------------------ ...eature_Grande_morsure_lDZ3qUPKN35ob5TH.yml | 29 ------------------ ...ature_Grandes_griffes_6eWCVDYLXXO1Z48D.yml | 29 ------------------ ...tencecreature_Griffes_9Y83OsQgeyR5oCdH.yml | 30 ------------------- ...tencecreature_Morsure_j1xHCzfIeYKgXxoH.yml | 29 ------------------ ...cecreature_Possession_wDHR5UHWq568lfGa.yml | 29 ------------------ system.json | 14 --------- 22 files changed, 55 insertions(+), 306 deletions(-) rename packs_src/{competences-entites => competences-creatures}/competencecreature_Attaque_18wcei5hlEInsBFO.yml (84%) rename packs_src/{competences-entites => competences-creatures}/competencecreature_Bouclier_Lourd_QGULMUoC9JXFze0r.yml (85%) rename packs_src/{competences-entites => competences-creatures}/competencecreature_Bras_Galet_WsYnwR8GcOxfuCI0.yml (73%) rename packs_src/{competences-entites => competences-creatures}/competencecreature_Corps___Corps_c0I93Q53i4ZmxpyT.yml (87%) rename packs_src/{competences-entites => competences-creatures}/competencecreature_Crocs_db8E8HwROw1ZcwRR.yml (84%) rename packs_src/{competences-entites => competences-creatures}/competencecreature_Ep_e_B_tarde_gPOQd9NI7AFH0whX.yml (82%) rename packs_src/{competences-entites => competences-creatures}/competencecreature_Parade_3Crwg8cx2JOb697T.yml (77%) delete mode 100644 packs_src/competences-creatures/competencecreature_Possession_duVgxI3Cdko0KzAj.yml rename packs_src/{competences-entites => competences-creatures}/competencecreature_Tentacules_D9cBJ3EJPYLnABiJ.yml (88%) delete mode 100644 packs_src/competences-entites/competencecreature_Bec_d5SZ09sFaG3cL2Rg.yml delete mode 100644 packs_src/competences-entites/competencecreature_Esquive_0Ms9iKxqigNNpZEx.yml delete mode 100644 packs_src/competences-entites/competencecreature_Grande_morsure_lDZ3qUPKN35ob5TH.yml delete mode 100644 packs_src/competences-entites/competencecreature_Grandes_griffes_6eWCVDYLXXO1Z48D.yml delete mode 100644 packs_src/competences-entites/competencecreature_Griffes_9Y83OsQgeyR5oCdH.yml delete mode 100644 packs_src/competences-entites/competencecreature_Morsure_j1xHCzfIeYKgXxoH.yml delete mode 100644 packs_src/competences-entites/competencecreature_Possession_wDHR5UHWq568lfGa.yml diff --git a/module/settings/system-compendiums.js b/module/settings/system-compendiums.js index 317f2054..663b3c5a 100644 --- a/module/settings/system-compendiums.js +++ b/module/settings/system-compendiums.js @@ -32,7 +32,7 @@ export class SystemCompendiums extends FormApplication { compendium: compendium, default: SystemCompendiums._getDefaultCompendium(compendium), setting: SystemCompendiums._getSettingCompendium(compendium) - }); + }) game.settings.register(SYSTEM_RDD, definition.setting, { name: definition.label, @@ -40,8 +40,8 @@ export class SystemCompendiums extends FormApplication { scope: "world", config: false, type: String - }); - }); + }) + }) game.settings.registerMenu(SYSTEM_RDD, "compendium-settings", { name: "Choisir les compendiums système", @@ -71,16 +71,18 @@ export class SystemCompendiums extends FormApplication { static async getCompetences(actorType) { switch (actorType ?? 'personnage') { - case 'personnage': return await SystemCompendiums.getWorldOrCompendiumItems('competence', 'competences'); - case 'creature': return await SystemCompendiums.getWorldOrCompendiumItems('competencecreature', 'competences-creatures'); - case 'entite': return await SystemCompendiums.getWorldOrCompendiumItems('competencecreature', 'competences-entites'); + case 'personnage': + return await SystemCompendiums.getWorldOrCompendiumItems('competence', 'competences') + case 'entite': + case 'creature': + return await SystemCompendiums.getWorldOrCompendiumItems('competencecreature', 'competences-creatures') case 'vehicule': return []; } } /* -------------------------------------------- */ static async getWorldOrCompendiumItems(itemType, compendium) { - let items = game.items.filter(it => it.type == itemType); + let items = game.items.filter(it => it.type == itemType) if (compendium) { const ids = items.map(it => it.id); const names = items.map(it => it.name.toLowerCase()); @@ -284,7 +286,7 @@ export class CompendiumTableHelpers { } /* -------------------------------------------- */ - static async tableRowToChatMessage(row, type, options = {showSource: true}) { + static async tableRowToChatMessage(row, type, options = { showSource: true }) { if (!row) { return; } diff --git a/packs_src/competences-entites/competencecreature_Attaque_18wcei5hlEInsBFO.yml b/packs_src/competences-creatures/competencecreature_Attaque_18wcei5hlEInsBFO.yml similarity index 84% rename from packs_src/competences-entites/competencecreature_Attaque_18wcei5hlEInsBFO.yml rename to packs_src/competences-creatures/competencecreature_Attaque_18wcei5hlEInsBFO.yml index e90193f6..271a9455 100644 --- a/packs_src/competences-entites/competencecreature_Attaque_18wcei5hlEInsBFO.yml +++ b/packs_src/competences-creatures/competencecreature_Attaque_18wcei5hlEInsBFO.yml @@ -6,17 +6,16 @@ effects: [] system: description: '' descriptionmj: '' - carac_value: 0 - niveau: 0 - default_diffLibre: 0 - categorie: generale + carac_value: 10 + niveau: 1 + default_diffLibre: -2 + categorie: melee categorie_parade: '' iscombat: true isnaturelle: true ispossession: false dommages: 0 mortalite: mortel - carac-value: null isparade: false ownership: default: 0 diff --git a/packs_src/competences-entites/competencecreature_Bouclier_Lourd_QGULMUoC9JXFze0r.yml b/packs_src/competences-creatures/competencecreature_Bouclier_Lourd_QGULMUoC9JXFze0r.yml similarity index 85% rename from packs_src/competences-entites/competencecreature_Bouclier_Lourd_QGULMUoC9JXFze0r.yml rename to packs_src/competences-creatures/competencecreature_Bouclier_Lourd_QGULMUoC9JXFze0r.yml index 8a3a086a..52eac4d1 100644 --- a/packs_src/competences-entites/competencecreature_Bouclier_Lourd_QGULMUoC9JXFze0r.yml +++ b/packs_src/competences-creatures/competencecreature_Bouclier_Lourd_QGULMUoC9JXFze0r.yml @@ -6,17 +6,16 @@ effects: [] system: description: '' descriptionmj: '' - carac_value: 0 - niveau: 0 - default_diffLibre: 0 - categorie: '' + carac_value: 10 + niveau: 1 + default_diffLibre: -2 + categorie: melee categorie_parade: boucliers iscombat: true isnaturelle: true ispossession: false dommages: 0 mortalite: mortel - carac-value: null isparade: true ownership: default: 0 diff --git a/packs_src/competences-entites/competencecreature_Bras_Galet_WsYnwR8GcOxfuCI0.yml b/packs_src/competences-creatures/competencecreature_Bras_Galet_WsYnwR8GcOxfuCI0.yml similarity index 73% rename from packs_src/competences-entites/competencecreature_Bras_Galet_WsYnwR8GcOxfuCI0.yml rename to packs_src/competences-creatures/competencecreature_Bras_Galet_WsYnwR8GcOxfuCI0.yml index f10e2925..e67969c9 100644 --- a/packs_src/competences-entites/competencecreature_Bras_Galet_WsYnwR8GcOxfuCI0.yml +++ b/packs_src/competences-creatures/competencecreature_Bras_Galet_WsYnwR8GcOxfuCI0.yml @@ -1,22 +1,21 @@ _id: WsYnwR8GcOxfuCI0 name: Bras-Galet type: competencecreature -img: systems/foundryvtt-reve-de-dragon/icons/competence_course.webp +img: systems/foundryvtt-reve-de-dragon/icons/compcreature-pierretenue.webp effects: [] system: description: '' descriptionmj: '' - carac_value: 0 - niveau: 0 - default_diffLibre: 0 - categorie: '' + carac_value: 10 + niveau: 1 + default_diffLibre: -2 + categorie: melee categorie_parade: '' iscombat: true isnaturelle: true ispossession: false dommages: 1 mortalite: mortel - carac-value: null isparade: false ownership: default: 0 diff --git a/packs_src/competences-entites/competencecreature_Corps___Corps_c0I93Q53i4ZmxpyT.yml b/packs_src/competences-creatures/competencecreature_Corps___Corps_c0I93Q53i4ZmxpyT.yml similarity index 87% rename from packs_src/competences-entites/competencecreature_Corps___Corps_c0I93Q53i4ZmxpyT.yml rename to packs_src/competences-creatures/competencecreature_Corps___Corps_c0I93Q53i4ZmxpyT.yml index 963f649e..f3170b52 100644 --- a/packs_src/competences-entites/competencecreature_Corps___Corps_c0I93Q53i4ZmxpyT.yml +++ b/packs_src/competences-creatures/competencecreature_Corps___Corps_c0I93Q53i4ZmxpyT.yml @@ -6,10 +6,10 @@ effects: [] system: description: '' descriptionmj: '' - carac_value: 0 - niveau: 0 - default_diffLibre: 0 - categorie: '' + carac_value: 10 + niveau: 1 + default_diffLibre: -2 + categorie: melee categorie_parade: sans-armes iscombat: true isnaturelle: true diff --git a/packs_src/competences-entites/competencecreature_Crocs_db8E8HwROw1ZcwRR.yml b/packs_src/competences-creatures/competencecreature_Crocs_db8E8HwROw1ZcwRR.yml similarity index 84% rename from packs_src/competences-entites/competencecreature_Crocs_db8E8HwROw1ZcwRR.yml rename to packs_src/competences-creatures/competencecreature_Crocs_db8E8HwROw1ZcwRR.yml index b5fb8da2..67cf492d 100644 --- a/packs_src/competences-entites/competencecreature_Crocs_db8E8HwROw1ZcwRR.yml +++ b/packs_src/competences-creatures/competencecreature_Crocs_db8E8HwROw1ZcwRR.yml @@ -6,17 +6,16 @@ effects: [] system: description: '' descriptionmj: '' - carac_value: 0 - niveau: 0 - default_diffLibre: 0 - categorie: '' + carac_value: 10 + niveau: 1 + default_diffLibre: -2 + categorie: melee categorie_parade: '' iscombat: true isnaturelle: true ispossession: false dommages: 1 mortalite: mortel - carac-value: null isparade: false ownership: default: 0 diff --git a/packs_src/competences-creatures/competencecreature_Dague_qilRzXpVaGceNmQp.yml b/packs_src/competences-creatures/competencecreature_Dague_qilRzXpVaGceNmQp.yml index f9241cc0..b33b2f85 100644 --- a/packs_src/competences-creatures/competencecreature_Dague_qilRzXpVaGceNmQp.yml +++ b/packs_src/competences-creatures/competencecreature_Dague_qilRzXpVaGceNmQp.yml @@ -6,9 +6,9 @@ effects: [] system: description: '' descriptionmj: '' - carac_value: 0 - niveau: 0 - default_diffLibre: 0 + carac_value: 10 + niveau: 1 + default_diffLibre: -2 categorie: melee categorie_parade: dagues iscombat: true diff --git a/packs_src/competences-entites/competencecreature_Ep_e_B_tarde_gPOQd9NI7AFH0whX.yml b/packs_src/competences-creatures/competencecreature_Ep_e_B_tarde_gPOQd9NI7AFH0whX.yml similarity index 82% rename from packs_src/competences-entites/competencecreature_Ep_e_B_tarde_gPOQd9NI7AFH0whX.yml rename to packs_src/competences-creatures/competencecreature_Ep_e_B_tarde_gPOQd9NI7AFH0whX.yml index cfb0476c..597578bd 100644 --- a/packs_src/competences-entites/competencecreature_Ep_e_B_tarde_gPOQd9NI7AFH0whX.yml +++ b/packs_src/competences-creatures/competencecreature_Ep_e_B_tarde_gPOQd9NI7AFH0whX.yml @@ -6,17 +6,16 @@ effects: [] system: description: '' descriptionmj: '' - carac_value: 0 - niveau: 0 - default_diffLibre: 0 - categorie: '' + carac_value: 10 + niveau: 1 + default_diffLibre: -2 + categorie: melee categorie_parade: epees-lourdes iscombat: true - isnaturelle: true + isnaturelle: false ispossession: false dommages: 4 mortalite: mortel - carac-value: null isparade: true ownership: default: 0 diff --git a/packs_src/competences-creatures/competencecreature_Esquive_CYpxxf1uTa78NWR9.yml b/packs_src/competences-creatures/competencecreature_Esquive_CYpxxf1uTa78NWR9.yml index 6ce6e20b..40e9a232 100644 --- a/packs_src/competences-creatures/competencecreature_Esquive_CYpxxf1uTa78NWR9.yml +++ b/packs_src/competences-creatures/competencecreature_Esquive_CYpxxf1uTa78NWR9.yml @@ -6,8 +6,8 @@ effects: [] system: description: '' descriptionmj: '' - carac_value: 0 - niveau: 0 + carac_value: 10 + niveau: 1 default_diffLibre: 0 categorie: generale categorie_parade: '' diff --git a/packs_src/competences-entites/competencecreature_Parade_3Crwg8cx2JOb697T.yml b/packs_src/competences-creatures/competencecreature_Parade_3Crwg8cx2JOb697T.yml similarity index 77% rename from packs_src/competences-entites/competencecreature_Parade_3Crwg8cx2JOb697T.yml rename to packs_src/competences-creatures/competencecreature_Parade_3Crwg8cx2JOb697T.yml index d5a31151..3fb5dfe6 100644 --- a/packs_src/competences-entites/competencecreature_Parade_3Crwg8cx2JOb697T.yml +++ b/packs_src/competences-creatures/competencecreature_Parade_3Crwg8cx2JOb697T.yml @@ -6,17 +6,16 @@ effects: [] system: description: '' descriptionmj: '' - carac_value: 0 - niveau: 0 - default_diffLibre: 0 - categorie: '' - categorie_parade: '' - iscombat: false + carac_value: 10 + niveau: 1 + default_diffLibre: -2 + categorie: melee + categorie_parade: boucliers + iscombat: true isnaturelle: true ispossession: false dommages: 0 mortalite: mortel - carac-value: null isparade: false ownership: default: 0 diff --git a/packs_src/competences-creatures/competencecreature_Possession_9u16zxXRurCtxuOX.yml b/packs_src/competences-creatures/competencecreature_Possession_9u16zxXRurCtxuOX.yml index 9d05d174..5ba90923 100644 --- a/packs_src/competences-creatures/competencecreature_Possession_9u16zxXRurCtxuOX.yml +++ b/packs_src/competences-creatures/competencecreature_Possession_9u16zxXRurCtxuOX.yml @@ -7,7 +7,7 @@ system: descriptionmj: '' carac_value: 14 niveau: 2 - default_diffLibre: 0 + default_diffLibre: -4 categorie: draconic categorie_parade: '' iscombat: true diff --git a/packs_src/competences-creatures/competencecreature_Possession_duVgxI3Cdko0KzAj.yml b/packs_src/competences-creatures/competencecreature_Possession_duVgxI3Cdko0KzAj.yml deleted file mode 100644 index 69b4b94c..00000000 --- a/packs_src/competences-creatures/competencecreature_Possession_duVgxI3Cdko0KzAj.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Possession -type: competencecreature -img: systems/foundryvtt-reve-de-dragon/icons/entites/possession.webp -effects: [] -system: - description:

L'entité tente de prendre possession du corps de sa victime.

- descriptionmj: '' - carac_value: 14 - niveau: 2 - default_diffLibre: 0 - categorie: draconic - categorie_parade: '' - iscombat: true - isnaturelle: true - ispossession: true - dommages: 0 - mortalite: mortel - isparade: false -_id: duVgxI3Cdko0KzAj -folder: null -sort: 0 -ownership: - default: 0 -_stats: - systemId: foundryvtt-reve-de-dragon - systemVersion: 12.0.22 - coreVersion: '12.331' -_key: '!items!duVgxI3Cdko0KzAj' - diff --git a/packs_src/competences-entites/competencecreature_Tentacules_D9cBJ3EJPYLnABiJ.yml b/packs_src/competences-creatures/competencecreature_Tentacules_D9cBJ3EJPYLnABiJ.yml similarity index 88% rename from packs_src/competences-entites/competencecreature_Tentacules_D9cBJ3EJPYLnABiJ.yml rename to packs_src/competences-creatures/competencecreature_Tentacules_D9cBJ3EJPYLnABiJ.yml index 589737e9..3f8e73ac 100644 --- a/packs_src/competences-entites/competencecreature_Tentacules_D9cBJ3EJPYLnABiJ.yml +++ b/packs_src/competences-creatures/competencecreature_Tentacules_D9cBJ3EJPYLnABiJ.yml @@ -6,10 +6,10 @@ effects: [] system: description:

Attaque ou parade avec un tentacule.

descriptionmj: '' - carac_value: 0 - niveau: 0 - default_diffLibre: 0 - categorie: '' + carac_value: 10 + niveau: 1 + default_diffLibre: -2 + categorie: melee categorie_parade: boucliers iscombat: true isnaturelle: true diff --git a/packs_src/competences-creatures/competencecreature_Tron_onneuse_h9ASt4vrvEgxfj7j.yml b/packs_src/competences-creatures/competencecreature_Tron_onneuse_h9ASt4vrvEgxfj7j.yml index b846d737..63d7253e 100644 --- a/packs_src/competences-creatures/competencecreature_Tron_onneuse_h9ASt4vrvEgxfj7j.yml +++ b/packs_src/competences-creatures/competencecreature_Tron_onneuse_h9ASt4vrvEgxfj7j.yml @@ -6,9 +6,9 @@ effects: [] system: description: '' descriptionmj: '' - carac_value: 0 - niveau: 0 - default_diffLibre: 0 + carac_value: 10 + niveau: 1 + default_diffLibre: -2 categorie: melee categorie_parade: '' iscombat: true diff --git a/packs_src/competences-entites/competencecreature_Bec_d5SZ09sFaG3cL2Rg.yml b/packs_src/competences-entites/competencecreature_Bec_d5SZ09sFaG3cL2Rg.yml deleted file mode 100644 index d25a5723..00000000 --- a/packs_src/competences-entites/competencecreature_Bec_d5SZ09sFaG3cL2Rg.yml +++ /dev/null @@ -1,29 +0,0 @@ -_id: d5SZ09sFaG3cL2Rg -name: Bec -type: competencecreature -img: systems/foundryvtt-reve-de-dragon/icons/compcreature-beak.webp -effects: [] -system: - description: '' - descriptionmj: '' - carac_value: 0 - niveau: 0 - default_diffLibre: 0 - categorie: '' - categorie_parade: '' - iscombat: true - isnaturelle: true - ispossession: false - dommages: 0 - mortalite: mortel - isparade: false -ownership: - default: 0 -folder: null -sort: 0 -_stats: - systemId: foundryvtt-reve-de-dragon - systemVersion: 12.0.22 - coreVersion: '12.331' -_key: '!items!d5SZ09sFaG3cL2Rg' - diff --git a/packs_src/competences-entites/competencecreature_Esquive_0Ms9iKxqigNNpZEx.yml b/packs_src/competences-entites/competencecreature_Esquive_0Ms9iKxqigNNpZEx.yml deleted file mode 100644 index f374dcee..00000000 --- a/packs_src/competences-entites/competencecreature_Esquive_0Ms9iKxqigNNpZEx.yml +++ /dev/null @@ -1,29 +0,0 @@ -_id: 0Ms9iKxqigNNpZEx -name: Esquive -type: competencecreature -img: systems/foundryvtt-reve-de-dragon/icons/competence_esquive.webp -effects: [] -system: - description: '' - descriptionmj: '' - carac_value: 0 - niveau: 0 - default_diffLibre: 0 - categorie: '' - categorie_parade: '' - iscombat: false - isnaturelle: true - ispossession: false - dommages: 0 - mortalite: mortel - isparade: false -ownership: - default: 0 -folder: null -sort: 0 -_stats: - systemId: foundryvtt-reve-de-dragon - systemVersion: 12.0.22 - coreVersion: '12.331' -_key: '!items!0Ms9iKxqigNNpZEx' - diff --git a/packs_src/competences-entites/competencecreature_Grande_morsure_lDZ3qUPKN35ob5TH.yml b/packs_src/competences-entites/competencecreature_Grande_morsure_lDZ3qUPKN35ob5TH.yml deleted file mode 100644 index f080c64b..00000000 --- a/packs_src/competences-entites/competencecreature_Grande_morsure_lDZ3qUPKN35ob5TH.yml +++ /dev/null @@ -1,29 +0,0 @@ -_id: lDZ3qUPKN35ob5TH -name: Grande morsure -type: competencecreature -img: systems/foundryvtt-reve-de-dragon/icons/compcreature-morsure.webp -effects: [] -system: - description: '' - descriptionmj: '' - carac_value: 0 - niveau: 0 - default_diffLibre: 0 - categorie: '' - categorie_parade: '' - iscombat: true - isnaturelle: true - ispossession: false - dommages: 2 - mortalite: mortel - isparade: false -ownership: - default: 0 -folder: null -sort: 0 -_stats: - systemId: foundryvtt-reve-de-dragon - systemVersion: 12.0.22 - coreVersion: '12.331' -_key: '!items!lDZ3qUPKN35ob5TH' - diff --git a/packs_src/competences-entites/competencecreature_Grandes_griffes_6eWCVDYLXXO1Z48D.yml b/packs_src/competences-entites/competencecreature_Grandes_griffes_6eWCVDYLXXO1Z48D.yml deleted file mode 100644 index 833f15bd..00000000 --- a/packs_src/competences-entites/competencecreature_Grandes_griffes_6eWCVDYLXXO1Z48D.yml +++ /dev/null @@ -1,29 +0,0 @@ -_id: 6eWCVDYLXXO1Z48D -name: Grandes griffes -type: competencecreature -img: systems/foundryvtt-reve-de-dragon/icons/compcreature-griffes.webp -effects: [] -system: - description: '' - descriptionmj: '' - carac_value: 0 - niveau: 0 - default_diffLibre: 0 - categorie: '' - categorie_parade: sans-armes - iscombat: true - isnaturelle: true - ispossession: false - dommages: 2 - mortalite: mortel - isparade: false -ownership: - default: 0 -folder: null -sort: 0 -_stats: - systemId: foundryvtt-reve-de-dragon - systemVersion: 12.0.22 - coreVersion: '12.331' -_key: '!items!6eWCVDYLXXO1Z48D' - diff --git a/packs_src/competences-entites/competencecreature_Griffes_9Y83OsQgeyR5oCdH.yml b/packs_src/competences-entites/competencecreature_Griffes_9Y83OsQgeyR5oCdH.yml deleted file mode 100644 index f8634ba7..00000000 --- a/packs_src/competences-entites/competencecreature_Griffes_9Y83OsQgeyR5oCdH.yml +++ /dev/null @@ -1,30 +0,0 @@ -_id: 9Y83OsQgeyR5oCdH -name: Griffes -type: competencecreature -img: systems/foundryvtt-reve-de-dragon/icons/compcreature-griffes.webp -effects: [] -system: - description: '' - descriptionmj: '' - carac_value: 0 - niveau: 0 - default_diffLibre: 0 - categorie: '' - categorie_parade: sans-armes - iscombat: true - isnaturelle: true - ispossession: false - dommages: 1 - mortalite: mortel - carac-value: null - isparade: false -ownership: - default: 0 -folder: null -sort: 0 -_stats: - systemId: foundryvtt-reve-de-dragon - systemVersion: 12.0.22 - coreVersion: '12.331' -_key: '!items!9Y83OsQgeyR5oCdH' - diff --git a/packs_src/competences-entites/competencecreature_Morsure_j1xHCzfIeYKgXxoH.yml b/packs_src/competences-entites/competencecreature_Morsure_j1xHCzfIeYKgXxoH.yml deleted file mode 100644 index cca2b8d5..00000000 --- a/packs_src/competences-entites/competencecreature_Morsure_j1xHCzfIeYKgXxoH.yml +++ /dev/null @@ -1,29 +0,0 @@ -_id: j1xHCzfIeYKgXxoH -name: Morsure -type: competencecreature -img: systems/foundryvtt-reve-de-dragon/icons/compcreature-morsure.webp -effects: [] -system: - description: '' - descriptionmj: '' - carac_value: 0 - niveau: 0 - default_diffLibre: 0 - categorie: '' - categorie_parade: '' - iscombat: true - isnaturelle: true - ispossession: false - dommages: 1 - mortalite: mortel - isparade: false -ownership: - default: 0 -folder: null -sort: 0 -_stats: - systemId: foundryvtt-reve-de-dragon - systemVersion: 12.0.22 - coreVersion: '12.331' -_key: '!items!j1xHCzfIeYKgXxoH' - diff --git a/packs_src/competences-entites/competencecreature_Possession_wDHR5UHWq568lfGa.yml b/packs_src/competences-entites/competencecreature_Possession_wDHR5UHWq568lfGa.yml deleted file mode 100644 index 7edbd88a..00000000 --- a/packs_src/competences-entites/competencecreature_Possession_wDHR5UHWq568lfGa.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Possession -type: competencecreature -img: systems/foundryvtt-reve-de-dragon/icons/entites/possession.webp -effects: [] -system: - description:

L'entité tente de prendre possession du corps de sa victime.

- descriptionmj: '' - carac_value: 14 - niveau: 2 - default_diffLibre: -4 - categorie: melee - categorie_parade: '' - iscombat: true - isnaturelle: true - ispossession: true - dommages: 0 - mortalite: mortel - isparade: false -ownership: - default: 0 -folder: null -sort: 0 -_id: wDHR5UHWq568lfGa -_stats: - systemId: foundryvtt-reve-de-dragon - systemVersion: 12.0.22 - coreVersion: '12.331' -_key: '!items!wDHR5UHWq568lfGa' - diff --git a/system.json b/system.json index b1af567b..29683b0a 100644 --- a/system.json +++ b/system.json @@ -115,19 +115,6 @@ }, "flags": {} }, - { - "name": "competences-entites", - "label": "Compétences des Entités", - "system": "foundryvtt-reve-de-dragon", - "path": "packs/competences-entites", - "banner": "systems/foundryvtt-reve-de-dragon/styles/img/ui/compendium_banner.webp", - "type": "Item", - "ownership": { - "PLAYER": "NONE", - "ASSISTANT": "OWNER" - }, - "flags": {} - }, { "name": "sorts-oniros", "label": "Sorts d'Oniros", @@ -541,7 +528,6 @@ "entites", "faune-flore-mineraux", "competences-creatures", - "competences-entites", "maladies-et-poisons" ] }, -- 2.35.3 From a27e3894a0d6f93331b61cc03c729b40ac60ec3d Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Mon, 2 Dec 2024 21:59:55 +0100 Subject: [PATCH 2/3] =?UTF-8?q?Fix=20Import=20entit=C3=A9s=20de=20cauchema?= =?UTF-8?q?r&cr=C3=A9atures?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - utiliser les carac liées au type d'entités - fix: +dom&protection 0 ou négatifs - fix compétences (qui peuvent ne pas avoir d'init) --- module/apps/rdd-import-stats.js | 109 +++++++++++++++++++++----------- 1 file changed, 72 insertions(+), 37 deletions(-) diff --git a/module/apps/rdd-import-stats.js b/module/apps/rdd-import-stats.js index a6c6494a..0f938010 100644 --- a/module/apps/rdd-import-stats.js +++ b/module/apps/rdd-import-stats.js @@ -4,6 +4,7 @@ import { SystemCompendiums } from "../settings/system-compendiums.js"; import { RdDBaseActorReve } from "../actor/base-actor-reve.js"; import { Grammar } from "../grammar.js"; import { Misc } from "../misc.js"; +import { ENTITE_INCARNE, ENTITE_NONINCARNE } from "../constants.js"; /************************************************************************************/ // Some internal test strings @@ -291,17 +292,13 @@ export class RdDStatBlockParser { // Remove all leading and trailing spaces statString = statString.trim(); - let actorType = "personnage"; // TODO: check for entite - let perception = XRegExp.exec(statString, XRegExp("perception\\s+(?\\d+)", 'giu')) - if (perception?.value) { - actorType = "creature"; - } + let actorType = RdDStatBlockParser.parseActorType(statString); // Now start carac let actorData = foundry.utils.deepClone(game.model.Actor[actorType]); - for (let key in game.model.Actor.personnage.carac) { - let caracDef = game.model.Actor.personnage.carac[key]; + for (let key in actorData.carac) { + let caracDef = actorData.carac[key]; // Parse the stat string for each caracteristic let carac = XRegExp.exec(statString, XRegExp(caracDef.label + "\\s+(?\\d+)", 'giu')); if (carac?.value) { @@ -310,29 +307,13 @@ export class RdDStatBlockParser { } // If creature we need to setup additionnal fields - if (actorType == "creature") { - let plusDom = XRegExp.exec(statString, XRegExp("\\+dom\\s+(?\\+\\d+)", 'giu')); - if (plusDom?.values) { - actorData.attributs.plusdom.value = Number(plusDom.value); - } - let protection = XRegExp.exec(statString, XRegExp("protection\\s+(?\\d+)", 'giu')); - if (protection?.value) { - actorData.attributs.protection.value = Number(protection.value); - } - let endurance = XRegExp.exec(statString, XRegExp("endurance\\s+(?\\d+)", 'giu')); - if (endurance?.value) { - actorData.sante.endurance.value = Number(endurance.value); - actorData.sante.endurance.max = Number(endurance.value); - } - let vie = XRegExp.exec(statString, XRegExp("vie\\s+(?\\d+)", 'giu')); - if (vie.value) { - actorData.sante.vie.value = Number(vie.value); - actorData.sante.vie.max = Number(vie.value); - } - let vitesse = XRegExp.exec(statString, XRegExp("vitesse\\s+(?[\\d\\/]+)", 'giu')); - if (vitesse?.value) { - actorData.attributs.vitesse.value = vitesse.value; - } + switch (actorType) { + case "creature": + RdDStatBlockParser.parseCreature(statString, actorData) + break + case "entite": + RdDStatBlockParser.parseEntite(statString, actorData) + break } let items = []; @@ -353,11 +334,8 @@ export class RdDStatBlockParser { } } } - if (actorType == "creature" && skill.init) { - items.push(comp); // Only selective push - } - if (actorType == "personnage") { - items.push(comp); // Always push + if (actorType == "personnage" || skill!= undefined){ + items.push(comp) } } @@ -418,10 +396,10 @@ export class RdDStatBlockParser { items.push(sort); } }); - if (hautRevant) { + if (hautRevant) { let tetes = await SystemCompendiums.getWorldOrCompendiumItems("tete", "tetes-de-dragon-pour-tous-personnages") let donHR = tetes.find(t => Grammar.equalsInsensitive(t.name, "Don de Haut-Rêve")) - if (donHR) { + if (donHR) { items.push(donHR.toObject()); } } @@ -474,6 +452,63 @@ export class RdDStatBlockParser { console.log(actorData); } + static parseCreature(statString, actorData) { + let plusDom = XRegExp.exec(statString, XRegExp("\\+dom\\s+(?[\\+\\-]?\\d+)", 'giu')); + if (plusDom?.values) { + actorData.attributs.plusdom.value = Number(plusDom.value); + } + let protection = XRegExp.exec(statString, XRegExp("protection\\s+(?[\\-]?\\d+)", 'giu')); + if (protection?.value) { + actorData.attributs.protection.value = Number(protection.value); + } + let endurance = XRegExp.exec(statString, XRegExp("endurance\\s+(?\\d+)", 'giu')); + if (endurance?.value) { + actorData.sante.endurance.value = Number(endurance.value); + actorData.sante.endurance.max = Number(endurance.value); + } + let vie = XRegExp.exec(statString, XRegExp("vie\\s+(?\\d+)", 'giu')); + if (vie.value) { + actorData.sante.vie.value = Number(vie.value); + actorData.sante.vie.max = Number(vie.value); + } + let vitesse = XRegExp.exec(statString, XRegExp("vitesse\\s+(?[\\d\\/]+)", 'giu')); + if (vitesse?.value) { + actorData.attributs.vitesse.value = vitesse.value; + } + } + + static parseEntite(statString, actorData) { + let plusDom = XRegExp.exec(statString, XRegExp("\\+dom\\s+(?[\\+\\-]?\\d+)", 'giu')); + if (plusDom?.values) { + actorData.attributs.plusdom.value = Number(plusDom.value); + } + + actorData.definition.categorieentite = 'cauchemar' + actorData.definition.typeentite = ENTITE_NONINCARNE + let endurance = XRegExp.exec(statString, XRegExp("endurance\\s+(?\\d+)", 'giu')); + if (endurance?.value) { + actorData.sante.endurance.value = Number(endurance.value); + actorData.sante.endurance.max = Number(endurance.value); + actorData.definition.typeentite = ENTITE_INCARNE + } + let vitesse = XRegExp.exec(statString, XRegExp("vitesse\\s+(?[\\d\\/]+)", 'giu')); + if (vitesse?.value) { + actorData.attributs.vitesse.value = vitesse.value; + } + } + + static parseActorType(statString) { + let niveau = XRegExp.exec(statString, XRegExp("Niveau\\s+(?[\\+\\-]?\\d+)", 'giu')) + let perception = XRegExp.exec(statString, XRegExp("perception\\s+(?\\d+)", 'giu')) + if (perception?.value) { + return "creature" + } + if (niveau?.value) { + return "entite" + } + return "personnage" + } + static extractName(actorType, statString) { switch (actorType) { case "personnage": return RdDStatBlockParser.extractNamePersonnage(statString); -- 2.35.3 From fa375f80928b93328cab238c6a680a495ca5063c Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Tue, 3 Dec 2024 00:49:03 +0100 Subject: [PATCH 3/3] =?UTF-8?q?Am=C3=A9liorations=20parser?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - armure équipée - armes équipées - ajout des bonus de cases - dommages des créatures - ajout des esquives spéciales - fix édition feuilles de compétences créatures - déplacement des valeurs de test en fin de fichier --- module/apps/rdd-import-stats.js | 699 +++++++++--------- module/item-competencecreature.js | 2 +- ...ecreature_Esquive_eau_Qrg3ADB9LOhGthaO.yml | 35 + ...ecreature_Esquive_sol_siPvW3hAMCJbrYvq.yml | 35 + ...ecreature_Esquive_vol_3ScoGTkQ0VBOpaX6.yml | 35 + 5 files changed, 471 insertions(+), 335 deletions(-) create mode 100644 packs_src/competences-creatures/competencecreature_Esquive_eau_Qrg3ADB9LOhGthaO.yml create mode 100644 packs_src/competences-creatures/competencecreature_Esquive_sol_siPvW3hAMCJbrYvq.yml create mode 100644 packs_src/competences-creatures/competencecreature_Esquive_vol_3ScoGTkQ0VBOpaX6.yml diff --git a/module/apps/rdd-import-stats.js b/module/apps/rdd-import-stats.js index 0f938010..894f594f 100644 --- a/module/apps/rdd-import-stats.js +++ b/module/apps/rdd-import-stats.js @@ -6,6 +6,370 @@ import { Grammar } from "../grammar.js"; import { Misc } from "../misc.js"; import { ENTITE_INCARNE, ENTITE_NONINCARNE } from "../constants.js"; +const WHITESPACES = "\\s+" +const NUMERIC = "[\\+\\-]?\\d+" +const NUMERIC_VALUE = "(?" + NUMERIC + ")" + +const XREGEXP_NAME = "(?[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+)" +const XREGEXP_COMP_CREATURE = WHITESPACES + "(?\\d+)" + + WHITESPACES + NUMERIC_VALUE + + "(" + WHITESPACES + "(?\\d+)?\\s+?(?[\\+\\-]?\\d+)?" + ")?" + +// Skill parser depending on the type of actor +const compParser = { + personnage: "(\\D+)*" + WHITESPACES + NUMERIC_VALUE, + creature: XREGEXP_COMP_CREATURE, + entite: XREGEXP_COMP_CREATURE +} + +const XREGEXP_SORT_VOIE = "[OHNT\\/]+" +const XREGEXP_SORT_CASE = "\\((?[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+)\\)"; + +const XREGEXP_SORT = "(" + XREGEXP_SORT_VOIE + + WHITESPACES + XREGEXP_NAME + + WHITESPACES + XREGEXP_SORT_CASE + + WHITESPACES + "R(?([\\-\\d]+|(\\w|\\s)+))" + + WHITESPACES + "r(?(\\d+(\\+)?|\\s\\w+))" + + "(" + WHITESPACES + "\\+(?\\d+)\\s?%" + WHITESPACES + "en" + WHITESPACES + "(?[A-M]\\d{1,2})" + ")?" + + ")" + + +// Main class for parsing a stat block +export class RdDStatBlockParser { + + static openInputDialog() { + let dialog = new Dialog({ + title: "Import de stats de PNJ/Créatures", + content: ` +
+

Coller le texte de la stat ici

+ +
+ `, + buttons: { + ok: { + label: "OK", + callback: async (html) => { + let statBlock = html.find("#statBlock")[0].value; + await RdDStatBlockParser.parseStatBlock(statBlock); + dialog.close(); + } + }, + cancel: { + label: "Cancel" + } + } + }); + dialog.render(true); + } + + static fixWeirdPDF(statString) { + // Split the statString into lines + let lines = statString.split("\n"); + let newLines = []; + let index = 0; + let nextType = "string"; + // Loop through each line + for (let i = 0; i < lines.length; i++) { + // remove trailing spaces + lines[i] = lines[i].trim(); + // Is it text ? + if (lines[i].match(/^[a-zA-Zéêè\s]+/)) { + if (nextType == "string") { + newLines[index] = lines[i]; + nextType = "number"; + } else { + console.log("Wrong sequence string detected...", lines[i], nextType); + } + } + // Is it a number ? + if (lines[i].match(/^[\d\s]+/)) { + if (nextType == "number") { + newLines[index] = newLines[index] + lines[i]; + nextType = "string"; + index++; + } else { + console.log("Wrong sequence number detected...", lines[i], nextType); + } + } + } + } + + static getHeureKey(heure) { + for (let h of game.system.rdd.config.heuresRdD) { + if (h.label.toLowerCase() == heure.toLowerCase()) { + return h.value; + } + } + return "vaisseau"; + } + + static async parseStatBlock(statString, type = "npc") { + + //statString = statBlock03; + if (!statString) { + return; + } + + // Special function to fix strange/weird copy/paste from PDF readers + // Unused up to now : this.fixWeirdPDF(statString); + + // Replace all endline by space in the statString + statString = statString.replace(/\n/g, " "); + // Remove all multiple spaces + statString = statString.replace(/\s{2,}/g, " "); + // Remove all leading and trailing spaces + statString = statString.trim(); + + // TODO: check for entite + let actorType = RdDStatBlockParser.parseActorType(statString); + + // Now start carac + let actorData = foundry.utils.deepClone(game.model.Actor[actorType]); + for (let key in actorData.carac) { + let caracDef = actorData.carac[key]; + // Parse the stat string for each caracteristic + let carac = XRegExp.exec(statString, XRegExp(caracDef.label + "\\s+(?\\d+)", 'giu')); + if (carac?.value) { + actorData.carac[key].value = Number(carac.value); + } + } + + // If creature we need to setup additionnal fields + switch (actorType) { + case "creature": + RdDStatBlockParser.parseCreature(statString, actorData) + break + case "entite": + RdDStatBlockParser.parseEntite(statString, actorData) + break + } + + let items = []; + // Get skills from compendium + const competences = await SystemCompendiums.getCompetences(actorType); + //console.log("Competences : ", competences); + for (let comp of competences) { + let compMatch = XRegExp.exec(statString, XRegExp(comp.name + compParser[actorType], 'giu')); + if (compMatch) { + comp = comp.toObject() + comp.system.niveau = Number(compMatch.value); + if (actorType == "creature" || actorType == "entite") { + comp.system.carac_value = Number(compMatch.carac); + if (compMatch.dommages != undefined) { + comp.system.dommages = Number(compMatch.dommages); + comp.system.iscombat = true; + } + } + items.push(comp) + } + else if (actorType == "personnage") { + comp = comp.toObject() + items.push(comp) + } + } + + // Now process weapons + const weapons = await SystemCompendiums.getWorldOrCompendiumItems("arme", "equipement") + //console.log("Equipement : ", equipment); + // TODO: les noms d'armes peuvent avoir un suffixe (à une main, lancée) qui détermine la compétence correspondante + // TODO: une arme peut être spécifique ("fourche"), ajouter une compétence dans ces cas là? + for (let weapon of weapons) { + let weapMatch = XRegExp.exec(statString, XRegExp(weapon.name + "\\s+(?\\+\\d+)", 'giu')); + if (weapMatch) { + weapon = weapon.toObject() + weapon.system.equipe = 'true' + items.push(weapon) + // now process the skill + if (weapon.system?.competence != "") { + let wComp = items.find(i => Grammar.equalsInsensitive(i.name, weapon.system.competence)) + if (wComp) { + wComp.system.niveau = Number(weapMatch.value); + } + } + if (weapon.system?.tir != "") { + let wComp = items.find(i => Grammar.equalsInsensitive(i.name, weapon.system.tir)) + if (wComp) { + wComp.system.niveau = Number(weapMatch.value); + } + } + if (weapon.system?.lancer != "") { + let wComp = items.find(i => Grammar.equalsInsensitive(i.name, weapon.system.lancer)) + if (wComp) { + wComp.system.niveau = Number(weapMatch.value); + } + } + } + } + + // Now process armors + const armors = await SystemCompendiums.getWorldOrCompendiumItems("armure", "equipement") + for (let armor of armors) { + let matchArmor = XRegExp.exec(statString, XRegExp(armor.name, 'giu')); + if (matchArmor) { + armor = armor.toObject() + armor.system.equipe = true + items.push(armor); + } + } + + // Attemp to detect spell + let hautRevant = false + let sorts = await SystemCompendiums.getWorldOrCompendiumItems("sort", "sorts-oniros") + sorts = sorts.concat(await SystemCompendiums.getWorldOrCompendiumItems("sort", "sorts-hypnos")) + sorts = sorts.concat(await SystemCompendiums.getWorldOrCompendiumItems("sort", "sorts-narcos")) + sorts = sorts.concat(await SystemCompendiums.getWorldOrCompendiumItems("sort", "sorts-thanatos")) + + XRegExp.forEach(statString, XRegExp(XREGEXP_SORT, 'giu'), + function (matchSort, i) { + let sort = sorts.find(s => Grammar.equalsInsensitive(s.name, matchSort.name)) + if (sort) { + hautRevant = true + sort = sort.toObject(); + if (matchSort.bonus && matchSort.bonuscase) { + sort.system.bonuscase = `${matchSort.bonuscase}:${matchSort.bonus}` + } + items.push(sort); + } + }); + + if (hautRevant) { + let tetes = await SystemCompendiums.getWorldOrCompendiumItems("tete", "tetes-de-dragon-pour-tous-personnages") + let donHR = tetes.find(t => Grammar.equalsInsensitive(t.name, "Don de Haut-Rêve")) + if (donHR) { + items.push(donHR.toObject()); + } + } + if (actorType == "personnage") { + + let feminin = XRegExp.exec(statString, XRegExp("né(?e?) à", 'giu')); + actorData.sexe = (feminin?.value == 'e') ? 'féminin' : 'masculin' + + // Get hour name : heure du XXXXX + let heure = XRegExp.exec(statString, XRegExp("heure (du|de la|des|de l\')\\s*(?[A-Za-zÀ-ÖØ-öø-ÿ\\s]+),", 'giu')); + actorData.heure = this.getHeureKey(heure?.value || "Vaisseau"); + + // Get age + let age = XRegExp.exec(statString, XRegExp("(?\\d+) ans", 'giu')); + if (age?.value) { + actorData.age = Number(age.value); + } + // Get height + let taille = XRegExp.exec(statString, XRegExp("(?\\d+m\\d+)", 'giu')); + if (taille?.value) { + actorData.taille = taille.value; + } + // Get weight + let poids = XRegExp.exec(statString, XRegExp("(?\\d+) kg", 'giu')); + if (poids?.value) { + actorData.poids = poids.value; + } + // Get cheveux + let cheveux = XRegExp.exec(statString, XRegExp("kg,\\s+(?[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+),\\s+yeux", 'giu')); + if (cheveux?.value) { + actorData.cheveux = cheveux.value; + } + // Get yeux + let yeux = XRegExp.exec(statString, XRegExp("yeux\\s+(?[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+), Beau", 'giu')); + if (yeux?.value) { + actorData.yeux = yeux.value; + } + + // Get beauty + let beaute = XRegExp.exec(statString, XRegExp("beauté\\s+(?\\d+)", 'giu')); + if (beaute?.value) { + actorData.beaute = Number(beaute.value); + } + } + + // Name is all string before ', né' + let name = RdDStatBlockParser.extractName(actorType, statString); + + let newActor = RdDBaseActorReve.create({ name: name || "Importé", type: actorType, system: actorData, items: items }); + + // DUmp.... + console.log(actorData); + } + + static parseCreature(statString, actorData) { + let plusDom = XRegExp.exec(statString, XRegExp("\\+dom\\s+(?[\\+\\-]?\\d+)", 'giu')); + if (plusDom?.values) { + actorData.attributs.plusdom.value = Number(plusDom.value); + } + let protection = XRegExp.exec(statString, XRegExp("protection\\s+(?[\\-]?\\d+)", 'giu')); + if (protection?.value) { + actorData.attributs.protection.value = Number(protection.value); + } + let endurance = XRegExp.exec(statString, XRegExp("endurance\\s+(?\\d+)", 'giu')); + if (endurance?.value) { + actorData.sante.endurance.value = Number(endurance.value); + actorData.sante.endurance.max = Number(endurance.value); + } + let vie = XRegExp.exec(statString, XRegExp("vie\\s+(?\\d+)", 'giu')); + if (vie.value) { + actorData.sante.vie.value = Number(vie.value); + actorData.sante.vie.max = Number(vie.value); + } + let vitesse = XRegExp.exec(statString, XRegExp("vitesse\\s+(?[\\d\\/]+)", 'giu')); + if (vitesse?.value) { + actorData.attributs.vitesse.value = vitesse.value; + } + } + + static parseEntite(statString, actorData) { + let plusDom = XRegExp.exec(statString, XRegExp("\\+dom\\s+(?[\\+\\-]?\\d+)", 'giu')); + if (plusDom?.values) { + actorData.attributs.plusdom.value = Number(plusDom.value); + } + + actorData.definition.categorieentite = 'cauchemar' + actorData.definition.typeentite = ENTITE_NONINCARNE + let endurance = XRegExp.exec(statString, XRegExp("endurance\\s+(?\\d+)", 'giu')); + if (endurance?.value) { + actorData.sante.endurance.value = Number(endurance.value); + actorData.sante.endurance.max = Number(endurance.value); + actorData.definition.typeentite = ENTITE_INCARNE + } + let vitesse = XRegExp.exec(statString, XRegExp("vitesse\\s+(?[\\d\\/]+)", 'giu')); + if (vitesse?.value) { + actorData.attributs.vitesse.value = vitesse.value; + } + } + + static parseActorType(statString) { + let niveau = XRegExp.exec(statString, XRegExp("Niveau\\s+(?[\\+\\-]?\\d+)", 'giu')) + let perception = XRegExp.exec(statString, XRegExp("perception\\s+(?\\d+)", 'giu')) + if (perception?.value) { + return "creature" + } + if (niveau?.value) { + return "entite" + } + return "personnage" + } + + static extractName(actorType, statString) { + switch (actorType) { + case "personnage": return RdDStatBlockParser.extractNamePersonnage(statString); + case "creature": return RdDStatBlockParser.extractNameCreature(statString); + } + return RdDStatBlockParser.extractNameCreature(statString); + } + + static extractNamePersonnage(statString) { + let name = XRegExp.exec(statString, XRegExp("(?[\\p{Letter}\\s\\d]+),", 'giu')); + if (!name?.value) { + name = XRegExp.exec(statString, XRegExp("(?.+)\\s+taille", 'giu')); + } + return Misc.upperFirst(name?.value || "Importé"); + } + + static extractNameCreature(statString) { + const name = XRegExp.exec(statString, XRegExp("(?.+)\\s+taille", 'giu')); + return Misc.upperFirst(name?.value || "Importé"); + } +} + /************************************************************************************/ // Some internal test strings let statBlock01 = `+$16(/, baron de Sylvedire, né à l’heure du @@ -197,337 +561,4 @@ Discrétion Vigilance 13 +3 - ` -// Skill parser depending on the type of actor -const compParser = { - personnage: "(\\D+)*\\s+(?[\\+\\-]?\\d+)", - creature: "\\s+(?\\d+)\\s+(?[\\+\\-]?\\d+)\\s?(?\\d+)?\\s+?(?\\+\\d+)?" -}; - -// Main class for parsing a stat block -export class RdDStatBlockParser { - - static openInputDialog() { - let dialog = new Dialog({ - title: "Import de stats de PNJ/Créatures", - content: ` -
-

Coller le texte de la stat ici

- -
- `, - buttons: { - ok: { - label: "OK", - callback: async (html) => { - let statBlock = html.find("#statBlock")[0].value; - await RdDStatBlockParser.parseStatBlock(statBlock); - dialog.close(); - } - }, - cancel: { - label: "Cancel" - } - } - }); - dialog.render(true); - } - - static fixWeirdPDF(statString) { - // Split the statString into lines - let lines = statString.split("\n"); - let newLines = []; - let index = 0; - let nextType = "string"; - // Loop through each line - for (let i = 0; i < lines.length; i++) { - // remove trailing spaces - lines[i] = lines[i].trim(); - // Is it text ? - if (lines[i].match(/^[a-zA-Zéêè\s]+/)) { - if (nextType == "string") { - newLines[index] = lines[i]; - nextType = "number"; - } else { - console.log("Wrong sequence string detected...", lines[i], nextType); - } - } - // Is it a number ? - if (lines[i].match(/^[\d\s]+/)) { - if (nextType == "number") { - newLines[index] = newLines[index] + lines[i]; - nextType = "string"; - index++; - } else { - console.log("Wrong sequence number detected...", lines[i], nextType); - } - } - } - - } - - static getHeureKey(heure) { - for (let h of game.system.rdd.config.heuresRdD) { - if (h.label.toLowerCase() == heure.toLowerCase()) { - return h.value; - } - } - return "vaisseau"; - } - - static async parseStatBlock(statString, type = "npc") { - - //statString = statBlock03; - if (!statString) { - return; - } - - // Special function to fix strange/weird copy/paste from PDF readers - // Unused up to now : this.fixWeirdPDF(statString); - - // Replace all endline by space in the statString - statString = statString.replace(/\n/g, " "); - // Remove all multiple spaces - statString = statString.replace(/\s{2,}/g, " "); - // Remove all leading and trailing spaces - statString = statString.trim(); - - // TODO: check for entite - let actorType = RdDStatBlockParser.parseActorType(statString); - - // Now start carac - let actorData = foundry.utils.deepClone(game.model.Actor[actorType]); - for (let key in actorData.carac) { - let caracDef = actorData.carac[key]; - // Parse the stat string for each caracteristic - let carac = XRegExp.exec(statString, XRegExp(caracDef.label + "\\s+(?\\d+)", 'giu')); - if (carac?.value) { - actorData.carac[key].value = Number(carac.value); - } - } - - // If creature we need to setup additionnal fields - switch (actorType) { - case "creature": - RdDStatBlockParser.parseCreature(statString, actorData) - break - case "entite": - RdDStatBlockParser.parseEntite(statString, actorData) - break - } - - let items = []; - // Get skills from compendium - const competences = await SystemCompendiums.getCompetences(actorType); - //console.log("Competences : ", competences); - let allComp = competences.map(i => i.toObject()) - for (let comp of allComp) { - const compName = comp.name; - let skill = XRegExp.exec(Grammar.toLowerCaseNoAccent(statString), XRegExp(Grammar.toLowerCaseNoAccent(compName) + compParser[actorType], 'giu')); - if (skill) { - comp.system.niveau = Number(skill.value); - if (actorType == "creature") { - comp.system.carac_value = Number(skill.carac); - if (skill.init) { - comp.system.dommages = Number(skill.dommages); - comp.system.iscombat = true; - } - } - } - if (actorType == "personnage" || skill!= undefined){ - items.push(comp) - } - } - - // Now process weapons - const weapons = await SystemCompendiums.getWorldOrCompendiumItems("arme", "equipement") - //console.log("Equipement : ", equipment); - // TODO: les noms d'armes peuvent avoir un suffixe (à une main, lancée) qui détermine la compétence correspondante - // TODO: une arme peut être spécifique ("fourche"), ajouter une compétence dans ces cas là? - for (let w of weapons) { - let weapon = XRegExp.exec(statString, XRegExp(w.name + "\\s+(?\\+\\d+)", 'giu')); - if (weapon) { - w.system.equipe = 'true' - items.push(w.toObject()); - // now process the skill - if (w.system?.competence != "") { - let wComp = items.find(i => Grammar.equalsInsensitive(i.name, w.system.competence)) - if (wComp) { - wComp.system.niveau = Number(weapon.value); - } - } - if (w.system?.tir != "") { - let wComp = items.find(i => Grammar.equalsInsensitive(i.name, w.system.tir)) - if (wComp) { - wComp.system.niveau = Number(weapon.value); - } - } - if (w.system?.lancer != "") { - let wComp = items.find(i => Grammar.equalsInsensitive(i.name, w.system.lancer)) - if (wComp) { - wComp.system.niveau = Number(weapon.value); - } - } - } - } - - // Now process armors - const armors = await SystemCompendiums.getWorldOrCompendiumItems("armure", "equipement") - for (let a of armors) { - let armor = XRegExp.exec(statString, XRegExp(a.name, 'giu')); - if (armor) { - a.system.equipe = true - items.push(a.toObject()); - } - } - - // Attemp to detect spell - let hautRevant = false - let sorts = await SystemCompendiums.getWorldOrCompendiumItems("sort", "sorts-oniros") - sorts = sorts.concat(await SystemCompendiums.getWorldOrCompendiumItems("sort", "sorts-hypnos")) - sorts = sorts.concat(await SystemCompendiums.getWorldOrCompendiumItems("sort", "sorts-narcos")) - sorts = sorts.concat(await SystemCompendiums.getWorldOrCompendiumItems("sort", "sorts-thanatos")) - XRegExp.forEach(statString, XRegExp("[OHNT]\\s+(?[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+)\\s+\\((?[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+)\\)\\s+R(?[\\-\\d]+)\\s+r(?\\d+)", 'giu'), - function (match, i) { - let sortCompendium = sorts.find(s => Grammar.equalsInsensitive(s.name, match.name)) - if (sortCompendium) { - hautRevant = true - let sort = sortCompendium.toObject(); - items.push(sort); - } - }); - if (hautRevant) { - let tetes = await SystemCompendiums.getWorldOrCompendiumItems("tete", "tetes-de-dragon-pour-tous-personnages") - let donHR = tetes.find(t => Grammar.equalsInsensitive(t.name, "Don de Haut-Rêve")) - if (donHR) { - items.push(donHR.toObject()); - } - } - - let feminin = XRegExp.exec(statString, XRegExp("né(?e?) à", 'giu')); - actorData.sexe = (feminin?.value == 'e') ? 'féminin' : 'masculin' - - // Get hour name : heure du XXXXX - let heure = XRegExp.exec(statString, XRegExp("heure (du|de la|des|de l\')\\s*(?[A-Za-zÀ-ÖØ-öø-ÿ\\s]+),", 'giu')); - actorData.heure = this.getHeureKey(heure?.value || "Vaisseau"); - - // Get age - let age = XRegExp.exec(statString, XRegExp("(?\\d+) ans", 'giu')); - if (age?.value) { - actorData.age = Number(age.value); - } - // Get height - let taille = XRegExp.exec(statString, XRegExp("(?\\d+m\\d+)", 'giu')); - if (taille?.value) { - actorData.taille = taille.value; - } - // Get weight - let poids = XRegExp.exec(statString, XRegExp("(?\\d+) kg", 'giu')); - if (poids?.value) { - actorData.poids = poids.value; - } - // Get cheveux - let cheveux = XRegExp.exec(statString, XRegExp("kg,\\s+(?[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+),\\s+yeux", 'giu')); - if (cheveux?.value) { - actorData.cheveux = cheveux.value; - } - // Get yeux - let yeux = XRegExp.exec(statString, XRegExp("yeux\\s+(?[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+), Beau", 'giu')); - if (yeux?.value) { - actorData.yeux = yeux.value; - } - - // Get beauty - let beaute = XRegExp.exec(statString, XRegExp("beauté\\s+(?\\d+)", 'giu')); - if (beaute?.value) { - actorData.beaute = Number(beaute.value); - } - - // Name is all string before ', né' - let name = RdDStatBlockParser.extractName(actorType, statString); - - let newActor = RdDBaseActorReve.create({ name: name || "Importé", type: actorType, system: actorData, items: items }); - - // DUmp.... - console.log(actorData); - } - - static parseCreature(statString, actorData) { - let plusDom = XRegExp.exec(statString, XRegExp("\\+dom\\s+(?[\\+\\-]?\\d+)", 'giu')); - if (plusDom?.values) { - actorData.attributs.plusdom.value = Number(plusDom.value); - } - let protection = XRegExp.exec(statString, XRegExp("protection\\s+(?[\\-]?\\d+)", 'giu')); - if (protection?.value) { - actorData.attributs.protection.value = Number(protection.value); - } - let endurance = XRegExp.exec(statString, XRegExp("endurance\\s+(?\\d+)", 'giu')); - if (endurance?.value) { - actorData.sante.endurance.value = Number(endurance.value); - actorData.sante.endurance.max = Number(endurance.value); - } - let vie = XRegExp.exec(statString, XRegExp("vie\\s+(?\\d+)", 'giu')); - if (vie.value) { - actorData.sante.vie.value = Number(vie.value); - actorData.sante.vie.max = Number(vie.value); - } - let vitesse = XRegExp.exec(statString, XRegExp("vitesse\\s+(?[\\d\\/]+)", 'giu')); - if (vitesse?.value) { - actorData.attributs.vitesse.value = vitesse.value; - } - } - - static parseEntite(statString, actorData) { - let plusDom = XRegExp.exec(statString, XRegExp("\\+dom\\s+(?[\\+\\-]?\\d+)", 'giu')); - if (plusDom?.values) { - actorData.attributs.plusdom.value = Number(plusDom.value); - } - - actorData.definition.categorieentite = 'cauchemar' - actorData.definition.typeentite = ENTITE_NONINCARNE - let endurance = XRegExp.exec(statString, XRegExp("endurance\\s+(?\\d+)", 'giu')); - if (endurance?.value) { - actorData.sante.endurance.value = Number(endurance.value); - actorData.sante.endurance.max = Number(endurance.value); - actorData.definition.typeentite = ENTITE_INCARNE - } - let vitesse = XRegExp.exec(statString, XRegExp("vitesse\\s+(?[\\d\\/]+)", 'giu')); - if (vitesse?.value) { - actorData.attributs.vitesse.value = vitesse.value; - } - } - - static parseActorType(statString) { - let niveau = XRegExp.exec(statString, XRegExp("Niveau\\s+(?[\\+\\-]?\\d+)", 'giu')) - let perception = XRegExp.exec(statString, XRegExp("perception\\s+(?\\d+)", 'giu')) - if (perception?.value) { - return "creature" - } - if (niveau?.value) { - return "entite" - } - return "personnage" - } - - static extractName(actorType, statString) { - switch (actorType) { - case "personnage": return RdDStatBlockParser.extractNamePersonnage(statString); - case "creature": return RdDStatBlockParser.extractNameCreature(statString); - } - return RdDStatBlockParser.extractNameCreature(statString); - } - - static extractNamePersonnage(statString) { - let name = XRegExp.exec(statString, XRegExp("(?[\\p{Letter}\\s\\d]+),", 'giu')); - if (!name?.value) { - name = XRegExp.exec(statString, XRegExp("(?.+)\\s+taille", 'giu')); - } - return Misc.upperFirst(name?.value || "Importé"); - } - - static extractNameCreature(statString) { - const name = XRegExp.exec(statString, XRegExp("(?.+)\\s+taille", 'giu')); - return Misc.upperFirst(name?.value || "Importé"); - } -} - +` diff --git a/module/item-competencecreature.js b/module/item-competencecreature.js index 4fefb887..8648d8bd 100644 --- a/module/item-competencecreature.js +++ b/module/item-competencecreature.js @@ -81,7 +81,7 @@ export class RdDItemCompetenceCreature extends Item { static isParade(item) { if (item.type == ITEM_TYPES.competencecreature) { - return armeData.system.categorie_parade || armeData.system.isparade + return item.system.categorie_parade || item.system.isparade } return false } diff --git a/packs_src/competences-creatures/competencecreature_Esquive_eau_Qrg3ADB9LOhGthaO.yml b/packs_src/competences-creatures/competencecreature_Esquive_eau_Qrg3ADB9LOhGthaO.yml new file mode 100644 index 00000000..9700dddc --- /dev/null +++ b/packs_src/competences-creatures/competencecreature_Esquive_eau_Qrg3ADB9LOhGthaO.yml @@ -0,0 +1,35 @@ +name: Esquive eau +type: competencecreature +img: systems/foundryvtt-reve-de-dragon/icons/competence_esquive.webp +effects: [] +system: + description: '' + descriptionmj: '' + carac_value: 10 + niveau: 1 + default_diffLibre: 0 + categorie: generale + categorie_parade: '' + iscombat: false + isnaturelle: true + ispossession: false + dommages: 0 + mortalite: mortel + isparade: false +ownership: + default: 0 +folder: null +_stats: + compendiumSource: null + duplicateSource: null + coreVersion: '12.331' + systemId: foundryvtt-reve-de-dragon + systemVersion: 12.0.24 + createdTime: 1733182927319 + modifiedTime: 1733182927336 + lastModifiedBy: Hp9ImM4o9YRTSdfu +flags: {} +_id: Qrg3ADB9LOhGthaO +sort: 1300000 +_key: '!items!Qrg3ADB9LOhGthaO' + diff --git a/packs_src/competences-creatures/competencecreature_Esquive_sol_siPvW3hAMCJbrYvq.yml b/packs_src/competences-creatures/competencecreature_Esquive_sol_siPvW3hAMCJbrYvq.yml new file mode 100644 index 00000000..db5434fb --- /dev/null +++ b/packs_src/competences-creatures/competencecreature_Esquive_sol_siPvW3hAMCJbrYvq.yml @@ -0,0 +1,35 @@ +name: Esquive sol +type: competencecreature +img: systems/foundryvtt-reve-de-dragon/icons/competence_esquive.webp +effects: [] +system: + description: '' + descriptionmj: '' + carac_value: 10 + niveau: 1 + default_diffLibre: 0 + categorie: generale + categorie_parade: '' + iscombat: false + isnaturelle: true + ispossession: false + dommages: 0 + mortalite: mortel + isparade: false +ownership: + default: 0 +folder: null +_stats: + compendiumSource: null + duplicateSource: null + coreVersion: '12.331' + systemId: foundryvtt-reve-de-dragon + systemVersion: 12.0.24 + createdTime: 1733182930109 + modifiedTime: 1733182930109 + lastModifiedBy: Hp9ImM4o9YRTSdfu +flags: {} +_id: siPvW3hAMCJbrYvq +sort: 0 +_key: '!items!siPvW3hAMCJbrYvq' + diff --git a/packs_src/competences-creatures/competencecreature_Esquive_vol_3ScoGTkQ0VBOpaX6.yml b/packs_src/competences-creatures/competencecreature_Esquive_vol_3ScoGTkQ0VBOpaX6.yml new file mode 100644 index 00000000..971ad0a4 --- /dev/null +++ b/packs_src/competences-creatures/competencecreature_Esquive_vol_3ScoGTkQ0VBOpaX6.yml @@ -0,0 +1,35 @@ +name: Esquive vol +type: competencecreature +img: systems/foundryvtt-reve-de-dragon/icons/competence_esquive.webp +effects: [] +system: + description: '' + descriptionmj: '' + carac_value: 10 + niveau: 1 + default_diffLibre: 0 + categorie: generale + categorie_parade: '' + iscombat: false + isnaturelle: true + ispossession: false + dommages: 0 + mortalite: mortel + isparade: false +ownership: + default: 0 +folder: null +_stats: + compendiumSource: null + duplicateSource: null + coreVersion: '12.331' + systemId: foundryvtt-reve-de-dragon + systemVersion: 12.0.24 + createdTime: 1733182932133 + modifiedTime: 1733182932133 + lastModifiedBy: Hp9ImM4o9YRTSdfu +flags: {} +_id: 3ScoGTkQ0VBOpaX6 +sort: 0 +_key: '!items!3ScoGTkQ0VBOpaX6' + -- 2.35.3