foundryvtt-wh4-lang-fr-fr/addon-register.js

115 lines
7.1 KiB
JavaScript

/************************************************************************************/
const _patch_eis = () => {
WFRP4E.symptoms["delirium"] = "Délire"
WFRP4E.symptomDescriptions["delirium"] = "Your sensibility comes and goes, with moments of clarity replaced suddenly by bouts of raving, hallucinations, and terror. Make a <b>Challenging (+0) Willpower Test</b> each hour, and consult the <b><a class='table-click' data-table='delirium'>Delirium</a></b> table."
// '<br>' creates a new line
// This is how you can roll from chat cards. Wrap 'd10' in <b><a class = 'chat-roll'>___</a></b>
WFRP4E.symptomTreatment["delirium"] = "Some authorities treat delirium as part of a fever, prescribing the same measures. Remedies cost from a few pennies to a few shillings, and 10% are genuine.<br><br>With the correct medicin e, a successful <b>Challenging (+0) Heal</b> Test banishes the hallucinations for <b><a class = 'chat-roll'>1d10</a></b> hours.<br><br>It is also common to sedate delirious patients with a tranquillising drug, such as Moonflower or even Nightshade, to keep the patient comfortable until the condition has passed, sending them into a Fitful Sleep until they either recover or die."
WFRP4E.symptoms["swelling"] = "Swelling"
WFRP4E.symptomDescriptions["swelling"] = "A part of the body swells up to several times its normal size, turning an angry red or purple colour and becoming almost unusable. The affected body part is normally the location of a wound or bite causing the Swelling, or the point of contact where a disease or infection entered the body.<br><br><b>Head</b>: The eyes and tongue bulge, the cheeks become livid, the jaw is forced open. Eating is impossible, but clear liquids maybe sipped in small quantities. Any Tests requiring speech are 3 steps more Difficult.<br><b>Arm</b>:The arm and hand swell, the shoulder and elbow joints cannot move, and the hand becomes useless. For the duration, the arm counts as Amputated (WFRP, page 180).<br><b>Body</b>: The entire body swells until the sufferer can no longer wear clothes. All Tests involving movement become 3 steps more Difficult.<br><b>Leg</b>: The leg swells grotesquely, becoming as wide as the widest part of the thigh for its entire length. The foot is almost indistingushable. For the duration, the leg counts as Amputated (WFRP, page 180)."
WFRP4E.symptomTreatment["swelling"] = "Most treatments involve plunging the affected part, or sometimes the whole body, into an ice-water bath to reduce the heat that accompanies the swellings. An Extended <b>Hard (-20) Heal Test</b> requiring +3 SL reduces the swelling by <b><a class = 'chat-roll'>2d10</a></b> hours. Each Test takes an hour. The patient is left with +1 Fatigued Condition for every Test made in the process.<br><br>Some physicians instead bleed the patient with a blade or leeches. A successful <b>Extended Heal Test</b> requiring +4 SL and Trade Tools (Physician) reduces the swelling by (<a class = 'chat-roll'>1d10</a> + the patient's Toughness Bonus) hours. Each Test has a base Difficulty of <b>Impossible (-50)</b> and takes half an hour."
WFRP4E.difficultyModifiers["futile"] = -40
WFRP4E.difficultyModifiers["impossible"] = -50
WFRP4E.difficultyLabels["futile"] = "Futile (-40)"
WFRP4E.difficultyLabels["impossible"] = "Impossible (-50)"
WFRP4E.loreEffect["tzeentch"] = "Les cibles des sorts de Tzeentch sont déchirées par la magie transformatrice du Chaos. Les cibles affectées par un sort du savoir de Tzeentch doivent réussir un test d'endurance Intermédiaire (+0) ou gagner +1 Point de Corruption. S'ils réussissent leur test, ils gagnent à la place +1 Point de Chance, qui peut être utilisé normalement. Tels sont les caprices de Tzeentch"
}
/************************************************************************************/
/* Manages /auberge command */
const _manage_inn_roll = async (content, msg) => {
// Split input into arguments
let command = content.split(" ").map(function(item) {
return item.trim();
})
if (command[0] == "/auberge" && command[1] )
{
msg["type"] = 0;
msg["rollMode"] = "gmroll";
var compendium = game.packs.get('WH4-fr-translation.plats-dauberges');
let rollList = [];
await compendium.getIndex().then(index => rollList = index);
//console.log("Got compendium...", rollList.length);
for (var i=0; i< rollList.length; i++) {
var rollTab = rollList[i];
if ( rollTab.name.toLowerCase().includes(command[1].toLowerCase()) ) {
let my_rollTable;
await compendium.getEntity(rollTab._id).then(mytab => my_rollTable = mytab);
let myroll = my_rollTable.roll();
//console.log("RES: ", myroll );
msg.content = my_rollTable.name + " : " + myroll.results[0].text;
//my_rollTable.draw();
ChatMessage.create(msg);
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;
}
}
/************************************************************************************/
/* Hook for specific command */
Hooks.on("chatMessage", (html, content, msg) => {
if ( content.includes("/auberge") ) {
_manage_inn_roll( content, msg );
return false;
}
} );
/************************************************************************************/
/* Additionnal hooks ready */
Hooks.once('ready', () => {
_patch_eis();
const lang = game.settings.get('core', 'language');
if ( lang == "fr" ) {
let pack_array = [];
game.packs.forEach((pack, name) => {
let newpack = pack;
if(!pack.translated && pack.entity === 'Actor') {
let translations = {
"label": pack.metadata.name,
"mapping": {
"name": "name",
"description": "details.biography.value",
"items": {
"path": "items",
"converter": "bestiary_traits"
},
"characteristics": {
"path": "data.characteristics",
"converter": "npc_characteristics"
}
},
"entries": [
]
};
console.log("Actor compendium has been replaced !!!!");
newpack = new TranslatedCompendium(pack, translations);
}
pack_array.push( [name, newpack ] );
} );
game.packs = new Collection( pack_array );
}
} );