Ajout de la commande /voyage et grosse MAJK de la commande /auberge

This commit is contained in:
2026-01-07 15:04:49 +01:00
parent c8119601d8
commit f525b6c07a
1329 changed files with 24138 additions and 4397 deletions

View File

@@ -3,30 +3,37 @@ if (this.actor.type != "character")
return;
}
let god = await ValueDialog.create({text : "Enter a Deity", title : "Blessed"})
let god = await ValueDialog.create({text : "Choisissez un Dieu", title : "Béni"})
if (god)
{
let prayers = await warhammer.utility.findAllItems("prayer", "Loading Prayers")
let prayers = await warhammer.utility.findAllItems("prayer", "Chargement des Prières", true, ["system.type.value", "system.god.value"])
let blessings = prayers.filter(p => p.system.god.value.split(",").map(i => i.trim().toLowerCase()).includes(god.toLowerCase()) && p.system.type.value == "blessing")
let godBlessings = game.wfrp4e.config.godBlessings[god.toLowerCase()] || [];
if (god == "Old Faith")
let configBlessings = await Promise.tout((game.wfrp4e.config.godBlessings[god.toLowerCase()] || []).map(fromUuid));
if (god == "Foi Antique")
{
blessings = await ItemDialog.create(prayers.filter(i => i.system.type.value == "blessing"), 6, {text : "Select any 6 Blessings", title : "Blessed"})
blessings = await ItemDialog.create(prayers.filter(i => i.system.type.value == "blessing"), 6, {text : "Sélectionnez 6 Bénédictions", title : "Béni"})
}
if (godBlessings.length)
if (configBlessings.length)
{
blessings = blessings.concat(await Promise.all(godBlessings.filter(bls => !(blessings.map(i => i.uuid).includes(bls.uuid))).map(fromUuid)));
// Combine blessings defined by config with actual blessing items found that specify this god, avoiding duplicates
blessings = blessings.concat(
configBlessings.map(i => {return {uuid : i.uuid, name : i.name}})
.filter(bls => !(blessings.find(i => i.uuid == bls.uuid)))
);
}
if (blessings.length)
{
this.script.notification("Adding " + blessings.map(i => i.name).join(", "))
await this.actor.createEmbeddedDocuments("Item", blessings, {fromEffect : this.effect.id})
this.script.scriptNotification("Ajout de " + blessings.map(i => i.name).join(", "))
await this.actor.addEffectItems(blessings.map(i => i.uuid), this.effet)
}
else
else
{
this.script.notification(`Impossible de trouver any Blessings associated with ${god}.`)
this.script.scriptNotification(`Impossible de trouver des Bénédictions associées à ${god}.`)
}
this.item.updateSource({name : this.item.name.replace("Any", god)})
if (this.item.name.includes("Au choix"))
this.item.updateSource({name: this.item.name.replace("Au choix", god)});
else
this.item.updateSource({name: this.item.name + ` (${god})`});
await this.actor.update({"system.details.god.value": god})
}