Compare commits

..

9 Commits

29 changed files with 145 additions and 128 deletions

View File

@ -4,7 +4,7 @@
"Career Tables": "Table des Carrières",
"Character Creation": "Création de Personnage",
"Core Rulebook": "Livre de Base",
"Corruption & Mutation Tables": "ables de Corruption & Mutations",
"Corruption & Mutation Tables": "Tables de Corruption & Mutations",
"Critical Hit Tables": "Tables de Critiques",
"GM Booklet": "Livret du MJ",
"Hit Location": "Table de Localisation",

View File

@ -8,7 +8,7 @@
}
],
"url": "https://www.uberwald.me/gitea/public/foundryvtt-wh4-lang-fr-fr",
"version": "7.2.0",
"version": "7.2.3",
"esmodules": [
"modules/babele-register.js",
"modules/addon-register.js",
@ -117,7 +117,7 @@
}
],
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-wh4-lang-fr-fr/raw/v10/module.json",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-wh4-lang-fr-fr/archive/foundryvtt-wh4-lang-fr-7.2.0.zip",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-wh4-lang-fr-fr/archive/foundryvtt-wh4-lang-fr-7.2.3.zip",
"id": "wh4-fr-translation",
"compatibility": {
"minimum": "11",

View File

@ -300,7 +300,7 @@ Hooks.once('init', () => {
}
}
if (results[0].documentCollection) {
return game.babele.instance.converters.tableResults(results)
return game.babele.converters.tableResults(results)
}
return results
},

File diff suppressed because one or more lines are too long

View File

@ -17,5 +17,5 @@ let scriptLoader = `export default function()
}`
fs.writeFileSync(".modules/loadScripts.js", scriptLoader)
fs.writeFileSync("./modules/loadScripts.js", scriptLoader)
console.log(`Packed ${count} scripts`);

View File

@ -73,7 +73,7 @@ for (let c of choice)
{
item = item.toObject()
equip(item);
items.push(mergeObject(item, (c.diff || {})))
items.push(foundry.utils.mergeObject(item, (c.diff || {})))
}
else
ui.notifications.warn(`Impossible de trouver ${talent}`, {permanent : true})

View File

