Compare commits

...

15 Commits

1353 changed files with 24606 additions and 4809 deletions

View File

@@ -2841,6 +2841,12 @@
"name": "Combattant au contact", "name": "Combattant au contact",
"tests": "Corps à corps quand vous combattez au contact ou que vous allez au contact" "tests": "Corps à corps quand vous combattez au contact ou que vous allez au contact"
}, },
{
"description": "<p>Vous êtes entraîné à vous placer très près dun adversaire. Vous ne subissez aucune pénalité pour vous battre contre un adversaire avec une arme plus longue que la vôtre. De plus, si vous utilisez les règles optionnelles de Combat au contact (voir page 297), gagnez un bonus de +10 pour toucher votre adversaire.</p>",
"id": "Infighter",
"name": "Combattant au contact",
"tests": "Corps à corps quand vous combattez au contact ou que vous allez au contact"
},
{ {
"description": "<p>Vos appels exaltants peuvent renverser le cours d'une bataille. Référez-vous au tableau suivant pour voir combien de personnes vous pouvez à présent influencer avec votre Compétence @Compendium[wfrp4e-core.items.oMaJZ5cvCJeOUq9H] lors d'une guerre.</p>\n<p>&nbsp;</p>\n<div>\n<table title=\"\" border=\"1\" summary=\"\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>\n<p>Talent pris</p>\n</td>\n<td>\n<p>Nombre de soldats influencés</p>\n</td>\n</tr>\n<tr>\n<td>\n<p>1</p>\n</td>\n<td>\n<p>Normal × 5</p>\n</td>\n</tr>\n<tr>\n<td>\n<p>2</p>\n</td>\n<td>\n<p>Normal × 10</p>\n</td>\n</tr>\n<tr>\n<td>\n<p>3</p>\n</td>\n<td>\n<p>&nbsp;Normal × 20</p>\n</td>\n</tr>\n<tr>\n<td>\n<p>4</p>\n</td>\n<td>\n<p>&nbsp;Normal × 50</p>\n</td>\n</tr>\n<tr>\n<td>\n<p>5</p>\n</td>\n<td>\n<p>&nbsp;Normal × 100</p>\n</td>\n</tr>\n<tr>\n<td>\n<p>6</p>\n</td>\n<td>\n<p>&nbsp;Normal × 200</p>\n</td>\n</tr>\n<tr>\n<td>\n<p>7</p>\n</td>\n<td>\n<p>&nbsp;Normal × 500</p>\n</td>\n</tr>\n<tr>\n<td>\n<p>8</p>\n</td>\n<td>\n<p>&nbsp;Normal × 1000</p>\n</td>\n</tr>\n<tr>\n<td>\n<p>9</p>\n</td>\n<td>\n<p>&nbsp;Tous ceux qui peuvent entendre votre voix inspirante</p>\n</td>\n</tr>\n</tbody>\n</table>\n</div><p><strong>Exemple</strong> : <em>Le monastère de labbesse Brigitte van der Hoogenband est pris dassaut par les peaux-vertes, et les choses vont mal. De fait, elle décide de renforcer lesprit de ses soldats avec un Test de Commandement, leur octroyant +10 à tous les Tests de Psychologie. Elle obtient 3 DR à son Test de Commandement. Étant donné quelle possède un Bonus de Sociabilité de 6, et quelle peut influencer un nombre de soldats, égal à son Bonus de Sociabilité + DR en utilisant Commandement, elle renforce 9 soldats. Cependant, comme elle possède Exaltant 3, ce nombre est multiplié par 20, ce qui signifie que 180 de ses soldats sont inspirés par ses cris dencouragement « MAINTENEZ LES RANGS ! »</em>", "description": "<p>Vos appels exaltants peuvent renverser le cours d'une bataille. Référez-vous au tableau suivant pour voir combien de personnes vous pouvez à présent influencer avec votre Compétence @Compendium[wfrp4e-core.items.oMaJZ5cvCJeOUq9H] lors d'une guerre.</p>\n<p>&nbsp;</p>\n<div>\n<table title=\"\" border=\"1\" summary=\"\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>\n<p>Talent pris</p>\n</td>\n<td>\n<p>Nombre de soldats influencés</p>\n</td>\n</tr>\n<tr>\n<td>\n<p>1</p>\n</td>\n<td>\n<p>Normal × 5</p>\n</td>\n</tr>\n<tr>\n<td>\n<p>2</p>\n</td>\n<td>\n<p>Normal × 10</p>\n</td>\n</tr>\n<tr>\n<td>\n<p>3</p>\n</td>\n<td>\n<p>&nbsp;Normal × 20</p>\n</td>\n</tr>\n<tr>\n<td>\n<p>4</p>\n</td>\n<td>\n<p>&nbsp;Normal × 50</p>\n</td>\n</tr>\n<tr>\n<td>\n<p>5</p>\n</td>\n<td>\n<p>&nbsp;Normal × 100</p>\n</td>\n</tr>\n<tr>\n<td>\n<p>6</p>\n</td>\n<td>\n<p>&nbsp;Normal × 200</p>\n</td>\n</tr>\n<tr>\n<td>\n<p>7</p>\n</td>\n<td>\n<p>&nbsp;Normal × 500</p>\n</td>\n</tr>\n<tr>\n<td>\n<p>8</p>\n</td>\n<td>\n<p>&nbsp;Normal × 1000</p>\n</td>\n</tr>\n<tr>\n<td>\n<p>9</p>\n</td>\n<td>\n<p>&nbsp;Tous ceux qui peuvent entendre votre voix inspirante</p>\n</td>\n</tr>\n</tbody>\n</table>\n</div><p><strong>Exemple</strong> : <em>Le monastère de labbesse Brigitte van der Hoogenband est pris dassaut par les peaux-vertes, et les choses vont mal. De fait, elle décide de renforcer lesprit de ses soldats avec un Test de Commandement, leur octroyant +10 à tous les Tests de Psychologie. Elle obtient 3 DR à son Test de Commandement. Étant donné quelle possède un Bonus de Sociabilité de 6, et quelle peut influencer un nombre de soldats, égal à son Bonus de Sociabilité + DR en utilisant Commandement, elle renforce 9 soldats. Cependant, comme elle possède Exaltant 3, ce nombre est multiplié par 20, ce qui signifie que 180 de ses soldats sont inspirés par ses cris dencouragement « MAINTENEZ LES RANGS ! »</em>",
"id": "WCXnFSV4WOSmzzc4", "id": "WCXnFSV4WOSmzzc4",
@@ -5985,6 +5991,11 @@
"id": "Lore (Tilea)", "id": "Lore (Tilea)",
"name": "Savoir (Tilée)" "name": "Savoir (Tilée)"
}, },
{
"description": "<p>Posséder une Compétence Savoir signifie que vous avez officiellement étudié, ou avez appris dune façon ou dune autre, une branche de connaissances avancées. Vous possédez des données approfondies dans une spécialisation et navez donc pas besoin deffectuer de Test pour que le MJ vous donne les éléments dinformation utiles. Si vous recherchez des informations spécifiques moins connues, vous aurez besoin deffectuer un Test de Savoir, modifié selon la nature obscure de linformation, où les DR indiqueront de combien de détails vous vous souvenez.<p>En combat, un Test de Savoir réussi peut éventuellement vous accorder +1 Avantage (avec laccord de votre MJ). Par exemple, Savoir (Géologie) peut vous donner un Avantage si vous combattez dans une caverne, ou Savoir (Ingénierie) peut vous aider si vous combattez un ennemi armé dun appareil mécanique complexe. Vous pouvez continuer à renforcer votre Avantage lors des tours ultérieurs, à condition que les circonstances le permettent (déterminé par le MJ) et que vous ne soyez pas interrompu ; de cette façon, vous pouvez gagner un maximum dAvantages, égal à votre Bonus dIntelligence.</p>",
"id": "Lore (Law)",
"name": "Savoir (Loi)"
},
{ {
"description": "<p>La Compétence Corps à corps représente l'entraînement spécifique que vous avez reçu avec un seul type d'armes de combat rapproché. Chaque Spécialisation de Corps à corps indique un entraînement à une classe d'arme spécifique. Si vous n'avez pas la Spécialisation appropriée pour une arme que vous souhaitez utiliser, référez-vous au <strong>Chapitre 11 : Guide de l'équipement </strong>pour consulter les statistiques de l'arme et savoir quelles pénalités vous subirez. Voir <strong>Chapitre 5 : Règles </strong>pour plus d'informations sur les combats et l'utilisation de la Compétence Corps à corps.<p><strong>Exemples de Spécialisations : </strong>Arme d'hast, Arme à deux mains, Bagarre, Base, Cavalerie, Escrime, Fléau, Parade.</p>", "description": "<p>La Compétence Corps à corps représente l'entraînement spécifique que vous avez reçu avec un seul type d'armes de combat rapproché. Chaque Spécialisation de Corps à corps indique un entraînement à une classe d'arme spécifique. Si vous n'avez pas la Spécialisation appropriée pour une arme que vous souhaitez utiliser, référez-vous au <strong>Chapitre 11 : Guide de l'équipement </strong>pour consulter les statistiques de l'arme et savoir quelles pénalités vous subirez. Voir <strong>Chapitre 5 : Règles </strong>pour plus d'informations sur les combats et l'utilisation de la Compétence Corps à corps.<p><strong>Exemples de Spécialisations : </strong>Arme d'hast, Arme à deux mains, Bagarre, Base, Cavalerie, Escrime, Fléau, Parade.</p>",
"id": "Melee", "id": "Melee",

File diff suppressed because it is too large Load Diff

15
fr.json
View File

@@ -314,6 +314,10 @@
"SHEET.NPCSheetNoTheme":"Fiche de PNJ (sans thème)", "SHEET.NPCSheetNoTheme":"Fiche de PNJ (sans thème)",
"SHEET.VehicleSheet":"Fiche de véhicule", "SHEET.VehicleSheet":"Fiche de véhicule",
"SHEET.VehicleSheetNoTheme":"Fiche de véhicule (sans thème)", "SHEET.VehicleSheetNoTheme":"Fiche de véhicule (sans thème)",
"SHEET.Append":"Ajouter après",
"SHEET.Prepend":"Ajouter avant",
"SHEET.SkillName":"Nom de la compétence",
"SHEET.TalentName":"Nom du Talent",
"SHEETS.Actor.vehicle":"Fiche de Véhicule", "SHEETS.Actor.vehicle":"Fiche de Véhicule",
"SHEETS.Item.ammunition":"Fiche de Munitions", "SHEETS.Item.ammunition":"Fiche de Munitions",
@@ -429,6 +433,7 @@
"ITEM.Roles":"Roles", "ITEM.Roles":"Roles",
"ITEM.VitalRoles":"Roles vitaux", "ITEM.VitalRoles":"Roles vitaux",
"ITEM.LearningXP":"XP d'Apprentissage", "ITEM.LearningXP":"XP d'Apprentissage",
"ITEM.Custom":"Personnalisé",
"TOKEN.MOVEMENT.Status.immobile":"Immobile", "TOKEN.MOVEMENT.Status.immobile":"Immobile",
"TOKEN.MOVEMENT.Status.restricted":"Restreint", "TOKEN.MOVEMENT.Status.restricted":"Restreint",
@@ -645,6 +650,7 @@
"Hide": "Cacher", "Hide": "Cacher",
"Targets": "Cibles", "Targets": "Cibles",
"Melee": "Corps à corps", "Melee": "Corps à corps",
"Swim":" Natation",
"Cost": "Prix", "Cost": "Prix",
"Length": "Longueur", "Length": "Longueur",
"Cargo": "Cargaison", "Cargo": "Cargaison",
@@ -737,7 +743,6 @@
"Stat Block Parser":"Parser de fiches de PNJ", "Stat Block Parser":"Parser de fiches de PNJ",
"Submit":"Soumettre", "Submit":"Soumettre",
"SuccessLevels":"DR", "SuccessLevels":"DR",
"Swim":"Nager",
"TBRed":"BE", "TBRed":"BE",
"TookDamage":"Encaisse {damage} dommages", "TookDamage":"Encaisse {damage} dommages",
"ToughnessDesc":"Endurance", "ToughnessDesc":"Endurance",
@@ -1020,6 +1025,7 @@
"DIALOG.LinkCareerContent":"Relier {new} avec {old}? Les compétences de {old} seront ajoutées à {new}, tout en préservant toutes les spécialisations effectuées avec la carrière précédente.", "DIALOG.LinkCareerContent":"Relier {new} avec {old}? Les compétences de {old} seront ajoutées à {new}, tout en préservant toutes les spécialisations effectuées avec la carrière précédente.",
"DIALOG.ChoosePassenger":"Choisissez un passager", "DIALOG.ChoosePassenger":"Choisissez un passager",
"DIALOG.PostQuantityContent":"Combien de fois cet item peut être récupéré? Laissez vide pour illimité.", "DIALOG.PostQuantityContent":"Combien de fois cet item peut être récupéré? Laissez vide pour illimité.",
"DIALOG.ChooseArmour":"Choisissez une armure à endommager",
"CHAT.CareerChoose" : "Choisissez votre carrière", "CHAT.CareerChoose" : "Choisissez votre carrière",
"CHAT.DamageError" : "Erreur de calcul des dégâts:", "CHAT.DamageError" : "Erreur de calcul des dégâts:",
@@ -1184,6 +1190,8 @@
"CHAT.Vital":"Vital", "CHAT.Vital":"Vital",
"CHAT.DiseaseRollError":"Une erreur s'est produite lors du jet d'incubation ou de durée de la maladie.", "CHAT.DiseaseRollError":"Une erreur s'est produite lors du jet d'incubation ou de durée de la maladie.",
"CHAT.ExpReceivedNoReason":"Vous avez reçu <b>{amount}</b> points d'expérience", "CHAT.ExpReceivedNoReason":"Vous avez reçu <b>{amount}</b> points d'expérience",
"CHAT.CriticalDeflection":"Déviation de Critique",
"CHAT.DamageToArmour":"1 Dommages appliqués à {item} ({type})",
"Error.SpeciesSkills" : "Impossible d'ajouter des compétences pour les races", "Error.SpeciesSkills" : "Impossible d'ajouter des compétences pour les races",
"Error.SpeciesTalents" : "Impossible d'ajouter des talents pour les races", "Error.SpeciesTalents" : "Impossible d'ajouter des talents pour les races",
@@ -2696,6 +2704,10 @@
"major":"Majeur", "major":"Majeur",
"minor":"Mineur", "minor":"Mineur",
"moderate":"Modéré", "moderate":"Modéré",
"DurationPlaceholder":"Texte concernant a durée",
"ErrorArmourDamagePermission":"Vous n'avez pas les droits pour endommager l'armure de cet acteur.",
"IncubationPlaceholder":"Texte concernant l'incubation",
"Required Trappings":"Equipement requis",
"WH":{ "WH":{
"TransferType":{ "TransferType":{
@@ -2716,5 +2728,6 @@
"SHEET.ExperienceLog":"Journal d'Expérince", "SHEET.ExperienceLog":"Journal d'Expérince",
"SHEET.Attacker":"Attaquant", "SHEET.Attacker":"Attaquant",
"SHEET.Randomize":"Aléatoire", "SHEET.Randomize":"Aléatoire",
"SHEET.RequiredTrappingsError":"Impossible de lancer les revenus sans avoir tous les équipements requis dans cette carrière !",
"Sheet.RollIncome":"Revenu" "Sheet.RollIncome":"Revenu"
} }

View File

@@ -8,8 +8,9 @@
} }
], ],
"url": "https://www.uberwald.me/gitea/public/foundryvtt-wh4-lang-fr-fr", "url": "https://www.uberwald.me/gitea/public/foundryvtt-wh4-lang-fr-fr",
"version": "9.1.2", "version": "9.3.4",
"esmodules": [ "esmodules": [
"wh4_fr.js",
"modules/babele-register.js", "modules/babele-register.js",
"modules/addon-register.js", "modules/addon-register.js",
"modules/import-stat-2.js", "modules/import-stat-2.js",
@@ -119,7 +120,7 @@
} }
], ],
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-wh4-lang-fr-fr/raw/v10/module.json", "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-wh4-lang-fr-fr/raw/v10/module.json",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-wh4-lang-fr-fr/archive/foundryvtt-wh4-lang-fr-9-1-2.zip", "download": "https://www.uberwald.me/gitea/public/foundryvtt-wh4-lang-fr-fr/archive/foundryvtt-wh4-lang-fr-9-3-4.zip",
"id": "wh4-fr-translation", "id": "wh4-fr-translation",
"compatibility": { "compatibility": {
"minimum": "13", "minimum": "13",

View File

@@ -82,39 +82,8 @@ const _patch_up_in_arms = () => {
} }
/************************************************************************************/ /************************************************************************************/
/* Manages /auberge command */ /* Module /auberge géré par modules/inn/inn-init.js */
const _manage_inn_roll = async (content, msg) => { // L'ancienne implémentation a été migrée vers le module inn pour cohérence avec /voyage
// Split input into arguments
let command = content.split(" ").map(function (item) {
return item.trim();
})
console.log("COMMANDES", command);
if (command[0] == "/auberge" && command[1]) {
msg["type"] = 0;
msg["rollMode"] = "gmroll";
let compendium = game.packs.get('wh4-fr-translation.plats-dauberges')
game.packs.get(compendium);
let rollList = await compendium.getDocuments()
for (const element of rollList) {
let rollTab = element;
console.log("Got compendium...", rollList, rollTab.name);
if (rollTab.name.toLowerCase().includes(command[1].toLowerCase())) {
let my_rollTable;
await compendium.getDocument(rollTab._id).then(mytab => my_rollTable = mytab);
my_rollTable.draw({ rollMode: "gmroll" });
return false;
}
}
}
if (content.includes("/auberge")) {
msg["type"] = 0;
msg["rollMode"] = "gmroll";
msg["content"] = "Syntaxe : /auberge MOT_CLE, avec MOT_CLE parmi:<br>BoissonsBase, BoissonsFortes, Desserts, PlatsCommuns, PlatsExcellents, PlatsMaritimes, PlatsMédiocres, PlatsQualité, PlatsRivières<br>Des raccourcis sont possibles avec une partie du nom : /auberge Base (correspond à BoissonBase) ou /auberge Mari (correspond à PlatsMaritimes), etc."
ChatMessage.create(msg);
return false;
}
}
/************************************************************************************/ /************************************************************************************/
let __eis_tables = { let __eis_tables = {
@@ -262,17 +231,13 @@ const __check_fix_wrong_modules = (chatFlag, patchFinished) => {
} }
} else if (game.user.isGM && patchFinished) { } else if (game.user.isGM && patchFinished) {
ChatMessage.create({ ChatMessage.create({
content: "<div>Les modules WFRP4E ont été <strong>patchés avec succés</strong>. Vous pouvez y aller et que <strong>Shallya vous garde !</strong></div><div>Derniers changements : Support WFRP4E v8.3.X</div></ul>", content: "<div>Les modules WFRP4E ont été <strong>patchés avec succés</strong>. Vous pouvez y aller et que <strong>Shallya vous garde !</strong><div><div>Changements v9.3.4 : <ul><li>Ajout de la commande /voyage !</li><li>Améliorations de la commande /auberge</li><li>Très grosses mise à jour des scripts d'Effets et de leur traduction</li></ul></div>",
user: game.user.id, user: game.user.id,
whisper: ChatMessage.getWhisperRecipients("GM") whisper: ChatMessage.getWhisperRecipients("GM")
}); });
} }
} }
const __history = [
"Nouveautés 9.0.0: <ul><li>Support Foundry v13 et diverses petites corrections !</li></ul>"
]
/************************************************************************************/ /************************************************************************************/
const convertColumnToMulti = (table) => { const convertColumnToMulti = (table) => {
let columns = table.columns; let columns = table.columns;
@@ -366,14 +331,8 @@ const __add_actors_translation = () => {
/************************************************************************************/ /************************************************************************************/
/* Hook for specific command */ /* Hook for specific command - Module /auberge migré vers modules/inn/ */
Hooks.on("chatMessage", (html, content, msg) => { // La commande /auberge est désormais gérée par le module inn-init.js
if (content.toLowerCase().includes('auberge')) {
_manage_inn_roll(content, msg);
return false;
}
});
/************************************************************************************/ /************************************************************************************/
/* Additionnal hooks ready */ /* Additionnal hooks ready */

View File

@@ -421,7 +421,7 @@ Hooks.once('init', () => {
let validCompendiums = game.wfrp4e.tags.getPacksWithTag("trait") let validCompendiums = game.wfrp4e.tags.getPacksWithTag("trait")
for (let compData of validCompendiums) { for (let compData of validCompendiums) {
let trait_fr = game.babele.translate(compData.metadata.id, { name: name_en, system:{description:{value: trait_en.system.description.value}} }, true) let trait_fr = game.babele.translate(compData.metadata.id, { name: name_en, system:{description:{value: trait_en.system.description.value}} }, true)
if (trait_fr?.name ) { if (trait_fr?.name && trait_fr?.name != name_en) {
trait_fr.name = trait_fr.name || trait_en.name trait_fr.name = trait_fr.name || trait_en.name
trait_en.name = nbt + trait_fr.name + special; trait_en.name = nbt + trait_fr.name + special;
trait_en.system.description.value = trait_fr.system.description.value; trait_en.system.description.value = trait_fr.system.description.value;
@@ -442,7 +442,8 @@ Hooks.once('init', () => {
let validCompendiums = game.wfrp4e.tags.getPacksWithTag("skill") let validCompendiums = game.wfrp4e.tags.getPacksWithTag("skill")
for (let compData of validCompendiums) { for (let compData of validCompendiums) {
let trait_fr = game.babele.translate(compData.metadata.id, { name: name_en, system:{description:{value: trait_en.system.description.value}} }, true) let trait_fr = game.babele.translate(compData.metadata.id, { name: name_en, system:{description:{value: trait_en.system.description.value}} }, true)
if (trait_fr?.name) { //console.log(">>>>> Skill FR ?", trait_fr, name_en, special)
if (trait_fr?.name && trait_fr?.name != name_en) {
trait_fr.name = trait_fr.name || name_en trait_fr.name = trait_fr.name || name_en
trait_en.name = trait_fr.name + special; trait_en.name = trait_fr.name + special;
trait_en.system.description.value = trait_fr.system.description.value; trait_en.system.description.value = trait_fr.system.description.value;
@@ -453,7 +454,7 @@ Hooks.once('init', () => {
let validCompendiums = game.wfrp4e.tags.getPacksWithTag("prayer") let validCompendiums = game.wfrp4e.tags.getPacksWithTag("prayer")
for (let compData of validCompendiums) { for (let compData of validCompendiums) {
let trait_fr = game.babele.translate(compData.metadata.id, { name: name_en, system:{description:{value: trait_en.system.description.value}} }, true) let trait_fr = game.babele.translate(compData.metadata.id, { name: name_en, system:{description:{value: trait_en.system.description.value}} }, true)
if (trait_fr?.name) { if (trait_fr?.name && trait_fr?.name != name_en) {
WFRP4FrTranslation.parseSpellContent(trait_en) WFRP4FrTranslation.parseSpellContent(trait_en)
trait_fr.name = trait_fr.name || name_en trait_fr.name = trait_fr.name || name_en
trait_en.name = trait_fr.name + special; trait_en.name = trait_fr.name + special;
@@ -467,7 +468,7 @@ Hooks.once('init', () => {
let validCompendiums = game.wfrp4e.tags.getPacksWithTag("spell") let validCompendiums = game.wfrp4e.tags.getPacksWithTag("spell")
for (let compData of validCompendiums) { for (let compData of validCompendiums) {
let trait_fr = game.babele.translate(compData.metadata.id, { name: name_en, system:{description:{value: trait_en.system.description.value}} }, true) let trait_fr = game.babele.translate(compData.metadata.id, { name: name_en, system:{description:{value: trait_en.system.description.value}} }, true)
if (trait_fr?.name) { if (trait_fr?.name && trait_fr?.name != name_en) {
WFRP4FrTranslation.parseSpellContent(trait_en) WFRP4FrTranslation.parseSpellContent(trait_en)
trait_fr.name = trait_fr.name || name_en trait_fr.name = trait_fr.name || name_en
trait_en.name = trait_fr.name + special; trait_en.name = trait_fr.name + special;
@@ -494,7 +495,7 @@ Hooks.once('init', () => {
} }
trait_en.name = name_en // Reset the name to the original one trait_en.name = name_en // Reset the name to the original one
let trait_fr = game.babele.translate(compData.metadata.id, trait_en, true) let trait_fr = game.babele.translate(compData.metadata.id, trait_en, true)
if (trait_fr?.name) { if (trait_fr?.name && trait_fr?.name != name_en) {
trait_fr.name = trait_fr.name || name_en // Security since babele v10 trait_fr.name = trait_fr.name || name_en // Security since babele v10
//console.log(">>>>> Talent ?", trait_fr, name_en, special, trait_fr.name); //console.log(">>>>> Talent ?", trait_fr, name_en, special, trait_fr.name);
if (trait_fr.name && (trait_fr.name == "Sprinter" || trait_fr.name != name_en)) { // Talent translated! if (trait_fr.name && (trait_fr.name == "Sprinter" || trait_fr.name != name_en)) { // Talent translated!
@@ -513,7 +514,7 @@ Hooks.once('init', () => {
let validCompendiums = game.wfrp4e.tags.getPacksWithTag("career") let validCompendiums = game.wfrp4e.tags.getPacksWithTag("career")
for (let compData of validCompendiums) { for (let compData of validCompendiums) {
let career_fr = game.babele.translate(compData.metadata.id, trait_en, true); let career_fr = game.babele.translate(compData.metadata.id, trait_en, true);
if (career_fr?.name) { if (career_fr?.name && career_fr?.name != name_en) {
trait_en.name = career_fr.name || trait_en.name trait_en.name = career_fr.name || trait_en.name
// DEBG: console.log(">>>>> Career ?", career_fr.name ); // DEBG: console.log(">>>>> Career ?", career_fr.name );
trait_en.system = foundry.utils.duplicate(career_fr.system); trait_en.system = foundry.utils.duplicate(career_fr.system);
@@ -524,7 +525,7 @@ Hooks.once('init', () => {
let validCompendiums = game.wfrp4e.tags.getPacksWithTag("vehicleRole") let validCompendiums = game.wfrp4e.tags.getPacksWithTag("vehicleRole")
for (let compData of validCompendiums) { for (let compData of validCompendiums) {
let role_fr = game.babele.translate(compData.metadata.id, trait_en, true); let role_fr = game.babele.translate(compData.metadata.id, trait_en, true);
if (role_fr?.name) { if (role_fr?.name && role_fr?.name != name_en) {
trait_en.name = role_fr.name || trait_en.name trait_en.name = role_fr.name || trait_en.name
// DEBG: console.log(">>>>> Role ?", role_fr.name ); // DEBG: console.log(">>>>> Role ?", role_fr.name );
trait_en.system = foundry.utils.duplicate(role_fr.system); trait_en.system = foundry.utils.duplicate(role_fr.system);
@@ -535,7 +536,7 @@ Hooks.once('init', () => {
let validCompendiums = game.wfrp4e.tags.getPacksWithTag(["trapping"], ["weapon", "armour", "container", "money"]) let validCompendiums = game.wfrp4e.tags.getPacksWithTag(["trapping"], ["weapon", "armour", "container", "money"])
for (let compData of validCompendiums) { for (let compData of validCompendiums) {
let trapping_fr = game.babele.translate(compData.metadata.id, { name: name_en, system:{description:{value: trait_en.system.description.value}} }, true); let trapping_fr = game.babele.translate(compData.metadata.id, { name: name_en, system:{description:{value: trait_en.system.description.value}} }, true);
if (trapping_fr?.name) { if (trapping_fr?.name && trapping_fr?.name != name_en) {
trait_en.name = trapping_fr.name || trait_en.name trait_en.name = trapping_fr.name || trait_en.name
if (trapping_fr.system?.description?.value) { if (trapping_fr.system?.description?.value) {
trait_en.system.description.value = trapping_fr.system.description.value trait_en.system.description.value = trapping_fr.system.description.value

View File

@@ -2,51 +2,72 @@
export class WH4FRPatchConfig { export class WH4FRPatchConfig {
/************************************************************************************/ /************************************************************************************/
static translateSkillList( skillList) { static translateSkillList(skillList) {
if (!skillList || skillList.length == 0) {
return skillList;
}
let compendiumName = 'wfrp4e-core.items' let compendiumName = 'wfrp4e-core.items'
let newList = []; let newList = [];
for( let compName of skillList) { for (let compName of skillList) {
if (!compName) {
newList.push(compName);
continue;
}
if (!isNaN(compName)) { // If numeric, keep as is (for skill levels)
newList.push(compName);
continue;
}
// Trim compName
compName = compName.trim();
let special = ""; let special = "";
let newName = compName; let newName = compName;
if ( compName.includes("(") && compName.includes(")") ) { // Then process specific skills name with (xxxx) inside let baseName = compName
let re = /(.*) +\((.*)\)/i; if (compName.includes("(") && compName.includes(")")) { // Then process specific skills name with (xxxx) inside
let res = re.exec( compName ); let re = /(.*) +\((.*)\)/i;
let res = re.exec(compName);
compName = res[1].trim(); // Get the root skill name compName = res[1].trim(); // Get the root skill name
special = " (" + game.i18n.localize( res[2].trim() ) + ")"; // And the special keyword special = " (" + game.i18n.localize(res[2].trim()) + ")"; // And the special keyword
} }
let compNameFR = game.babele.translate( compendiumName, { name: compName }, true ); let compNameFR = game.babele.translate(compendiumName, { name: compName }, true);
if (compNameFR.name != compName) { // Translation OK if (compNameFR.name != compName) { // Translation OK
newName = compNameFR.name + special; newName = compNameFR.name + special;
} }
// DEBUG console.log("Translating skill ", compName, baseName, " to ", newName, special);
if (!newName || newName == "" || newName === undefined || newName === "undefined") { // If no translation, keep the original name
newName = baseName; // If no translation, keep the original name
}
newList.push(newName); newList.push(newName);
} }
return newList; return newList;
} }
/************************************************************************************/ /************************************************************************************/
static translateTalentList( talentList) { static translateTalentList(talentList) {
if (!talentList || talentList.length == 0) {
return talentList;
}
let compendiumName = 'wfrp4e-core.items' let compendiumName = 'wfrp4e-core.items'
let newList = []; let newList = [];
for( let talentLine of talentList) { for (let talentLine of talentList) {
let special = ""; let special = "";
let newName = talentLine; let newName = talentLine;
if ( isNaN(talentLine) ) { if (isNaN(talentLine)) {
let subList = talentLine.split(','); let subList = talentLine.split(',');
let newSubList = []; let newSubList = [];
for (let talentName of subList ) { for (let talentName of subList) {
talentName = talentName.trim(); talentName = talentName.trim();
let newName2 = talentName; let newName2 = talentName;
if ( talentName.includes("(") && talentName.includes(")") ) { // Then process specific skills name with (xxxx) inside if (talentName.includes("(") && talentName.includes(")")) { // Then process specific skills name with (xxxx) inside
let re = /(.*) +\((.*)\)/i; let re = /(.*) +\((.*)\)/i;
let res = re.exec( talentName ); let res = re.exec(talentName);
talentName = res[1].trim(); // Get the root skill name talentName = res[1].trim(); // Get the root skill name
special = " (" + game.i18n.localize( res[2].trim() ) + ")"; // And the special keyword special = " (" + game.i18n.localize(res[2].trim()) + ")"; // And the special keyword
} }
let talentNameFR = game.babele.translate( compendiumName, { name: talentName }, true ); let talentNameFR = game.babele.translate(compendiumName, { name: talentName }, true);
if (talentNameFR.name != talentName) { // Translation OK if (talentNameFR.name != talentName) { // Translation OK
newName2 = talentNameFR.name + special; newName2 = talentNameFR.name + special;
} }
@@ -60,15 +81,18 @@ export class WH4FRPatchConfig {
} }
/************************************************************************************/ /************************************************************************************/
static patch_subspecies( ) { static patch_subspecies() {
for ( let speciesName in game.wfrp4e.config.subspecies) { if (!game.wfrp4e?.config?.subspecies) {
return
}
for (let speciesName in game.wfrp4e.config.subspecies) {
let subspeciesList = game.wfrp4e.config.subspecies[speciesName]; let subspeciesList = game.wfrp4e.config.subspecies[speciesName];
for ( let subspeciesName in subspeciesList) { for (let subspeciesName in subspeciesList) {
let subspecies = subspeciesList[subspeciesName]; let subspecies = subspeciesList[subspeciesName];
if ( subspecies.skills) { if (subspecies.skills) {
subspecies.skills = this.translateSkillList(subspecies.skills); subspecies.skills = this.translateSkillList(subspecies.skills);
} }
if ( subspecies.talents) { if (subspecies.talents) {
subspecies.talents = this.translateTalentList(subspecies.talents); subspecies.talents = this.translateTalentList(subspecies.talents);
} }
} }
@@ -76,20 +100,26 @@ export class WH4FRPatchConfig {
} }
/************************************************************************************/ /************************************************************************************/
static patch_species_skills( ) { static patch_species_skills() {
if (!game.wfrp4e?.config?.speciesSkills) {
return
}
console.log("Patching species skills...."); console.log("Patching species skills....");
for (let speciesName in game.wfrp4e.config.speciesSkills) { for (let speciesName in game.wfrp4e.config.speciesSkills) {
let speciesComp = game.wfrp4e.config.speciesSkills[speciesName]; let speciesComp = game.wfrp4e.config.speciesSkills[speciesName];
console.log("SpeciesName", speciesName, speciesComp); console.log("SpeciesName", speciesName, speciesComp);
game.wfrp4e.config.speciesSkills[speciesName] = this.translateSkillList( speciesComp ) game.wfrp4e.config.speciesSkills[speciesName] = this.translateSkillList(speciesComp)
} }
} }
/************************************************************************************/ /************************************************************************************/
static patch_species_talents( ) { static patch_species_talents() {
if (!game.wfrp4e?.config?.speciesTalents) {
return
}
for (let speciesName in game.wfrp4e.config.speciesTalents) { for (let speciesName in game.wfrp4e.config.speciesTalents) {
let speciesTalents = game.wfrp4e.config.speciesTalents[speciesName]; let speciesTalents = game.wfrp4e.config.speciesTalents[speciesName];
game.wfrp4e.config.speciesTalents[speciesName] = this.translateTalentList( speciesTalents); game.wfrp4e.config.speciesTalents[speciesName] = this.translateTalentList(speciesTalents);
} }
} }
@@ -97,16 +127,16 @@ export class WH4FRPatchConfig {
static patch_career() { static patch_career() {
let compendiumName = 'wfrp4e-core.items' let compendiumName = 'wfrp4e-core.items'
if ( game.wfrp4e.tables.career) { if (game.wfrp4e?.tables?.career) {
for( let row of game.wfrp4e.tables.career.rows) { for (let row of game.wfrp4e.tables.career.rows) {
for ( let key in row) { for (let key in row) {
if (key != "range") { if (key != "range") {
if ( row[key].name == 'Slayer' ) { if (row[key].name == 'Slayer') {
row[key].name = "Tueur Nains"; row[key].name = "Tueur Nains";
} else if ( row[key].name == 'Duelist' ) { } else if (row[key].name == 'Duelist') {
row[key].name = "Duelliste"; row[key].name = "Duelliste";
} else { } else {
let career_fr = game.babele.translate( compendiumName, {name: row[key].name}, true ); let career_fr = game.babele.translate(compendiumName, { name: row[key].name }, true);
row[key].name = career_fr.name; row[key].name = career_fr.name;
} }
} }
@@ -118,12 +148,15 @@ export class WH4FRPatchConfig {
/************************************************************************************/ /************************************************************************************/
static fixSpeciesTable() { static fixSpeciesTable() {
let speciesTable = game.wfrp4e.tables.findTable("species"); let speciesTable = game.wfrp4e?.tables?.findTable("species");
if (!speciesTable?.results) {
return
}
let newResults = foundry.utils.duplicate(speciesTable.results); let newResults = foundry.utils.duplicate(speciesTable.results);
for (let result of newResults) { for (let result of newResults) {
result.name = game.i18n.localize(result.name); result.name = game.i18n.localize(result.name);
} }
speciesTable.update({results: newResults } ) speciesTable.update({ results: newResults })
console.log("Species table patched to use 'Humain' instead of 'Human'", speciesTable); console.log("Species table patched to use 'Humain' instead of 'Human'", speciesTable);
} }
@@ -139,7 +172,7 @@ export class WH4FRPatchConfig {
} }
// Detect and patch as necessary // Detect and patch as necessary
if (game.wfrp4e.config?.talentBonuses ) { if (game.wfrp4e.config?.talentBonuses) {
this.fixSpeciesTable() // Force 'name' field replacement this.fixSpeciesTable() // Force 'name' field replacement
@@ -181,22 +214,22 @@ export class WH4FRPatchConfig {
if (game.wfrp4e.config.characteristicsBonus) { if (game.wfrp4e.config.characteristicsBonus) {
game.wfrp4e.config.characteristicsBonus = game.wfrp4e.config.characteristicsBonus =
{ {
"ws": "Bonus de Capacité de Combat", "ws": "Bonus de Capacité de Combat",
"bs": "Bonus de Capacité de Tir", "bs": "Bonus de Capacité de Tir",
"s": "Bonus de Force", "s": "Bonus de Force",
"t": "Bonus d'Endurance", "t": "Bonus d'Endurance",
"i": "Bonus d'Initiative", "i": "Bonus d'Initiative",
"ag": "Bonus d'Agilité", "ag": "Bonus d'Agilité",
"dex": "Bonus de Dexterité", "dex": "Bonus de Dexterité",
"int": "Bonus d'Intelligence", "int": "Bonus d'Intelligence",
"wp": "Bonus de Force Mentale", "wp": "Bonus de Force Mentale",
"fel": "Bonus de Sociabilité" "fel": "Bonus de Sociabilité"
} }
} }
if (game.wfrp4e.config.classTrappings) { if (game.wfrp4e.config.classTrappings) {
for(const c of Object.keys(game.wfrp4e.config.classTrappings)) { for (const c of Object.keys(game.wfrp4e.config.classTrappings)) {
game.wfrp4e.config.classTrappings[game.i18n.localize(c)] = game.wfrp4e.config.classTrappings[c]; game.wfrp4e.config.classTrappings[game.i18n.localize(c)] = game.wfrp4e.config.classTrappings[c];
} }
} }

410
modules/inn/InnRoller.js Normal file
View File

@@ -0,0 +1,410 @@
/**
* InnRoller
* Classe de gestion des jets de tables d'auberge pour WFRP4e
* Module de traduction française
*/
export default class InnRoller {
static tableNames = {
'boissonsbase': 'BoissonsBase',
'boissonsfortes': 'BoissonsFortes',
'desserts': 'Desserts',
'platscommuns': 'PlatsCommuns',
'platsexcellents': 'PlatsExcellents',
'platsmaritimes': 'PlatsMaritimes',
'platsmediocres': 'PlatsMédiocres',
'platsqualite': 'PlatsQualité',
'platsrivieres': 'PlatsRivières'
};
static displayNames = {
'BoissonsBase': 'Boissons de Base',
'BoissonsFortes': 'Boissons Fortes',
'Desserts': 'Desserts',
'PlatsCommuns': 'Plats Communs',
'PlatsExcellents': 'Plats Excellents',
'PlatsMaritimes': 'Plats Maritimes',
'PlatsMédiocres': 'Plats Médiocres',
'PlatsQualité': 'Plats de Qualité',
'PlatsRivières': 'Plats de Rivières'
};
/**
* Obtient le nom d'affichage formaté pour une table
* @param {String} tableName
* @returns {String}
*/
static getDisplayName(tableName) {
return this.displayNames[tableName] || tableName;
}
/**
* Normalise le nom d'une table (enlève accents, espaces, met en minuscules)
* @param {String} name
* @returns {String}
*/
static normalizeTableName(name) {
return name
.toLowerCase()
.normalize("NFD")
.replace(/[\u0300-\u036f]/g, "")
.replace(/\s+/g, '');
}
/**
* Trouve la table correspondant au mot-clé
* @param {String} keyword
* @returns {String|null}
*/
static findTableByKeyword(keyword) {
if (!keyword) return null;
const normalized = this.normalizeTableName(keyword);
// Recherche exacte
if (this.tableNames[normalized]) {
return this.tableNames[normalized];
}
// Recherche partielle
for (let [key, value] of Object.entries(this.tableNames)) {
if (key.includes(normalized) || normalized.includes(key)) {
return value;
}
}
return null;
}
/**
* Lance un jet sur une table d'auberge
* @param {String} keyword Mot-clé pour identifier la table
*/
static async rollInnTable(keyword) {
console.log(`InnRoller: rollInnTable appelé avec keyword="${keyword}"`);
// Si pas de keyword, afficher l'aide
if (!keyword) {
this.displayHelp();
return;
}
// Rechercher la table
const tableName = this.findTableByKeyword(keyword);
if (!tableName) {
this.displayHelp();
ui.notifications.warn(`Table d'auberge introuvable pour le mot-clé: "${keyword}"`);
return;
}
console.log(`InnRoller: Table trouvée: ${tableName}`);
// Charger le compendium
const compendium = game.packs.get('wh4-fr-translation.plats-dauberges');
if (!compendium) {
ui.notifications.error("Compendium 'plats-dauberges' introuvable");
console.error("InnRoller: Compendium wh4-fr-translation.plats-dauberges non trouvé");
return;
}
// Récupérer les tables
const tables = await compendium.getDocuments();
// Trouver la table correspondante
const rollTable = tables.find(t => t.name === tableName);
if (!rollTable) {
ui.notifications.error(`Table "${tableName}" non trouvée dans le compendium`);
console.error(`InnRoller: Table ${tableName} non trouvée`);
return;
}
console.log(`InnRoller: Jet sur la table ${rollTable.name}`);
// Effectuer le jet sans affichage automatique
try {
const roll = await rollTable.draw({ displayChat: false });
console.log(`InnRoller: Jet effectué avec succès`, roll);
// Créer un message personnalisé
await this.displayRollResult(rollTable.name, roll);
} catch (error) {
console.error("InnRoller: Erreur lors du jet:", error);
ui.notifications.error("Erreur lors du jet sur la table d'auberge");
}
}
/**
* Affiche le résultat d'un jet de table avec un style personnalisé
* @param {String} tableName Nom de la table
* @param {Object} rollResult Résultat du jet
*/
static async displayRollResult(tableName, rollResult) {
// Déterminer l'icône en fonction du type de table
let icon = "fa-utensils";
let category = "Plat";
if (tableName.toLowerCase().includes('boisson')) {
icon = "fa-wine-glass";
category = "Boisson";
} else if (tableName.toLowerCase().includes('dessert')) {
icon = "fa-birthday-cake";
category = "Dessert";
}
// Extraire les informations du résultat
const resultText = rollResult.results[0]?.text || "Résultat inconnu";
const rollFormula = rollResult.roll?.formula || "1d100";
const rollTotal = rollResult.roll?.total || 0;
// Construire le message HTML simplifié
let message = `<div class="wfrp4e-inn-result">`;
message += `<div class="message-header">`;
message += `<i class="fas ${icon}"></i> `;
message += `<span class="flavor-text">${category}: ${tableName}</span>`;
message += `</div>`;
message += `<div class="inn-dish-name">${resultText}</div>`;
message += `<div class="inn-roll-info"><i class="fas fa-dice"></i> ${rollFormula} = ${rollTotal}</div>`;
message += `</div>`;
// Créer le message dans le chat
await ChatMessage.create({
content: message,
speaker: ChatMessage.getSpeaker(),
whisper: ChatMessage.getWhisperRecipients("GM")
});
}
/**
* Affiche l'aide pour la commande /auberge avec liste cliquable
*/
static displayHelp() {
let message = `<div class="wfrp4e-inn-help">`;
message += `<h3><i class="fas fa-utensils"></i> Aide pour /auberge</h3>`;
message += `<p><strong>Usage:</strong> <code>/auberge [mot_clé]</code></p>`;
// Bouton Menu
message += `<div style="margin: 0.8em 0;">`;
message += `<a class="action-link inn-menu-quick-btn" data-action="clickAubergeMenu" data-quality="menu">`;
message += `<i class="fas fa-book-open"></i> Générer un menu complet`;
message += `</a>`;
message += `</div>`;
message += `<hr>`;
// Section avec liste cliquable
message += `<h4><i class="fas fa-list"></i> Tables disponibles</h4>`;
message += `<div class="wfrp4e-inn-table-grid">`;
const sortedTables = Object.values(this.tableNames).sort();
for (let tableName of sortedTables) {
const normalized = this.normalizeTableName(tableName);
const displayName = this.getDisplayName(tableName);
message += `<a class="action-link inn-table-btn" data-action="clickAuberge" data-table="${normalized}">`;
message += `<i class="fas fa-dice"></i> ${displayName}`;
message += `</a>`;
}
message += `</div>`;
message += `<hr>`;
message += `<p style="font-size: 0.9em; margin-top: 0.5em;"><em>Vous pouvez aussi taper <code>/auberge [mot_clé]</code> directement (ex: <code>/auberge base</code>)</em></p>`;
message += `</div>`;
ChatMessage.create({
content: message,
whisper: ChatMessage.getWhisperRecipients("GM")
});
}
/**
* Liste toutes les tables disponibles
*/
static listTables() {
let message = `<div class="wfrp4e-inn-list">`;
message += `<h3><i class="fas fa-list"></i> Tables d'auberge disponibles</h3>`;
message += `<div class="wfrp4e-inn-table-grid">`;
const sortedTables = Object.values(this.tableNames).sort();
for (let tableName of sortedTables) {
const normalized = this.normalizeTableName(tableName);
const displayName = this.getDisplayName(tableName);
message += `<a class="action-link inn-table-btn" data-action="clickAuberge" data-table="${normalized}">`;
message += `<i class="fas fa-dice"></i> ${displayName}`;
message += `</a>`;
}
message += `</div>`;
message += `</div>`;
ChatMessage.create({
content: message,
whisper: ChatMessage.getWhisperRecipients("GM")
});
}
/**
* Affiche le choix de qualité pour générer un menu complet
*/
static displayMenuChoice() {
let message = `<div class="wfrp4e-inn-menu-choice">`;
message += `<h3><i class="fas fa-book-open"></i> Menu de l'auberge</h3>`;
message += `<p>Choisissez la qualité du menu :</p>`;
message += `<div class="inn-menu-buttons">`;
message += `<a class="action-link inn-menu-btn" data-action="clickAubergeMenu" data-quality="mediocre">`;
message += `<i class="fas fa-drumstick-bite"></i> Menu Médiocre`;
message += `<br><span class="inn-menu-desc">Plat médiocre + Boisson de base</span>`;
message += `</a>`;
message += `<a class="action-link inn-menu-btn" data-action="clickAubergeMenu" data-quality="commun">`;
message += `<i class="fas fa-utensils"></i> Menu Commun`;
message += `<br><span class="inn-menu-desc">Plat commun + Boisson de base + Dessert</span>`;
message += `</a>`;
message += `<a class="action-link inn-menu-btn" data-action="clickAubergeMenu" data-quality="qualite">`;
message += `<i class="fas fa-crown"></i> Menu de Qualité`;
message += `<br><span class="inn-menu-desc">Plat de qualité + Boisson forte + Dessert</span>`;
message += `</a>`;
message += `<a class="action-link inn-menu-btn" data-action="clickAubergeMenu" data-quality="fluvial">`;
message += `<i class="fas fa-fish"></i> Menu Fluvial`;
message += `<br><span class="inn-menu-desc">Plat de rivière + Boisson de base + Dessert</span>`;
message += `</a>`;
message += `<a class="action-link inn-menu-btn" data-action="clickAubergeMenu" data-quality="maritime">`;
message += `<i class="fas fa-anchor"></i> Menu Maritime`;
message += `<br><span class="inn-menu-desc">Plat maritime + Boisson forte + Dessert</span>`;
message += `</a>`;
message += `<a class="action-link inn-menu-btn" data-action="clickAubergeMenu" data-quality="excellent">`;
message += `<i class="fas fa-gem"></i> Menu Excellent`;
message += `<br><span class="inn-menu-desc">Plat excellent + Boisson forte + Dessert</span>`;
message += `</a>`;
message += `</div>`;
message += `</div>`;
ChatMessage.create({
content: message,
whisper: ChatMessage.getWhisperRecipients("GM")
});
}
/**
* Génère un menu complet selon la qualité choisie
* @param {String} quality - 'mediocre', 'commun', ou 'qualite'
*/
static async generateMenu(quality) {
console.log(`InnRoller: generateMenu appelé avec quality="${quality}"`);
let tables = [];
let menuName = "";
// Définir les tables à tirer selon la qualité
switch(quality) {
case 'mediocre':
menuName = "Menu Médiocre";
tables = ['PlatsMédiocres', 'BoissonsBase'];
break;
case 'commun':
menuName = "Menu Commun";
tables = ['PlatsCommuns', 'BoissonsBase', 'Desserts'];
break;
case 'qualite':
menuName = "Menu de Qualité";
tables = ['PlatsQualité', 'BoissonsFortes', 'Desserts'];
break;
case 'fluvial':
menuName = "Menu Fluvial";
tables = ['PlatsRivières', 'BoissonsBase', 'Desserts'];
break;
case 'maritime':
menuName = "Menu Maritime";
tables = ['PlatsMaritimes', 'BoissonsFortes', 'Desserts'];
break;
case 'excellent':
menuName = "Menu Excellent";
tables = ['PlatsExcellents', 'BoissonsFortes', 'Desserts'];
break;
default:
ui.notifications.error(`Qualité de menu inconnue: ${quality}`);
return;
}
// Charger le compendium
const compendium = game.packs.get('wh4-fr-translation.plats-dauberges');
if (!compendium) {
ui.notifications.error("Compendium 'plats-dauberges' introuvable");
return;
}
const allTables = await compendium.getDocuments();
let results = [];
// Effectuer les jets sur chaque table
for (let tableName of tables) {
const rollTable = allTables.find(t => t.name === tableName);
if (rollTable) {
try {
const roll = await rollTable.draw({ displayChat: false });
const resultText = roll.results[0]?.text || "Résultat inconnu";
results.push({
category: this.getCategoryName(tableName),
name: resultText,
tableName: tableName
});
} catch (error) {
console.error(`InnRoller: Erreur lors du jet sur ${tableName}:`, error);
}
}
}
// Afficher le menu complet
this.displayMenuResult(menuName, results);
}
/**
* Obtient le nom de catégorie pour une table
* @param {String} tableName
* @returns {String}
*/
static getCategoryName(tableName) {
if (tableName.includes('Boisson')) return 'Boisson';
if (tableName.includes('Dessert')) return 'Dessert';
if (tableName.includes('Plat')) return 'Plat';
return 'Item';
}
/**
* Affiche le résultat d'un menu complet
* @param {String} menuName
* @param {Array} results
*/
static async displayMenuResult(menuName, results) {
let message = `<div class="wfrp4e-inn-menu-result">`;
message += `<div class="message-header">`;
message += `<i class="fas fa-book-open"></i> `;
message += `<span class="flavor-text">${menuName}</span>`;
message += `</div>`;
message += `<div class="inn-menu-items">`;
for (let result of results) {
message += `<div class="inn-menu-item">`;
let icon = result.category === 'Boisson' ? 'fa-wine-glass' :
result.category === 'Dessert' ? 'fa-birthday-cake' : 'fa-utensils';
message += `<i class="fas ${icon}"></i> `;
message += `<strong>${result.category}:</strong> ${result.name}`;
message += `</div>`;
}
message += `</div>`;
message += `</div>`;
await ChatMessage.create({
content: message,
speaker: ChatMessage.getSpeaker(),
whisper: ChatMessage.getWhisperRecipients("GM")
});
}
}

148
modules/inn/README.md Normal file
View File

@@ -0,0 +1,148 @@
# Module Inn (Auberge)
Module de gestion des jets sur les tables d'auberge pour WFRP4e - Traduction française.
## Utilisation
### Commande `/auberge`
La commande `/auberge` permet d'effectuer des jets sur les tables d'auberge (plats et boissons).
**Syntaxe :**
```
/auberge [mot_clé]
```
### Exemples
- `/auberge` - Affiche l'aide avec toutes les tables disponibles **et cliquables**
- `/auberge help` ou `/auberge aide` - Affiche l'aide avec liste cliquable
- `/auberge list` ou `/auberge liste` - Liste toutes les tables avec liens cliquables
- `/auberge menu` - **Génère un menu complet** (6 types disponibles)
- `/auberge base` - Lance un jet sur la table "BoissonsBase"
- `/auberge fortes` - Lance un jet sur la table "BoissonsFortes"
- `/auberge mari` - Lance un jet sur la table "PlatsMaritimes"
> **Note :** Quand vous tapez `/auberge` sans argument, une liste cliquable s'affiche dans le chat. Vous pouvez cliquer directement sur une table pour effectuer un jet.
### Génération de menus complets
La commande `/auberge menu` permet de générer automatiquement un menu complet :
1. Tapez `/auberge menu` dans le chat
2. Cliquez sur le type de menu souhaité :
- **Menu Médiocre** 🍗 : Plat médiocre + Boisson de base
- **Menu Commun** 🍽️ : Plat commun + Boisson de base + Dessert
- **Menu de Qualité** 👑 : Plat de qualité + Boisson forte + Dessert
- **Menu Fluvial** 🐟 : Plat de rivière + Boisson de base + Dessert
- **Menu Maritime** ⚓ : Plat maritime + Boisson forte + Dessert
- **Menu Excellent** 💎 : Plat excellent + Boisson forte + Dessert
3. Le menu complet est généré automatiquement avec un jet sur chaque table concernée
### Tables disponibles
- **BoissonsBase** (`boissonsbase`, `base`)
- **BoissonsFortes** (`boissonsfortes`, `fortes`)
- **Desserts** (`desserts`)
- **PlatsCommuns** (`platscommuns`, `communs`)
- **PlatsExcellents** (`platsexcellents`, `excellents`)
- **PlatsMaritimes** (`platsmaritimes`, `maritimes`, `mari`)
- **PlatsMédiocres** (`platsmediocres`, `mediocres`)
- **PlatsQualité** (`platsqualite`, `qualite`)
- **PlatsRivières** (`platsrivieres`, `rivieres`)
### Raccourcis
Le système accepte des raccourcis et ignore les accents :
- `mari` → PlatsMaritimes
- `qualité` ou `qualite` → PlatsQualité
- `médiocres` ou `mediocres` → PlatsMédiocres
## Architecture
Le module suit la même architecture que le module TravelV2 (commande `/voyage`) :
```
modules/inn/
├── inn-init.js # Initialisation et enregistrement de la commande
└── InnRoller.js # Logique métier des jets de tables
```
### Affichage personnalisé
Les résultats des jets sont affichés avec un **rendu visuel personnalisé** :
- 🍷 Icône adaptée au type (boisson, plat, dessert)
- 🎨 Carte stylisée avec dégradés et bordures
- 🎲 Affichage du jet de dés (formule et total)
- 📋 Nom de la table et du plat mis en valeur
- 🎉 Message de conclusion thématique
Le système détecte automatiquement le type de plat/boisson et adapte l'icône :
- **Boissons** : 🍷 Verre de vin
- **Desserts** : 🎂 Gâteau
- **Plats** : 🍴 Couverts
### Fichiers principaux
- **inn-init.js** :
- Enregistre la commande `/auberge` via `game.wfrp4e.commands`
- Gère les hooks pour les clics sur les liens de tables
- Expose `game.wfrp4e.inn` pour accès programmatique
- **InnRoller.js** :
- Gestion des jets sur les tables d'auberge
- Normalisation des noms de tables
- Recherche par mots-clés
- Affichage de l'aide et de la liste des tables
## Intégration
Le module est initialisé dans `wh4_fr.js` :
```javascript
import { initInn } from './modules/inn/inn-init.js';
Hooks.once("init", function() {
initInn();
});
```
## Dépendances
- Compendium : `wh4-fr-translation.plats-dauberges`
- Système WFRP4e avec support de `game.wfrp4e.commands`
## Permissions
La commande `/auberge` est réservée au MJ (GM).
## API Programmatique
```javascript
// Afficher l'aide
game.wfrp4e.inn.displayHelp();
// Lister les tables
game.wfrp4e.inn.listTables();
// Effectuer un jet
game.wfrp4e.inn.rollInnTable('base');
// Trouver une table par mot-clé
const tableName = game.wfrp4e.inn.findTableByKeyword('mari');
```
## Migration depuis l'ancien système
L'ancienne implémentation dans `addon-register.js` (`_manage_inn_roll`) a été remplacée par ce module pour :
- Cohérence avec le module TravelV2
- Meilleure maintenabilité
- Support des commandes WFRP4e natives
- Interface utilisateur améliorée
## Styles CSS
Les styles sont définis dans `patch-styles.css` avec les classes :
- `.wfrp4e-inn-help` - Aide de la commande
- `.wfrp4e-inn-list` - Liste des tables
- `.wfrp4e-inn-table-list` - Liste avec liens cliquables

93
modules/inn/inn-init.js Normal file
View File

@@ -0,0 +1,93 @@
import InnRoller from './InnRoller.js';
/**
* Initialisation du module Inn (Auberge)
*/
export function initInn() {
console.log("Inn: Initialisation du module d'auberge");
// Hook pour initialiser au démarrage
Hooks.once('ready', async () => {
console.log("Inn: Module d'auberge prêt");
// Exposer la classe globalement
game.wfrp4e = game.wfrp4e || {};
game.wfrp4e.inn = InnRoller;
console.log("Inn: Classe accessible via game.wfrp4e.inn");
// Enregistrer la commande dans le système WFRP4e si disponible
if (game.wfrp4e?.commands) {
console.log("Inn: Enregistrement de la commande /auberge");
game.wfrp4e.commands.add({
auberge: {
description: "Jets sur les tables d'auberge (FR)",
args: ["table"],
defaultArg: "table",
callback: (table) => {
// Vérifier que l'utilisateur est GM
if (!game.user.isGM) {
ui.notifications.warn("La commande /auberge est réservée au MJ.");
return;
}
console.log(`Inn: Commande /auberge exécutée avec table="${table}"`);
// Convertir null en undefined
table = table || undefined;
// Si pas de table spécifiée, afficher l'aide
if (!table) {
InnRoller.displayHelp();
} else if (table === 'help' || table === 'aide') {
InnRoller.displayHelp();
} else if (table === 'list' || table === 'liste') {
InnRoller.listTables();
} else if (table === 'menu') {
InnRoller.displayMenuChoice();
} else {
InnRoller.rollInnTable(table);
}
}
}
});
console.log("Inn: Commande /auberge enregistrée avec succès");
} else {
console.warn("Inn: game.wfrp4e.commands non disponible");
}
});
// Hook pour gérer les clics sur les liens de tables d'auberge
Hooks.on('renderChatMessage', (message, html, data) => {
// Ajouter un listener pour les clics sur les liens d'auberge
html.find('a[data-action="clickAuberge"]').click((event) => {
event.preventDefault();
const tableKey = $(event.currentTarget).data('table');
console.log(`Inn: Clic sur la table ${tableKey}`);
if (game.user.isGM) {
InnRoller.rollInnTable(tableKey);
} else {
ui.notifications.warn("Seul le MJ peut utiliser les tables d'auberge.");
}
});
// Ajouter un listener pour les clics sur les boutons de menu
html.find('a[data-action="clickAubergeMenu"]').click((event) => {
event.preventDefault();
const quality = $(event.currentTarget).data('quality');
console.log(`Inn: Clic sur menu de qualité "${quality}"`);
if (game.user.isGM) {
// Si quality === "menu", afficher le choix, sinon générer directement
if (quality === 'menu') {
InnRoller.displayMenuChoice();
} else {
InnRoller.generateMenu(quality);
}
} else {
ui.notifications.warn("Seul le MJ peut utiliser les tables d'auberge.");
}
});
});
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,339 @@
/**
* TravelDistanceV2
* Classe de gestion du calcul des distances de voyage pour WFRP4e
* Version adaptée pour le module de traduction française
*/
import { PathFinder } from './pathfinding.js';
export default class TravelDistanceV2 {
static roadGraph = null; // Graphe pour les routes terrestres uniquement
static waterGraph = null; // Graphe pour les voies fluviales et maritimes
static mixedGraph = null; // Graphe combinant tous les modes de transport
/**
* Charge les données de voyage depuis le fichier JSON
*/
static async loadTravelData() {
try {
console.log("TravelV2: Début du chargement des données...");
const response = await fetch('modules/wh4-fr-translation/modules/travelv2/travel_data.json');
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
this.travel_data = await response.json();
console.log(`TravelV2: ${this.travel_data.length} routes chargées avec succès`);
// Construire les 3 graphes pour le pathfinding
this.roadGraph = PathFinder.buildGraph(this.travel_data, 'road');
this.waterGraph = PathFinder.buildGraph(this.travel_data, 'water');
this.mixedGraph = PathFinder.buildGraph(this.travel_data, 'mixed');
console.log(`TravelV2: Graphe routier: ${Object.keys(this.roadGraph).length} villes`);
console.log(`TravelV2: Graphe fluvial/maritime: ${Object.keys(this.waterGraph).length} villes`);
console.log(`TravelV2: Graphe mixte: ${Object.keys(this.mixedGraph).length} villes`);
ui.notifications.info(`TravelV2: ${this.travel_data.length} routes de voyage chargées`);
} catch (error) {
console.error("TravelV2: Erreur lors du chargement des données de voyage:", error);
ui.notifications.error("Erreur lors du chargement des données de voyage. Vérifiez la console.");
this.travel_data = []; // Initialiser avec un tableau vide pour éviter les erreurs
}
}
/**
* Retourne une chaîne lisible pour le niveau de danger
* @param {String} dangerLevel
* @returns {String}
*/
static dangerToString(dangerLevel) {
if (dangerLevel == "") return "Très bas";
if (dangerLevel == '!') return "Bas";
if (dangerLevel == '!!') return "Moyen";
if (dangerLevel == '!!!') return "Élevé";
return "Très élevé";
}
/**
* Arrondit la durée à une valeur entière ou .5
* @param {Number} duration
* @returns {Number}
*/
static roundDuration(duration) {
let trunc = Math.trunc(duration);
let frac = duration - trunc;
let adjust = 0;
if (frac > 0.75) adjust = 1;
else if (frac >= 0.25) adjust = 0.5;
return trunc + adjust;
}
/**
* Affiche les distances de voyage entre deux villes ou liste les destinations
* @param {String} fromTown Ville de départ
* @param {String} toTown Ville d'arrivée (optionnel)
*/
static displayTravelDistance(fromTown, toTown) {
// Vérifier que les données sont chargées
if (!this.travel_data || this.travel_data.length === 0) {
ui.notifications.error("Les données de voyage ne sont pas encore chargées. Veuillez patienter...");
console.error("TravelV2: travel_data n'est pas chargé");
return;
}
console.log(`TravelV2: displayTravelDistance appelé avec fromTown="${fromTown}", toTown="${toTown}"`);
console.log(`TravelV2: fromTown type: ${typeof fromTown}, valeur falsy: ${!fromTown}`);
console.log(`TravelV2: toTown type: ${typeof toTown}, valeur falsy: ${!toTown}`);
console.log(`TravelV2: ${this.travel_data.length} routes disponibles`);
let message = "";
console.log("TravelV2: Vérification des conditions...");
console.log(`TravelV2: toTown ? ${!!toTown}`);
console.log(`TravelV2: fromTown == 'help' ? ${fromTown == 'help'}`);
console.log(`TravelV2: fromTown ? ${!!fromTown}`);
console.log(`TravelV2: else (pas de fromTown) ? ${!fromTown && !toTown}`);
if (toTown) {
console.log("TravelV2: Branche: Affichage des détails entre deux villes");
// Afficher les détails de voyage entre deux villes spécifiques
const originalFrom = fromTown;
const originalTo = toTown;
fromTown = fromTown.toLowerCase();
toTown = toTown.toLowerCase();
// Chercher d'abord une route directe
let directRoute = null;
for (const travel of this.travel_data) {
if (travel.from.toLowerCase() == fromTown && travel.to.toLowerCase() == toTown) {
directRoute = travel;
break;
}
}
if (directRoute) {
// Route directe trouvée - affichage classique avec toutes les options
message += this.formatDirectRoute(directRoute);
} else {
// Pas de route directe - calculer les 3 types de trajets
console.log("TravelV2: Pas de route directe, calcul des itinéraires...");
const mixedPath = PathFinder.dijkstra(this.mixedGraph, originalFrom, originalTo, 'days');
const roadPath = PathFinder.dijkstra(this.roadGraph, originalFrom, originalTo, 'days');
const waterPath = PathFinder.dijkstra(this.waterGraph, originalFrom, originalTo, 'days');
if (!mixedPath && !roadPath && !waterPath) {
message += `<p><strong>Aucun chemin trouvé entre ${originalFrom} et ${originalTo}</strong></p>`;
message += `<p>Il n'existe pas de route reliant ces deux villes dans les données disponibles.</p>`;
} else {
message += `<div class="voyage-main-title">De ${originalFrom} à ${originalTo}</div>`;
message += `<p><em>Différentes options de voyage disponibles :</em></p><hr class="voyage-separator">`;
// Option 1 : Trajet mixte optimal (le plus rapide)
if (mixedPath) {
message += this.formatMultiStepRoute(mixedPath, originalFrom, originalTo, 'mixed');
message += `<hr class="voyage-separator">`;
}
// Option 2 : Trajet 100% terrestre
if (roadPath) {
message += this.formatMultiStepRoute(roadPath, originalFrom, originalTo, 'road');
message += `<hr class="voyage-separator">`;
}
// Option 3 : Trajet 100% eau (fleuve/mer)
if (waterPath) {
message += this.formatMultiStepRoute(waterPath, originalFrom, originalTo, 'water');
}
}
}
} else if (fromTown && fromTown == "help") {
console.log("TravelV2: Branche: Affichage de l'aide");
// Afficher l'aide
message += `<p><strong>Aide pour /voyage</strong><br>`;
message += `Usage: <code>/voyage [ville_départ] [ville_arrivée]</code><br><br>`;
message += `Exemples:<br>`;
message += `<code>/voyage</code> - Liste toutes les villes de départ<br>`;
message += `<code>/voyage Altdorf</code> - Liste les destinations depuis Altdorf<br>`;
message += `<code>/voyage Altdorf Nuln</code> - Affiche les détails de voyage entre Altdorf et Nuln`;
message += `</p>`;
} else if (fromTown) {
console.log("TravelV2: Branche: Liste des destinations depuis une ville");
// Lister toutes les destinations possibles depuis une ville (avec pathfinding)
const normalizedFrom = PathFinder.findCityInGraph(this.roadGraph, fromTown);
if (normalizedFrom) {
message += `<div class="voyage-destinations-title">Destinations depuis ${normalizedFrom}</div>`;
message += `<p><em>Toutes les villes accessibles (routes directes et itinéraires calculés)</em></p>`;
// Récupérer toutes les villes du graphe sauf la ville de départ
const allCities = Object.keys(this.roadGraph)
.filter(city => city.toLowerCase() !== normalizedFrom.toLowerCase())
.sort((a, b) => a.localeCompare(b));
// Afficher toutes les destinations
for (const city of allCities) {
message += `<p><a class="action-link" data-action="clickVoyage" data-from="${normalizedFrom}" data-to="${city}"><i class="fas fa-map-marked-alt"></i> ${city}</a></p>`;
}
} else {
message += `<p><strong>Ville inconnue: ${fromTown}</strong></p>`;
message += `<p>Cette ville n'existe pas dans la base de données.</p>`;
}
} else {
console.log("TravelV2: Branche: Liste de toutes les villes de départ");
// Lister toutes les villes de départ
message += `<div class="voyage-destinations-title">Sélectionnez une ville de départ</div>`;
let uniqTown = {};
for (const travel of this.travel_data) {
if (uniqTown[travel.from] == undefined) {
uniqTown[travel.from] = 1;
message += `<p><a class="action-link" data-action="clickVoyage" data-from="${travel.from}"><i class="fas fa-list"></i> ${travel.from}</a></p>`;
}
}
}
console.log(`TravelV2: Message généré (longueur: ${message.length})`);
if (message.length === 0) {
console.warn("TravelV2: Aucune donnée trouvée pour les critères fournis");
ui.notifications.warn("Aucune route trouvée pour ces critères");
return;
}
ChatMessage.create({
content: message,
whisper: [game.user.id], // Afficher uniquement pour le GM qui a lancé la commande
speaker: { alias: "Outil de voyage" }
});
console.log("TravelV2: ChatMessage créé avec succès");
}
/**
* Gère le clic sur un lien de voyage
* @param {Event} event
* @param {HTMLElement} target
*/
static handleTravelClick(event, target) {
let fromTown = target.dataset.from;
let toTown = target.dataset.to;
TravelDistanceV2.displayTravelDistance(fromTown, toTown);
}
/**
* Formate l'affichage d'une route directe
* @param {Object} travel - Données de la route
* @returns {String} HTML formaté
*/
static formatDirectRoute(travel) {
let message = `<p><strong>De ${travel.from} à ${travel.to}</strong> (Route directe)`;
if (travel.road_distance != "") {
let road_horse_heavy_days = this.roundDuration(travel.road_days * 0.8);
let road_horse_fast_days = this.roundDuration(travel.road_days * 0.65);
let road_feet_days = this.roundDuration(travel.road_days * 1.25);
let road_danger_string = this.dangerToString(travel.road_danger);
let road_danger_feet_string = this.dangerToString(travel.road_danger + "!");
message += `<br><br><strong>Par route:</strong>`;
message += `<br>Distance: ${travel.road_distance} km`;
message += `<br>Durée (chariot): ${travel.road_days} jours - Danger: ${road_danger_string}`;
message += `<br>Durée (cheval de charge): ${road_horse_heavy_days} jours - Danger: ${road_danger_string}`;
message += `<br>Durée (cheval rapide): ${road_horse_fast_days} jours - Danger: ${road_danger_string}`;
message += `<br>Durée (à pied): ${road_feet_days} jours - Danger: ${road_danger_feet_string}`;
}
if (travel.river_distance != "") {
let river_danger_string = this.dangerToString(travel.river_danger);
message += `<br><br><strong>Par rivière:</strong>`;
message += `<br>Distance: ${travel.river_distance} km`;
message += `<br>Durée: ${travel.river_days} jours - Danger: ${river_danger_string}`;
}
if (travel.sea_distance != "") {
let sea_danger_string = this.dangerToString(travel.sea_danger);
message += `<br><br><strong>Par mer:</strong>`;
message += `<br>Distance: ${travel.sea_distance} km`;
message += `<br>Durée: ${travel.sea_days} jours - Danger: ${sea_danger_string}`;
}
message += "</p>";
return message;
}
/**
* Formate l'affichage d'une route multi-étapes
* @param {Object} pathResult - Résultat du pathfinding
* @param {String} fromCity - Ville de départ
* @param {String} toCity - Ville d'arrivée
* @param {String} routeType - Type de route ('mixed', 'road', 'water')
* @returns {String} HTML formaté
*/
static formatMultiStepRoute(pathResult, fromCity, toCity, routeType = 'road') {
// Déterminer le titre selon le type
let routeTitle = "";
if (routeType === 'mixed') {
routeTitle = "🌟 Itinéraire optimal (tous modes de transport)";
} else if (routeType === 'road') {
routeTitle = "🛤️ Itinéraire 100% terrestre";
} else if (routeType === 'water') {
routeTitle = "⛵ Itinéraire 100% fluvial/maritime";
}
let message = `<div class="voyage-route-title">${routeTitle}</div>`;
message += `<p><strong>${fromCity}${toCity}</strong> (${pathResult.steps} étape${pathResult.steps > 1 ? 's' : ''})`;
// Résumé du voyage
const totalDistance = Math.round(pathResult.totalDistance);
const totalDays = Math.round(pathResult.totalDays);
const danger_string = this.dangerToString(pathResult.maxDanger);
// Pour les routes terrestres, afficher les variantes de durée
const includesRoad = !pathResult.modesUsed || pathResult.modesUsed.includes('road');
message += `<br><br><strong>📊 Résumé du voyage:</strong>`;
message += `<br>Distance totale: ${totalDistance} km`;
if (includesRoad) {
const road_horse_heavy_days = this.roundDuration(pathResult.totalDays * 0.8);
const road_horse_fast_days = this.roundDuration(pathResult.totalDays * 0.65);
const road_feet_days = this.roundDuration(pathResult.totalDays * 1.25);
const danger_feet_string = this.dangerToString(pathResult.maxDanger + "!");
message += `<br>Durée (chariot): ${totalDays} jours - Danger max: ${danger_string}`;
message += `<br>Durée (cheval de charge): ${road_horse_heavy_days} jours - Danger max: ${danger_string}`;
message += `<br>Durée (cheval rapide): ${road_horse_fast_days} jours - Danger max: ${danger_string}`;
message += `<br>Durée (à pied): ${road_feet_days} jours - Danger max: ${danger_feet_string}`;
} else {
message += `<br>Durée totale: ${totalDays} jours - Danger max: ${danger_string}`;
}
// Détails des étapes avec mode de transport
message += `<br><br><strong>🗺️ Itinéraire détaillé:</strong>`;
for (let i = 0; i < pathResult.path.length; i++) {
const step = pathResult.path[i];
const stepNum = i + 1;
const stepDanger = this.dangerToString(step.danger);
// Icône selon le mode de transport
let modeIcon = "🛤️";
let modeName = "route";
if (step.mode === 'river') {
modeIcon = "🚣";
modeName = "fleuve";
} else if (step.mode === 'sea') {
modeIcon = "⛵";
modeName = "mer";
}
message += `<br><br><em>Étape ${stepNum}:</em> ${step.from}${step.to}`;
message += `<br> ${modeIcon} Par ${modeName}: ${Math.round(step.distance)} km, ${step.days} jour${step.days > 1 ? 's' : ''} - Danger: ${stepDanger}`;
}
message += "</p>";
return message;
}
}

View File

@@ -0,0 +1,30 @@
/**
* Script de débogage pour vérifier l'affichage du message
*/
// Vérifier que les données sont chargées
console.log("=== DEBUG DISPLAY ===");
console.log("travel_data:", game.wfrp4e.travelv2.travel_data);
console.log("Nombre de routes:", game.wfrp4e.travelv2.travel_data?.length);
// Générer le message manuellement comme le fait la fonction
let message = "";
message += `<h3>Sélectionnez une ville de départ</h3>`;
let uniqTown = {};
for (var travel of game.wfrp4e.travelv2.travel_data) {
if (uniqTown[travel.from] == undefined) {
uniqTown[travel.from] = 1;
message += `<p><a class="action-link" data-action="clickTravel2" data-from="${travel.from}"><i class="fas fa-list"></i> ${travel.from}</a></p>`;
}
}
console.log("Message généré:", message);
console.log("Longueur du message:", message.length);
console.log("Nombre de villes uniques:", Object.keys(uniqTown).length);
// Tester ChatMessage.create
ChatMessage.create({
content: message,
whisper: game.user.isGM ? [] : [game.user.id]
});

View File

@@ -0,0 +1,69 @@
/**
* Script de diagnostic pour TravelV2
*
* Copiez-collez ce code dans la console de Foundry VTT (F12)
* pour diagnostiquer les problèmes de chargement
*/
console.log("=== Diagnostic TravelV2 ===\n");
// Test 1: Vérifier si la classe existe
console.log("1. Classe TravelDistanceV2 existe ?");
if (typeof TravelDistanceV2 !== 'undefined') {
console.log(" ✓ OUI - La classe est disponible");
} else {
console.log(" ✗ NON - La classe n'est pas chargée !");
console.log(" → Vérifiez que le module est activé et rechargez (F5)");
}
// Test 2: Vérifier les données
console.log("\n2. Données chargées ?");
if (typeof TravelDistanceV2 !== 'undefined' && TravelDistanceV2.travel_data) {
console.log(` ✓ OUI - ${TravelDistanceV2.travel_data.length} routes chargées`);
console.log(` → Première route: ${TravelDistanceV2.travel_data[0]?.from}${TravelDistanceV2.travel_data[0]?.to}`);
} else {
console.log(" ✗ NON - Les données ne sont pas chargées");
console.log(" → Essayez de les charger manuellement:");
console.log(" → await TravelDistanceV2.loadTravelData()");
}
// Test 3: Tester le chargement manuel
console.log("\n3. Test de chargement manuel:");
console.log(" Exécutez: await TravelDistanceV2.loadTravelData()");
console.log(" Puis vérifiez avec: TravelDistanceV2.travel_data.length");
// Test 4: Tester le chemin du fichier
console.log("\n4. Vérification du chemin du fichier:");
const path = 'modules/foundryvtt-wh4-lang-fr-fr/modules/travelv2/travel_data.json';
console.log(` Chemin: ${path}`);
console.log(" Test de fetch...");
fetch(path)
.then(response => {
console.log(` ✓ Fichier accessible - Status: ${response.status}`);
return response.json();
})
.then(data => {
console.log(` ✓ JSON valide - ${data.length} routes trouvées`);
})
.catch(error => {
console.log(` ✗ Erreur: ${error.message}`);
console.log(" → Vérifiez que le fichier travel_data.json existe bien");
});
// Test 5: Afficher l'état du module
console.log("\n5. État du module:");
console.log(` game.modules = ${game.modules ? 'Disponible' : 'Non disponible'}`);
const frModule = game.modules.get('foundryvtt-wh4-lang-fr-fr');
if (frModule) {
console.log(` ✓ Module trouvé: ${frModule.title}`);
console.log(` → Actif: ${frModule.active}`);
} else {
console.log(" ✗ Module 'foundryvtt-wh4-lang-fr-fr' non trouvé");
}
console.log("\n=== Fin du diagnostic ===");
console.log("\nCommandes utiles:");
console.log("• Charger les données: await TravelDistanceV2.loadTravelData()");
console.log("• Vérifier les données: TravelDistanceV2.travel_data");
console.log("• Tester l'affichage: TravelDistanceV2.displayTravelDistance()");
console.log("• Tester avec ville: TravelDistanceV2.displayTravelDistance('Altdorf')");

View File

@@ -0,0 +1,8 @@
/**
* Index du module TravelV2
*
* Ce fichier exporte tous les composants du module TravelV2
*/
export { default as TravelDistanceV2 } from './TravelDistanceV2.js';
export { initTravelV2 } from './travelv2-init.js';

View File

@@ -0,0 +1,218 @@
/**
* Algorithmes de calcul de plus court chemin pour les voyages
*/
/**
* Classe pour le calcul de plus court chemin (algorithme de Dijkstra)
*/
export class PathFinder {
/**
* Construit un graphe à partir des données de voyage
* @param {Array} travelData - Données de voyage
* @param {String|Array} modes - Mode(s) de transport ('road', 'river', 'sea', ['road', 'river', 'sea'], 'water')
* @returns {Object} Graphe avec adjacence et poids
*/
static buildGraph(travelData, modes = 'road') {
const graph = {};
// Normaliser modes en tableau
let modeList = [];
if (modes === 'water') {
modeList = ['river', 'sea'];
} else if (modes === 'mixed') {
modeList = ['road', 'river', 'sea'];
} else if (Array.isArray(modes)) {
modeList = modes;
} else {
modeList = [modes];
}
for (const route of travelData) {
const from = route.from;
const to = route.to;
// Initialiser les nœuds
if (!graph[from]) {
graph[from] = [];
}
if (!graph[to]) {
graph[to] = [];
}
// Pour chaque mode de transport disponible
for (const mode of modeList) {
const distanceKey = `${mode}_distance`;
const daysKey = `${mode}_days`;
const distance = route[distanceKey];
const days = route[daysKey];
// Ignorer les routes sans ce mode de transport
if (!distance || distance === "" || !days || days === "") {
continue;
}
// Ajouter les arêtes (bidirectionnelles)
graph[from].push({
destination: to,
distance: parseFloat(distance),
days: parseFloat(days),
danger: route[`${mode}_danger`] || "",
mode: mode
});
graph[to].push({
destination: from,
distance: parseFloat(distance),
days: parseFloat(days),
danger: route[`${mode}_danger`] || "",
mode: mode
});
}
}
return graph;
}
/**
* Algorithme de Dijkstra pour trouver le plus court chemin
* @param {Object} graph - Graphe d'adjacence
* @param {String} start - Ville de départ
* @param {String} end - Ville d'arrivée
* @param {String} metric - Métrique à minimiser ('distance' ou 'days')
* @returns {Object|null} Chemin trouvé avec détails ou null si pas de chemin
*/
static dijkstra(graph, start, end, metric = 'days') {
// Normaliser les noms de villes
const normalizedStart = this.findCityInGraph(graph, start);
const normalizedEnd = this.findCityInGraph(graph, end);
if (!normalizedStart || !normalizedEnd) {
console.warn(`PathFinder: Ville non trouvée - start: ${start}, end: ${end}`);
return null;
}
// Initialisation
const distances = {};
const previous = {};
const visited = new Set();
const queue = [];
// Initialiser toutes les distances à l'infini
for (const node in graph) {
distances[node] = Infinity;
previous[node] = null;
}
distances[normalizedStart] = 0;
queue.push({ node: normalizedStart, distance: 0 });
while (queue.length > 0) {
// Trouver le nœud avec la plus petite distance
queue.sort((a, b) => a.distance - b.distance);
const { node: current } = queue.shift();
if (visited.has(current)) continue;
visited.add(current);
// Si on a atteint la destination
if (current === normalizedEnd) {
return this.reconstructPath(previous, normalizedStart, normalizedEnd, graph, metric);
}
// Explorer les voisins
const neighbors = graph[current] || [];
for (const neighbor of neighbors) {
if (visited.has(neighbor.destination)) continue;
const weight = neighbor[metric]; // 'distance' ou 'days'
const newDistance = distances[current] + weight;
if (newDistance < distances[neighbor.destination]) {
distances[neighbor.destination] = newDistance;
previous[neighbor.destination] = {
from: current,
edge: neighbor
};
queue.push({ node: neighbor.destination, distance: newDistance });
}
}
}
// Pas de chemin trouvé
console.warn(`PathFinder: Aucun chemin trouvé entre ${start} et ${end}`);
return null;
}
/**
* Trouve une ville dans le graphe (insensible à la casse)
* @param {Object} graph - Graphe
* @param {String} cityName - Nom de la ville
* @returns {String|null} Nom normalisé de la ville ou null
*/
static findCityInGraph(graph, cityName) {
const lowerName = cityName.toLowerCase();
for (const city in graph) {
if (city.toLowerCase() === lowerName) {
return city;
}
}
return null;
}
/**
* Reconstruit le chemin à partir des prédécesseurs
* @param {Object} previous - Map des prédécesseurs
* @param {String} start - Ville de départ
* @param {String} end - Ville d'arrivée
* @param {Object} graph - Graphe d'adjacence
* @param {String} metric - Métrique utilisée
* @returns {Object} Détails du chemin
*/
static reconstructPath(previous, start, end, graph, metric) {
const path = [];
let current = end;
let totalDistance = 0;
let totalDays = 0;
let maxDanger = "";
const modesUsed = new Set();
// Reconstruire le chemin en remontant
while (current !== start) {
const prev = previous[current];
if (!prev) break;
const mode = prev.edge.mode || 'road';
modesUsed.add(mode);
path.unshift({
from: prev.from,
to: current,
distance: prev.edge.distance,
days: prev.edge.days,
danger: prev.edge.danger,
mode: mode
});
totalDistance += prev.edge.distance;
totalDays += prev.edge.days;
// Calculer le danger maximum
const dangerLevel = (prev.edge.danger || "").length;
const currentMaxLevel = maxDanger.length;
if (dangerLevel > currentMaxLevel) {
maxDanger = prev.edge.danger;
}
current = prev.from;
}
return {
path: path,
totalDistance: totalDistance,
totalDays: totalDays,
maxDanger: maxDanger,
steps: path.length,
modesUsed: Array.from(modesUsed)
};
}
}

53
modules/travelv2/test.js Normal file
View File

@@ -0,0 +1,53 @@
/**
* Fichier de test pour le module TravelV2
*
* Pour tester le module dans la console de développement de Foundry VTT:
*
* 1. Charger le module
* 2. Ouvrir la console (F12)
* 3. Exécuter ces tests
*/
// Test 1: Vérifier que la classe est chargée
console.log("Test 1: Classe TravelDistanceV2 disponible?");
console.log(typeof TravelDistanceV2 !== 'undefined' ? "✓ OK" : "✗ ÉCHEC");
// Test 2: Vérifier que les données sont chargées
console.log("\nTest 2: Données de voyage chargées?");
console.log(TravelDistanceV2.travel_data ? "✓ OK - " + TravelDistanceV2.travel_data.length + " routes trouvées" : "✗ ÉCHEC");
// Test 3: Tester dangerToString
console.log("\nTest 3: Test de dangerToString");
console.log("'' -> " + TravelDistanceV2.dangerToString(""));
console.log("'!' -> " + TravelDistanceV2.dangerToString("!"));
console.log("'!!' -> " + TravelDistanceV2.dangerToString("!!"));
console.log("'!!!' -> " + TravelDistanceV2.dangerToString("!!!"));
// Test 4: Tester roundDuration
console.log("\nTest 4: Test de roundDuration");
console.log("22.1 -> " + TravelDistanceV2.roundDuration(22.1));
console.log("22.3 -> " + TravelDistanceV2.roundDuration(22.3));
console.log("22.5 -> " + TravelDistanceV2.roundDuration(22.5));
console.log("22.8 -> " + TravelDistanceV2.roundDuration(22.8));
// Test 5: Tester displayTravelDistance avec une ville
console.log("\nTest 5: Affichage des destinations depuis Altdorf");
// TravelDistanceV2.displayTravelDistance("Altdorf");
console.log("Exécutez manuellement: TravelDistanceV2.displayTravelDistance('Altdorf')");
// Test 6: Tester displayTravelDistance avec deux villes
console.log("\nTest 6: Affichage du trajet Altdorf -> Nuln");
// TravelDistanceV2.displayTravelDistance("Altdorf", "Nuln");
console.log("Exécutez manuellement: TravelDistanceV2.displayTravelDistance('Altdorf', 'Nuln')");
// Test 7: Tester la commande help
console.log("\nTest 7: Affichage de l'aide");
// TravelDistanceV2.displayTravelDistance("help");
console.log("Exécutez manuellement: TravelDistanceV2.displayTravelDistance('help')");
console.log("\n=== Tests terminés ===");
console.log("\nPour tester la commande complète, tapez dans le chat:");
console.log("/travel2");
console.log("/travel2 Altdorf");
console.log("/travel2 Altdorf Nuln");
console.log("/travel2 help");

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,67 @@
import TravelDistanceV2 from './TravelDistanceV2.js';
/**
* Initialisation du module TravelV2
*/
export function initTravelV2() {
console.log("TravelV2: Initialisation du module de voyage");
// Hook pour charger les données au démarrage
Hooks.once('ready', async () => {
console.log("TravelV2: Chargement des données de voyage");
// Exposer la classe globalement pour accès depuis la console
game.wfrp4e = game.wfrp4e || {};
game.wfrp4e.travelv2 = TravelDistanceV2;
await TravelDistanceV2.loadTravelData();
console.log("TravelV2: Classe accessible via game.wfrp4e.travelv2");
// Enregistrer la commande dans le système WFRP4e si disponible
if (game.wfrp4e?.commands) {
console.log("TravelV2: Enregistrement de la commande /voyage");
game.wfrp4e.commands.add({
voyage: {
description: "Outil de calcul de distances de voyage (FR)",
args: ["from", "to"],
defaultArg: "from",
callback: (from, to) => {
// Vérifier que l'utilisateur est GM
if (!game.user.isGM) {
ui.notifications.warn("La commande /voyage est réservée au MJ.");
return;
}
console.log(`TravelV2: Commande /voyage exécutée`);
console.log(`TravelV2: from =`, from, `(type: ${typeof from})`);
console.log(`TravelV2: to =`, to, `(type: ${typeof to})`);
console.log(`TravelV2: from === null ?`, from === null);
console.log(`TravelV2: to === null ?`, to === null);
// Convertir null en undefined pour que la logique fonctionne
from = from || undefined;
to = to || undefined;
TravelDistanceV2.displayTravelDistance(from, to);
}
}
});
console.log("TravelV2: Commande /voyage enregistrée avec succès");
} else {
console.warn("TravelV2: game.wfrp4e.commands non disponible");
}
});
// Hook pour ajouter un gestionnaire de clics sur les liens de voyage
Hooks.on('renderChatMessage', (message, html, data) => {
// Ajouter un listener pour les clics sur les liens de voyage
html.find('a[data-action="clickVoyage"]').click((event) => {
event.preventDefault();
const target = event.currentTarget;
TravelDistanceV2.handleTravelClick(event, target);
});
});
console.log("TravelV2: Module de voyage initialisé");
}

View File

@@ -1 +1 @@
MANIFEST-001134 MANIFEST-001251

View File

@@ -1,7 +1,7 @@
2025/06/04-17:19:09.444091 7ff2609fa6c0 Recovering log #1132 2026/01/07-15:05:51.801144 7f93ebfff6c0 Recovering log #1249
2025/06/04-17:19:09.455068 7ff2609fa6c0 Delete type=3 #1130 2026/01/07-15:05:51.812047 7f93ebfff6c0 Delete type=3 #1247
2025/06/04-17:19:09.455138 7ff2609fa6c0 Delete type=0 #1132 2026/01/07-15:05:51.812099 7f93ebfff6c0 Delete type=0 #1249
2025/06/04-17:45:04.305164 7ff25a3ff6c0 Level-0 table #1137: started 2026/01/07-15:06:45.486999 7f93e9ffb6c0 Level-0 table #1254: started
2025/06/04-17:45:04.305197 7ff25a3ff6c0 Level-0 table #1137: 0 bytes OK 2026/01/07-15:06:45.487020 7f93e9ffb6c0 Level-0 table #1254: 0 bytes OK
2025/06/04-17:45:04.311962 7ff25a3ff6c0 Delete type=0 #1135 2026/01/07-15:06:45.493208 7f93e9ffb6c0 Delete type=0 #1252
2025/06/04-17:45:04.332591 7ff25a3ff6c0 Manual compaction at level-0 from '!journal!3IgmiprzLB6Lwenc' @ 72057594037927935 : 1 .. '!journal.pages!suuYN87Al1ZZWtQQ.jhgNnhWhrkOpKs1B' @ 0 : 0; will stop at (end) 2026/01/07-15:06:45.493509 7f93e9ffb6c0 Manual compaction at level-0 from '!journal!3IgmiprzLB6Lwenc' @ 72057594037927935 : 1 .. '!journal.pages!suuYN87Al1ZZWtQQ.jhgNnhWhrkOpKs1B' @ 0 : 0; will stop at (end)

View File

@@ -1,7 +1,7 @@
2025/06/04-15:28:44.957251 7ff25b7fe6c0 Recovering log #1128 2026/01/07-14:19:22.396531 7f93ebfff6c0 Recovering log #1245
2025/06/04-15:28:44.967265 7ff25b7fe6c0 Delete type=3 #1126 2026/01/07-14:19:22.406238 7f93ebfff6c0 Delete type=3 #1243
2025/06/04-15:28:44.967344 7ff25b7fe6c0 Delete type=0 #1128 2026/01/07-14:19:22.406300 7f93ebfff6c0 Delete type=0 #1245
2025/06/04-16:03:30.536357 7ff25a3ff6c0 Level-0 table #1133: started 2026/01/07-15:04:29.638874 7f93e9ffb6c0 Level-0 table #1250: started
2025/06/04-16:03:30.536423 7ff25a3ff6c0 Level-0 table #1133: 0 bytes OK 2026/01/07-15:04:29.638900 7f93e9ffb6c0 Level-0 table #1250: 0 bytes OK
2025/06/04-16:03:30.543881 7ff25a3ff6c0 Delete type=0 #1131 2026/01/07-15:04:29.650961 7f93e9ffb6c0 Delete type=0 #1248
2025/06/04-16:03:30.557944 7ff25a3ff6c0 Manual compaction at level-0 from '!journal!3IgmiprzLB6Lwenc' @ 72057594037927935 : 1 .. '!journal.pages!suuYN87Al1ZZWtQQ.jhgNnhWhrkOpKs1B' @ 0 : 0; will stop at (end) 2026/01/07-15:04:29.667055 7f93e9ffb6c0 Manual compaction at level-0 from '!journal!3IgmiprzLB6Lwenc' @ 72057594037927935 : 1 .. '!journal.pages!suuYN87Al1ZZWtQQ.jhgNnhWhrkOpKs1B' @ 0 : 0; will stop at (end)

Binary file not shown.

View File

@@ -1 +1 @@
MANIFEST-001136 MANIFEST-001253

View File

@@ -1,7 +1,7 @@
2025/06/04-17:19:09.458785 7ff25affd6c0 Recovering log #1134 2026/01/07-15:05:51.814570 7f93ea7fc6c0 Recovering log #1251
2025/06/04-17:19:09.468745 7ff25affd6c0 Delete type=3 #1132 2026/01/07-15:05:51.824155 7f93ea7fc6c0 Delete type=3 #1249
2025/06/04-17:19:09.468888 7ff25affd6c0 Delete type=0 #1134 2026/01/07-15:05:51.824233 7f93ea7fc6c0 Delete type=0 #1251
2025/06/04-17:45:04.318439 7ff25a3ff6c0 Level-0 table #1139: started 2026/01/07-15:06:45.493731 7f93e9ffb6c0 Level-0 table #1256: started
2025/06/04-17:45:04.318469 7ff25a3ff6c0 Level-0 table #1139: 0 bytes OK 2026/01/07-15:06:45.493762 7f93e9ffb6c0 Level-0 table #1256: 0 bytes OK
2025/06/04-17:45:04.325169 7ff25a3ff6c0 Delete type=0 #1137 2026/01/07-15:06:45.500998 7f93e9ffb6c0 Delete type=0 #1254
2025/06/04-17:45:04.332616 7ff25a3ff6c0 Manual compaction at level-0 from '!folders!3uquYH73ttCdoH0I' @ 72057594037927935 : 1 .. '!items!ylFhk7mGZOnAJTUT' @ 0 : 0; will stop at (end) 2026/01/07-15:06:45.529036 7f93e9ffb6c0 Manual compaction at level-0 from '!folders!3uquYH73ttCdoH0I' @ 72057594037927935 : 1 .. '!items!ylFhk7mGZOnAJTUT' @ 0 : 0; will stop at (end)

View File

@@ -1,7 +1,7 @@
2025/06/04-15:28:44.973169 7ff25affd6c0 Recovering log #1130 2026/01/07-14:19:22.408420 7f93ea7fc6c0 Recovering log #1247
2025/06/04-15:28:44.984459 7ff25affd6c0 Delete type=3 #1128 2026/01/07-14:19:22.419450 7f93ea7fc6c0 Delete type=3 #1245
2025/06/04-15:28:44.984535 7ff25affd6c0 Delete type=0 #1130 2026/01/07-14:19:22.419496 7f93ea7fc6c0 Delete type=0 #1247
2025/06/04-16:03:30.544022 7ff25a3ff6c0 Level-0 table #1135: started 2026/01/07-15:04:29.689520 7f93e9ffb6c0 Level-0 table #1252: started
2025/06/04-16:03:30.544055 7ff25a3ff6c0 Level-0 table #1135: 0 bytes OK 2026/01/07-15:04:29.689548 7f93e9ffb6c0 Level-0 table #1252: 0 bytes OK
2025/06/04-16:03:30.550364 7ff25a3ff6c0 Delete type=0 #1133 2026/01/07-15:04:29.701802 7f93e9ffb6c0 Delete type=0 #1250
2025/06/04-16:03:30.557961 7ff25a3ff6c0 Manual compaction at level-0 from '!folders!3uquYH73ttCdoH0I' @ 72057594037927935 : 1 .. '!items!ylFhk7mGZOnAJTUT' @ 0 : 0; will stop at (end) 2026/01/07-15:04:29.713438 7f93e9ffb6c0 Manual compaction at level-0 from '!folders!3uquYH73ttCdoH0I' @ 72057594037927935 : 1 .. '!items!ylFhk7mGZOnAJTUT' @ 0 : 0; will stop at (end)

Binary file not shown.

View File

@@ -1 +1 @@
MANIFEST-001134 MANIFEST-001251

View File

@@ -1,7 +1,7 @@
2025/06/04-17:19:09.486234 7ff25bfff6c0 Recovering log #1132 2026/01/07-15:05:51.839318 7f93eaffd6c0 Recovering log #1249
2025/06/04-17:19:09.497211 7ff25bfff6c0 Delete type=3 #1130 2026/01/07-15:05:51.849796 7f93eaffd6c0 Delete type=3 #1247
2025/06/04-17:19:09.497296 7ff25bfff6c0 Delete type=0 #1132 2026/01/07-15:05:51.849857 7f93eaffd6c0 Delete type=0 #1249
2025/06/04-17:45:04.325308 7ff25a3ff6c0 Level-0 table #1137: started 2026/01/07-15:06:45.501213 7f93e9ffb6c0 Level-0 table #1254: started
2025/06/04-17:45:04.325335 7ff25a3ff6c0 Level-0 table #1137: 0 bytes OK 2026/01/07-15:06:45.501269 7f93e9ffb6c0 Level-0 table #1254: 0 bytes OK
2025/06/04-17:45:04.332456 7ff25a3ff6c0 Delete type=0 #1135 2026/01/07-15:06:45.508204 7f93e9ffb6c0 Delete type=0 #1252
2025/06/04-17:45:04.332625 7ff25a3ff6c0 Manual compaction at level-0 from '!journal!cZtNgayIw2QFhC9u' @ 72057594037927935 : 1 .. '!journal.pages!cZtNgayIw2QFhC9u.ts265H1XkisLgdow' @ 0 : 0; will stop at (end) 2026/01/07-15:06:45.529072 7f93e9ffb6c0 Manual compaction at level-0 from '!journal!cZtNgayIw2QFhC9u' @ 72057594037927935 : 1 .. '!journal.pages!cZtNgayIw2QFhC9u.ts265H1XkisLgdow' @ 0 : 0; will stop at (end)

View File

@@ -1,7 +1,7 @@
2025/06/04-15:28:45.008049 7ff25affd6c0 Recovering log #1128 2026/01/07-14:19:22.434524 7f93ea7fc6c0 Recovering log #1245
2025/06/04-15:28:45.018492 7ff25affd6c0 Delete type=3 #1126 2026/01/07-14:19:22.444128 7f93ea7fc6c0 Delete type=3 #1243
2025/06/04-15:28:45.018631 7ff25affd6c0 Delete type=0 #1128 2026/01/07-14:19:22.444200 7f93ea7fc6c0 Delete type=0 #1245
2025/06/04-16:03:30.558067 7ff25a3ff6c0 Level-0 table #1133: started 2026/01/07-15:04:29.701936 7f93e9ffb6c0 Level-0 table #1250: started
2025/06/04-16:03:30.558110 7ff25a3ff6c0 Level-0 table #1133: 0 bytes OK 2026/01/07-15:04:29.701958 7f93e9ffb6c0 Level-0 table #1250: 0 bytes OK
2025/06/04-16:03:30.564426 7ff25a3ff6c0 Delete type=0 #1131 2026/01/07-15:04:29.713305 7f93e9ffb6c0 Delete type=0 #1248
2025/06/04-16:03:30.593650 7ff25a3ff6c0 Manual compaction at level-0 from '!journal!cZtNgayIw2QFhC9u' @ 72057594037927935 : 1 .. '!journal.pages!cZtNgayIw2QFhC9u.ts265H1XkisLgdow' @ 0 : 0; will stop at (end) 2026/01/07-15:04:29.713449 7f93e9ffb6c0 Manual compaction at level-0 from '!journal!cZtNgayIw2QFhC9u' @ 72057594037927935 : 1 .. '!journal.pages!cZtNgayIw2QFhC9u.ts265H1XkisLgdow' @ 0 : 0; will stop at (end)

Binary file not shown.

Binary file not shown.

View File

View File

@@ -1 +1 @@
MANIFEST-001134 MANIFEST-001251

View File

@@ -1,7 +1,7 @@
2025/06/04-17:19:09.429340 7ff25b7fe6c0 Recovering log #1132 2026/01/07-15:05:51.788330 7f93eaffd6c0 Recovering log #1249
2025/06/04-17:19:09.439947 7ff25b7fe6c0 Delete type=3 #1130 2026/01/07-15:05:51.798442 7f93eaffd6c0 Delete type=3 #1247
2025/06/04-17:19:09.440019 7ff25b7fe6c0 Delete type=0 #1132 2026/01/07-15:05:51.798508 7f93eaffd6c0 Delete type=0 #1249
2025/06/04-17:45:04.298490 7ff25a3ff6c0 Level-0 table #1137: started 2026/01/07-15:06:45.480176 7f93e9ffb6c0 Level-0 table #1254: started
2025/06/04-17:45:04.298520 7ff25a3ff6c0 Level-0 table #1137: 0 bytes OK 2026/01/07-15:06:45.480197 7f93e9ffb6c0 Level-0 table #1254: 0 bytes OK
2025/06/04-17:45:04.304763 7ff25a3ff6c0 Delete type=0 #1135 2026/01/07-15:06:45.486885 7f93e9ffb6c0 Delete type=0 #1252
2025/06/04-17:45:04.305020 7ff25a3ff6c0 Manual compaction at level-0 from '!journal!50u8VAjdmovyr0hx' @ 72057594037927935 : 1 .. '!journal.pages!yzw9I0r3hCK7PJnz.sPNCYj2nR3Cp3jHd' @ 0 : 0; will stop at (end) 2026/01/07-15:06:45.493497 7f93e9ffb6c0 Manual compaction at level-0 from '!journal!50u8VAjdmovyr0hx' @ 72057594037927935 : 1 .. '!journal.pages!yzw9I0r3hCK7PJnz.sPNCYj2nR3Cp3jHd' @ 0 : 0; will stop at (end)

View File

@@ -1,7 +1,7 @@
2025/06/04-15:28:44.939372 7ff2609fa6c0 Recovering log #1128 2026/01/07-14:19:22.383713 7f93eb7fe6c0 Recovering log #1245
2025/06/04-15:28:44.950220 7ff2609fa6c0 Delete type=3 #1126 2026/01/07-14:19:22.394171 7f93eb7fe6c0 Delete type=3 #1243
2025/06/04-15:28:44.950355 7ff2609fa6c0 Delete type=0 #1128 2026/01/07-14:19:22.394305 7f93eb7fe6c0 Delete type=0 #1245
2025/06/04-16:03:30.528726 7ff25a3ff6c0 Level-0 table #1133: started 2026/01/07-15:04:29.651336 7f93e9ffb6c0 Level-0 table #1250: started
2025/06/04-16:03:30.528791 7ff25a3ff6c0 Level-0 table #1133: 0 bytes OK 2026/01/07-15:04:29.651360 7f93e9ffb6c0 Level-0 table #1250: 0 bytes OK
2025/06/04-16:03:30.536083 7ff25a3ff6c0 Delete type=0 #1131 2026/01/07-15:04:29.666893 7f93e9ffb6c0 Delete type=0 #1248
2025/06/04-16:03:30.557927 7ff25a3ff6c0 Manual compaction at level-0 from '!journal!50u8VAjdmovyr0hx' @ 72057594037927935 : 1 .. '!journal.pages!yzw9I0r3hCK7PJnz.sPNCYj2nR3Cp3jHd' @ 0 : 0; will stop at (end) 2026/01/07-15:04:29.667066 7f93e9ffb6c0 Manual compaction at level-0 from '!journal!50u8VAjdmovyr0hx' @ 72057594037927935 : 1 .. '!journal.pages!yzw9I0r3hCK7PJnz.sPNCYj2nR3Cp3jHd' @ 0 : 0; will stop at (end)

Binary file not shown.

Binary file not shown.

View File

View File

View File

@@ -1 +1 @@
MANIFEST-001134 MANIFEST-001251

View File

@@ -1,7 +1,7 @@
2025/06/04-17:19:09.415218 7ff2609fa6c0 Recovering log #1132 2026/01/07-15:05:51.775857 7f93ea7fc6c0 Recovering log #1249
2025/06/04-17:19:09.425579 7ff2609fa6c0 Delete type=3 #1130 2026/01/07-15:05:51.785876 7f93ea7fc6c0 Delete type=3 #1247
2025/06/04-17:19:09.425663 7ff2609fa6c0 Delete type=0 #1132 2026/01/07-15:05:51.785947 7f93ea7fc6c0 Delete type=0 #1249
2025/06/04-17:45:04.291860 7ff25a3ff6c0 Level-0 table #1137: started 2026/01/07-15:06:45.473201 7f93e9ffb6c0 Level-0 table #1254: started
2025/06/04-17:45:04.291911 7ff25a3ff6c0 Level-0 table #1137: 0 bytes OK 2026/01/07-15:06:45.473242 7f93e9ffb6c0 Level-0 table #1254: 0 bytes OK
2025/06/04-17:45:04.298331 7ff25a3ff6c0 Delete type=0 #1135 2026/01/07-15:06:45.480074 7f93e9ffb6c0 Delete type=0 #1252
2025/06/04-17:45:04.305006 7ff25a3ff6c0 Manual compaction at level-0 from '!tables!4l60Lxv8cpsyy2Cg' @ 72057594037927935 : 1 .. '!tables.results!tfaYKDZqu7kgZvRG.yvbwKursaixh2dby' @ 0 : 0; will stop at (end) 2026/01/07-15:06:45.493481 7f93e9ffb6c0 Manual compaction at level-0 from '!tables!4l60Lxv8cpsyy2Cg' @ 72057594037927935 : 1 .. '!tables.results!tfaYKDZqu7kgZvRG.yvbwKursaixh2dby' @ 0 : 0; will stop at (end)

View File

@@ -1,7 +1,7 @@
2025/06/04-15:28:44.907467 7ff25affd6c0 Recovering log #1128 2026/01/07-14:19:22.369653 7f93ebfff6c0 Recovering log #1245
2025/06/04-15:28:44.933287 7ff25affd6c0 Delete type=3 #1126 2026/01/07-14:19:22.381041 7f93ebfff6c0 Delete type=3 #1243
2025/06/04-15:28:44.933354 7ff25affd6c0 Delete type=0 #1128 2026/01/07-14:19:22.381133 7f93ebfff6c0 Delete type=0 #1245
2025/06/04-16:03:30.521711 7ff25a3ff6c0 Level-0 table #1133: started 2026/01/07-15:04:29.629205 7f93e9ffb6c0 Level-0 table #1250: started
2025/06/04-16:03:30.521751 7ff25a3ff6c0 Level-0 table #1133: 0 bytes OK 2026/01/07-15:04:29.629243 7f93e9ffb6c0 Level-0 table #1250: 0 bytes OK
2025/06/04-16:03:30.528207 7ff25a3ff6c0 Delete type=0 #1131 2026/01/07-15:04:29.638743 7f93e9ffb6c0 Delete type=0 #1248
2025/06/04-16:03:30.528580 7ff25a3ff6c0 Manual compaction at level-0 from '!tables!4l60Lxv8cpsyy2Cg' @ 72057594037927935 : 1 .. '!tables.results!tfaYKDZqu7kgZvRG.yvbwKursaixh2dby' @ 0 : 0; will stop at (end) 2026/01/07-15:04:29.667035 7f93e9ffb6c0 Manual compaction at level-0 from '!tables!4l60Lxv8cpsyy2Cg' @ 72057594037927935 : 1 .. '!tables.results!tfaYKDZqu7kgZvRG.yvbwKursaixh2dby' @ 0 : 0; will stop at (end)

Binary file not shown.

View File

View File

View File

@@ -1 +1 @@
MANIFEST-000777 MANIFEST-000894

View File

@@ -1,7 +1,7 @@
2025/06/04-17:19:09.473204 7ff2609fa6c0 Recovering log #775 2026/01/07-15:05:51.826614 7f93ebfff6c0 Recovering log #892
2025/06/04-17:19:09.483139 7ff2609fa6c0 Delete type=3 #773 2026/01/07-15:05:51.837158 7f93ebfff6c0 Delete type=3 #890
2025/06/04-17:19:09.483218 7ff2609fa6c0 Delete type=0 #775 2026/01/07-15:05:51.837206 7f93ebfff6c0 Delete type=0 #892
2025/06/04-17:45:04.312115 7ff25a3ff6c0 Level-0 table #780: started 2026/01/07-15:06:45.521984 7f93e9ffb6c0 Level-0 table #897: started
2025/06/04-17:45:04.312145 7ff25a3ff6c0 Level-0 table #780: 0 bytes OK 2026/01/07-15:06:45.522031 7f93e9ffb6c0 Level-0 table #897: 0 bytes OK
2025/06/04-17:45:04.318313 7ff25a3ff6c0 Delete type=0 #778 2026/01/07-15:06:45.528836 7f93e9ffb6c0 Delete type=0 #895
2025/06/04-17:45:04.332603 7ff25a3ff6c0 Manual compaction at level-0 from '!journal!056ILNNrLiPq3Gi3' @ 72057594037927935 : 1 .. '!journal.pages!yfZxl4I7XAuUF6r3.apXmOlZRmGT4GreB' @ 0 : 0; will stop at (end) 2026/01/07-15:06:45.529100 7f93e9ffb6c0 Manual compaction at level-0 from '!journal!056ILNNrLiPq3Gi3' @ 72057594037927935 : 1 .. '!journal.pages!yfZxl4I7XAuUF6r3.apXmOlZRmGT4GreB' @ 0 : 0; will stop at (end)

View File

@@ -1,7 +1,7 @@
2025/06/04-15:28:44.990819 7ff25b7fe6c0 Recovering log #771 2026/01/07-14:19:22.421981 7f93eb7fe6c0 Recovering log #888
2025/06/04-15:28:45.002034 7ff25b7fe6c0 Delete type=3 #769 2026/01/07-14:19:22.432249 7f93eb7fe6c0 Delete type=3 #886
2025/06/04-15:28:45.002200 7ff25b7fe6c0 Delete type=0 #771 2026/01/07-14:19:22.432317 7f93eb7fe6c0 Delete type=0 #888
2025/06/04-16:03:30.550493 7ff25a3ff6c0 Level-0 table #776: started 2026/01/07-15:04:29.679197 7f93e9ffb6c0 Level-0 table #893: started
2025/06/04-16:03:30.550525 7ff25a3ff6c0 Level-0 table #776: 0 bytes OK 2026/01/07-15:04:29.679221 7f93e9ffb6c0 Level-0 table #893: 0 bytes OK
2025/06/04-16:03:30.557793 7ff25a3ff6c0 Delete type=0 #774 2026/01/07-15:04:29.689398 7f93e9ffb6c0 Delete type=0 #891
2025/06/04-16:03:30.557980 7ff25a3ff6c0 Manual compaction at level-0 from '!journal!056ILNNrLiPq3Gi3' @ 72057594037927935 : 1 .. '!journal.pages!yfZxl4I7XAuUF6r3.apXmOlZRmGT4GreB' @ 0 : 0; will stop at (end) 2026/01/07-15:04:29.713429 7f93e9ffb6c0 Manual compaction at level-0 from '!journal!056ILNNrLiPq3Gi3' @ 72057594037927935 : 1 .. '!journal.pages!yfZxl4I7XAuUF6r3.apXmOlZRmGT4GreB' @ 0 : 0; will stop at (end)

Binary file not shown.

View File

@@ -7,4 +7,314 @@
color: darkolivegreen; color: darkolivegreen;
align-self: center; align-self: center;
text-align: center; text-align: center;
} }
/* Styles pour le module de voyage TravelV2 */
.voyage-main-title {
font-size: 1.3em;
font-weight: bold;
margin-top: 0.5em;
margin-bottom: 0.3em;
}
.voyage-route-title {
font-size: 1.15em;
font-weight: bold;
margin-top: 0.8em;
margin-bottom: 0.3em;
color: #4a5568;
}
.voyage-section-title {
font-size: 1em;
font-weight: bold;
margin-top: 0.5em;
margin-bottom: 0.2em;
}
.voyage-destinations-title {
font-size: 1.2em;
font-weight: bold;
margin-bottom: 0.3em;
}
.voyage-separator {
margin-top: 1em;
margin-bottom: 1em;
border: 0;
border-top: 1px solid #ccc;
}
/* Styles pour le module Inn (Auberge) */
.wfrp4e-inn-help h3,
.wfrp4e-inn-list h3 {
font-size: 1.3em;
font-weight: bold;
margin-top: 0.5em;
margin-bottom: 0.5em;
color: #8b4513;
border-bottom: 2px solid #d2691e;
padding-bottom: 0.3em;
}
.wfrp4e-inn-help ul,
.wfrp4e-inn-list ul {
margin-left: 1.5em;
list-style-type: disc;
}
.wfrp4e-inn-help li,
.wfrp4e-inn-table-list li {
margin: 0.3em 0;
}
.wfrp4e-inn-help hr {
margin: 1em 0;
border: 0;
border-top: 1px solid #ccc;
}
.wfrp4e-inn-help code {
background-color: #f5f5f5;
padding: 0.2em 0.4em;
border-radius: 3px;
font-family: monospace;
color: #d63384;
}
.wfrp4e-inn-help h4 {
font-size: 1em;
font-weight: bold;
margin: 0.8em 0 0.5em 0;
color: var(--color-warm);
}
/* Grille de boutons pour les tables */
.wfrp4e-inn-table-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
gap: 0.5em;
margin: 0.5em 0;
}
.inn-table-btn {
display: block;
padding: 0.6em 0.8em;
background: rgba(139, 69, 19, 0.12);
border: 2px solid rgba(139, 69, 19, 0.35);
border-radius: 4px;
text-align: center;
font-weight: 600;
font-size: 0.95em;
color: var(--color-warm);
transition: all 0.2s;
text-decoration: none;
}
.inn-table-btn:hover {
background: rgba(139, 69, 19, 0.2);
border-color: rgba(139, 69, 19, 0.5);
transform: translateY(-1px);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}
.inn-table-btn i {
margin-right: 0.4em;
color: var(--color-warm-3);
}
/* Anciens styles - à supprimer ou garder pour compatibilité */
.wfrp4e-inn-table-list {
list-style: none;
margin-left: 0;
}
.wfrp4e-inn-table-list li {
margin: 0.5em 0;
padding-left: 0;
}
.wfrp4e-inn-table-list a.action-link {
display: inline-block;
padding: 0.3em 0.8em;
background-color: #8b4513;
color: white;
text-decoration: none;
border-radius: 4px;
transition: background-color 0.2s;
}
.wfrp4e-inn-table-list a.action-link:hover {
background-color: #a0522d;
}
.wfrp4e-inn-table-list a.action-link i {
margin-right: 0.5em;
}
.inn-keyword {
font-size: 0.85em;
color: var(--color-grey2);
font-style: italic;
}
/* Styles pour les résultats de jets d'auberge - Thème WFRP4e */
.wfrp4e-inn-result {
margin: 0.3em 0;
}
.wfrp4e-inn-result .message-header {
text-shadow: 0px 0px 1px #00000087;
border: 2px solid rgba(62, 0, 0, 0.3);
padding: 0.4em 0.6em;
margin-bottom: 0.5em;
background: rgba(0, 0, 0, 0.05);
}
.wfrp4e-inn-result .flavor-text {
color: var(--color-warm);
font-weight: bold;
font-size: 1em;
}
.wfrp4e-inn-result .message-header i {
margin-right: 0.3em;
color: var(--color-warm-3);
}
.inn-dish-name {
font-size: 1.15em;
font-weight: bold;
text-align: center;
padding: 0.6em;
margin: 0.3em 0;
background: rgba(255, 255, 255, 0.3);
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 3px;
}
.inn-roll-info {
text-align: center;
font-size: 0.85em;
color: var(--color-grey2);
margin-top: 0.4em;
padding: 0.3em;
}
.inn-roll-info i {
margin-right: 0.2em;
}
/* Styles pour le choix de menu */
.wfrp4e-inn-menu-choice {
padding: 0.5em;
}
.wfrp4e-inn-menu-choice h3 {
color: var(--color-warm);
margin: 0 0 0.5em 0;
}
.inn-menu-buttons {
display: flex;
flex-direction: column;
gap: 0.5em;
margin: 0.5em 0;
}
.inn-menu-btn {
display: block;
padding: 0.6em 1em;
background: rgba(139, 69, 19, 0.1);
border: 2px solid rgba(139, 69, 19, 0.3);
border-radius: 4px;
text-align: center;
font-weight: bold;
transition: all 0.2s;
}
.inn-menu-btn:hover {
background: rgba(139, 69, 19, 0.2);
border-color: rgba(139, 69, 19, 0.5);
transform: translateY(-1px);
}
.inn-menu-btn i {
margin-right: 0.4em;
color: var(--color-warm-3);
}
.inn-menu-desc {
display: block;
font-size: 0.85em;
font-weight: normal;
color: var(--color-grey2);
margin-top: 0.2em;
}
/* Styles pour le résultat de menu */
.wfrp4e-inn-menu-result {
margin: 0.3em 0;
}
.wfrp4e-inn-menu-result .message-header {
text-shadow: 0px 0px 1px #00000087;
border: 2px solid rgba(62, 0, 0, 0.3);
padding: 0.4em 0.6em;
margin-bottom: 0.5em;
background: rgba(0, 0, 0, 0.05);
}
.wfrp4e-inn-menu-result .flavor-text {
color: var(--color-warm);
font-weight: bold;
font-size: 1em;
}
.inn-menu-items {
display: flex;
flex-direction: column;
gap: 0.3em;
}
.inn-menu-item {
padding: 0.5em;
background: rgba(255, 255, 255, 0.3);
border: 1px solid rgba(0, 0, 0, 0.1);
border-radius: 3px;
}
.inn-menu-item i {
margin-right: 0.4em;
color: var(--color-warm-3);
}
.inn-menu-item strong {
color: var(--color-warm);
}
/* Bouton rapide Menu dans l'aide */
.inn-menu-quick-btn {
display: block;
padding: 0.7em 1em;
background: rgba(139, 69, 19, 0.15);
border: 2px solid rgba(139, 69, 19, 0.4);
border-radius: 4px;
text-align: center;
font-weight: bold;
font-size: 1.05em;
color: var(--color-warm);
transition: all 0.2s;
}
.inn-menu-quick-btn:hover {
background: rgba(139, 69, 19, 0.25);
border-color: rgba(139, 69, 19, 0.6);
transform: translateY(-1px);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.inn-menu-quick-btn i {
margin-right: 0.5em;
color: var(--color-warm-3);
}

View File

@@ -1 +1 @@
return args.item?.system?.isRanged && args.data.targets[0]?.actor?.sizeNum < 3 return args.item?.system?.isProjectiles && args.data.targets[0]?.actor?.sizeNum < 3

View File

@@ -2,24 +2,24 @@
// takes 3 Poisoned Conditions that cannot be resisted at first, // takes 3 Poisoned Conditions that cannot be resisted at first,
await this.actor.addCondition("poisoned", 3) await this.actor.addCondition("poisoned", 3)
// recovers a number of Wounds equal to their Toughness Bonus, // recovers a number of Wounds equal to their Toughness Bonus,
await this.actor.modifyWounds(this.actor.system.characteristics.t.bonus) await this.actor.modifyWounds(this.actor.system.characteristics.t.bonus)
// and acquires the Regenerate Creature Trait. // and acquires the Régénération Creature Trait.
const hasRegenerate = this.actor.has("Régénération") const hasRégénération = this.actor.has("Régénération")
if (hasRegenerate === undefined) { if (hasRégénération === undefined) {
fromUuid("Compendium.wfrp4e-core.items.SfUUdOGjdYpr3KSR").then(trait => { fromUuid("Compendium.wfrp4e-core.items.SfUUdOGjdYpr3KSR").then(trait => {
let traitItem = trait.toObject() let traitItem = trait.toObject()
this.actor.createEmbeddedDocuments("Item", [traitItem], {fromEffect: this.effect.id}) this.actor.createEmbeddedDocuments("Item", [traitItem], {fromEffect: this.effect.id})
}) })
} }
this.script.scriptMessage(`<p><strong>${this.actor.prototypeToken.name}</strong> : this.script.message(`<p><strong>${this.actor.prototypeToken.name}</strong> a :
<ul> <ul>
<li>Reçoit 3 états Empoisonnés, sans Test de Résistance possible</li> <li>Acquis 3 états Empoisonné qui ne peuvent pas être résistés au début du round.</li>
<li>Récupère ${this.actor.system.characteristics.t.bonus} Blessures</li> <li>Récupération de ${this.actor.system.characteristics.t.bonus} Blessures</li>
<li>Acuiert le Trait de Creature Régénération.</li> <li>Acquisition du Trait de Créature Régénération.</li>
</ul> </ul>
C'est à Ranaldde choisir si la régénératin peut guérir de l'empoisonnement.</p> Cest à Ranald de décider si leur régénération peut dépasser leur empoisonnement.</p>
<p>Lorsque tout les états Empoisonnés sont terminés, le Trait Régénération est perdu également.</p>`, <p>Lorsque tous les états Empoisonné sont perdus, la Régénération lest aussi.</p>`,
{ whisper: ChatMessage.getWhisperRecipients("GM"), blind: true }) { whisper: ChatMessage.getWhisperRecipients("GM"), blind: true })

View File

@@ -0,0 +1,3 @@
if (args.test.result.misfire && args.test.result.roll !== 100) {
delete args.test.result.misfire
}

View File

@@ -1 +1 @@
return !args.options.terror && !args.extendedTest?.flags.wfrp4e?.fear return !args.context.terror && !args.extendedTest?.flags.wfrp4e?.fear

View File

@@ -1 +0,0 @@
return !args.skill?.name.includes(game.i18n.localize("NAME.Row")) && !args.skill?.name.includes(game.i18n.localize("NAME.Sail"));

View File

@@ -1,4 +1,4 @@
let spells = await warhammer.utility.findAllItems("spell", "Chargement des sorts") let spells = await warhammer.utility.findAllItems("spell", "Chargement des sorts", true, ["system.lore.value"])
let text = (await game.wfrp4e.tables.rollTable("random-caster", {hideDSN: true})).result let text = (await game.wfrp4e.tables.rollTable("random-caster", {hideDSN: true})).result
@@ -6,15 +6,15 @@ lore = Array.from(text.matchAll(/{(.+?)}/gm))[0][1]
if (text == "GM's Choice") if (text == "GM's Choice")
{ {
return this.script.scriptNotification(text) return this.script.notification(text)
} }
if (spellsWithLore.length > 0) if (spellsWithLore.length > 0)
{ {
let spellsWithLore = spells.filter(i => game.wfrp4e.config.magicLores[i.system.lore.value] == lore) let spellsWithLore = spells.filter(i => game.wfrp4e.config.magicLores[i.system.lore.value] == lore)
let selectedSpell = spellsWithLore[Math.floor(CONFIG.Dice.randomUniform() * spellsWithLore.length)] let selectedSpell = spellsWithLore[Math.floor(CONFIG.Dice.randomUniform() * spellsWithLore.length)]
this.script.scriptNotification(selectedSpell.name); this.script.notification(selectedSpell.name);
this.actor.createEmbeddedDocuments("Item", [selectedSpell]) this.actor.createEmbeddedDocuments("Item", [(await fromUuid(selectedSpell)).toObject()])
} }
else else
{ {

View File

@@ -0,0 +1,4 @@
if ( args.actor.has(game.i18n.localize("NAME.AA"), "talent") ||
args.actor.has(game.i18n.localize("NAME.SecondSight"), "talent") ) {
args.modifiers.other.push({label : this.effect.name, value : 5, details : "La Cible possède Harmonisation Aethyrique ou Seconde Vue"});
}

View File

@@ -0,0 +1 @@
return args.characteristic != "int" || args.type != "characteristic"

View File

@@ -0,0 +1 @@
return args.skill?.name !== game.i18n.localize("NAME.Cool") && args.skill?.name !== game.i18n.localize("NAME.Résistance");

View File

@@ -0,0 +1 @@
this.item.update({"system.AP" : {lArm : 0, rArm : 0, lLeg : 0, rLeg: 0}});

View File

@@ -1,7 +1,7 @@
let table = game.wfrp4e.tables.findTable("mutatephys"); let table = game.wfrp4e.tables.findTable("mutatephys");
if (!table) if (!table)
{ {
return ui.notifications.error("La table des Mutations n'a pas été trouvée. Assurez vous que la table avec la clé `mutatephys` est bien importée dans le monde.") return ui.notifications.error("Table de Mutation introuvable, veuillez vous assurer qu'une table avec la clé `mutatephys` est importée dans le monde.")
} }
let result = (await table.roll()).results[0]; let result = (await table.roll()).results[0];
let uuid = `Compendium.${result.documentCollection}.${result.documentId}` let uuid = `Compendium.${result.documentCollection}.${result.documentId}`
@@ -9,10 +9,10 @@ let item = await fromUuid(uuid);
if (item) if (item)
{ {
this.script.scriptNotification(`${item.name} added`) this.script.notification(`${item.name} added`)
this.actor.createEmbeddedDocuments("Item", [item]) this.actor.createEmbeddedDocuments("Item", [item])
} }
else else
{ {
ui.notifications.error("L'item ne peut être trouvé: " + uuid) ui.notifications.error("Impossible de trouver l'objet : " + uuid)
} }

View File

@@ -6,7 +6,7 @@ if (location)
if (dropped.length) if (dropped.length)
{ {
this.script.scriptNotification(`Lache ${dropped.map(i => i.name).join(", ")}!`) this.script.notification(`Lache ${dropped.map(i => i.name).join(", ")}!`)
for(let weapon of dropped) for(let weapon of dropped)
{ {
await weapon.system.toggleEquip(); await weapon.system.toggleEquip();
@@ -16,6 +16,6 @@ if (location)
let roll = await new Roll("max(1, 1d10 - @system.characteristics.t.bonus)", this.actor).roll() let roll = await new Roll("max(1, 1d10 - @system.characteristics.t.bonus)", this.actor).roll()
roll.toMessage(this.script.getChatData({flavor : `${this.effect.name} (Durée)`})); roll.toMessage(this.script.getChatData({flavor : `${this.effet.name} (Durée)`}));
this.effect.updateSource({"duration.rounds" : roll.total}) this.effet.updateSource({"duration.rounds" : roll.total})

View File

@@ -1,9 +0,0 @@
if (args.skill?.name != game.i18n.localize("NAME.Gossip"))
{
return true;
}
else
{
args.data.canReverse = true; // Kind of a kludge here, the talent Tests has a specific condition, but the description simply says "any gossip test can be reversed" so check it here instead of submission
}

View File

@@ -1,6 +1,6 @@
if (args.applyAP && args.modifiers.ap.metal) if (args.applyAP && args.modifiers.ap.metal)
{ {
args.modifiers.ap.ignored += args.modifiers.ap.metal args.modifiers.ap.ignored += args.modifiers.ap.metal
args.modifiers.ap.details.push("<strong>" + this.effect.name + "</strong>: Ignore le m<>tal (" + args.modifiers.ap.metal + ")"); args.modifiers.ap.details.push("<strong>" + this.effect.name + "</strong>: Ignorer Métal (" + args.modifiers.ap.metal + ")");
args.modifiers.ap.metal = 0 args.modifiers.ap.metal = 0
} }

View File

@@ -0,0 +1,3 @@
let wounds = this.effect.sourceActor.system.characteristics.wp.bonus;
this.actor.modifyWounds(wounds);
this.script.message(`Soigne ${wounds} Blessures`);

View File

@@ -0,0 +1 @@
if (!this.actor.has(game.i18n.localize("NAME.SecondSight"),"talent")) this.actor.addEffectItems("Compendium.wfrp4e-core.items.Item.OEjUvJKi0xmBwbS2", this.effect)

View File

@@ -0,0 +1,5 @@
let fearCounter = this.item.effects.filter(i => i.name == this.effect.name).length;
fearCounter += Number(this.actor.has("Peur")?.system.specification.value) || 0
game.wfrp4e.utility.postPeur(fearCounter || 1, this.effect.name)

View File

@@ -1,4 +1,4 @@
if (args.test.spell) if (args.test.spell)
{ {
args.test.result.other.push(`<strong>${this.effect.name}</strong>: Automatic Failure`) args.test.result.other.push(`<strong>${this.effect.name}</strong>: Echec Automatique`)
} }

View File

@@ -0,0 +1 @@
return args.item?.system?.attackType == "ranged" && !this.actor.system.canFly.effects.filter(e => e.name == "Flying")[0].disabled

View File

@@ -1,7 +0,0 @@
this.actor.setupSkill(game.i18n.localize("NAME.Cool"), {skipTargets: true, appendTitle : ` - ${this.effect.name}`}).then(async test => {
await test.roll()
if (test.failed)
{
this.actor.addCondition("stunned")
}
})

View File

@@ -0,0 +1,3 @@
let species = await ValueDialog.create({text : "Saisir l'espèce cible (singulier)", title : this.effect.name})
this.effect.updateSource({name : this.effect.setSpecifier(species)});

View File

@@ -0,0 +1,7 @@
let value = await ValueDialog.create({
title : this.script.label,
text: "Notes de Victoire pour le Journal d'Expérience"
});
value
? this.actor.system.awardExp(50, value)
: this.actor.system.awardExp(50, this.script.label)

View File

@@ -0,0 +1,4 @@
if (args.test.options.doomboltRolled)
{
args.test.result.damage += 4;
}

View File

@@ -1 +1 @@
return args.options.terror || args.extendedTest?.flags.wfrp4e?.fear return args.context.terror || args.extendedTest?.flags.wfrp4e?.fear

View File

@@ -1,6 +1,6 @@
let type = this.item.getFlag("wfrp4e", "breath"); let type = this.item.getFlag("wfrp4e", "breath");
if (["feu", "electricité", "poison"].includes(type)) if (["fire", "electricity", "poison"].includes(type))
{ {
args.applyAP = false; args.applyAP = false;
} }

View File

@@ -2,6 +2,6 @@ let state = !this.effect.disabled;
this.effect.update({"disabled": state}); this.effect.update({"disabled": state});
if (state) if (state)
return ui.notifications.info("EFFECT.CreatureBackInWater", {localize: true}) return ui.notifications.info("Effet.CreatureBackInWater", {localize: true})
return ui.notifications.info("EFFECT.CreatureOutOfWater", {localize: true}); return ui.notifications.info("Effet.CreatureOutOfWater", {localize: true});

View File

@@ -1,31 +1,31 @@
if (!this.item.name.includes("(") || this.item.system.tests.value.includes("Terrain")) if (!this.item.name.includes("(") || this.item.system.Tests.value.includes("Terrain") || this.item.system.Tests.value.toLowerCase().includes("(any)"))
{ {
let tests = this.item.system.tests.value let Tests = this.item.system.Tests.value
let name = this.item.name let name = this.item.name
// If name already specifies, make sure tests value reflects that // If name already specifies, make sure Tests value reflects that
if (name.includes("(")) if (name.includes("(") && !name.toLowerCase().includes("(any)"))
{ {
let terrain = name.split("(")[1].split(")")[0] let terrain = name.split("(")[1].split(")")[0]
tests = tests.replace("Terrain", terrain) tests = tests.replace("the Terrain", terrain)
} }
else // If no sense specified, provide dialog choice else // If no sense specified, provide dialog choice
{ {
let choice = await ItemDialog.create(ItemDialog.objectToArray({ let choice = await ItemDialog.create(ItemDialog.objectToArray({
coastal : "Côtes", coastal : "Littoral",
deserts : "Déserts", deserts : "Déserts",
marshes : "Marches", marshes : "Marécages",
rocky : "Rocailles", rocky : "Rocailleux",
tundra : "Tundra", tundra : "Toundra",
woodlands : "Forêts" woodlands : "Régions boisées"
}, this.item.img), 1, "Choisir le Terrain"); }, this.item.img), 1, "Choisissez un Terrain");
if (choice[0]) if (choice[0])
{ {
name = `${name.split("(")[0].trim()} (${choice[0].name})` name = `${name.split("(")[0].trim()} (${choice[0].name})`
tests = tests.replace("Terrain", "Terrain " + choice[0].name ) tests = tests.replace("Terrain", choice[0].name + " Terrain")
} }
} }
this.effect.updateSource({name}) this.effet.updateSource({name})
this.item.updateSource({name, "system.tests.value" : tests}) this.item.updateSource({name, "system.tests.value" : tests})
} }

View File

@@ -1 +0,0 @@
return !args.skill?.name.includes(game.i18n.localize("NAME.Language"));

View File

@@ -14,13 +14,13 @@
let updateObj = this.actor.toObject(); let updateObj = this.actor.toObject();
let talents = (await Promise.all([game.wfrp4e.tables.rollTable("talents"), game.wfrp4e.tables.rollTable("talents"), game.wfrp4e.tables.rollTable("talents")])).map(i => i.text) let talents = (await Promise.tout([game.wfrp4e.tables.rollTable("talents"), game.wfrp4e.tables.rollTable("talents"), game.wfrp4e.tables.rollTable("talents")])).map(i => i.text)
for (let ch in characteristics) for (let ch in characteristics)
{ {
updateObj.system.characteristics[ch].modifier += characteristics[ch]; updateObj.system.characteristics[ch].modifier += characteristics[ch];
} }
for (let talent of talents) for (let talent of talents)
{ {
let talentItem = await game.wfrp4e.utility.findTalent(talent) let talentItem = await game.wfrp4e.utility.findTalent(talent)
@@ -28,13 +28,12 @@
{ {
items.push(talentItem.toObject()); items.push(talentItem.toObject());
} }
else else
{ {
ui.notifications.warn(`Impossible de trouver ${talent}`, {permanent : true}) ui.notifications.warn(`Impossible de trouver ${talent}`, {permanent : true})
} }
} }
await this.actor.update(updateObj) await this.actor.update(updateObj)
this.actor.createEmbeddedDocuments("Item", items); this.actor.createEmbeddedDocuments("Item", items);

View File

@@ -10,12 +10,12 @@ let characteristics = {
"wp" : 10, "wp" : 10,
"fel" : 10 "fel" : 10
} }
let skills = ["Intimidate", "Commandement" , "Perception"] let skills = ["Intimidation", "Commandement", "Perception"]
let skillAdvancements = [10, 10, 10] let skillAdvancements = [10, 10, 10]
let talents = ["Combat Aware", "Drilled", "Menaçant", "Robust"] let talents = ["Vigilance", "Coude-à-coude", "Menaçant", "Robuste"]
let trappings = ["Arme simple", "Mail Coat", "Mail Chausses"] let trappings = ["Arme simple", "Cotte de Mailles", "Chausses de Mailles"]
let specialItems = [ let specialItems = [
] ]
let items = []; let items = [];
let updateObj = this.actor.toObject(); let updateObj = this.actor.toObject();
@@ -28,11 +28,11 @@ for (let ch in characteristics)
for (let item of specialItems) { for (let item of specialItems) {
let newItem let newItem
if (item.type == "weapon") { if (item.type == "weapon") {
newItem = new ItemWfrp4e({ name: item.name, type: item.type, system: { equipped: true, damage: {value: item.damage}} }) newItem = new ItemWFRP4e({ name: item.name, type: item.type, system: { equipped: true, damage: {value: item.damage}} })
} else if (item.type == "trapping") { } else if (item.type == "trapping") {
newItem = new ItemWfrp4e({ img: "systems/wfrp4e/icons/blank.png", name: item.name, type: item.type, system: { worn: true, trappingType: { value: item.trappingType} } } ) newItem = new ItemWFRP4e({ img: "systems/wfrp4e/icons/blank.png", name: item.name, type: item.type, system: { worn: true, trappingType: { value: item.trappingType} } } )
} else { } else {
newItem = new ItemWfrp4e({ img: "systems/wfrp4e/icons/blank.png", name: item.name, type: item.type }) newItem = new ItemWFRP4e({ img: "systems/wfrp4e/icons/blank.png", name: item.name, type: item.type })
} }
items.push(newItem.toObject()) items.push(newItem.toObject())
} }
@@ -44,7 +44,7 @@ for (let index = 0; index < skills.length; index++)
skillItem = updateObj.items.find(i => i.name == skill && i.type == "skill") skillItem = updateObj.items.find(i => i.name == skill && i.type == "skill")
if (skillItem) if (skillItem)
skillItem.system.advances.value += skillAdvancements[index] skillItem.system.advances.value += skillAdvancements[index]
else else
{ {
skillItem = await game.wfrp4e.utility.findSkill(skill) skillItem = await game.wfrp4e.utility.findSkill(skill)
skillItem = skillItem.toObject(); skillItem = skillItem.toObject();
@@ -60,13 +60,13 @@ for (let talent of talents)
{ {
items.push(talentItem.toObject()); items.push(talentItem.toObject());
} }
else else
{ {
ui.notifications.warn(`Impossible de trouver ${talent}`, {permanent : true}) ui.notifications.warn(`Impossible de trouver ${talent}`, {permanent : true})
} }
} }
for (let trapping of trappings) for (let trapping of trappings)
{ {
let trappingItem = await game.wfrp4e.utility.findItem(trapping) let trappingItem = await game.wfrp4e.utility.findItem(trapping)
if (trappingItem) if (trappingItem)
@@ -77,13 +77,13 @@ for (let trapping of trappings)
items.push(trappingItem); items.push(trappingItem);
} }
else else
{ {
ui.notifications.warn(`Impossible de trouver ${trapping}`, {permanent : true}) ui.notifications.warn(`Could not find ${trapping}`, {permanent : true})
} }
} }
updateObj.name = updateObj.name += " " + this.effect.name updateObj.name = updateObj.name += " " + this.effet.name
await this.actor.update(updateObj) await this.actor.update(updateObj)
this.actor.createEmbeddedDocuments("Item", items); this.actor.createEmbeddedDocuments("Item", items);

View File

@@ -0,0 +1,10 @@
if (args.equipped === true && this.actor.name !== "Kurgorn Three-eyes")
{
this.actor.addCondition("blinded", 1, {"statuses" : ["blinded", "blind"]})
this.script.notification(`Aveuglé en portant ${this.item.name}`);
}
if (args.equipped === false && this.actor.name !== "Kurgorn Three-eyes")
{
this.actor.removeCondition("blinded")
}

View File

@@ -1,2 +1,2 @@
await this.actor.addCondition("ablaze", 2) await this.actor.addCondition("ablaze", 2)
await this.script.scriptMessage(await this.actor.applyBasicDamage(this.effect.sourceTest.result.damage, {suppressMsg: true})) await this.script.message(await this.actor.applyBasicDamage(this.effect.sourceTest.result.damage, {suppressMsg: true}))

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