foundryvtt-wh4-lang-fr-fr/scripts/sgS9rblPkQB36C8S.js

29 lines
1000 B
JavaScript
Raw Permalink Normal View History

2024-05-16 17:57:51 +02:00
if (this.item.name.includes("("))
{
let trade = this.item.parenthesesText;
if (trade?.toLowerCase() != "any")
return this.item.updateSource({"system.tests.value" : this.item.system.tests.value.replace("any one", trade)})
}
let index = game.packs
.filter(i => i.metadata.type == "Item")
.reduce((acc, pack) => acc.concat(pack.index.contents), [])
.filter(i => i.type == "skill" && i.name.includes(game.i18n.localize("NAME.Trade")))
.map(i => {
i.id = i._id
return i
})
let choice = await ItemDialog.create(index, 1, "Choisissez une compétence Métier")
2024-05-16 17:57:51 +02:00
let text;
if (!choice[0])
{
let custom = await ValueDialog.create("Saisissez une spécialisation de Métier", "Custom Trade");
2024-05-16 17:57:51 +02:00
text = custom || ""
}
else
{
text = game.wfrp4e.utility.extractParenthesesText(choice[0].name)
}
await this.item.updateSource({name : this.item.name.replace("(Any)", "").replace("(any)", "").trim() + ` (${text})`, "system.tests.value" : this.item.system.tests.value.replace("any one", text)});