Quantcast

-- Work-around to detect candy bucket quest completion.
-- Should work for ~98% of buckets (GetSubZoneText() reports nil or gives unexpected results in some areas).

local F = CreateFrame("Frame")
F:Hide()
F:SetScript("OnEvent", function(self, event, msg)
	if type(msg) == 'string' and msg == "Candy Bucket completed." then
		if GetSubZoneText() == nil then
			print("GetSubZoneText() returned nil")
		else
			print("Sending CompleteQuest to TourGuide:  '" .. GetSubZoneText() .. " Candy Bucket" .. "'")
			TourGuide:CompleteQuest(GetSubZoneText() .. " Candy Bucket")
			TourGuide:UpdateStatusFrame()
		end
	end
end)

F:RegisterEvent("CHAT_MSG_SYSTEM")