diff --git a/CHANGELOG.md b/CHANGELOG.md index f7a7825..2dabb94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,16 @@ ## Version 1.6.1 - ????-??-?? +### **Features:** + +- [#255](https://github.com/deltagreen-foundryvtt/delta-green-foundry-vtt-system/issues/255) - Added option to toggle display of tooltips per client + ### **Bug Fixes:** - [#259](https://github.com/deltagreen-foundryvtt/delta-green-foundry-vtt-system/issues/259) - Fixed "Keep Sanity Private" setting in agent sheets. - [#263](https://github.com/deltagreen-foundryvtt/delta-green-foundry-vtt-system/issues/263) - Fixed inability to edit item descriptions. - [#253](https://github.com/deltagreen-foundryvtt/delta-green-foundry-vtt-system/issues/253) - Close "Automation Menu" & "Handler Settings" when settings are saved. +- [#252](https://github.com/deltagreen-foundryvtt/delta-green-foundry-vtt-system/issues/252) - Removed redundant lines in tooltip texts ## Version 1.6.0 - 2025-09-04 diff --git a/lang/en.json b/lang/en.json index cfe707b..e36837f 100644 --- a/lang/en.json +++ b/lang/en.json @@ -395,6 +395,8 @@ "DG.Settings.charactersheet.program": "The Program", "DG.Settings.sortskills.name": "Sort Skills By Column?", "DG.Settings.sortskills.hint": "Checked sorts by column. Unchecked sorts by row.", + "DG.Settings.hideSkillTooltips.name": "Hide Skill Tooltips", + "DG.Settings.hideSkillTooltips.hint": "Do not display skill tooltips in Agent sheets.", "DG.Settings.keepSanityPrivate.name": "Keep Sanity Private", "DG.Settings.keepSanityPrivate.hint": "Hide sanity from players in both Agent sheets and rolls.", "DG.Settings.skillImprovementFormula.name": "Default Skill Improvement Roll", diff --git a/module/settings.js b/module/settings.js index 420460b..e9f7b11 100644 --- a/module/settings.js +++ b/module/settings.js @@ -1,5 +1,6 @@ /* eslint-disable max-classes-per-file */ import DG, { BASE_TEMPLATE_PATH } from "./config.js"; +import DGActorSheet from "./sheets/base-actor-sheet.js"; const { ApplicationV2, HandlebarsApplicationMixin } = foundry.applications.api; @@ -312,6 +313,22 @@ export default function registerSystemSettings() { default: false, }); + game.settings.register("deltagreen", "hideSkillTooltips", { + name: game.i18n.localize("DG.Settings.hideSkillTooltips.name"), + hint: game.i18n.localize("DG.Settings.hideSkillTooltips.hint"), + scope: "client", + config: true, + type: Boolean, + default: false, + onChange: () => { + foundry.applications.instances.forEach((app) => { + if (app instanceof DGActorSheet) { + app.render(); + } + }); + }, + }); + // obsolete - will be removed at some point game.settings.register("deltagreen", "characterSheetFont", { name: "World Font Choice", diff --git a/module/sheets/base-actor-sheet.js b/module/sheets/base-actor-sheet.js index 0ffcaa3..7b1227c 100644 --- a/module/sheets/base-actor-sheet.js +++ b/module/sheets/base-actor-sheet.js @@ -83,6 +83,17 @@ export default class DGActorSheet extends DGSheetMixin(ActorSheetV2) { this._sortSkills(); this._sortCustomSkills(); + // Wether to hide skill tooltips + context.hideSkillTooltips = game.settings.get( + "deltagreen", + "hideSkillTooltips", + ); + + if (!context.hideSkillTooltips) { + // Setup tooltips + this._prepareSkillTooltips(); + } + // Set sanity block per actor type. context.sanityInputs = await foundry.applications.handlebars.renderTemplate( `${DGActorSheet.TEMPLATE_PATH}/partials/sanity-${this.actor.type}.html`, @@ -390,6 +401,24 @@ export default class DGActorSheet extends DGSheetMixin(ActorSheetV2) { } } + /** + * Sets up the list of sorted skills with their respective tooltips. + * + * @returns {void} + */ + _prepareSkillTooltips() { + for (const skill of Object.values(this.actor.system.sortedSkills)) { + skill.tooltip = game.i18n.localize(`DG.Skills.Tooltip.${skill.key}`); + if (!skill.proficiency) { + skill.tooltip = skill.tooltip.concat( + skill.tooltip, + "

", + game.i18n.localize("DG.Tooltip.CannotRollSkillLabel"), + ); + } + } + } + /** * Prepares a simplified version of the special training for display on sheet. * diff --git a/templates/actor/parts/skills-tab.html b/templates/actor/parts/skills-tab.html index 4708941..9b561d6 100644 --- a/templates/actor/parts/skills-tab.html +++ b/templates/actor/parts/skills-tab.html @@ -24,7 +24,10 @@ data-key="{{skill.key}}" data-rolltype="skill" for="system.skills.{{skill.key}}.value" - data-tooltip="{{concat (localize (concat 'DG.Skills.Tooltip.' skill.key)) '

' (localize (ifThen skill.proficiency 'DG.Tooltip.SkillLabel' 'DG.Tooltip.CannotRollSkillLabel')) }}"> + {{#unless ../hideSkillTooltips }} + data-tooltip="{{ skill.tooltip }}" + {{/unless }} + > {{localizeWithFallback (concat "DG.Skills." skill.key) skill.label }}