feat(tooltip): add data-source attribution line to tooltips

Objective tooltips (Tooltip.lua) and world-map icon tooltips
(MapIconTooltip.lua) now append a greyed-out 'Source:' line listing the
data origin: Static DB or Learner per the active data-source mode, plus
Comms when remote player data exists for the key. Also corrects an
internal QuestieDB:GetQuest colon call to the dot form QuestieDB.GetQuest.
This commit is contained in:
Xurkon
2026-06-08 07:59:24 -05:00
parent 79e877f4c9
commit acc829ebba
3 changed files with 59 additions and 1 deletions
+1
View File
@@ -31,6 +31,7 @@
### Tooltip
- **[Tooltip - Data Source Attribution Line]** Objective tooltips and world-map icon tooltips now append a greyed-out `Source:` line listing where the data came from — `Static DB` or `Learner` depending on the active data-source mode, plus `Comms` when remote player data exists for that key. This makes it clear at a glance whether a pin/objective is backed by the shipped database, runtime-learned evidence, or another player's broadcast. The objective-tooltip path also corrects an internal `QuestieDB:GetQuest` colon call to the dot form `QuestieDB.GetQuest`.
- **[QuestieLearner - Secondary Tooltip Style Match]** The optional secondary learner tooltip frame is now styled to match the standard GameTooltip whether or not ElvUI is installed. When ElvUI is loaded, the frame defers to `ElvUI:GetModule("Tooltip"):SetStyle(frame)` so the user's configured colors and fonts take effect. When ElvUI is absent, the frame applies a hard-coded replica of ElvUI's default "Transparent" template (backdrop color `0.06, 0.06, 0.06, 0.8`, black 1px border, `FRIZQT__.TTF` 12px, 3px insets, 12px edge) using the standard GameTooltip textures. The skin is re-applied on every `OnShow` so the frame stays consistent if ElvUI loads late or its settings change.
- **[QuestieLearner - Combined Tooltip Spacing]** When the secondary learner tooltip is disabled and learner stats are appended directly to the active GameTooltip, the learner section is now framed by an invisible spacer line above and below. This keeps NPC/quest data above and any other-addon data below from being visually crammed against the learner counts, while adding no new texture or color assets.
+10
View File
@@ -69,6 +69,14 @@ local DEFAULT_WAYPOINT_HOVER_COLOR = { 0.93, 0.46, 0.13, 0.8 }
local lastTooltipShowTimestamp = GetTime()
local function _GetWorldMapTooltipSourceLine()
local parts = { "Questie DB" }
if QuestieComms and (QuestieComms.remotePlayerEnabled or QuestieComms.data) then
tinsert(parts, "Comms")
end
return "|cFF808080Source: " .. table.concat(parts, " + ") .. "|r"
end
function MapIconTooltip:Show()
local _, _, _, alpha = self.texture:GetVertexColor();
if alpha == 0 then
@@ -716,6 +724,8 @@ function MapIconTooltip:Show()
self:AddLine('|cFFa6a6a6Shift-click to hide|r') -- grey
end
end
self:AddLine(_GetWorldMapTooltipSourceLine(), 0.55, 0.55, 0.55)
end
Tooltip:_Rebuild() -- we separate this so things like MODIFIER_STATE_CHANGED can redraw the tooltip
Tooltip:SetFrameStrata("TOOLTIP");
+48 -1
View File
@@ -95,7 +95,7 @@ local function _GetQuestObjectiveSummary(questId)
return nil
end
local quest = QuestieDB:GetQuest(questId)
local quest = QuestieDB.GetQuest(questId)
if not quest or not quest.ObjectiveData then
return nil
end
@@ -115,6 +115,47 @@ local function _GetQuestObjectiveSummary(questId)
return summary
end
local function _BuildTooltipSourceLine(sourceFlags)
if not sourceFlags then
return nil
end
local parts = {}
if sourceFlags.static then
tinsert(parts, "Static DB")
end
if sourceFlags.learner then
tinsert(parts, "Learner")
end
if sourceFlags.comms then
tinsert(parts, "Comms")
end
if table.getn(parts) == 0 then
return nil
end
return "|cFF808080Source: " .. table.concat(parts, " + ") .. "|r"
end
local function _GetTooltipSourceLine(key)
local sourceFlags = {}
local QuestieLearner = QuestieLoader:ImportModule("QuestieLearner")
local mode = QuestieLearner and QuestieLearner.GetDataSourceMode and QuestieLearner:GetDataSourceMode() or "auto"
if mode == "learner" then
sourceFlags.learner = true
else
sourceFlags.static = true
end
if QuestieComms and QuestieComms.data and QuestieComms.data.KeyExists and QuestieComms.data:KeyExists(key) then
sourceFlags.comms = true
end
return _BuildTooltipSourceLine(sourceFlags)
end
---@param questId number
---@param key string monster: m_, items: i_, objects: o_ + string name of the objective
---@param objective table
@@ -538,6 +579,12 @@ elseif key:sub(1,2) == "o_" then
end
end
end
local sourceLine = _GetTooltipSourceLine(key)
if sourceLine then
tinsert(tooltipLines, sourceLine)
end
return tooltipLines
end