- Added "send to chat" button on items sheets.
- Minor fixe on editable state.
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
# Changelog
|
||||
|
||||
## 1.3.3 - TODO
|
||||
- Added "send to chat" button on items sheets.
|
||||
- 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.
|
||||
- Minor fixe on editable state.
|
||||
|
||||
## 1.3.2 - Ronin's Bubble
|
||||
- Added a tooltip on hover with all information for items, and removed all these silly moving description (which made me crazy).
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
"edit": "Edit",
|
||||
"delete_confirm": "Are you sure you want to delete '{name}' ?",
|
||||
"drop_here": "Drop here",
|
||||
"send_to_chat": "Send to Chat",
|
||||
"edge_translation_disclaimer": ""
|
||||
},
|
||||
"logo": {
|
||||
|
||||
@@ -42,6 +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",
|
||||
"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": {
|
||||
|
||||
@@ -42,6 +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.",
|
||||
"edge_translation_disclaimer": ""
|
||||
},
|
||||
"logo": {
|
||||
|
||||
@@ -177,7 +177,7 @@ export class BaseSheetL5r5e extends ActorSheet {
|
||||
*/
|
||||
async _onDrop(event) {
|
||||
// *** Everything below here is only needed if the sheet is editable ***
|
||||
if (!this.options.editable) {
|
||||
if (!this.isEditable) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ export class BaseSheetL5r5e extends ActorSheet {
|
||||
game.l5r5e.HelpersL5r5e.commonListeners(html, this.actor);
|
||||
|
||||
// *** Everything below here is only needed if the sheet is editable ***
|
||||
if (!this.options.editable) {
|
||||
if (!this.isEditable) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ export class CharacterSheetL5r5e extends BaseSheetL5r5e {
|
||||
*/
|
||||
_getHeaderButtons() {
|
||||
let buttons = super._getHeaderButtons();
|
||||
if (!this.options.editable || this.actor.limited) {
|
||||
if (!this.isEditable || this.actor.limited) {
|
||||
return buttons;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ export class CharacterSheetL5r5e extends BaseSheetL5r5e {
|
||||
super.activateListeners(html);
|
||||
|
||||
// *** Everything below here is only needed if the sheet is editable ***
|
||||
if (!this.options.editable) {
|
||||
if (!this.isEditable) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ export class TwentyQuestionsDialog extends FormApplication {
|
||||
});
|
||||
|
||||
// *** Everything below here is only needed if the sheet is editable ***
|
||||
if (!this.options.editable) {
|
||||
if (!this.isEditable) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ export class TwentyQuestionsDialog extends FormApplication {
|
||||
*/
|
||||
async _onDropItem(type, event) {
|
||||
// *** Everything below here is only needed if the sheet is editable ***
|
||||
if (!this.options.editable) {
|
||||
if (!this.isEditable) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -258,7 +258,7 @@ export class RollnKeepDialog extends FormApplication {
|
||||
}
|
||||
|
||||
// *** Everything below here is only needed if the sheet is editable ***
|
||||
if (!this.options.editable) {
|
||||
if (!this.isEditable) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ export class RollnKeepDialog extends FormApplication {
|
||||
*/
|
||||
async _onDropItem(event) {
|
||||
// *** Everything below here is only needed if the sheet is editable ***
|
||||
if (!this.options.editable) {
|
||||
if (!this.isEditable) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -660,7 +660,7 @@ export class RollnKeepDialog extends FormApplication {
|
||||
*/
|
||||
async _updateObject(event, formData) {
|
||||
// *** Everything below here is only needed if the sheet is editable ***
|
||||
if (!this.options.editable) {
|
||||
if (!this.isEditable) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -431,11 +431,7 @@ export class HelpersL5r5e {
|
||||
return;
|
||||
}
|
||||
|
||||
const type = item.type.replace("_", "-"); // ex: item_pattern
|
||||
const tpl = await renderTemplate(
|
||||
`${CONFIG.l5r5e.paths.templates}items/${type}/${type}-text.html`,
|
||||
item
|
||||
);
|
||||
const tpl = await item.renderTextTemplate();
|
||||
if (!tpl) {
|
||||
return;
|
||||
}
|
||||
@@ -460,6 +456,7 @@ export class HelpersL5r5e {
|
||||
* Get a Item from a Actor Sheet
|
||||
* @param {Event} event HTML Event
|
||||
* @param {ActorL5r5e} actor
|
||||
* @return {ItemL5r5e}
|
||||
*/
|
||||
static async getEmbedItemByEvent(event, actor) {
|
||||
const current = $(event.currentTarget);
|
||||
|
||||
@@ -115,6 +115,20 @@ export class ItemL5r5e extends Item {
|
||||
return parentItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the text template for this Item (tooltips and chat)
|
||||
* @return {Promise<string|null>}
|
||||
*/
|
||||
async renderTextTemplate() {
|
||||
const type = this.type.replace("_", "-"); // ex: item_pattern
|
||||
await game.l5r5e.HelpersL5r5e.refreshItemProperties(this);
|
||||
const tpl = await renderTemplate(`${CONFIG.l5r5e.paths.templates}items/${type}/${type}-text.html`, this);
|
||||
if (!tpl) {
|
||||
return null;
|
||||
}
|
||||
return tpl;
|
||||
}
|
||||
|
||||
// ***** Embedded items management *****
|
||||
/**
|
||||
* Shortcut for this.data.data.items.get
|
||||
|
||||
@@ -37,7 +37,7 @@ export class AdvancementSheetL5r5e extends ItemSheetL5r5e {
|
||||
super.activateListeners(html);
|
||||
|
||||
// Everything below here is only needed if the sheet is editable
|
||||
if (!this.options.editable) {
|
||||
if (!this.isEditable) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ export class ItemPatternSheetL5r5e extends ItemSheetL5r5e {
|
||||
super.activateListeners(html);
|
||||
|
||||
// Everything below here is only needed if the sheet is editable
|
||||
if (!this.options.editable) {
|
||||
if (!this.isEditable) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ export class ItemPatternSheetL5r5e extends ItemSheetL5r5e {
|
||||
*/
|
||||
async _onDrop(event) {
|
||||
// Everything below here is only needed if the sheet is editable
|
||||
if (!this.options.editable) {
|
||||
if (!this.isEditable) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,48 @@ export class ItemSheetL5r5e extends ItemSheet {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 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: "twenty-questions",
|
||||
icon: "fas fa-comment-dots",
|
||||
onclick: async () => this.sendToChat(),
|
||||
});
|
||||
|
||||
return buttons;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the description of this Item to chat
|
||||
* @return {Promise<*>}
|
||||
*/
|
||||
async sendToChat() {
|
||||
const tpl = await this.object.renderTextTemplate();
|
||||
if (!tpl) {
|
||||
return;
|
||||
}
|
||||
|
||||
let link = null;
|
||||
if (this.object.data.flags.core?.sourceId) {
|
||||
link = this.object.data.flags.core?.sourceId.replace(/(\w+)\.(.+)/, "@$1[$2]");
|
||||
} else if (this.object.pack) {
|
||||
link = `@Compendium[${this.object.pack}.${this.object.id}]{${this.object.name}}`;
|
||||
} else if (!this.object.actor) {
|
||||
link = this.object.link;
|
||||
}
|
||||
|
||||
return ChatMessage.create({
|
||||
content: (link ? link + `<br>` : "") + tpl,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {Object|Promise}
|
||||
*/
|
||||
@@ -26,6 +68,10 @@ export class ItemSheetL5r5e extends ItemSheet {
|
||||
// Prepare Properties (id/name => object)
|
||||
await this._prepareProperties(sheetData);
|
||||
|
||||
// Fix editable
|
||||
sheetData.editable = this.isEditable;
|
||||
sheetData.options.editable = sheetData.editable;
|
||||
|
||||
return sheetData;
|
||||
}
|
||||
|
||||
@@ -94,7 +140,7 @@ export class ItemSheetL5r5e extends ItemSheet {
|
||||
game.l5r5e.HelpersL5r5e.commonListeners(html);
|
||||
|
||||
// Everything below here is only needed if the sheet is editable
|
||||
if (!this.options.editable) {
|
||||
if (!this.isEditable) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -130,7 +176,7 @@ export class ItemSheetL5r5e extends ItemSheet {
|
||||
*/
|
||||
async _onDrop(event) {
|
||||
// Everything below here is only needed if the sheet is editable
|
||||
if (!this.options.editable) {
|
||||
if (!this.isEditable) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ export class TitleSheetL5r5e extends ItemSheetL5r5e {
|
||||
*/
|
||||
async _onDrop(event) {
|
||||
// Everything below here is only needed if the sheet is editable
|
||||
if (!this.options.editable) {
|
||||
if (!this.isEditable) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ export class TitleSheetL5r5e extends ItemSheetL5r5e {
|
||||
super.activateListeners(html);
|
||||
|
||||
// Everything below here is only needed if the sheet is editable
|
||||
if (!this.options.editable) {
|
||||
if (!this.isEditable) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ export class BaseJournalSheetL5r5e extends JournalSheet {
|
||||
game.l5r5e.HelpersL5r5e.commonListeners(html);
|
||||
|
||||
// *** Everything below here is only needed if the sheet is editable ***
|
||||
// if (!this.options.editable) {
|
||||
// if (!this.isEditable) {
|
||||
// return;
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user