From 8e80c7a00511a8ef8f0e8c1cdafcddca8264be50 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Tue, 20 Jul 2021 15:15:13 +0200 Subject: [PATCH] Fix commande /auberge --- addon-register.js | 22 +++++++++------------- module.json | 2 +- packs/antidotes-and-remedes.db | 2 +- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/addon-register.js b/addon-register.js index a710eda..aa33bbe 100644 --- a/addon-register.js +++ b/addon-register.js @@ -37,8 +37,8 @@ const _manage_inn_roll = async (content, msg) => { let command = content.split(" ").map(function(item) { return item.trim(); }) - //console.log(game.wfrp4e.tables["talents"]); + console.log("COMMANDES", command); if (command[0] == "/auberge" && command[1] ) { msg["type"] = 0; @@ -46,17 +46,14 @@ const _manage_inn_roll = async (content, msg) => { var compendium = game.packs.get('WH4-fr-translation.plats-dauberges'); let rollList = []; await compendium.getIndex().then(index => rollList = index); - //console.log("Got compendium...", rollList.length); + rollList = rollList.contents; for (var i=0; i< rollList.length; i++) { var rollTab = rollList[i]; + console.log("Got compendium...", rollList, rollTab.name); if ( rollTab.name.toLowerCase().includes(command[1].toLowerCase()) ) { let my_rollTable; - await compendium.getEntity(rollTab._id).then(mytab => my_rollTable = mytab); - let myroll = my_rollTable.roll(); - //console.log("RES: ", myroll ); - msg.content = my_rollTable.name + " : " + myroll.results[0].text; - //my_rollTable.draw(); - ChatMessage.create(msg); + await compendium.getDocument(rollTab._id).then(mytab => my_rollTable = mytab); + my_rollTable.draw( { rollMode : "gmroll"} ); return false; } } @@ -243,7 +240,7 @@ const __add_actors_translation = ( ) => { //newpack = new TranslatedCompendium(pack, translations); //console.log("Actor compendium has been replaced !!!!", pack.metadata.name); } - console.log("Parsing pack", metadata); + //console.log("Parsing pack", metadata); if (!game.babele.isTranslated(metadata) && metadata.name == "forien-armoury" ) { /** TODO !!!/ metadata.mapping.mapping["qualities"] = { @@ -265,12 +262,11 @@ const __add_actors_translation = ( ) => { /************************************************************************************/ /* Hook for specific command */ Hooks.on("chatMessage", (html, content, msg) => { - - if ( content.includes("/auberge") ) { + + if ( content.toLowerCase().includes('auberge') ) { _manage_inn_roll( content, msg ); return false; - } - + } } ); /************************************************************************************/ diff --git a/module.json b/module.json index 38eec49..6a74457 100644 --- a/module.json +++ b/module.json @@ -2,7 +2,7 @@ "name": "WH4-fr-translation", "title": "WFRP4e - Core Module en français.", "description": "Traduction Française pour Warhammer v4.", - "version": "4.0.7", + "version": "4.0.8", "minimumCoreVersion" : "0.8.0", "compatibleCoreVersion": "0.8.8", "author": "LeRatierBretonnien", diff --git a/packs/antidotes-and-remedes.db b/packs/antidotes-and-remedes.db index 4700139..d2e7823 100644 --- a/packs/antidotes-and-remedes.db +++ b/packs/antidotes-and-remedes.db @@ -20,4 +20,4 @@ {"_id":"klCBzk4hwQoPx0KA","name":"Poudre d'Emeraude","permission":{"default":0,"BnP1htmXWwH7JbHW":3},"type":"trapping","data":{"description":{"type":"String","label":"Description","value":"

Les apothicaires ont longtemps soutenu que les pierres précieuses en poudre ont des propriétés efficaces. Si l'Emeraude en poudre est mélangée à du vin ou à un autre alcool, elle a une chance de neutraliser tout poison contaminant cette boisson. 

\n
\n

Après avoir mis en contact la poudre avec l'alcool suspect

\n\n
\n
Forme: Poudre
\n
Type: Décoction
\n
Artisanat: Métier (Apothicaire)
\n
Principe actif: Emeraude
\n
Excipient: Écorce, Farine d'Os, Citron Vert, Potasse
"},"gmdescription":{"type":"String","label":"Description","value":""},"quantity":{"type":"Number","label":"Quantity","value":1},"encumbrance":{"type":"Number","label":"Encumbrance","value":0},"price":{"type":"String","label":"Price","gc":"15","ss":"0","bp":"0"},"availability":{"type":"String","label":"Availability","value":"rare"},"location":{"type":"Number","label":"Location","value":0},"trappingType":{"type":"String","label":"Trapping Type","value":"drugsPoisonsHerbsDraughts"},"worn":false,"spellIngredient":{"type":"String","value":""}},"flags":{},"img":"modules/WH4-fr-translation/icons/apothicarium/Poudre%20d%27Emeuraude.png"} {"_id":"nwSu59iDUP6m8UHa","name":"Racine Sobre","permission":{"default":0,"BnP1htmXWwH7JbHW":3},"type":"trapping","data":{"description":{"type":"String","label":"Description","value":"

Selon la tradition Halfeling, la connaissance de cette plante nous fut donnée par Esmeralda elle-même, après que son premier mari Bibogenitus amena la connaissance du brassage et de la vinification au Moot. On l'appelle Racine Sobre, bien que les Elfes l'appellent Corrylliamid. On la trouve dans les forêts les plus profondes, souvent entre les racines d'un arbre lornalim, ou à côté d'un vieux chêne. Le bulbe est pelé et rôti dans un four jusqu'à ce qu'il soit aussi mou qu'une pomme bien cuite, et ensuite est mangé.

\n

La Racine Sobre est une plante amère ressemblant à un oignon, ayant l'étrange propriété d'annuler les effets de l'alcool.

\n
\n

Après ingurgitation

\n\n
\n
Forme: Gruau
\n
Type: Préparation
\n
Artisanat: Métier (Apothicaire) et Métier (Herboriste)
\n
Principe actif: Racine Sobre
\n
Excipient: Eau, Sel, Herbes
"},"gmdescription":{"type":"String","label":"Description","value":""},"quantity":{"type":"Number","label":"Quantity","value":1},"encumbrance":{"type":"Number","label":"Encumbrance","value":0},"price":{"type":"String","label":"Price","gc":"1","ss":"0","bp":"0"},"availability":{"type":"String","label":"Availability","value":"exotic"},"location":{"type":"Number","label":"Location","value":0},"trappingType":{"type":"String","label":"Trapping Type","value":"drugsPoisonsHerbsDraughts"},"worn":false,"spellIngredient":{"type":"String","value":""}},"flags":{},"img":"modules/WH4-fr-translation/icons/apothicarium/Racine%20Sobre.png"} {"_id":"pUNBdpLe44MEO8v5","name":"Aconit Anti-toxine","permission":{"default":0,"BnP1htmXWwH7JbHW":3},"type":"trapping","data":{"description":{"type":"String","label":"Description","value":"

Fabriquée à partir du sang d'un petit mammifère mort d'un empoisonnement à l'Aconit Napel, cette potion est le seul remède connu contre l'empoisonnement à cette substance ... à part peut être la prière.

\n
\n

Après absorption

\n\n
\n
Forme: Potion
\n
Type: Concoction
\n
Artisanat: Métier (Apothicaire)
\n
Principe actif: Sang de mammifère empoissonné à l'Aconit Napel
\n
Excipient: Écorce, Feuilles, Potasse, Spiritueux
"},"gmdescription":{"type":"String","label":"Description","value":""},"quantity":{"type":"Number","label":"Quantity","value":1},"encumbrance":{"type":"Number","label":"Encumbrance","value":0},"price":{"type":"String","label":"Price","gc":"3","ss":"0","bp":"0"},"availability":{"type":"String","label":"Availability","value":"scarce"},"location":{"type":"Number","label":"Location","value":0},"trappingType":{"type":"String","label":"Trapping Type","value":"drugsPoisonsHerbsDraughts"},"worn":false,"spellIngredient":{"type":"String","value":""}},"flags":{},"img":"modules/WH4-fr-translation/icons/apothicarium/Aconit%20AntiTox.png"} -{"_id":"tNcsMSh8VwCG4caU","name":"Racine de Réglisse","permission":{"default":0,"BnP1htmXWwH7JbHW":3},"type":"trapping","data":{"description":{"type":"String","label":"Description","value":"

Cette plante constitue un traitement efficace contre la Peste Noire. Durant le période active de le maladie, le patient doit recevoir une dose chaque jour.

\n
\n

Après ingurgitation

\n\n
\n
Forme: Gruau
\n
Type: Préparation
\n
Artisanat: Métier (Herboriste)
\n
Principe actif: Racine de Réglisse
\n
Excipient: Cendre, Charbon de Bois, Farine, Eau
"},"gmdescription":{"type":"String","label":"Description","value":""},"quantity":{"type":"Number","label":"Quantity","value":1},"encumbrance":{"type":"Number","label":"Encumbrance","value":0},"price":{"type":"String","label":"Price","gc":"5","ss":"0","bp":"0"},"availability":{"type":"String","label":"Availability","value":"scarce"},"location":{"type":"Number","label":"Location","value":0},"trappingType":{"type":"String","label":"Trapping Type","value":"drugsPoisonsHerbsDraughts"},"worn":false,"spellIngredient":{"type":"String","value":""},"source":{"type":"String","label":"Source"}},"flags":{"_sheetTab":"description"},"img":"modules/WH4-fr-translation/icons/apothicarium/Racine%20de%20Reglisse.png"} \ No newline at end of file +{"_id":"tNcsMSh8VwCG4caU","name":"Racine de Réglisse","permission":{"default":0,"BnP1htmXWwH7JbHW":3},"type":"trapping","data":{"description":{"type":"String","label":"Description","value":"

Cette plante constitue un traitement efficace contre la Peste Noire. Durant le période active de le maladie, le patient doit recevoir une dose chaque jour.

\n
\n

Après ingurgitation

\n\n
\n
Forme: Gruau
\n
Type: Préparation
\n
Artisanat: Métier (Herboriste)
\n
Principe actif: Racine de Réglisse
\n
Excipient: Cendre, Charbon de Bois, Farine, Eau
"},"gmdescription":{"type":"String","label":"Description","value":""},"quantity":{"type":"Number","label":"Quantity","value":1},"encumbrance":{"type":"Number","label":"Encumbrance","value":0},"price":{"type":"String","label":"Price","gc":"5","ss":"0","bp":"0"},"availability":{"type":"String","label":"Availability","value":"scarce"},"location":{"type":"Number","label":"Location","value":0},"trappingType":{"type":"String","label":"Trapping Type","value":"drugsPoisonsHerbsDraughts"},"worn":false,"spellIngredient":{"type":"String","value":""},"source":{"type":"String","label":"Source"}},"flags":{"_sheetTab":"description"},"img":"modules/WH4-fr-translation/icons/apothicarium/Racine%20de%20Reglisse.png"}