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:
@@ -115,12 +115,27 @@ local function _GetQuestObjectiveSummary(questId)
|
||||
return summary
|
||||
end
|
||||
|
||||
local function _BuildTooltipSourceLine(sourceFlags)
|
||||
return nil
|
||||
end
|
||||
|
||||
--- Accurate data-source attribution for a unit/object/item hover tooltip.
|
||||
--- Derives provenance from the entity id (never from the global mode): AscensionDB
|
||||
--- curated override, learner record, or base "Questie DB", plus a Comms overlay when
|
||||
--- comms holds data for this key. Returns nil when the source can't be determined or the
|
||||
--- option is off, so a wrong/guessed label is never shown.
|
||||
---@param key string @"m_<npcId>" | "o_<objectId>" | "i_<itemId>"
|
||||
local function _GetTooltipSourceLine(key)
|
||||
return nil
|
||||
if not Questie.db.profile.enableTooltipsSource then return nil end
|
||||
if not key then return nil end
|
||||
local prefix = key:sub(1, 2)
|
||||
local id = tonumber(key:sub(3))
|
||||
local entityType = (prefix == "o_" and "OBJECT") or (prefix == "i_" and "ITEM") or "NPC"
|
||||
|
||||
local parts = {}
|
||||
local src = id and QuestieDB.GetPinDataSource(entityType, id) or nil
|
||||
if src then tinsert(parts, src) end
|
||||
if QuestieComms and QuestieComms.data and QuestieComms.data.KeyExists and QuestieComms.data:KeyExists(key) then
|
||||
tinsert(parts, "Comms")
|
||||
end
|
||||
if table.getn(parts) == 0 then return nil end
|
||||
return "|cFF808080Source: " .. table.concat(parts, " + ") .. "|r"
|
||||
end
|
||||
|
||||
---@param questId number
|
||||
@@ -632,6 +647,14 @@ elseif key:sub(1,2) == "o_" then
|
||||
return tooltipLines
|
||||
end
|
||||
|
||||
--- Public accessor for the data-source attribution line. Called by the render layer
|
||||
--- (TooltipHandler) rather than appended inside GetTooltip so it never interferes with
|
||||
--- the quest-title de-duplication that consumes GetTooltip's result.
|
||||
---@param key string @"m_<npcId>" | "o_<objectId>" | "i_<itemId>"
|
||||
function QuestieTooltips:GetDataSourceLine(key)
|
||||
return _GetTooltipSourceLine(key)
|
||||
end
|
||||
|
||||
_InitObjectiveTexts = function(objectivesText, objectiveIndex, playerName)
|
||||
if (not objectivesText) then
|
||||
objectivesText = {}
|
||||
|
||||
Reference in New Issue
Block a user