Fix learned tooltip quest-start schema in Stormwind

This commit is contained in:
Xurkon
2026-05-13 21:54:09 -05:00
parent a5e3d545a6
commit 306fb2ac89
+113 -87
View File
@@ -232,93 +232,119 @@ function QuestieTooltips:GetTooltip(key)
-- Try to find in learned NPCs or objects -- Try to find in learned NPCs or objects
local id = tonumber(key:sub(3)) local id = tonumber(key:sub(3))
if id then if id then
if key:sub(1,2) == "m_" then if key:sub(1,2) == "m_" then
local learnedNpc = QuestieLearner.data.npcs[id] local learnedNpc = QuestieLearner.data.npcs[id]
if learnedNpc and learnedNpc[10] then -- check questObjectives -- npc[10] from _AddToArray is an array of questIds, not {questId -> objList}
for questId, objList in next, learnedNpc[10] do if learnedNpc and learnedNpc[10] then
local oIndex = 1 for _, questId in ipairs(learnedNpc[10]) do
while objList[oIndex] do local qData = QuestieLearner.data.quests[questId]
local objText = objList[oIndex] if qData and qData[10] then
local needed, collected for slotIdx = 1, #qData[10] do
local objectives = QuestLogCache.GetQuestObjectives(questId) local objSlot = qData[10][slotIdx]
if objectives then if objSlot then
for _, obj in next, objectives do for oIndex = 1, #objSlot do
if obj.text and objText and (obj.text == objText or string.find(obj.text, objText, 1, true) or string.find(objText, obj.text, 1, true)) then local objEntry = objSlot[oIndex]
needed = obj.numRequired if objEntry and objEntry[2] then
collected = obj.numFulfilled local objText = objEntry[2]
break local needed, collected
end local objectives = QuestLogCache.GetQuestObjectives(questId)
end local objectiveIcon
end if objectives then
QuestieTooltips:RegisterObjectiveTooltip(questId, key, { for _, obj in next, objectives do
Index = 0, if obj.text and objText and (obj.text == objText or string.find(obj.text, objText, 1, true) or string.find(objText, obj.text, 1, true)) then
Description = objText, needed = obj.numRequired
Needed = needed, collected = obj.numFulfilled
Collected = collected, objectiveIcon = obj.Icon
Update = function(self) break
local objs = QuestLogCache.GetQuestObjectives(questId) end
if objs then end
for _, o in next, objs do end
if o.text and self.Description and (o.text == self.Description or string.find(o.text, self.Description, 1, true) or string.find(self.Description, o.text, 1, true)) then QuestieTooltips:RegisterObjectiveTooltip(questId, key, {
self.Needed = o.numRequired Index = 0,
self.Collected = o.numFulfilled Description = objText,
break Needed = needed,
end Collected = collected,
end Icon = objectiveIcon,
end Update = function(self)
end local objs = QuestLogCache.GetQuestObjectives(questId)
}) if objs then
oIndex = oIndex + 1 for _, o in next, objs do
end if o.text and self.Description and (o.text == self.Description or string.find(o.text, self.Description, 1, true) or string.find(self.Description, o.text, 1, true)) then
end self.Needed = o.numRequired
if learnedNpc.mc then self.Collected = o.numFulfilled
tinsert(tooltipLines, "|cFF5EBAF3(Learned - Confidence: " .. tostring(learnedNpc.mc) .. ")|r") break
end end
end end
elseif key:sub(1,2) == "o_" then end
local learnedObj = QuestieLearner.data.objects[id] end
if learnedObj and learnedObj[10] then })
for questId, objList in next, learnedObj[10] do end
local oIndex = 1 end
while objList[oIndex] do end
local objText = objList[oIndex] end
local needed, collected end
local objectives = QuestLogCache.GetQuestObjectives(questId) end
if objectives then if learnedNpc.mc then
for _, obj in next, objectives do tinsert(tooltipLines, "|cFF5EBAF3(Learned - Confidence: " .. tostring(learnedNpc.mc) .. ")|r")
if obj.text and objText and (obj.text == objText or string.find(obj.text, objText, 1, true) or string.find(objText, obj.text, 1, true)) then end
needed = obj.numRequired end
collected = obj.numFulfilled elseif key:sub(1,2) == "o_" then
break local learnedObj = QuestieLearner.data.objects[id]
end -- obj[2] from _AddToArray is an array of questIds (questStarts), not {questId -> objList}
end if learnedObj and learnedObj[2] then
end for _, questId in ipairs(learnedObj[2]) do
QuestieTooltips:RegisterObjectiveTooltip(questId, key, { local qData = QuestieLearner.data.quests[questId]
Index = 0, if qData and qData[10] then
Description = objText, for slotIdx = 1, #qData[10] do
Needed = needed, local objSlot = qData[10][slotIdx]
Collected = collected, if objSlot then
Update = function(self) for oIndex = 1, #objSlot do
local objs = QuestLogCache.GetQuestObjectives(questId) local objEntry = objSlot[oIndex]
if objs then if objEntry and objEntry[2] then
for _, o in next, objs do local objText = objEntry[2]
if o.text and self.Description and (o.text == self.Description or string.find(o.text, self.Description, 1, true) or string.find(self.Description, o.text, 1, true)) then local needed, collected
self.Needed = o.numRequired local objectives = QuestLogCache.GetQuestObjectives(questId)
self.Collected = o.numFulfilled local objectiveIcon
break if objectives then
end for _, obj in next, objectives do
end if obj.text and objText and (obj.text == objText or string.find(obj.text, objText, 1, true) or string.find(objText, obj.text, 1, true)) then
end needed = obj.numRequired
end collected = obj.numFulfilled
}) objectiveIcon = obj.Icon
oIndex = oIndex + 1 break
end end
end end
if learnedObj.mc then end
tinsert(tooltipLines, "|cFF5EBAF3(Learned - Confidence: " .. tostring(learnedObj.mc) .. ")|r") QuestieTooltips:RegisterObjectiveTooltip(questId, key, {
end Index = 0,
end Description = objText,
end Needed = needed,
Collected = collected,
Icon = objectiveIcon,
Update = function(self)
local objs = QuestLogCache.GetQuestObjectives(questId)
if objs then
for _, o in next, objs do
if o.text and self.Description and (o.text == self.Description or string.find(o.text, self.Description, 1, true) or string.find(self.Description, o.text, 1, true)) then
self.Needed = o.numRequired
self.Collected = o.numFulfilled
break
end
end
end
end
})
end
end
end
end
end
end
if learnedObj.mc then
tinsert(tooltipLines, "|cFF5EBAF3(Learned - Confidence: " .. tostring(learnedObj.mc) .. ")|r")
end
end
end
end end
end end
end end