Add NPC buttons + enhance NPC characteristics translation

This commit is contained in:
LeRatierBretonnien 2020-04-23 11:52:39 +02:00
parent 1f3c084982
commit 577ff31d5d
6 changed files with 180 additions and 20 deletions

View File

@ -146,6 +146,35 @@ class ActorWfrp4e_fr extends ActorWfrp4e {
}
Hooks.on("chatMessage", (html, content, msg) => {
// Setup new message's visibility
let rollMode = game.settings.get("core", "rollMode");
if ( ["gmroll", "blindroll"].includes(rollMode) ) msg["whisper"] = ChatMessage.getWhisperIDs("GM");
if ( rollMode === "blindroll" ) msg["blind"] = true;
msg["type"] = 0;
// Split input into arguments
let command = content.split(" ").map(function(item) {
return item.trim();
})
// Roll on a table
if (command[0] == "/auberge")
{
var compendium = game.packs.find(p => p.collection === 'world.plats-dauberges');
compendium.getIndex().then(index => {
index.forEach(entity => {
//console.log(entity.name, entity._id);
if (entity.name.toLowerCase().includes(command[1].toLowerCase()) ) {
compendium.getEntity(entity._id).then(table => {
table.draw();
} );
}
} );
});
return false;
}
} );
Hooks.once('init', () => {
@ -163,7 +192,116 @@ Hooks.once('init', () => {
"doigts de fée": "dex",
"guerrier né": "ws"
}
WFRP4E.speciesSkills = {
"human": [
"Soins aux animaux",
"Charme",
"Calme",
"Evaluation",
"Ragot",
"Marchandage",
"Langue (Bretonnien)",
"Langue (Wastelander)",
"Commandement",
"Savoir (Reikland)",
"Corps à corps (Base)",
"Projectiles (Arc)"
],
"dwarf": [
"Résistance à l'alcool",
"Calme",
"Endurance",
"Divertissement (Raconter)",
"Evaluation",
"Intimidation",
"Langue (Khazalid)",
"Savoir (Nains)",
"Savoir (Geologie)",
"Savoir (Metallurgie)",
"Corps à corps (Base)",
"Métier (Au choix)"
],
"halfling": [
"Charme",
"Résistance à l'alcool",
"Esquive",
"Pari",
"Marchandage",
"Intuition",
"Langue (Mootland)",
"Savoir (Reikland)",
"Perception",
"Escamotage",
"Discrétion (Au choix)",
"Métier (Cuisinier)"
],
"helf": [
"Calme",
"Divertissement (Chant)",
"Evaluation",
"Langue (Eltharin)",
"Commandement",
"Corps à corps (Base)",
"Navigation",
"Perception",
"Musicien (Au choix)",
"Projectiles (Arc)",
"Voile",
"Natation"
],
"welf": [
"Athlétisme",
"Escalade",
"Endurance",
"Divertissement (Chant)",
"Intimidation",
"Langue (Eltharin)",
"Corps à corps (Base)",
"Survie en extérieur",
"Perception",
"Projectiles (Arc)",
"Discrétion (Rural)",
"Pistage"
],
}
WFRP4E.speciesTalents = {
"human": [
"Destinée",
"Affable, Perspicace",
3
],
"dwarf": [
"Résistance à la Magie",
"Vision Nocturne",
"Lire/Ecrire, Impitoyable",
"Déterminé, Obstiné",
"Costaud",
0
],
"halfling": [
"Sens Aiguisé (Gout)",
"Vision Nocturne",
"Résistance (Chaos)",
"Petit",
0
],
"helf": [
"Sens Aiguisé (Vue)",
"Imperturbable, Perspicace",
"Vision Nocturne",
"Seconde Vue, Sixième Sens",
"Lire/Ecrire",
0
],
"welf": [
"Sens Aiguisé (Sight)",
"Dur à cuire, Seconde Vue",
"Vision Nocturne",
"Seconde Vue, Sixth Sense",
"Lire/Ecrire",
0
],
}
if(typeof Babele !== 'undefined') {
@ -233,6 +371,16 @@ Hooks.once('init', () => {
}
return talents_list;
},
"npc_characteristics": (chars) => { // Auto-convert char names in the sheet
for (var key in chars) {
//console.log("Was here !", key, chars[key].label);
var char = chars[key]
var abrev = char["abrev"];
char["label"] = game.i18n.localize( "CHAR." + abrev );
char["abrev"] = game.i18n.localize( "CHARAbbrev." + abrev);
}
return chars;
},
"bestiary_traits": (beast_traits, translations) => {
var compendium = game.packs.find(p => p.collection === 'wfrp4e.traits');
for (let trait_en of beast_traits)
@ -257,7 +405,7 @@ Hooks.once('init', () => {
trait_en.data.description.value = trait_fr.data.description.value;
if ( isNaN(trait_en.data.specification.value) ) { // This is a string, so translate it
//console.log("Translating : ", trait_en.data.specification.value);
trait_en.data.specification.value = game.i18n.localize(trait_en.data.specification.value);
trait_en.data.specification.value = game.i18n.localize( trait_en.data.specification.value.trim() );
}
}
return beast_traits;

View File

@ -2,8 +2,12 @@
"label": "PNJ Ennemi Intérieur",
"mapping": {
"name": "name",
"description": "description"
"description": "details.biography.value",
"characteristics": {
"path": "data.characteristics",
"converter": "npc_characteristics"
}
},
"entries": [
]
}
}

View File

@ -4,7 +4,11 @@
"items": {
"path": "items",
"converter": "bestiary_traits"
}
},
"characteristics": {
"path": "data.characteristics",
"converter": "npc_characteristics"
}
},
"entries": [
{

View File

@ -929,5 +929,9 @@
"Ammo" : "Munition",
"Size": "Taille",
"NAME.CombatReflexes" : "Combat Instinctif"
"NAME.CombatReflexes" : "Combat Instinctif",
"character": "PJ",
"npc": "PNJ",
"creature": "Créature"
}

View File

@ -2,7 +2,7 @@
"name": "WH4-fr-translation",
"title": "Traduction du module WH4 en Français.",
"description": "La traduction du module WH4.",
"version": "0.58",
"version": "0.59",
"minimumCoreVersion" : "0.5.1",
"compatibleCoreVersion": "0.5.5",
"author": "LeRatierBretonnien",

View File

@ -2,13 +2,13 @@
"name": "Talents aléatoires",
"die" : "1d32",
"rows": [{
"name": "Sens aiguisés (Au choix)",
"name": "Sens Aiguisé (Au choix)",
"range": [1, 1]
}, {
"name": "Ambidextre",
"range": [2, 2]
}, {
"name": "Affinité avec les Animaux",
"name": "Affinité avec les animaux",
"range": [3, 3]
}, {
"name": "Artiste",
@ -26,7 +26,7 @@
"name": "Fuite!",
"range": [8, 8]
}, {
"name": "Dur à Cuire",
"name": "Dur à cuire",
"range": [9, 9]
}, {
"name": "Reflexes Foudroyants",
@ -38,7 +38,7 @@
"name": "Chanceux",
"range": [12, 12]
}, {
"name": "Tireur de Précision",
"name": "Tireur de précision",
"range": [13, 13]
}, {
"name": "Imitation",
@ -47,7 +47,7 @@
"name": "Vision Nocturne",
"range": [15, 15]
}, {
"name": "Doigts de Fée",
"name": "Doigts de fée",
"range": [16, 16]
}, {
"name": "Noblesse",
@ -56,16 +56,16 @@
"name": "Orientation",
"range": [18, 18]
}, {
"name": "Oreille Absolue",
"name": "Oreille absolue",
"range": [19, 19]
}, {
"name": "Ame Pure",
"name": "Ame pure",
"range": [20, 20]
}, {
"name": "Lire/Ecrire",
"range": [21, 21]
}, {
"name": "Résistance (au choix)",
"name": "Resistant (au choix)",
"range": [22, 22]
}, {
"name": "Perspicace",
@ -77,7 +77,7 @@
"name": "Sixième Sens",
"range": [25, 25]
}, {
"name": "Bonnes Jambes",
"name": "Bonnes jambes",
"range": [26, 26]
}, {
"name": "Costaud",
@ -86,16 +86,16 @@
"name": "Affable",
"range": [28, 28]
}, {
"name": "Doué en Calcul",
"name": "Doué en calcul",
"range": [29, 29]
}, {
"name": "Très Résistant",
"name": "Très résistant",
"range": [30, 30]
}, {
"name": "Très Fort",
"name": "Très fort",
"range": [31, 31]
}, {
"name": "Guerrier Né",
"name": "Guerrier né",
"range": [32, 32]
}]
}