fix(tooltip): keep learner lines out of main NPC tooltip when using secondary

Two parallel learner-tooltip systems both rendered on unit hover, so with
the 'Use secondary learner tooltip' option on, learner spawn/kill lines
still leaked into the main NPC tooltip instead of going solely to the
secondary frame.

QuestieLearner's OnTooltipSetUnit hook (toggle-aware, secondary-capable)
already owns unit-hover learner display, routing it to the main tooltip
(secondary off) or the separate secondary frame (secondary on). But
Tooltip.lua's _GetLearnerTooltipLines also injected learner lines into the
m_<npcId> tooltip data, redundantly.

Add a suppressLearnerLines flag to QuestieTooltips:GetTooltip and pass it
from the NPC unit-hover call in TooltipHandler so the inline lines are
omitted there. Map-pin and object tooltips (no secondary frame) keep their
learner lines. Also removes the latent duplicate present even with the
secondary frame disabled.
This commit is contained in:
Xurkon
2026-06-09 17:11:51 -05:00
parent 9d5d4a947e
commit 5a9dce0f13
3 changed files with 21 additions and 6 deletions
+16 -5
View File
@@ -334,7 +334,12 @@ local function _GetLearnerTooltipLines(key)
end
---@param key string
function QuestieTooltips:GetTooltip(key)
---@param suppressLearnerLines boolean? When true, omit the inline learner spawn/kill
--- lines from System A. Used by the NPC unit-hover tooltip, where the learner data is
--- already rendered by QuestieLearner's OnTooltipSetUnit hook (main tooltip when the
--- secondary learner tooltip is off, or the separate secondary frame when it is on).
--- Map-pin and object tooltips leave this nil so they keep showing learner lines.
function QuestieTooltips:GetTooltip(key, suppressLearnerLines)
Questie:Debug(Questie.DEBUG_SPAM, "[QuestieTooltips:GetTooltip]", key)
if (not key) then
return nil
@@ -603,10 +608,16 @@ elseif key:sub(1,2) == "o_" then
end
-- Append learner spawn data when the learner has recorded this NPC.
local learnerLines = _GetLearnerTooltipLines(key)
if learnerLines then
for _, line in ipairs(learnerLines) do
tinsert(tooltipLines, line)
-- Skipped for the NPC unit-hover tooltip (suppressLearnerLines): QuestieLearner's
-- OnTooltipSetUnit hook owns that display and routes it to the main tooltip or the
-- separate secondary learner frame, so adding it here too would duplicate it (and,
-- with the secondary frame enabled, leak the lines back into the main tooltip).
if not suppressLearnerLines then
local learnerLines = _GetLearnerTooltipLines(key)
if learnerLines then
for _, line in ipairs(learnerLines) do
tinsert(tooltipLines, line)
end
end
end
+4 -1
View File
@@ -310,7 +310,10 @@ function _QuestieTooltips:AddUnitDataToTooltip()
) then
QuestieTooltips.lastGametooltipUnit = name
local tooltipData = QuestieTooltips:GetTooltip("m_" .. npcId);
-- Suppress System A's inline learner lines here: QuestieLearner's OnTooltipSetUnit
-- hook already renders learner spawn/kill data for the hovered unit (into the main
-- tooltip, or the separate secondary learner frame when that option is enabled).
local tooltipData = QuestieTooltips:GetTooltip("m_" .. npcId, true);
if tooltipData then
if Questie.db.profile.enableTooltipsNPCID == true then