Ready for Foundry 14 + release mode
This commit is contained in:
+111
-116
@@ -1,5 +1,6 @@
|
||||
import { SWDELUXStatBlockParser } from "./sw-statblock-parser.js";
|
||||
import { ClassCounter} from "https://www.uberwald.me/fvtt_appcount/count-class-ready.js"
|
||||
import { ClassCounter } from "https://www.uberwald.me/fvtt_appcount/count-class-ready.js"
|
||||
|
||||
const __compFolderTranslation = [
|
||||
{
|
||||
compendium: 'swade-core-rules.swade-vehicles',
|
||||
@@ -65,128 +66,122 @@ class swadeFrTranslator {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************************/
|
||||
Hooks.once('init', () => {
|
||||
Hooks.once("babele.init", (babele) => {
|
||||
babele.register({
|
||||
module: 'swade-fr-content',
|
||||
lang: 'fr',
|
||||
dir: 'compendiums'
|
||||
});
|
||||
|
||||
console.log("INIT !!!!!!")
|
||||
if (typeof Babele !== 'undefined') {
|
||||
|
||||
console.log("BABELE LOADED !!!");
|
||||
Babele.get().register({
|
||||
module: 'swade-fr-content',
|
||||
lang: 'fr',
|
||||
dir: 'compendiums'
|
||||
});
|
||||
|
||||
Babele.get().registerConverters({
|
||||
"gear_skill": (skill) => {
|
||||
let transl = skill
|
||||
//console.log("Testing", skill)
|
||||
if (skill) {
|
||||
let translated = game.babele.translate("swade-core-rules.swade-skills", { name: skill.trim() }, true)
|
||||
transl = translated.name || skill.trim()
|
||||
}
|
||||
return transl
|
||||
},
|
||||
"skill_swid": (swid) => {
|
||||
if (swid == "combat") return "fighting";
|
||||
if (swid == "tir") return "shooting";
|
||||
return swid
|
||||
},
|
||||
"category_converter": (category) => {
|
||||
return game.i18n.localize(category)
|
||||
},
|
||||
"edge_requirements": (req) => {
|
||||
let reqTab = req.split(",")
|
||||
let results = []
|
||||
for (let item of reqTab) {
|
||||
let keyName = item.match(/([\w\s\(\)]+) (d[\w\+]*)/)
|
||||
//console.log("Keyword", item, keyName)
|
||||
if (keyName && keyName[2]) { // This is a skill or attribute
|
||||
let toTranslate = keyName[1].trim()
|
||||
let attr = swadeFrTranslator.getAttribute(toTranslate)
|
||||
if (attr) { // Test if attribute
|
||||
results.push(attr + " " + keyName[2].trim())
|
||||
} else { // Test if skill
|
||||
let translated = game.babele.translate("swade-core-rules.swade-skills", { name: toTranslate }, true)
|
||||
if (!translated.name) {
|
||||
translated = game.babele.translate("deadlands-core-rules.deadlands-skills", { name: toTranslate }, true)
|
||||
}
|
||||
let transResult = translated.name || toTranslate
|
||||
results.push(transResult + " " + keyName[2].trim())
|
||||
babele.registerConverters({
|
||||
"gear_skill": (skill) => {
|
||||
let transl = skill
|
||||
//console.log("Testing", skill)
|
||||
if (skill) {
|
||||
let translated = game.babele.translate("swade-core-rules.swade-skills", { name: skill.trim() }, true)
|
||||
transl = translated.name || skill.trim()
|
||||
}
|
||||
return transl
|
||||
},
|
||||
"skill_swid": (swid) => {
|
||||
if (swid == "combat") return "fighting";
|
||||
if (swid == "tir") return "shooting";
|
||||
return swid
|
||||
},
|
||||
"category_converter": (category) => {
|
||||
return game.i18n.localize(category)
|
||||
},
|
||||
"edge_requirements": (req) => {
|
||||
let reqTab = req.split(",")
|
||||
let results = []
|
||||
for (let item of reqTab) {
|
||||
let keyName = item.match(/([\w\s\(\)]+) (d[\w\+]*)/)
|
||||
//console.log("Keyword", item, keyName)
|
||||
if (keyName && keyName[2]) { // This is a skill or attribute
|
||||
let toTranslate = keyName[1].trim()
|
||||
let attr = swadeFrTranslator.getAttribute(toTranslate)
|
||||
if (attr) { // Test if attribute
|
||||
results.push(attr + " " + keyName[2].trim())
|
||||
} else { // Test if skill
|
||||
let translated = game.babele.translate("swade-core-rules.swade-skills", { name: toTranslate }, true)
|
||||
if (!translated.name) {
|
||||
translated = game.babele.translate("deadlands-core-rules.deadlands-skills", { name: toTranslate }, true)
|
||||
}
|
||||
} else { // Rank or edge
|
||||
let itemName = item.trim()
|
||||
let rank = swadeFrTranslator.getRank(itemName)
|
||||
if (rank) {
|
||||
results.push(rank)
|
||||
} else {
|
||||
let translated = game.babele.translate("swade-core-rules.swade-edges", { name: itemName }, true)
|
||||
if (!translated.name) {
|
||||
translated = game.babele.translate("deadlands-core-rules.deadlands-edges", { name: itemName }, true)
|
||||
}
|
||||
let transResult = translated.name || itemName
|
||||
results.push(transResult)
|
||||
let transResult = translated.name || toTranslate
|
||||
results.push(transResult + " " + keyName[2].trim())
|
||||
}
|
||||
} else { // Rank or edge
|
||||
let itemName = item.trim()
|
||||
let rank = swadeFrTranslator.getRank(itemName)
|
||||
if (rank) {
|
||||
results.push(rank)
|
||||
} else {
|
||||
let translated = game.babele.translate("swade-core-rules.swade-edges", { name: itemName }, true)
|
||||
if (!translated.name) {
|
||||
translated = game.babele.translate("deadlands-core-rules.deadlands-edges", { name: itemName }, true)
|
||||
}
|
||||
let transResult = translated.name || itemName
|
||||
results.push(transResult)
|
||||
}
|
||||
}
|
||||
//console.log(">>>>>>>>>>>>>>>>>>>>>>>>><REQ !!!!", req, results)
|
||||
return results.join(", ")
|
||||
},
|
||||
"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;
|
||||
},
|
||||
"powers_duration": (duration) => {
|
||||
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';
|
||||
if (duration == 'A brief conversation of about five minutes') return 'Une brève conversation d\'environ 5 minutes';
|
||||
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)';
|
||||
return duration;
|
||||
},
|
||||
"powers_range": (range) => {
|
||||
if (range == 'Smarts x5 (Sound); Smarts (Silence)')
|
||||
return 'Intellect ×5 (son), Intellect (silence)';
|
||||
if (range == "Cone Template")
|
||||
return "Gabarit de cône"
|
||||
if (range == "Touch")
|
||||
return "Toucher"
|
||||
if (range == "Sm")
|
||||
return "Intellect"
|
||||
if (range == "Sm x 2" || range == "Sm x2")
|
||||
return "Intellect x2"
|
||||
if (range == "Self")
|
||||
return "Personnel"
|
||||
return range;
|
||||
},
|
||||
"powers_rank": (rank) => {
|
||||
return swadeFrTranslator.getRank(rank)
|
||||
}
|
||||
});
|
||||
}
|
||||
//console.log(">>>>>>>>>>>>>>>>>>>>>>>>><REQ !!!!", req, results)
|
||||
return results.join(", ")
|
||||
},
|
||||
"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;
|
||||
},
|
||||
"powers_duration": (duration) => {
|
||||
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';
|
||||
if (duration == 'A brief conversation of about five minutes') return 'Une brève conversation d\'environ 5 minutes';
|
||||
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)';
|
||||
return duration;
|
||||
},
|
||||
"powers_range": (range) => {
|
||||
if (range == 'Smarts x5 (Sound); Smarts (Silence)')
|
||||
return 'Intellect ×5 (son), Intellect (silence)';
|
||||
if (range == "Cone Template")
|
||||
return "Gabarit de cône"
|
||||
if (range == "Touch")
|
||||
return "Toucher"
|
||||
if (range == "Sm")
|
||||
return "Intellect"
|
||||
if (range == "Sm x 2" || range == "Sm x2")
|
||||
return "Intellect x2"
|
||||
if (range == "Self")
|
||||
return "Personnel"
|
||||
return range;
|
||||
},
|
||||
"powers_rank": (rank) => {
|
||||
return swadeFrTranslator.getRank(rank)
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class SwadeFRContentCommands {
|
||||
|
||||
@@ -373,7 +368,7 @@ async function loadSecretCompendiums() {
|
||||
/************************************************************************************/
|
||||
function processItemSwid(actor, item) {
|
||||
let swid = item.system.swid
|
||||
let newSwid = swid
|
||||
let newSwid = swid
|
||||
if (swid == "combat") newSwid = "fighting";
|
||||
if (swid == "tir") newSwid = "shooting";
|
||||
if (swid != newSwid) {
|
||||
@@ -415,7 +410,7 @@ Hooks.once('ready', () => {
|
||||
type: Boolean,
|
||||
onChange: lang => window.location.reload()
|
||||
})
|
||||
|
||||
|
||||
SwadeFRContentCommands.init()
|
||||
migrateSwid()
|
||||
checkSwidSettings()
|
||||
@@ -428,6 +423,6 @@ Hooks.once('ready', () => {
|
||||
Hooks.once('babele.ready', () => {
|
||||
console.log(">>>>>>>>>> BABELE READY")
|
||||
loadSecretCompendiums()
|
||||
});
|
||||
});
|
||||
|
||||
console.log(">>>>>>>>>>>> LOADED")
|
||||
|
||||
Reference in New Issue
Block a user