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:
@@ -2586,6 +2586,42 @@ local function _Asc_LoadIfString(data, label)
|
||||
return data
|
||||
end
|
||||
|
||||
--- Returns the data-source label for a pin/spawn, or nil if it cannot be determined.
|
||||
--- Accuracy rule: never guess from global mode. Only returns a label backed by real
|
||||
--- evidence — the per-spawn `isLearned` flag, an AscensionDB curated-override entry, or a
|
||||
--- learner record for the entity — and otherwise reports the base "Questie DB".
|
||||
---@param entityType string @"NPC" | "OBJECT" | "QUEST" | "ITEM"
|
||||
---@param id number|nil
|
||||
---@param spawnData table|nil @optional per-spawn entry from a spawnList (its .isLearned wins)
|
||||
---@return string|nil
|
||||
function QuestieDB.GetPinDataSource(entityType, id, spawnData)
|
||||
-- Per-spawn truth is the most precise signal when available.
|
||||
if spawnData and spawnData.isLearned then
|
||||
return "Learner"
|
||||
end
|
||||
if not id then return nil end
|
||||
|
||||
-- AscensionDB-curated entity (has at least one curated override field for this id).
|
||||
local ascKeys = QuestieDB.ascensionOverrideKeys and QuestieDB.ascensionOverrideKeys[entityType]
|
||||
if ascKeys and ascKeys[id] and next(ascKeys[id]) then
|
||||
return "AscensionDB"
|
||||
end
|
||||
|
||||
-- Learner-known entity (learned data exists for this id).
|
||||
local learner = Questie.dbLearner and Questie.dbLearner.global
|
||||
if learner then
|
||||
local bucket = (entityType == "OBJECT" and learner.objects)
|
||||
or (entityType == "QUEST" and learner.quests)
|
||||
or (entityType == "ITEM" and learner.items)
|
||||
or learner.npcs
|
||||
if bucket and bucket[id] then
|
||||
return "Learner"
|
||||
end
|
||||
end
|
||||
|
||||
return "Questie DB"
|
||||
end
|
||||
|
||||
local function _Asc_ProtectField(dbType, id, key)
|
||||
QuestieDB.ascensionOverrideKeys = QuestieDB.ascensionOverrideKeys or {}
|
||||
QuestieDB.ascensionOverrideKeys[dbType] = QuestieDB.ascensionOverrideKeys[dbType] or {}
|
||||
|
||||
Reference in New Issue
Block a user