2024-05-16 17:57:51 +02:00
|
|
|
let filters = [
|
|
|
|
{
|
|
|
|
property : "type",
|
|
|
|
value : "weapon"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
property : "system.weaponGroup.value",
|
|
|
|
value : ["twohanded", "polearm"]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2024-05-17 12:46:44 +02:00
|
|
|
let items = await game.wfrp4e.apps.ItemDialog.createFromFilters(filters, 1, "Choisissez une Arme d'Hast ou à Deux Mains")
|
2024-05-16 17:57:51 +02:00
|
|
|
items = items.map(i => i.toObject())
|
|
|
|
|
|
|
|
items.forEach(i => equip(i))
|
|
|
|
|
|
|
|
this.actor.createEmbeddedDocuments("Item", items);
|
|
|
|
|
|
|
|
function equip(item)
|
|
|
|
{
|
|
|
|
if (item.type == "armour")
|
|
|
|
item.system.worn.value = true
|
|
|
|
else if (item.type == "weapon")
|
|
|
|
item.system.equipped = true
|
|
|
|
else if (item.type == "trapping" && item.system.trappingType.value == "clothingAccessories")
|
|
|
|
item.system.worn = true
|
|
|
|
}
|