From 3c877a0e85992b0e54e5cd05fd511274e72abaac Mon Sep 17 00:00:00 2001 From: RDW Date: Sat, 14 Sep 2024 04:00:13 +0200 Subject: [PATCH 1/2] Options: Added a new setting to hide untracked items --- Locales.lua | 2 ++ Modules/Options/Options.lua | 14 ++++++++++++++ Options_Defaults.lua | 1 + 3 files changed, 17 insertions(+) diff --git a/Locales.lua b/Locales.lua index 83d76d07..26700a53 100644 --- a/Locales.lua +++ b/Locales.lua @@ -2,6 +2,8 @@ local L L = LibStub("AceLocale-3.0"):NewLocale("Rarity", "enUS", true) -- L["AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"] = true +L["When enabled, Rarity will not add tooltip information for items that aren't being tracked."] = true +L["Hide untracked items in tooltips"] = true L["Reins of Anu'relos, Flame's Guidance"] = true L["Awakened Cache"] = true L["Machine Defense Unit 1-11"] = true diff --git a/Modules/Options/Options.lua b/Modules/Options/Options.lua index 097cc1e9..349bb877 100644 --- a/Modules/Options/Options.lua +++ b/Modules/Options/Options.lua @@ -724,6 +724,20 @@ function R:PrepareOptions() Rarity.GUI:UpdateText() end, }, + hideUntrackedItemsInTooltip = { + type = "toggle", + order = newOrder(), + width = "double", + name = L["Hide untracked items in tooltips"], + desc = L["When enabled, Rarity will not add tooltip information for items that aren't being tracked."], + get = function() + return self.db.profile.hideUntrackedItemsInTooltip + end, + set = function(info, val) + self.db.profile.hideUntrackedItemsInTooltip = val + Rarity.GUI:UpdateText() + end, + }, }, -- args }, -- worldTooltips contentCategory = { diff --git a/Options_Defaults.lua b/Options_Defaults.lua index 8f2a46ef..650899d3 100644 --- a/Options_Defaults.lua +++ b/Options_Defaults.lua @@ -81,6 +81,7 @@ function R:PrepareDefaults() blankLineBeforeTooltipAdditions = true, tooltipAttempts = true, hideKnownItemsInTooltip = false, + hideUntrackedItemsInTooltip = false, takeScreenshot = true, hideUnavailable = true, hideDefeated = false, From 813bb92841ed44bc0dd0a2584a20f32b34fb3584 Mon Sep 17 00:00:00 2001 From: RDW Date: Sat, 14 Sep 2024 04:01:47 +0200 Subject: [PATCH 2/2] UI: Updated the tooltip hooks to allow hiding untracked items --- Core/GUI/GameTooltipHooks.lua | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Core/GUI/GameTooltipHooks.lua b/Core/GUI/GameTooltipHooks.lua index 151bf557..a17d74ab 100644 --- a/Core/GUI/GameTooltipHooks.lua +++ b/Core/GUI/GameTooltipHooks.lua @@ -94,7 +94,10 @@ local function onTooltipSetUnit(tooltip, data) local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture, itemSellPrice = GetItemInfo(v.itemId) if itemLink or itemName or v.name then - if v.known and R.db.profile.hideKnownItemsInTooltip then + if + (v.known and R.db.profile.hideKnownItemsInTooltip) + or (not v.enabled and R.db.profile.hideUntrackedItemsInTooltip) + then GameTooltip:Show() else if not blankAdded and R.db.profile.blankLineBeforeTooltipAdditions then @@ -317,7 +320,10 @@ local function onTooltipSetUnit(tooltip, data) local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture, itemSellPrice = GetItemInfo(vv.itemId) if itemLink or itemName or vv.name then - if vv.known and R.db.profile.hideKnownItemsInTooltip then + if + (vv.known and R.db.profile.hideKnownItemsInTooltip) + or (not vv.enabled and R.db.profile.hideUntrackedItemsInTooltip) + then GameTooltip:Show() else if not blankAdded and R.db.profile.blankLineBeforeTooltipAdditions then @@ -386,7 +392,10 @@ local function processItem(id, tooltip) local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture, itemSellPrice = GetItemInfo(v.itemId) if itemLink or itemName or v.name then - if v.known and R.db.profile.hideKnownItemsInTooltip then + if + (v.known and R.db.profile.hideKnownItemsInTooltip) + or (not v.enabled and R.db.profile.hideUntrackedItemsInTooltip) + then tooltip:Show() else if not blankAdded and R.db.profile.blankLineBeforeTooltipAdditions then @@ -448,7 +457,10 @@ local function processItem(id, tooltip) itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture, itemSellPrice = GetItemInfo(vv.itemId) if itemLink or itemName or vv.name then - if vv.known and R.db.profile.hideKnownItemsInTooltip then + if + (vv.known and R.db.profile.hideKnownItemsInTooltip) + or (not vv.enabled and R.db.profile.hideUntrackedItemsInTooltip) + then tooltip:Show() else if