From d13ec4049c771c274ef69654578e4b7e22ddb14e Mon Sep 17 00:00:00 2001 From: Vlyan Date: Thu, 12 Aug 2021 12:42:30 +0200 Subject: [PATCH] Fixed Title's embed items tooltips. --- CHANGELOG.md | 1 + system/scripts/actors/twenty-questions-dialog.js | 2 +- system/scripts/helpers.js | 7 ++++++- system/scripts/items/item-sheet.js | 2 +- system/templates/actors/character/advancement-others.html | 2 +- system/templates/items/title/title-sheet.html | 2 +- 6 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1996b0b..fcf9ce5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - Fixes for RnK : - Visibility mode is now consistent with the 1st message (public, private, gm...). - DiceSoNice will now not show the new dice(s) for explosive in non-public mode. +- Fixed Title's embed items tooltips. - Minor fixe on editable state. ## 1.3.2 - Ronin's Bubble diff --git a/system/scripts/actors/twenty-questions-dialog.js b/system/scripts/actors/twenty-questions-dialog.js index 6f8bab4..84732b4 100644 --- a/system/scripts/actors/twenty-questions-dialog.js +++ b/system/scripts/actors/twenty-questions-dialog.js @@ -175,7 +175,7 @@ export class TwentyQuestionsDialog extends FormApplication { super.activateListeners(html); // Commons - game.l5r5e.HelpersL5r5e.commonListeners(html); + game.l5r5e.HelpersL5r5e.commonListeners(html, this.actor); // BT Next html.find(".next").on("click", (event) => { diff --git a/system/scripts/helpers.js b/system/scripts/helpers.js index ae5be1a..ead7ffb 100644 --- a/system/scripts/helpers.js +++ b/system/scripts/helpers.js @@ -469,7 +469,12 @@ export class HelpersL5r5e { item = await HelpersL5r5e.getObjectGameOrPack({ id: propertyId, type: "Item" }); } else if (itemParentId) { // Embed Item - const parentItem = actor.items.get(itemParentId); + let parentItem; + if (actor) { + parentItem = actor.items?.get(itemParentId); + } else { + parentItem = game.items.get(itemParentId); + } if (!parentItem) { return; } diff --git a/system/scripts/items/item-sheet.js b/system/scripts/items/item-sheet.js index a1bded3..2002c42 100644 --- a/system/scripts/items/item-sheet.js +++ b/system/scripts/items/item-sheet.js @@ -113,7 +113,7 @@ export class ItemSheetL5r5e extends ItemSheet { super.activateListeners(html); // Commons - game.l5r5e.HelpersL5r5e.commonListeners(html); + game.l5r5e.HelpersL5r5e.commonListeners(html, this.actor); // Everything below here is only needed if the sheet is editable if (!this.isEditable) { diff --git a/system/templates/actors/character/advancement-others.html b/system/templates/actors/character/advancement-others.html index 8a1c725..542a302 100644 --- a/system/templates/actors/character/advancement-others.html +++ b/system/templates/actors/character/advancement-others.html @@ -1,5 +1,5 @@ - {{advancement.name}}{{#if advancement.data.bond_type}} ({{advancement.data.bond_type}}){{/if}} + {{advancement.name}}{{#if advancement.data.bond_type}} ({{advancement.data.bond_type}}){{/if}} {{#if show_curriculum_toggle}}{{#if advancement.data.in_curriculum}} {{/if}}{{/if}} {{#if advancement.data.xp_used_total}}{{advancement.data.xp_used_total}}{{else}}{{advancement.data.xp_used}}{{/if}} {{advancement.data.rank}} diff --git a/system/templates/items/title/title-sheet.html b/system/templates/items/title/title-sheet.html index 59f09d9..8c51647 100644 --- a/system/templates/items/title/title-sheet.html +++ b/system/templates/items/title/title-sheet.html @@ -51,7 +51,7 @@ {{#each data.embedItemsList as |advancement|}} - {{> 'systems/l5r5e/templates/actors/character/advancement-others.html' advancement=advancement show_curriculum_toggle=true editable=../options.editable}} + {{> 'systems/l5r5e/templates/actors/character/advancement-others.html' advancement=advancement show_curriculum_toggle=true editable=../options.editable parent_id=../data._id}} {{/each}}