Update scripts

This commit is contained in:
2024-10-08 20:52:09 +02:00
parent 1f1d871e53
commit fc4fa1deb5
178 changed files with 12247 additions and 10701 deletions

View File

@ -12,11 +12,11 @@ let choice1 = [
},
{
type : "weapon",
name : "Arc",
name : "Bow",
},
{
type : "ammunition",
name : "Flèche",
name : "Arrow",
}
]
let choice2 = [
@ -26,21 +26,21 @@ let choice = await Dialog.wait({
title : "Option",
content :
`<p>
Ajouter une Option?
Ajouter une option?
</p>
<ol>
<li>Projectiles (Arc) +10 et un arc avec 12 Flèches</li>
<li>Ranged (Bow) +10 and a Bow with 12 Arrows</li>
</ol>
`,
buttons : {
1 : {
label : "Oui",
label : "Yes",
callback : () => {
return choice1
}
},
2 : {
label : "Non",
label : "No",
callback : () => {
choice2
}
@ -67,9 +67,13 @@ for (let c of choice)
let item = await game.wfrp4e.utility.find(c.name, c.type)
if (item)
{
let equip = item.system.tags.has("equippable");
item = item.toObject()
equip(item);
items.push(foundry.utils.mergeObject(item, (c.diff || {})))
if (equip)
{
item.system.equipped.value = true;
}
items.push(foundry.utils.mergeObject(item, (c.diff || {})))
}
else
ui.notifications.warn(`Impossible de trouver ${talent}`, {permanent : true})
@ -78,13 +82,3 @@ for (let c of choice)
}
await this.actor.update(updateObj)
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
}