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

30 lines
911 B
JavaScript
Raw Normal View History

2024-05-16 17:57:51 +02:00
let item = this.effect.getCreatedItems()?.[0];
ChatMessage.create({content : "<em>La grâce est au delà du style</em>", speaker : ChatMessage.getSpeaker({token: this.actor.getActiveTokens()[0]?.document, actor: this.actor})}, {chatBubble : true})
2024-05-16 17:57:51 +02:00
let choice = await ItemDialog.create(ItemDialog.objectToArray({
"nobles" : "Nobles",
"guilders" : "Maitres de Guildes",
"servants" : "Serviteurs"
}), 1, "Choisissez un groupes")
2024-05-16 17:57:51 +02:00
let name = choice[0]?.name
if (!name)
{
return;
}
if (item)
{
item.update({
name : item.name.split("(")[0] + ` (${name})`,
"system.tests.value" : item.system.tests.value.split("(")[0] + ` (${name}`
})
}
else
{
item = await fromUuid("Compendium.wfrp4e-core.items.Item.sYbgpSnRqSZWgwFP");
let data = item.toObject();
data.name += ` (${name})`
this.actor.createEmbeddedDocuments("Item", [data], {fromEffect: this.effect.id})
}