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

39 lines
1006 B
JavaScript
Raw Permalink Normal View History

2024-10-08 20:52:09 +02:00
let choice = await Dialog.wait({
title : "Choice",
content :
`<p>
Select your choice
</p>
`,
buttons : {
1 : {
label : "Shield",
callback : () => {
return "shield"
}
},
2 : {
label : "Two-Handed Weapon",
callback : () => {
return "twohanded"
}
},
}
})
let weapons = await warhammer.utility.findAllItems("weapon", "Loading Weapons");
let items
if (choice == "shield")
{
items = await game.wfrp4e.apps.ItemDialog.create(weapons.filter(i => i.system.properties.qualities.shield), 1, "Choisissez a Shield");
}
else if (choice == "twohanded")
{
items = await game.wfrp4e.apps.ItemDialog.create(weapons.filter(i => i.system.weaponGroup.value == "twohanded"), 1, "Choisissez a Two-Handed Weapon");
}
items = items.map(i => i.toObject())
items.forEach(i => i.system.equipped.value)
this.actor.createEmbeddedDocuments("Item", items);