2021-03-15 09:22:27 +01:00
/************************************************************************************/
Hooks . once ( 'init' , ( ) => {
2021-03-28 18:33:31 +02:00
2021-03-15 09:22:27 +01:00
if ( typeof Babele !== 'undefined' ) {
2021-04-10 17:26:50 +02:00
2021-03-15 09:22:27 +01:00
console . log ( "BABELE LOADED !!!" ) ;
Babele . get ( ) . register ( {
module : 'swade-fr' ,
lang : 'fr' ,
dir : 'compendiums'
} ) ;
2021-03-28 18:33:31 +02:00
Babele . get ( ) . registerConverters ( {
2021-11-16 14:53:31 +01:00
"gear_skill" : ( skill ) => {
if ( skill ) {
if ( skill == 'Fighting' ) return 'Combat' ;
if ( skill == 'Shooting' ) return 'Tir' ;
console . log ( "UNKOWN SKILL" , skill ) ;
}
return skill ;
} ,
"gear_range" : ( range ) => {
if ( range ) {
if ( range == 'Cone Template' ) return 'Gabarit de cone' ;
}
return range ;
} ,
"gear_ammo" : ( ammo ) => {
if ( ammo ) {
if ( ammo == 'Arrows/Bolts' ) return 'Flèches/Carreaux' ;
if ( ammo == 'Canister Shot (Cannon)' ) return 'Cartouches (Canon)' ;
if ( ammo == 'Shrapnel Shot (Cannon)' ) return 'Shrapnel (Canon)' ;
if ( ammo == 'Solid Shot (Cannon)' ) return 'Solide (Canon)' ;
if ( ammo == 'Bullets, Medium' ) return 'Balles, Moyenne' ;
if ( ammo == 'Shotgun Shells' ) return 'Cartouche de Shotgun' ;
if ( ammo == 'Laser Battery, Pistol' ) return 'Batterie pour laser, Pistolet' ;
if ( ammo == 'Laser Battery, Rifle / SMG' ) return 'Batterie pour laser, Fusil' ;
}
return ammo ;
} ,
2021-03-28 18:33:31 +02:00
"powers_duration" : ( duration ) => {
2021-04-10 17:26:50 +02:00
if ( duration == 'One hour' ) return '1 heure' ;
if ( duration == 'Instant (slot); 5 (speed)' ) return 'Instantanée (apathie), 5 (vitesse)' ;
if ( duration == '(boost); Instant (lower)' ) return '5 (augmentation), Instantanée (diminution)' ;
if ( duration == 'Instant' ) return 'Instantannée' ;
if ( duration == 'Until the end of the victim\'s next turn' ) return 'Jusqu’ à la fin du prochain tour de la victime' ;
2021-03-28 18:33:31 +02:00
if ( duration == 'A brief conversation of about five minutes' ) return 'Une brève conversation d\'environ 5 minutes' ;
2021-04-10 17:26:50 +02:00
if ( duration == '5 (detect), one hour (conceal)' ) return '5 (détection), 1 heure (dissimulation)' ;
if ( duration == 'Instant (Sound); 5 (Silence)' ) return 'Instantanée (son), 5 (silence)' ;
2021-03-28 18:33:31 +02:00
return duration ;
} ,
"powers_range" : ( range ) => {
2021-04-10 17:26:50 +02:00
if ( range == 'Smarts x5 (Sound); Smarts (Silence)' )
return 'Intellect × 5 (son), Intellect (silence)' ;
2021-03-28 18:33:31 +02:00
if ( range == "Cone Template" )
2021-04-10 17:26:50 +02:00
return "Gabarit de cône"
2021-03-28 18:33:31 +02:00
if ( range == "Touch" )
return "Toucher"
if ( range == "Sm" )
2021-04-10 17:26:50 +02:00
return "Intellect"
2021-03-28 18:33:31 +02:00
if ( range == "Sm x 2" || range == "Sm x2" )
2021-04-10 17:26:50 +02:00
return "Intellect x2"
2021-03-28 18:33:31 +02:00
if ( range == "Self" )
2021-04-10 17:26:50 +02:00
return "Personnel"
2021-03-28 18:33:31 +02:00
return range ;
} ,
"powers_rank" : ( rank ) => {
if ( rank == 'Novice' ) return 'Novice' ;
if ( rank == 'Seasoned' ) return 'Aguerri' ;
if ( rank == 'Veteran' ) return 'Vétéran' ;
if ( rank == 'Heroic' ) return 'Héroïque' ;
return rank ;
2021-04-10 17:26:50 +02:00
}
2021-03-28 18:33:31 +02:00
} ) ;
2021-03-15 09:22:27 +01:00
}
2021-03-26 12:04:57 +01:00
} ) ;
/************************************************************************************/
const transFolder = { "Actor" : "Acteur" , "Edges" : "Atouts" }
2021-04-10 17:26:50 +02:00
const subFolder = { 'Social Edges' : 'Atouts sociaux' , 'Background Edges' : 'Atouts de Background' , 'Combat Edges' : 'Atouts de combat' ,
'Leadership Edges' : 'Atouts de commandement' , 'Legendary Edges' : 'Atouts légendaires' , 'Power Edges' : 'Atouts de pouvoir' ,
'Professional Edges' : 'Atouts professionnels' , 'Weird Edges' : 'Atouts étranges' , 'Edges' : 'Atouts' , 'Hindrances' : 'Handicaps' , 'Skills' : 'Compétences' ,
'Equipment' : 'Equipement' , 'Ammo' : 'Munitions' , 'Armor' : 'Armure' , 'Common Gear' : 'Matériel commun' , 'Modern Firearms' : 'Armes à feu modernes' ,
2021-03-28 18:58:41 +02:00
'Personal Weapons' : 'Armes' , 'Special Weapons' : 'Armes spéciales' , 'Bullet' : 'Balles' , 'Cannon' : 'Canon' , 'Laser Battery' : 'Batterie Laser' ,
'Adventuring Gear' : 'Matériel d\'aventure' , 'Animals and Tack' : 'Animaux' , 'Clothing' : 'Vêtements' , 'Computers & Electronics' : 'Ordinateurs et Electroniques' ,
2021-04-10 17:26:50 +02:00
'Firearms Accessories' : 'Accessoires armes à feu' , 'Food' : 'Nourriture' , 'Personal Defense' : 'Auto-défense' , 'Futuristic' : 'Futuriste' ,
2021-03-28 18:58:41 +02:00
'Medieval & Ancient' : 'Médiévale et Antiquité' , 'Modern' : 'Moderne' , 'Shields' : 'Boucliers' , 'Laser (Futuristic)' : 'Laser (Fururiste)' ,
2021-04-10 17:26:50 +02:00
'Machine Guns' : 'Mitraillettes' , 'Pistols' : 'Pistolets' , 'Rifles' : 'Fusils' , 'Submachine Guns' : 'Semi-automatiques' , 'Cannons' : 'Canons' ,
'Catapults' : 'Catapultes' , 'Flamethrowers' : 'Lance-flammes' , 'Rocket Launchers & Torpedoes' : 'Lance roquettes et torpilles' ,
2021-03-28 18:58:41 +02:00
'Vehicular Weapons' : 'Armes de véhicules' }
/************************************************************************************/
const _ _translate _sub _folders = async ( packName ) => {
let pack = game . packs . get ( packName )
pack . locked = false ;
let folderEntityIds = pack . index . filter ( x => x . name === "#[CF_tempEntity]" ) ;
for ( let index of folderEntityIds ) {
let folderEntity = await pack . getEntity ( index . _id ) ;
//console.log("Fold1", folderEntity);
let newName = subFolder [ folderEntity . data . flags . cf . name ] ;
if ( newName ) {
await pack . updateEntity ( { _id : index . _id , 'flags.cf.name' : newName } ) ;
}
2021-04-10 17:26:50 +02:00
}
2021-03-28 18:58:41 +02:00
}
2021-03-26 12:04:57 +01:00
/************************************************************************************/
const _ _fix _folder _names = async ( ) => {
if ( game . customFolders . compendium . folders ) {
for ( let [ key , trans ] in transFolder ) {
for ( let folder of game . customFolders . compendium . folders . entries ) {
folder . name = trans ;
folder . save ( false ) ;
}
}
}
2021-03-28 18:58:41 +02:00
_ _translate _sub _folders ( "swade-core-rules.swade-edges" ) ;
_ _translate _sub _folders ( "swade-core-rules.swade-hindrances" ) ;
_ _translate _sub _folders ( "swade-core-rules.swade-equipment" ) ;
2021-03-26 12:04:57 +01:00
}
/************************************************************************************/
Hooks . once ( 'ready' , ( ) => {
2021-04-29 08:57:04 +02:00
//if (game.user.isGM) {
//setTimeout( __fix_folder_names, 4000, true, false);
//}
2021-03-26 12:04:57 +01:00
2021-03-17 18:10:14 +01:00
} ) ;