Post to chat pour les acteurs

This commit is contained in:
Vincent Vandemeulebrouck
2022-12-29 02:25:45 +01:00
parent 26808d7b49
commit c79298b60a
10 changed files with 76 additions and 24 deletions

View File

@ -455,20 +455,19 @@ export class RdDItem extends Item {
}
/* -------------------------------------------- */
async postItem(modeOverride) {
async postItemToChat(modeOverride) {
console.log(this);
let chatData = duplicate(this);
chatData["properties"] = this.getProprietes();
if (this.actor) {
chatData.actor = { id: this.actor.id };
let chatData = {
doctype: 'Item',
id: this.id,
type: this.type,
img: this.img,
pack: this.pack,
name: this.name,
actor : this.actor ? { id: this.actor.id } : undefined,
system: { description: this.system.description },
properties: this.getProprietes(),
}
// JSON object for easy creation
chatData.jsondata = JSON.stringify(
{
compendium: "postedItem",
payload: chatData,
});
renderTemplate(this.getChatItemTemplate(), chatData).then(html => {
let chatOptions = RdDUtility.chatDataSetup(html, modeOverride);
ChatMessage.create(chatOptions)