From bb0edacec0dc7983339d46f0b35dbe6f2fe734f3 Mon Sep 17 00:00:00 2001 From: Xurkon Date: Mon, 8 Jun 2026 07:59:54 -0500 Subject: [PATCH] fix(db): enrich auto-mode static quests with learner objective payload In 'auto' data-source mode, QuestieDB.GetQuest now overlays the SavedVariables learner record on top of the static DB quest, filling only nil fields and deep-merging objectives/objIndex. Fixes quests like 8325 where the shipped DB has only a stub record but QuestieLearner holds the real objective mapping that the stub was blocking. Learner data never overwrites a present static value, so it strictly enriches. --- CHANGELOG.md | 1 + Database/QuestieDB.lua | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index df6432e..2fbda6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ - **[QuestieLearner - Accepted Handler Reducer]** Collapsed a redundant second pass over the quest log in `OnQuestAccepted` that was about to introduce a `local logIdx = 0` redeclaration. The index found while building the data table is now reused for the subsequent objective-mapping scan instead of being re-derived from scratch. - **[Tooltip - Item ID Always Shown]** `AddItemDataToTooltip` previously gated the "Item ID" line on the item having a registered quest-objective tooltip — for items that are not part of any quest objective (e.g. trade goods, vendor trash, quest-start items with no other Questie data attached), the option to show IDs had no visible effect. The line is now added for every item hover when the option is enabled, mirroring the NPC/Object tooltip behavior. Also switched the call to `self:AddDoubleLine` so the ID lands on the actual frame that fired `OnTooltipSetItem` (which can be `ItemRefTooltip` for chat links, not just `GameTooltip`). - **[Tooltip - Item Starts Quest]** Item tooltips now surface a "Drops a quest !" line with the quest title when the item has a non-zero `startQuest` value in the static DB / Ascension override table and the player does not already have the quest (active or turned in). The item→quest relationship is a build-time DB field — we never know it ahead of runtime observation — so it is read directly from `QueryItemSingle` at hover time. The line uses `QuestieLib:GetColoredQuestName` so the quest title respects the same level/complete state formatting the rest of Questie uses. +- **[QuestieDB - Auto Mode Learner Enrichment]** In `auto` data-source mode, `QuestieDB.GetQuest` now overlays the SavedVariables learner payload on top of the static DB record, filling only fields the static record leaves `nil` and deep-merging `objectives`/`objIndex`. This fixes quests like 8325 where the shipped DB carries only a stub record but QuestieLearner holds the real objective mapping — previously the stub blocked the learned objectives from ever surfacing. Learner data never clobbers a present static value, so it strictly enriches and cannot regress shipped data. ### Tooltip diff --git a/Database/QuestieDB.lua b/Database/QuestieDB.lua index a617ace..7c3a04a 100644 --- a/Database/QuestieDB.lua +++ b/Database/QuestieDB.lua @@ -1747,6 +1747,37 @@ function QuestieDB.GetQuest(questId, ...) -- /dump QuestieDB.GetQuest(867) if overrideData.objIndex then QO.objIndex = overrideData.objIndex end end + -- In auto mode, the SavedVariables learner payload should still enrich static DB quests. + -- This is required for quests like 8325 where the static DB has only a stub record, + -- but QuestieLearner has the real objective payload in QuestieLearnerDB.global.quests. + if mode == "auto" and learnerRecord and rawdata ~= learnerRecord then + local _sKey, _iKey = next(questKeys) + while _sKey do + local learnerVal = learnerRecord[_iKey] or learnerRecord[_sKey] + if learnerVal ~= nil then + if _sKey == "objectives" and QO.objectives then + local _objIdx, _objList = next(learnerVal) + while _objIdx do + if not QO.objectives[_objIdx] then + QO.objectives[_objIdx] = _objList + else + local _id, _data = next(_objList) + while _id do + QO.objectives[_objIdx][_id] = _data + _id, _data = next(_objList, _id) + end + end + _objIdx, _objList = next(learnerVal, _objIdx) + end + elseif QO[_sKey] == nil then + QO[_sKey] = learnerVal + end + end + _sKey, _iKey = next(questKeys, _sKey) + end + if learnerRecord.objIndex and not QO.objIndex then QO.objIndex = learnerRecord.objIndex end + end + local questLevel, requiredLevel = QuestieLib.GetTbcLevel(questId) QO.level = questLevel QO.requiredLevel = requiredLevel