fix: empty override tables no longer wipe base DB spawns; real-time pin refresh on NPC learn

Two fixes for QuestieLearner real-time pin rendering:

1. _MergeOverride now skips empty tables (IsEmptyTable guard).
   QuestieLearner stores spawns={} before any coords are captured.
   Previously _MergeOverride treated {} as valid data and replaced the
   base DB's real spawn coordinates with an empty table, breaking pins
   for all NPCs that had been seen but not killed (mouseovers, etc.).

2. _InvalidateSpawnListsForNPC triggers after LearnNPC adds new spawn data.
   The quest objective system caches spawnList once per objective.
   When a kill adds new coordinates, the cached list is stale.
   The new helper:
   - Scans all active quest objectives for references to the NPC
   - Clears objective.spawnList and objective.AlreadySpawned
   - Calls QuestieQuest:UpdateQuest to rebuild pins with fresh data
   This makes learned pins appear in real-time without /reload.
This commit is contained in:
Xurkon
2026-05-16 08:36:47 -05:00
parent 3fff65b66f
commit d3bcb6da49
2 changed files with 53 additions and 1 deletions
+8 -1
View File
@@ -15,12 +15,19 @@ local _QuestieDB = QuestieDB.private
-- 1. override[stringKey] (string-keyed, e.g. from wotlkNPCFixes)
-- 2. override[intKey] (numeric-keyed, e.g. from QuestieLearner / AscensionDB)
-- 3. rawdata[intKey] (fallback to compiled DB)
--
-- Empty tables from QuestieLearner (e.g. spawns={}) are treated as "not present"
-- so the base DB's real spawn data is preserved until actual coordinates are learned.
------------------------------------------------------------------------
local function IsEmptyTable(val)
return type(val) == "table" and next(val) == nil
end
local function _MergeOverride(result, override, rawdata, keyMap)
for stringKey, intKey in pairs(keyMap) do
if override[stringKey] ~= nil then
result[stringKey] = override[stringKey]
elseif override[intKey] ~= nil then
elseif override[intKey] ~= nil and not IsEmptyTable(override[intKey]) then
result[stringKey] = override[intKey]
elseif rawdata then
result[stringKey] = rawdata[intKey]