Auto-patch careers + tables
This commit is contained in:
@ -187,6 +187,31 @@ Hooks.once('init', () => {
|
||||
return skills_list;
|
||||
},
|
||||
|
||||
"resultConverter": (results, translated) => {
|
||||
console.log("rolltable data", results, translated)
|
||||
if (translated) {
|
||||
for (let data of results) {
|
||||
if ( translated[`${data.range[0]}-${data.range[1]}`] ) {
|
||||
data.text = translated[`${data.range[0]}-${data.range[1]}`]
|
||||
}
|
||||
}
|
||||
return results
|
||||
}
|
||||
if ( results[0].documentCollection && results[0].documentCollection == "wfrp4e-core.career-descriptions" ) {
|
||||
for (let data of results) {
|
||||
let career = data.text.match(/{(.*)}/)
|
||||
if (career && career[1]) {
|
||||
let careerFR = Babele.instance.converters.career_careergroup(career[1])
|
||||
data.text = data.text.replace(career[1], careerFR)
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( results[0].documentCollection ) {
|
||||
return Babele.instance.converters.tableResults(results)
|
||||
}
|
||||
return results
|
||||
},
|
||||
|
||||
"npc_details": (details) => {
|
||||
//console.log("DETAILS: ", details);
|
||||
let newDetails = duplicate(details);
|
||||
@ -414,9 +439,11 @@ Hooks.once('init', () => {
|
||||
if (!newName) newName = value
|
||||
return newName
|
||||
} else {
|
||||
ui.notifications.error("Impossible de trouver la carrière " + value + ". Elle n'est probablement pas traduite.", { permanent: true })
|
||||
ui.notifications.error("Impossible de trouver la carrière " + value + ". Elle n'est probablement pas traduite.", { permanent: true })
|
||||
}
|
||||
return value
|
||||
},
|
||||
|
||||
"mutations_modifier": (value) => { // This is really UGLYYYY i know, but i started like this and discovered afterward that many strings were not easy to automate... Sorry :)
|
||||
//console.log("Parsing mutation :", value);
|
||||
value = value.toLowerCase();
|
||||
|
Reference in New Issue
Block a user