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

29 lines
991 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
})
2024-10-08 20:52:09 +02:00
let choice = await ItemDialog.create(index, 1, "Choisissez a Trade Skill")
2024-05-16 17:57:51 +02:00
let text;
if (!choice[0])
{
2024-10-08 20:52:09 +02:00
let custom = await ValueDialog.create({text : "Enter Custom Trade Skill", title : "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)});