From f156cf8e658a81546eebd800e8992779f27d2e4e Mon Sep 17 00:00:00 2001 From: Adrian L Lange Date: Sat, 6 Sep 2014 20:31:39 +0200 Subject: [PATCH] Attempt to complete all autoquests when they occur or when the player logs in Fixes #12 --- QuickQuest.lua | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/QuickQuest.lua b/QuickQuest.lua index 5893e66..0123bee 100644 --- a/QuickQuest.lua +++ b/QuickQuest.lua @@ -262,21 +262,28 @@ end) QuickQuest:Register('QUEST_FINISHED', function() choiceQueue = nil autoCompleteIndex = nil -end) -QuickQuest:Register('QUEST_AUTOCOMPLETE', function(id) - local index = GetQuestLogIndexByID(id) - if(GetQuestLogIsAutoComplete(index)) then - ShowQuestComplete(index) + if(GetNumAutoQuestPopUps() > 0) then + QuickQuest:QUEST_AUTOCOMPLETE() + end +end) - autoCompleteIndex = index +QuickQuest:Register('QUEST_AUTOCOMPLETE', function() + while(not autoCompleteIndex and GetNumAutoQuestPopUps() > 0) do + local id, type = GetAutoQuestPopUp(1) + if(type == 'COMPLETE') then + local index = GetQuestLogIndexByID(id) + ShowQuestComplete(index) + autoCompleteIndex = index + else + return + end end end) QuickQuest:Register('BAG_UPDATE_DELAYED', function() if(autoCompleteIndex) then ShowQuestComplete(autoCompleteIndex) - autoCompleteIndex = nil end end) @@ -352,6 +359,10 @@ end QuickQuest:Register('PLAYER_LOGIN', function() QuickQuest:Register('BAG_UPDATE', BagUpdate) + + if(GetNumAutoQuestPopUps() > 0) then + QuickQuest:QUEST_AUTOCOMPLETE() + end end) local errors = { -- 1.7.9.5