It looks like there are some adjustments made to the Quest System that appears to make it somewhat possible ..
My Code running in Shadowlands Beta
Lua Code:
local addonName, addonData = ...
local QuestTracker = {}
XQuestData = XQuestData or {}
local lastQuest = nil
local function EventWatcher(self,event,...)
local args = {...}
print(event)
if event == "QUEST_ACCEPTED" then
XQuestData[args[1]] = {}
QuestTracker[args[1]] = {}
print("Accepted Quest ID ", args[1], " named ", C_QuestLog.GetTitleForQuestID(args[1]))
self:RegisterEvent("QUEST_DATA_LOAD_RESULT")
C_QuestLog.RequestLoadQuestByID(args[1])
elseif event == "QUEST_WATCH_UPDATE" then
print("Quest ID: ", args[1])
self:RegisterEvent("QUEST_LOG_UPDATE")
lastQuest = args[1]
elseif event == "QUEST_LOG_UPDATE" then
self:UnregisterEvent("QUEST_LOG_UPDATE")
self:RegisterEvent("QUEST_DATA_LOAD_RESULT")
C_QuestLog.RequestLoadQuestByID(lastQuest)
elseif event == "QUEST_LOG_CRITERA_UPDATE" then
for i,v in pairs(args) do
print(i,v)
end
elseif event == "QUEST_DATA_LOAD_RESULT" then
self:UnregisterEvent("QUEST_DATA_LOAD_RESULT")
print("QuestID: ",args[1],"Success:",args[2])
if not args[2] then return end
XQuestData[args[1]] = XQuestData[args[1]] or {}
QuestTracker[args[1]] = QuestTracker[args[1]] or {}
QuestTracker[args[1]].DataRequested = C_QuestLog.GetQuestObjectives(args[1]) or {}
for i,v in pairs(QuestTracker[args[1]].DataRequested) do
print(i,v)
end
XQuestData[args[1]].Data = C_QuestLog.GetQuestObjectives(args[1]) or {}
end
end
local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_LOGIN")
f:RegisterEvent("QUEST_ACCEPTED")
f:RegisterEvent("QUEST_LOG_CRITERIA_UPDATE")
f:RegisterEvent("QUEST_WATCH_UPDATE")
f:SetScript("OnEvent", EventWatcher)
WTF file containing contents of XQuestData table
Lua Code:
XQuestData = {
[25545] = {
["Data"] = {
{
["type"] = "item",
["numRequired"] = 4,
["text"] = "0/4 Stormwind Breastplate",
["finished"] = false,
["numFulfilled"] = 0,
}, -- [1]
{
["type"] = "item",
["numRequired"] = 4,
["text"] = "3/4 Stormwind Helm",
["finished"] = false,
["numFulfilled"] = 3,
}, -- [2]
{
["type"] = "item",
["numRequired"] = 4,
["text"] = "1/4 Stormwind Spear",
["finished"] = false,
["numFulfilled"] = 1,
}, -- [3]
{
["type"] = "item",
["numRequired"] = 4,
["text"] = "1/4 Stormwind Shield",
["finished"] = false,
["numFulfilled"] = 1,
}, -- [4]
},
},
}
The order of process appears to be ...
1. You loot/find a quest item
2. It triggers the QUEST_WATCH_UPDATE event with the questID affected .. instead of a watchlistnumber
3. The information regarding the quest changes aren't ready at that point but will be using a QUEST_LOG_UPDATE. So, start the questID we want to get info on later ...
4. When the QUEST_LOG_UPDATE event triggers we want to ask for quest details .. as follows:
self:RegisterEvent("QUEST_DATA_LOAD_RESULT")
C_QuestLog.RequestLoadQuestByID(lastQuest)
5. When the details are ready it will trigger the QUEST_DATA_LOAD_RESULT with the relevant updated info. It is at this point you can use the type field to choose whether it is a type of item you wanted to do extra work on.
I've left the other events in .. but for what you need it to do .. you won't need it as just picking an item up for an existing quest allows you to get up to date info on that quest.
Anyway, even though it doesn't help you now, you have something to work towards ready for Shadowlands.
Good Luck in your endeavours.