View Single Post
04-07-24, 06:51 AM   #5
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,950
Did you check to make sure that the event triggered when you clicked on the complete button for the quest ?

It is also possible that the IsQuestFlaggedCompleted function doesn't know about the just completed quest yet. If that is the case, the only thing you can do is use the OnUpdate function and put a timed check in there to periodically check if it is marked as complete yet.

Let me check with one of my test toons and see if a simple test works as I expect it to.


Okay.. I just tested with this small piece of code.

Lua Code:
  1. local addonName, addonNS = ...
  2.  
  3. Quests_Completed = Quests_Completed or {}
  4.  
  5. local function QuestTurnedIn(...)    
  6.     local questID, xpReward, moneyReward = ...    
  7.     local isCompleted = C_QuestLog.IsQuestFlaggedCompleted(questID)   -- Returns true    
  8.     print("Quest: ", questID,"XP: ", xpReward,"Money: ", moneyReward,"Completed: ",isCompleted)    
  9.     Quests_Completed[questID].Completed = isCompleted
  10. end
  11.  
  12. local function QuestAccepted(...)
  13.     local questID = ...
  14.     local questLogIndex = C_QuestLog.GetLogIndexForQuestID(questID)
  15.     local info = { C_QuestLog.GetInfo(questLogIndex) }
  16.     print("Accepted Quest: ", questID, info["title"])    
  17.     Quests_Completed[questID] = info                
  18. end
  19.  
  20. local frame = CreateFrame("Frame")
  21. frame:RegisterEvent("QUEST_TURNED_IN")
  22. frame:RegisterEvent("QUEST_ACCEPTED")
  23. frame:SetScript("OnEvent", function(self, event, ...)
  24.     if event == "QUEST_TURNED_IN" then
  25.         -- Triggers when pressing Complete Button
  26.         QuestTurnedIn(...)
  27.     elseif event == "QUEST_ACCEPTED" then
  28.         -- Triggers before Pressing Accept Button
  29.         QuestAccepted(...)
  30.     end
  31. end)

It worked as expected with the addon recognising that a quest had been turned in as it was turned in and marked it as completed immediately. The only slight error on my part was trying to display info.title instead of info["title"] on the screen.

It might be that the quests you are looking into in particular are working differently. Try separating the event tests and see whether the QUEST_TURNED_IN functionality kicks in correctly.


The saved variables show that on QUEST_ACCEPTED all of the information was available and on QUEST_TURNED_IN it knew it had been completed. In this example, the first alliance human quest was completed with the second accepted but not completed.

Lua Code:
  1. Quests_Completed = {
  2.     [28757] = {
  3.         {
  4.             ["difficultyLevel"] = 1,
  5.             ["useMinimalHeader"] = false,
  6.             ["isHeader"] = false,
  7.             ["questLogIndex"] = 2,
  8.             ["level"] = 1,
  9.             ["isOnMap"] = false,
  10.             ["isTask"] = false,
  11.             ["isHidden"] = false,
  12.             ["overridesSortOrder"] = false,
  13.             ["isInternalOnly"] = false,
  14.             ["isCollapsed"] = true,
  15.             ["startEvent"] = false,
  16.             ["questID"] = 28757,
  17.             ["suggestedGroup"] = 0,
  18.             ["isBounty"] = false,
  19.             ["readyForTranslation"] = true,
  20.             ["isLegendarySort"] = false,
  21.             ["title"] = "Beating Them Back!",
  22.             ["isAutoComplete"] = false,
  23.             ["isStory"] = false,
  24.             ["hasLocalPOI"] = false,
  25.             ["isScaling"] = true,
  26.             ["frequency"] = 0,
  27.         }, -- [1]
  28.         ["Completed"] = true,
  29.     },
  30.     [28769] = {
  31.         {
  32.             ["difficultyLevel"] = 2,
  33.             ["useMinimalHeader"] = false,
  34.             ["isHeader"] = false,
  35.             ["questLogIndex"] = 2,
  36.             ["level"] = 2,
  37.             ["isOnMap"] = false,
  38.             ["isTask"] = false,
  39.             ["isHidden"] = false,
  40.             ["overridesSortOrder"] = false,
  41.             ["isInternalOnly"] = false,
  42.             ["isCollapsed"] = true,
  43.             ["startEvent"] = false,
  44.             ["questID"] = 28769,
  45.             ["suggestedGroup"] = 0,
  46.             ["isBounty"] = false,
  47.             ["readyForTranslation"] = true,
  48.             ["isLegendarySort"] = false,
  49.             ["title"] = "Lions for Lambs",
  50.             ["isAutoComplete"] = false,
  51.             ["isStory"] = false,
  52.             ["hasLocalPOI"] = false,
  53.             ["isScaling"] = true,
  54.             ["frequency"] = 0,
  55.         }, -- [1]
  56.     },
  57. }
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818

Last edited by Xrystal : 04-07-24 at 07:28 AM.
  Reply With Quote