feat(tooltip): accurate per-pin data source attribution

Re-adds the 'Show data source' tooltip option (General tab, default off),
but accurate this time. The previous version was removed because it
guessed the source from the global data-source mode (showing Learner when
data was AscensionDB, etc.). This tags each pin with its real provenance
at creation and reads that tag.

- QuestieDB.GetPinDataSource(entityType, id, spawnData): resolves
  Learner (per-spawn isLearned or learner record), AscensionDB (curated
  ascensionOverrideKeys override), or base Questie DB. Never guesses.
- Objective pins tagged per-spawn in _DetermineIconsToDraw; available/
  finisher pins defaulted by quest in DrawWorldIcon; manual notes tagged
  Townsfolk in DrawManualIcon.
- World-map pins read the per-pin tag (MapIconTooltip); unit/object/item
  hovers derive per-id at the render layer (TooltipHandler via
  QuestieTooltips:GetDataSourceLine). Comms appended via KeyExists.
- No line shown when source is genuinely unknown (never misleading).
This commit is contained in:
Xurkon
2026-06-09 17:57:58 -05:00
parent d207feb3db
commit 0c4631be6e
9 changed files with 134 additions and 6 deletions
+21
View File
@@ -102,6 +102,23 @@ local function _GetWorldMapTooltipSourceLine(pinData)
return nil
end
--- Per-pin data-source attribution line for the hovered world-map icon.
--- Reads the DataSource tag set at pin creation (objective/finisher/available/manual) so
--- 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
local src = pinData and pinData.DataSource
local parts = {}
if src then tinsert(parts, src) end
local id = pinData and pinData.Id
if id and QuestieComms and QuestieComms.data and QuestieComms.data.KeyExists
and QuestieComms.data:KeyExists("m_" .. tostring(id)) then
tinsert(parts, "Comms")
end
if table.getn(parts) == 0 then return nil end
return "|cFF808080Source: " .. table.concat(parts, " + ") .. "|r"
end
function MapIconTooltip:Show()
local _, _, _, alpha = self.texture:GetVertexColor();
if alpha == 0 then
@@ -751,6 +768,10 @@ function MapIconTooltip:Show()
end
self:AddLine(_GetWorldMapTooltipSourceLine(self.data), 0.55, 0.55, 0.55)
local dataSourceLine = _GetWorldMapDataSourceLine(self.data)
if dataSourceLine then
self:AddLine(dataSourceLine, 0.55, 0.55, 0.55)
end
end
Tooltip:_Rebuild() -- we separate this so things like MODIFIER_STATE_CHANGED can redraw the tooltip
Tooltip:SetFrameStrata("TOOLTIP");