Ajout de la commande /voyage et grosse MAJK de la commande /auberge
This commit is contained in:
55
scripts/AYEiCx2Es3QtMY28.js
Normal file
55
scripts/AYEiCx2Es3QtMY28.js
Normal file
@@ -0,0 +1,55 @@
|
||||
let choice1 = [
|
||||
{
|
||||
type: "trait",
|
||||
name: "Bestial",
|
||||
},
|
||||
{
|
||||
type: "trait",
|
||||
name: "Regeneration",
|
||||
},
|
||||
{
|
||||
type: "trait",
|
||||
name: "Taille (Large)",
|
||||
},
|
||||
{
|
||||
type: "trait",
|
||||
name: "Territorial",
|
||||
}
|
||||
]
|
||||
|
||||
let updateObj;
|
||||
let actor;
|
||||
|
||||
async function addTrait(c) {
|
||||
let items = [];
|
||||
let existing;
|
||||
if (c.type == "trait") {
|
||||
existing = updateObj.items.find(i => i.name == c.name && i.type == c.type);
|
||||
}
|
||||
if (!existing) {
|
||||
let item = await game.wfrp4e.utility.find(c.name, c.type);
|
||||
if (item) {
|
||||
item = item.toObject();
|
||||
items.push(item);
|
||||
}
|
||||
else
|
||||
ui.notifications.warn(`Impossible de trouver ${c}`, { permanent: true });
|
||||
}
|
||||
console.log("WISH LIST2", choice1, items);
|
||||
actor.createEmbeddedDocuments("Item", items);
|
||||
}
|
||||
|
||||
async function dialogChoice() {
|
||||
for (let c of choice1)
|
||||
{
|
||||
if (await foundry.applications.api.DialogV2.confirm({window : {title: "Option"}, content:`<p>Add Option?</p><ol><li>${c.name}</li></ol>`}))
|
||||
{
|
||||
addTrait(c)
|
||||
c.valid = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updateObj = this.actor.toObject();
|
||||
actor = this.actor
|
||||
await dialogChoice();
|
||||
Reference in New Issue
Block a user