Quantcast

Clean up QUEST_GREETING and use the API available

Adrian L Lange [05-31-11 - 17:06]
Clean up QUEST_GREETING and use the API available
Filename
Monomyth.lua
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()