2024-05-16 17:57:51 +02:00
|
|
|
if (this.item.name.includes("("))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
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.Lore")))
|
|
|
|
.map(i => {
|
|
|
|
i.id = i._id
|
|
|
|
return i
|
|
|
|
})
|
|
|
|
|
2024-05-17 09:19:48 +02:00
|
|
|
let choice = await ItemDialog.create(index, 1, "Choisir un Savoir")
|
2024-05-16 17:57:51 +02:00
|
|
|
let text;
|
|
|
|
if (!choice[0])
|
|
|
|
{
|
|
|
|
let custom = await Dialog.wait({
|
2024-05-17 09:19:48 +02:00
|
|
|
title : "Saisir le savoir",
|
2024-05-16 17:57:51 +02:00
|
|
|
content : "<input type='text'>",
|
|
|
|
buttons : {
|
|
|
|
confirm : {
|
2024-05-17 09:19:48 +02:00
|
|
|
label : game.i18n.localize("Confirmer"),
|
2024-05-16 17:57:51 +02:00
|
|
|
callback : (dlg) => {
|
|
|
|
return dlg.find("input")[0].value
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
default : "confirm",
|
|
|
|
close : () => {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
})
|
|
|
|
text = custom || ""
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
text = game.wfrp4e.utility.extractParenthesesText(choice[0].name)
|
|
|
|
}
|
|
|
|
|
|
|
|
await this.item.updateSource({name : this.item.name + ` (${text})`, "system.tests.value" : this.item.system.tests.value.replace("chosen Lore", text)})
|
|
|
|
await this.effect.updateSource({name : this.effect.name + ` (${text})`})
|