@ -13,7 +13,7 @@ let choices = await ItemDialog.create(ItemDialog.objectToArray(symptoms), roll.t
if (choices.length)
{
let symptomEffects = duplicate(game.wfrp4e.config.symptomEffects)
let symptomEffects = foundry.utils.duplicate(game.wfrp4e.config.symptomEffects)
let added = []
for(let choice of choices)
{

View File

@ -1,8 +1,9 @@
let lore = this.effect.name.split("(")[1].split(")")[0].toLowerCase();
let spellLore = game.wfrp4e.config.magicLores[args.spell.system.lore.value].toLowerCase();
// If channelling corresponding lore
if (args.type == "channelling" && args.spell.system.lore.value == lore)
if (args.type == "channelling" && spellLore == lore)
args.prefillModifiers.slBonus += 2
// If channelling or casting different lore
else if (args.spell.system.lore.value != lore && args.spell.system.lore.value != "petty")
else if (spellLore != lore && args.spell.system.lore.value != "petty")
args.prefillModifiers.slBonus -= 1

View File

@ -1,7 +1,7 @@
let chatData = { whisper: ChatMessage.getWhisperRecipients("GM") }
let message = ""
let wounds = duplicate(this.actor.status.wounds)
let wounds = foundry.utils.duplicate(this.actor.status.wounds)
let regenRoll = await new Roll("1d10").roll();
let regen = regenRoll.total;

View File

@ -1,12 +1,12 @@
// This script needs to be separate because equipTransfer is off on the other effect, and thus won't execute when added to an actor
let mainEffect = this.item.effects.contents[0];
if (mainEffect.name.includes("(Savoir)"))
if (mainEffect.name.includes("(Lore)"))
{
let choice = await ItemDialog.create(ItemDialog.objectToArray(game.wfrp4e.config.magicLores, this.item.img), 1, "Choisissez le Savoir");
if (choice.length)
{
mainEffect.update({name : mainEffect.name.replace("Savoir", choice[0].name)})
mainEffect.update({name : mainEffect.name.replace("Lore", choice[0].name)})
this.item.update({name : this.item.name += ` (${choice[0].name})`})
}
}

View File

@ -2,7 +2,7 @@ fromUuid(this.effect.origin).then(caster => {
if (caster) {
if (actor.items.find(it => it.name == game.i18n.localize("Bestial"))) {
let healed = caster.characteristics.wp.bonus
let wounds = duplicate(args.actor.status.wounds)
let wounds = foundry.utils.duplicate(args.actor.status.wounds)
wounds.value += healed
if (wounds.value > wounds.max)

View File

@ -1,8 +1,9 @@
let lore = this.effect.name.split("(")[1].split(")")[0].toLowerCase();
let spellLore = game.wfrp4e.config.magicLores[args.spell.system.lore.value].toLowerCase();
// If channelling corresponding lore
if (args.type == "channelling" && args.spell.system.lore.value == lore)
if (args.type == "channelling" && spellLore == lore)
args.prefillModifiers.slBonus += 1
// If channelling or casting different lore
else if (args.spell.system.lore.value != lore && args.spell.system.lore.value != "petty")
else if (spellLore != lore && args.spell.system.lore.value != "petty")
args.prefillModifiers.slBonus -= 1

View File

@ -30,7 +30,7 @@ else if (roll = 10)
message = `Résultat de ${roll}, gagnez ${item.name}, ${modifier} en Force`
dice.toMessage(this.script.getChatData())
let changes = duplicate(this.effect.changes)
let changes = foundry.utils.duplicate(this.effect.changes)
changes[0].value = modifier
this.effect.updateSource({changes})

View File

@ -1,4 +1,4 @@
let test = await this.actor.setupCharacteristic("ag", {skipTargets: true, appendTitle : ` - ${this.effect.name}`, context: { failure: "Goes Prone" }})
let test = await this.actor.setupCharacteristic("ag", {skipTargets: true, appendTitle : ` - ${this.effect.name}`, context: { failure: "A Terre" }})
await test.roll();
if (test.failed)
{

View File

@ -109,7 +109,7 @@ for (let c of choice) {
if (item) {
item = item.toObject()
equip(item);
items.push(mergeObject(item, (c.diff || {})))
items.push(foundry.utils.mergeObject(item, (c.diff || {})))
}
else
ui.notifications.warn(`Impossible de trouver ${c.name}`, { permanent: true })

View File

@ -112,7 +112,7 @@ for (let c of choice)
{
item = item.toObject()
equip(item);
items.push(mergeObject(item, (c.diff || {})))
items.push(foundry.utils.mergeObject(item, (c.diff || {})))
}
else
ui.notifications.warn(`Impossible de trouver ${c.name}`, {permanent : true})

View File

@ -1,2 +1,3 @@
let lore = this.effect.name.split("(")[1].split(")")[0].toLowerCase();
return !args.spell || (args.type == "cast" && ["petty", lore].includes(args.spell.system.lore.value));
let spellLore = game.wfrp4e.config.magicLores[args.spell.system.lore.value].toLowerCase();
return !args.spell || (args.type == "cast" && [game.wfrp4e.config.magicLores["petty"].toLowerCase(), lore].includes(spellLore));

View File

@ -1,8 +1,9 @@
let lore = this.effect.name.split("(")[1].split(")")[0].toLowerCase();
let spellLore = game.wfrp4e.config.magicLores[args.spell.system.lore.value].toLowerCase();
// If channelling corresponding lore
if (args.type == "channelling" && args.spell.system.lore.value == lore)
if (args.type == "channelling" && spellLore == lore)
args.prefillModifiers.slBonus += 3
// If channelling or casting different lore
else if (args.spell.system.lore.value != lore && args.spell.system.lore.value != "petty")
else if (spellLore != lore && args.spell.system.lore.value != "petty")
args.prefillModifiers.slBonus -= 1

View File

@ -1,7 +1,7 @@
let chatData = { whisper: ChatMessage.getWhisperRecipients("GM") }
let message = ""
let wounds = duplicate(this.actor.status.wounds)
let wounds = foundry.utils.duplicate(this.actor.status.wounds)
let regenRoll = await new Roll("1d10").roll();
let regen = regenRoll.total;

View File

@ -4,39 +4,32 @@ let targetedItem = this.actor.items.get(this.effect.flags.wfrp4e.itemTargets[0])
let qualities = foundry.utils.deepClone(game.wfrp4e.config.itemQualities);
let flaws = foundry.utils.deepClone(game.wfrp4e.config.itemFlaws);
if (targetedItem.type == "weapon")
{
mergeObject(qualities, game.wfrp4e.config.weaponQualities)
mergeObject(flaws, game.wfrp4e.config.weaponFlaws)
if (targetedItem.type == "weapon") {
foundry.utils.mergeObject(qualities, game.wfrp4e.config.weaponQualities)
foundry.utils.mergeObject(flaws, game.wfrp4e.config.weaponFlaws)
}
else if (targetedItem.type == "armour")
{
mergeObject(qualities, game.wfrp4e.config.armorQualities)
mergeObject(flaws, game.wfrp4e.config.armorFlaws)
else if (targetedItem.type == "armour") {
foundry.utils.mergeObject(qualities, game.wfrp4e.config.armorQualities)
foundry.utils.mergeObject(flaws, game.wfrp4e.config.armorFlaws)
}
for(let q in qualities)
{
// If the weapon already has a flaw, don't put it in the dialog
if (targetedItem.system.properties.qualities[q])
{
delete qualities[q]
}
for (let q in qualities) {
// If the weapon already has a flaw, don't put it in the dialog
if (targetedItem.system.properties.qualities[q]) {
delete qualities[q]
}
}
for(let f in flaws)
{
// If a weapon doesn't have a flaw, don't put it in the dialog
if (!targetedItem.system.properties.flaws[f])
{
delete flaws[f]
}
for (let f in flaws) {
// If a weapon doesn't have a flaw, don't put it in the dialog
if (!targetedItem.system.properties.flaws[f]) {
delete flaws[f]
}
}
let added = await ItemDialog.create(ItemDialog.objectToArray(qualities), "unlimited", "Choisissez la Qualité à ajouter");
let removed = []
if (!foundry.utils.isEmpty(flaws))
{
removed = await ItemDialog.create(ItemDialog.objectToArray(flaws), "unlimited", "Choisissez le Défaut à enlever");
if (!foundry.utils.isEmpty(flaws)) {
removed = await ItemDialog.create(ItemDialog.objectToArray(flaws), "unlimited", "Choisissez le Défaut à enlever");
}
this.effect.updateSource({"flags.wfrp4e.propertiesChanged" : {added : added.map(i => i.id), removed : removed.map(i => i.id)}})
this.effect.updateSource({ "flags.wfrp4e.propertiesChanged": { added: added.map(i => i.id), removed: removed.map(i => i.id) } })

View File

@ -1,11 +1,13 @@
let injury = this.effect.itemTargets[0]
if (injury && this.effect.sourceTest.result.outcome == "success") {
let days = new Roll(injury.system.duration.value).roll( {async: false} ).total
let num = 1 + Number(this.effect.sourceTest.result.SL);
let roll = await new Roll(num+'d10').roll({async: false})
await roll.toMessage(this.script.getChatData())
let newDays = Math.max(days - roll.total, 1)
this.actor.updateEmbeddedDocuments("Item", [{_id: injury.id, 'system.duration.value': newDays} ])
let message = "Blessures réduites à "+newDays+" (-" + roll.total + ") au lieu de "+days
this.script.scriptMessage(message)
let roll1 = new Roll(injury.system.duration.value)
await roll1.roll()
let days = roll1.total
let num = 1 + Number(this.effect.sourceTest.result.SL);
let roll = await new Roll(num + 'd10').roll()
await roll.toMessage(this.script.getChatData())
let newDays = Math.max(days - roll.total, 1)
this.actor.updateEmbeddedDocuments("Item", [{ _id: injury.id, 'system.duration.value': newDays }])
let message = "Blessures réduites à " + newDays + " (-" + roll.total + ") au lieu de " + days
this.script.scriptMessage(message)
}

View File

@ -2,7 +2,7 @@ let aoeDamage = this.effect.sourceTest.result.damage - 5 // Easily handle magic
this.script.scriptMessage(await this.actor.applyBasicDamage(aoeDamage, {damageType : game.wfrp4e.config.DAMAGE_TYPE.IGNORE_AP, suppressMsg : true}))
let test = await this.actor.setupSkill(game.i18n.localize("NAME.Dodge"), {skipTargets: true, appendTitle : ` - Ablaze`})
let test = await this.actor.setupSkill(game.i18n.localize("NAME.Dodge"), {skipTargets: true, appendTitle : ` - En Flammes`})
await test.roll();

View File

@ -69,7 +69,7 @@ for (let c of choice)
{
item = item.toObject()
equip(item);
items.push(mergeObject(item, (c.diff || {})))
items.push(foundry.utils.mergeObject(item, (c.diff || {})))
}
else
ui.notifications.warn(`Impossible de trouver ${talent}`, {permanent : true})

View File

@ -94,7 +94,7 @@ for (let c of choice)
{
item = item.toObject()
equip(item);
items.push(mergeObject(item, (c.diff || {})))
items.push(foundry.utils.mergeObject(item, (c.diff || {})))
}
else
ui.notifications.warn(`Impossible de trouver ${talent}`, {permanent : true})

View File

@ -25,7 +25,7 @@ if (test.failed)
`
this.script.scriptMessage(msg);
let characteristics = duplicate(this.actor.system.characteristics)
let characteristics = foundry.utils.duplicate(this.actor.system.characteristics)
characteristics.ws.initial -= ws
characteristics.bs.initial -= bs

View File

@ -1,5 +1,5 @@
let lore = this.effect.name.split(" ")[2].toLowerCase();
if (args.item.type == "spell" && args.item.system.lore.value == lore)
if (args.item.type == "spell" && game.wfrp4e.config.magicLores[args.item.system.lore.value].toLowerCase() == lore)
{
args.item.system.cn.value -= 1
}
}

View File

@ -1,12 +1,12 @@
// This script needs to be separate because equipTransfer is off on the other effect, and thus won't execute when added to an actor
let mainEffect = this.item.effects.contents[0];
if (mainEffect.name.includes("<Savoir>"))
if (mainEffect.name.includes("<Lore>"))
{
let choice = await ItemDialog.create(ItemDialog.objectToArray(game.wfrp4e.config.magicLores, this.item.img), 1, "Choisissez le Savoir");
if (choice.length)
{
mainEffect.update({name : mainEffect.name.replace("<Savoir>", choice[0].name)})
mainEffect.update({name : mainEffect.name.replace("<Lore>", choice[0].name)})
this.item.update({name : this.item.name += ` (${choice[0].name})`})
}
}

View File

@ -1,30 +1,30 @@
let choice1 = [
{
type : "skill",
name : "Projectiles (Arc)",
diff : {
system : {
advances : {
value : 10
}
}
{
type: "skill",
name: "Projectiles (Arc)",
diff: {
system: {
advances: {
value: 10
}
},
{
type : "weapon",
name : "Arc long",
},
{
type : "ammunition",
name : "Flèche",
}
}
},
{
type: "weapon",
name: "Arc long",
},
{
type: "ammunition",
name: "Flèche",
}
]
let choice2 = [
]
let choice = await Dialog.wait({
title : "Option",
content :
title: "Option",
content:
`<p>
Ajouter l'ption?
</p>
@ -32,59 +32,53 @@ let choice = await Dialog.wait({
<li>Ranged (Bow) +10 and a Longbow with 12 Arrows</li>
</ol>
`,
buttons : {
1 : {
label : "Oui",
callback : () => {
return choice1;
}
},
2 : {
label : "Non",
callback : () => {
return choice2;
}
}
buttons: {
1: {
label: "Oui",
callback: () => {
return choice1;
}
},
2: {
label: "Non",
callback: () => {
return choice2;
}
}
}
})
let updateObj = this.actor.toObject();
let items = []
for (let c of choice)
{
let existing
if (c.type == "skill")
{
existing = updateObj.items.find(i => i.name == c.name && i.type == c.type)
if (existing && c.diff?.system?.advances?.value)
{
existing.system.advances.value += c.diff.system.advances.value
}
for (let c of choice) {
let existing
if (c.type == "skill") {
existing = updateObj.items.find(i => i.name == c.name && i.type == c.type)
if (existing && c.diff?.system?.advances?.value) {
existing.system.advances.value += c.diff.system.advances.value
}
}
if (!existing)
{
let item = await game.wfrp4e.utility.find(c.name, c.type)
if (item)
{
item = item.toObject()
equip(item);
items.push(mergeObject(item, (c.diff || {})))
}
else
ui.notifications.warn(`Impossible de trouver ${talent}`, {permanent : true})
if (!existing) {
let item = await game.wfrp4e.utility.find(c.name, c.type)
if (item) {
item = item.toObject()
equip(item);
items.push(foundry.utils.mergeObject(item, (c.diff || {})))
}
else
ui.notifications.warn(`Impossible de trouver ${talent}`, { permanent: true })
}
}
await this.actor.update(updateObj)
this.actor.createEmbeddedDocuments("Item", items);
function equip(item)
{
if (item.type == "armour")
item.system.worn.value = true
else if (item.type == "weapon")
item.system.equipped = true
else if (item.type == "trapping" && item.system.trappingType.value == "clothingAccessories")
item.system.worn = true
function equip(item) {
if (item.type == "armour")
item.system.worn.value = true
else if (item.type == "weapon")
item.system.equipped = true
else if (item.type == "trapping" && item.system.trappingType.value == "clothingAccessories")
item.system.worn = true
}

View File

@ -0,0 +1,24 @@
local lfs = require"lfs"
local src = "../reference_scripts/"
local dst = "../scripts/"
for file in lfs.dir(src) do
if file == '.' or file == '..' then
else
local fp1 = io.open(dst..file, "r+")
local fp2 = io.open(src..file, "r+")
if fp1 and fp2 then
-- Compare files
local content1 = fp1:read("*all")
local content2 = fp2:read("*all")
if content1 == content2 then
print("Identical files: "..file)
end
fp1:close()
fp2:close()
else
print("Error: Could not open file: "..file)
end
end
end