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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user