Ajout de la commande /voyage et grosse MAJK de la commande /auberge

This commit is contained in:
2026-01-07 15:04:49 +01:00
parent c8119601d8
commit f525b6c07a
1329 changed files with 24138 additions and 4397 deletions

View File

@@ -0,0 +1,103 @@
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const WFRP4E_SCRIPTS = '/home/morr/work/foundryvtt/WFRP4e-FoundryVTT/scripts';
const FR_SCRIPTS = '/home/morr/work/foundryvtt/foundryvtt-wh4-lang-fr-fr/scripts';
const REVIEW_FILE = path.join(__dirname, 'scripts-to-review.json');
const REPORT_FILE = path.join(__dirname, 'review-comparison.md');
const scriptsToReview = JSON.parse(fs.readFileSync(REVIEW_FILE, 'utf-8'));
let report = `# Scripts nécessitant révision manuelle\n\n`;
report += `Total de scripts: ${scriptsToReview.length}\n\n`;
report += `Ces scripts contiennent des traductions en français mais ont été modifiés dans WFRP4E.\n`;
report += `Ils nécessitent une révision manuelle pour intégrer les changements tout en préservant les traductions.\n\n`;
report += `---\n\n`;
scriptsToReview.forEach(({file}, index) => {
const wfrp4ePath = path.join(WFRP4E_SCRIPTS, file);
const frPath = path.join(FR_SCRIPTS, file);
const wfrp4eContent = fs.readFileSync(wfrp4ePath, 'utf-8');
const frContent = fs.readFileSync(frPath, 'utf-8');
report += `## ${index + 1}. ${file}\n\n`;
// Extraire les différences notables
const wfrp4eLines = wfrp4eContent.split('\n').length;
const frLines = frContent.split('\n').length;
report += `- **Lignes WFRP4E**: ${wfrp4eLines}\n`;
report += `- **Lignes FR**: ${frLines}\n`;
report += `- **Différence**: ${wfrp4eLines - frLines} lignes\n\n`;
// Extraire les textes notables
const wfrp4eTexts = extractNotableTexts(wfrp4eContent);
const frTexts = extractNotableTexts(frContent);
if (wfrp4eTexts.length > 0 || frTexts.length > 0) {
report += `### Textes identifiés\n\n`;
if (wfrp4eTexts.length > 0) {
report += `**WFRP4E (anglais)**:\n`;
wfrp4eTexts.forEach(text => {
report += `- \`${text}\`\n`;
});
report += `\n`;
}
if (frTexts.length > 0) {
report += `**FR (français)**:\n`;
frTexts.forEach(text => {
report += `- \`${text}\`\n`;
});
report += `\n`;
}
}
// Afficher le code côte à côte si court
if (wfrp4eLines < 30 && frLines < 30) {
report += `### Code WFRP4E\n\n\`\`\`javascript\n${wfrp4eContent}\n\`\`\`\n\n`;
report += `### Code FR\n\n\`\`\`javascript\n${frContent}\n\`\`\`\n\n`;
}
report += `### Actions recommandées\n\n`;
report += `- [ ] Vérifier les changements structurels dans WFRP4E\n`;
report += `- [ ] Intégrer les modifications tout en gardant les traductions FR\n`;
report += `- [ ] Tester le script après modification\n\n`;
report += `---\n\n`;
});
function extractNotableTexts(content) {
const texts = new Set();
// Patterns pour extraire les textes
const patterns = [
/ui\.notifications\.(info|warn|error|notify)\s*\(\s*["'`]([^"'`]+)["'`]/g,
/this\.script\.(scriptNotification|scriptMessage|notification)\s*\(\s*["'`]([^"'`]+)["'`]/g,
/["'`](Loading|Could not find|Chargement|Impossible de trouver|créé|modifié|supprimé)[^"'`]*["'`]/gi
];
patterns.forEach(pattern => {
const matches = content.matchAll(pattern);
for (const match of matches) {
const text = match[2] || match[1];
if (text && text.length > 3 && text.length < 100) {
texts.add(text);
}
}
});
return Array.from(texts);
}
fs.writeFileSync(REPORT_FILE, report, 'utf-8');
console.log(`\nRapport de révision généré: ${REPORT_FILE}`);
console.log(`\nNombre de scripts à réviser: ${scriptsToReview.length}`);
console.log(`\nOuvrez le fichier avec votre éditeur préféré pour réviser les scripts.`);
console.log(`Vous pouvez aussi utiliser un outil de diff comme 'meld' ou 'kdiff3' pour comparer:`);
console.log(`\nExemple:`);
console.log(` meld ${FR_SCRIPTS}/${scriptsToReview[0].file} ${WFRP4E_SCRIPTS}/${scriptsToReview[0].file}`);