From b0c7b3b5f5719e0c3a87bc03a060f7ef6a089967 Mon Sep 17 00:00:00 2001 From: Adrian L Lange Date: Tue, 31 May 2011 19:06:48 +0200 Subject: [PATCH] Clean up QUEST_GREETING and use the API available --- Monomyth.lua | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/Monomyth.lua b/Monomyth.lua index 60e7952..89ba26a 100644 --- a/Monomyth.lua +++ b/Monomyth.lua @@ -18,17 +18,22 @@ function addon:Register(event, func) end addon:Register('QUEST_GREETING', function() - for index = 1, MAX_NUM_QUESTS do - local button = _G['QuestTitleButton' .. index] - - if(button and button:IsVisible()) then - if(button.isActive == 1 and _G['QuestTitleButton' .. index .. 'QuestIcon']:GetTexture() == COMPLETE) then - return button:Click() - elseif(button.isActive == 0) then - return button:Click() + local active = GetNumActiveQuests() + if(active > 0) then + for index = 1, active do + local _, complete = GetActiveTitle(index) + if(complete) then + SelectActiveQuest(index) end end end + + local available = GetNumAvailableQuests() + if(available > 0) then + for index = 1, available do + SelectAvailableQuest(index) + end + end end) addon:Register('GOSSIP_SHOW', function() -- 1.7.9.5