Add NPC buttons + enhance NPC characteristics translation

This commit is contained in:
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;