From 75f68a485252db38bd52f4fd3b987ffe307d6142 Mon Sep 17 00:00:00 2001 From: Vlyan Date: Fri, 22 Jan 2021 15:19:03 +0100 Subject: [PATCH] Display Rarity in Compendiums for Items, Armors and Weapons --- CHANGELOG.md | 14 ++++++++++++-- system/scripts/hooks.js | 8 ++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15ab5ca..8b15d8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,20 @@ # Changelog +## 1.1.2 - Compendiums Update +- Added compendiums (Thanks to Stéfano Fara for the English version !) Partial for French as PoW and CR are not translated yet + - Shadowlands + - Emerald Empire + - Courts of Stone + - Path of Waves + - Celestial Realms +- Fix js error when Advancement is not embed in a actor +- Display Rarity in Compendiums for Items, Armors and Weapons +- Other minors fix + ## 1.1.1 - The Huns War - Fix Minion initiative - Fix textarea ninjo/giri - ## 1.1.0 - Initiative first ! - Added initiative system : - Now use the score rule (the real one if you prefer) @@ -22,7 +32,7 @@ - PC/NPC Sheet : - Added a visual indicator for equipped / readied - Now only equipped armor / weapon will show in conflict tab, and all armors/weapons now show in inventory tab - - Xp not in curriculum are now rounded up (down before) + - Xp not in curriculum are now rounded up (down before, due to a translation error) - No more automation in stats for Npc (these cheaters !) - 20Q Pushed the step3 item's limit to 20 (10 previous) - Added System migration stuff diff --git a/system/scripts/hooks.js b/system/scripts/hooks.js index 5d7ecce..fb14fe5 100644 --- a/system/scripts/hooks.js +++ b/system/scripts/hooks.js @@ -151,15 +151,19 @@ export default class HooksL5r5e { * Compendium display */ static async renderCompendium(app, html, data) { - // Add Rank & Ring in the compendium + // templates "item" : add Rarity + // Techniques / Peculiarities : add Ring / Rank if (app.entity === "Item") { const content = await app.getContent(); content.forEach((item) => { - if (!!item.data.data.ring || !!item.data.data.rank) { + if (["weapon", "armor", "item", "peculiarity", "technique", "peculiarity"].includes(item.type)) { html.find(`[data-entry-id="${item._id}"]`).append( `` + + (item.data.data.rarity + ? `${game.i18n.localize("l5r5e.rarity")} ${item.data.data.rarity}` + : "") + (item.data.data.rank ? game.i18n.localize("l5r5e.rank") + " " + item.data.data.rank : "") + `` );