From 69551f3499447f2288082957e3d8700b3d321576 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Mon, 26 Jul 2021 23:54:21 +0200 Subject: [PATCH] Fix --- addon-register.js | 2 +- babele-register.js | 30 ++++++++++++++++++++++++++++-- module.json | 2 +- wfrp4.code-workspace | 11 +++++++++++ 4 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 wfrp4.code-workspace diff --git a/addon-register.js b/addon-register.js index aa33bbe..63b5e4f 100644 --- a/addon-register.js +++ b/addon-register.js @@ -214,7 +214,7 @@ const __add_actors_translation = ( ) => { let pack_array = []; for ( let metadata of game.data.packs ) { if(!game.babele.isTranslated(metadata) && metadata.documentName === 'Actor') { - console.log("PACK : ", metadata); + //console.log("PACK : ", metadata); let translations = { "label": metadata.name, "mapping": { diff --git a/babele-register.js b/babele-register.js index 30799b9..209de06 100644 --- a/babele-register.js +++ b/babele-register.js @@ -34,9 +34,35 @@ Hooks.once('init', () => { vo_conditions: vo_conditions } game.wfrp4e.apps.StatBlockParser.parseStatBlock = async function( statString, type = "npc") { - return statParserFR( statString, type); + return statParserFR( statString, type); + } + + /*---------------------------------------------------------------------*/ + game.wfrp4e.utility.handleConditionClick = function(event) { + let cond = $(event.currentTarget).attr("data-cond") + if (!cond) + cond = event.target.text; + cond = cond.trim(); + let condkey + // En vo, les noms d'états sont égaux aux clés en minuscules + if ( game.wfrp4e.config.conditions[cond.toLowerCase()] ) { + condkey = cond.toLowerCase(); + } else { + try { + condkey = game.wfrp4e.utility.findKey(cond.toLowerCase(), game.wfrp4e.config.conditions, {caseInsensitive: true}); + } + catch { + ui.notifications.error("L'état est inconnu : " + cond); + } + } + let condName = game.wfrp4e.config.conditions[condkey]; + let condDescr = game.wfrp4e.config.conditionDescriptions[condkey]; + let messageContent = `${condName}
${condDescr}` + + let chatData = game.wfrp4e.utility.chatDataSetup(messageContent) + ChatMessage.create(chatData); } - + /*---------------------------------------------------------------------*/ game.wfrp4e.entities.ItemWfrp4e.prototype.computeSpellDamage = function(formula, isMagicMissile) { try { diff --git a/module.json b/module.json index bc6e14f..ae0b784 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.9", + "version": "4.0.10", "minimumCoreVersion" : "0.8.0", "compatibleCoreVersion": "0.8.8", "author": "LeRatierBretonnien", diff --git a/wfrp4.code-workspace b/wfrp4.code-workspace new file mode 100644 index 0000000..f36ab1b --- /dev/null +++ b/wfrp4.code-workspace @@ -0,0 +1,11 @@ +{ + "folders": [ + { + "path": "." + }, + { + "path": "../WFRP4e-FoundryVTT" + } + ], + "settings": {} +} \ No newline at end of file