2024-05-16 17:57:51 +02:00
let item = this . effect . getCreatedItems ( ) ? . [ 0 ] ;
2024-05-17 12:46:44 +02:00
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" ,
2024-05-17 12:46:44 +02:00
"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 } )
}