feat(tooltip): ElvUI style without ElvUI; source in secondary only; fix learner source label

- ElvUI tooltip style: new 'ElvUI tooltip style' option (General tab, on by
  default) skins GameTooltip/WorldMapTooltip/ItemRefTooltip/shopping tooltips
  and the secondary learner frame with ElvUI's transparent flat look (dark bg
  + thin 1px border) when ElvUI is not installed. Corrected the secondary
  frame fallback that used the chunky WoW border. No-op when ElvUI is loaded.

- Source attribution now shows ONLY inside the secondary learner tooltip when
  'Use secondary learner tooltip' is enabled; removed from the main NPC/object/
  item tooltip and gated off entirely when the secondary tooltip is disabled
  (map-pin source gated the same way).

- Fixed learner-learned pins mislabelled 'AscensionDB': GetPinDataSource is now
  mode-aware and returns 'Learner' in learner mode when the entity has a learner
  record, even if AscensionDB also curates it (curated coords are discarded by
  GetNPC/GetObject in learner mode anyway).

Test-neutral (145 successes / same 7 pre-existing failures + 1 error).
This commit is contained in:
Xurkon
2026-06-09 21:52:55 -05:00
parent ee67653414
commit fa37ab8eb5
8 changed files with 121 additions and 40 deletions
+3
View File
@@ -107,6 +107,9 @@ end
--- the label is accurate, plus a Comms overlay when comms holds data for this id.
local function _GetWorldMapDataSourceLine(pinData)
if not Questie.db.profile.enableTooltipsSource then return nil end
-- Source attribution is tied to the secondary learner tooltip: only show it when that
-- option is enabled, and never otherwise (matches the unit-hover behaviour).
if Questie.db.profile.learnerTooltipUseSecondary ~= true then return nil end
local src = pinData and pinData.DataSource
local parts = {}
if src then tinsert(parts, src) end
+48
View File
@@ -123,6 +123,9 @@ end
---@param key string @"m_<npcId>" | "o_<objectId>" | "i_<itemId>"
local function _GetTooltipSourceLine(key)
if not Questie.db.profile.enableTooltipsSource then return nil end
-- Source attribution is shown only inside the secondary learner tooltip; never when
-- that option is disabled (the only caller is the secondary frame, but gate here too).
if Questie.db.profile.learnerTooltipUseSecondary ~= true then return nil end
if not key then return nil end
local prefix = key:sub(1, 2)
local id = tonumber(key:sub(3))
@@ -668,6 +671,49 @@ _InitObjectiveTexts = function(objectivesText, objectiveIndex, playerName)
return objectivesText
end
-- Apply ElvUI's "Transparent" tooltip look (flat dark background + thin 1px border) so
-- Questie's tooltips match the ElvUI style even when ElvUI is not installed. ElvUI uses a
-- FLAT texture for both the background and the border with a 1px edge (see
-- ElvUI/Core/Toolkit.lua SetTemplate + Settings/Profile.lua:29-31), not the chunky default
-- WoW tooltip border.
local _ELV_FLAT = "Interface\\ChatFrame\\ChatFrameBackground" -- solid 1x1 texture on 3.3.5
local function _ApplyElvUIStyle(frame)
if not frame or not frame.SetBackdrop then return end
frame:SetBackdrop({
bgFile = _ELV_FLAT,
edgeFile = _ELV_FLAT,
tile = false,
tileSize = 0,
edgeSize = 1,
insets = { left = 0, right = 0, top = 0, bottom = 0 },
})
frame:SetBackdropColor(0.06, 0.06, 0.06, 0.8) -- ElvUI backdropfadecolor
frame:SetBackdropBorderColor(0, 0, 0, 1) -- ElvUI bordercolor (black)
end
-- Skins the standard tooltip frames Questie writes into. No-op when ElvUI is loaded (it
-- skins them itself) or when the option is disabled.
function QuestieTooltips:SkinDefaultTooltips()
if (not Questie.db) or (not Questie.db.profile) or Questie.db.profile.elvuiStyleTooltips == false then return end
if IsAddOnLoaded("ElvUI") then return end
for _, name in ipairs({ "GameTooltip", "ItemRefTooltip", "ShoppingTooltip1", "ShoppingTooltip2", "WorldMapTooltip" }) do
local frame = _G[name]
if frame then
_ApplyElvUIStyle(frame)
-- The default UI re-applies its template backdrop (e.g. item-quality borders) on
-- some shows; re-assert our flat look on show so it doesn't revert.
if not frame.__questieElvHook then
frame.__questieElvHook = true
frame:HookScript("OnShow", function(self)
if Questie.db.profile.elvuiStyleTooltips ~= false and not IsAddOnLoaded("ElvUI") then
_ApplyElvUIStyle(self)
end
end)
end
end
end
end
function QuestieTooltips:Initialize()
-- For the clicked item frame.
ItemRefTooltip:HookScript("OnTooltipSetItem", _QuestieTooltips.AddItemDataToTooltip)
@@ -750,6 +796,8 @@ function QuestieTooltips:Initialize()
end
end
end)
QuestieTooltips:SkinDefaultTooltips()
end
return QuestieTooltips
+3 -18
View File
@@ -329,11 +329,9 @@ function _QuestieTooltips:AddUnitDataToTooltip()
end
end
-- Data-source attribution (opt-in; internally gated and nil when source unknown).
local npcSourceLine = QuestieTooltips:GetDataSourceLine("m_" .. npcId)
if npcSourceLine then
GameTooltip:AddLine(npcSourceLine)
end
-- Data-source attribution is rendered by QuestieLearner's secondary tooltip frame
-- (only when the secondary learner tooltip is enabled), never inline in the main
-- tooltip — see _AddLearnedSpawnTooltipLine.
local npcNum = tonumber(npcId)
if npcNum then
@@ -400,11 +398,6 @@ function _QuestieTooltips:AddItemDataToTooltip()
self:AddLine(v)
end
end
-- Data-source attribution (opt-in; internally gated and nil when source unknown).
local itemSourceLine = QuestieTooltips:GetDataSourceLine("i_" .. (itemId or 0))
if itemSourceLine then
self:AddLine(itemSourceLine)
end
QuestieTooltips.lastGametooltipCount = _QuestieTooltips:CountTooltip()
end
lastItemId = itemId;
@@ -459,14 +452,6 @@ function _QuestieTooltips:AddObjectDataToTooltip(name)
end
end
end
-- Data-source attribution for the hovered object (opt-in; nil when unknown).
local firstObjectId = lookup[1]
if firstObjectId then
local objSourceLine = QuestieTooltips:GetDataSourceLine("o_" .. firstObjectId)
if objSourceLine then
GameTooltip:AddLine(objSourceLine)
end
end
if QuestieTooltips.ResizeTooltip then
QuestieTooltips:ResizeTooltip(GameTooltip)
end