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

@@ -1,8 +1,8 @@
# Changelog
## 1.3.3 - TODO
- Added "send to chat" header button on Item and Journal sheets.
- Added Opportunity usage helper Compendium.
## 1.3.3 - Send to Chat
- Added "send to chat" header button on Actor, Item and Journal sheets.
- Added Opportunity usage helper Compendium (courteously authorized by Edge).
- Fixed Compendium entries thanks to TesserWract :
- Utaku Battle Maiden: Replace "Striking as Air" with "Courtier's Resolve".
- Weapons: Chair, lute, sake bottle and cups, and scroll case use the "Unarmed skill" and changed the umbrella's stab grip to be 2-handed.

View File

@@ -42,7 +42,7 @@
"edit": "Edit",
"delete_confirm": "Are you sure you want to delete '{name}' ?",
"drop_here": "Drop here",
"send_to_chat": "Send to Chat",
"send_to_chat": "To Chat",
"edge_translation_disclaimer": ""
},
"logo": {

View File

@@ -42,7 +42,7 @@
"edit": "Editar",
"delete_confirm": "¿Estás seguro de que quieres borrar '{name}' ?",
"drop_here": "Dejar caer aquí",
"send_to_chat": "Send to Chat",
"send_to_chat": "To Chat",
"edge_translation_disclaimer": "Edge Studio nos da su permiso para ofrecer este módulo a la comunidad, pero tanto los textos así como los códigos que lo constituyen no tienen su aprobación explícita."
},
"logo": {

View File

@@ -42,7 +42,7 @@
"edit": "Modifier",
"delete_confirm": "Etes-vous sûr de vouloir supprimer '{name}' ?",
"drop_here": "Déposez ici",
"send_to_chat": "Env. dans la conv.",
"send_to_chat": "Vers Conv.",
"edge_translation_disclaimer": ""
},
"logo": {

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);

View File

@@ -0,0 +1,11 @@
<div class="{{cssClass}}" data-actor-id="{{actor.data._id}}">
<header class="card-header">
<h2 class="item-name">
{{data.name}}
</h2>
</header>
<section class="sheet-body">
{{#if data.img}}<p><img src="{{data.img}}" title="{{data.name}}" /></p>{{/if}}
{{#if data.data.description}}<p>{{{data.data.description}}}</p>{{/if}}
</section>
</div>