2024-05-16 17:57:51 +02:00
|
|
|
let choices = await Promise.all([game.wfrp4e.utility.findItemId("1zaqojk0Oq1m8vYv"), game.wfrp4e.utility.findItemId("zIuarD5mB0EF0ji0")])
|
2024-05-17 01:07:37 +02:00
|
|
|
let items = await game.wfrp4e.apps.ItemDialog.create(choices, 1, "Choisir une arme")
|
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.data.worn.value = true
|
|
|
|
else if (item.type == "weapon")
|
|
|
|
item.data.equipped = true
|
|
|
|
else if (item.type == "trapping" && item.data.trappingType.value == "clothingAccessories")
|
|
|
|
item.data.worn = true
|
|
|
|
}
|