Added "send to chat" header button on Actor sheets

This commit is contained in:
Vlyan
2021-08-05 14:48:01 +02:00
parent 56ab2cfb34
commit a8389a7cc1
7 changed files with 47 additions and 6 deletions

View File

@@ -186,4 +186,16 @@ export class ActorL5r5e extends Actor {
});
}
}
/**
* Render the text template for this Actor (tooltips and chat)
* @return {Promise<string|null>}
*/
async renderTextTemplate() {
const tpl = await renderTemplate(`${CONFIG.l5r5e.paths.templates}actors/actor-text.html`, this);
if (!tpl) {
return null;
}
return tpl;
}
}

View File

@@ -16,6 +16,24 @@ export class BaseSheetL5r5e extends ActorSheet {
});
}
/**
* Add the SendToChat button on top of sheet
* @override
*/
_getHeaderButtons() {
let buttons = super._getHeaderButtons();
// Send To Chat
buttons.unshift({
label: game.i18n.localize("l5r5e.global.send_to_chat"),
class: "send-to-chat",
icon: "fas fa-comment-dots",
onclick: async () => game.l5r5e.HelpersL5r5e.sendToChat(this.object),
});
return buttons;
}
/** @inheritdoc */
getData(options = {}) {
const sheetData = super.getData(options);