diff ReagentMaker.lua @ 101:060f5d0f7a35 v1.0beta10

Manage correctly the Campfire button
author contrebasse
date Fri, 20 May 2011 22:14:31 +0200
parents b980c00affcd
children c8d527a9fb3a
line wrap: on
line diff
--- a/ReagentMaker.lua	Fri May 20 19:29:13 2011 +0200
+++ b/ReagentMaker.lua	Fri May 20 22:14:31 2011 +0200
@@ -56,10 +56,15 @@
 	end
 end
 A.EventsFrame:SetScript("OnEvent", function(self, event)
-	A.ManageCampFireBtn()
 	if event == "TRADE_SKILL_UPDATE" then
 		t_throttle = SCAN_DELAY
 		self:SetScript("OnUpdate", throttleScan)
+		A.ManageCampFireBtn()
+
+	elseif event == "PLAYER_REGEN_DISABLED" then
+		A.HideCampFireBtn()
+	elseif event == "PLAYER_REGEN_ENABLED" then
+		A.ManageCampFireBtn()
 
 	elseif event == "TRADE_SKILL_SHOW" then
 		A:Initialize()
@@ -104,10 +109,10 @@
 	A.tooltipRecipe = CreateFrame("GameTooltip", "ReagentMaker_tooltipRecipe",UIParent, "GameTooltipTemplate")
 	A.tooltipRecipe:SetFrameStrata("TOOLTIP")
 	A.tooltipRecipe:Hide()
-	
+
 	-- Button for enchanting directy on a scroll
 	A.LoadEnchantOnScroll()
-	
+
 	-- Button to cast a campfire
 	A.InitialiseCampFireBtn()
 end -- function
@@ -194,7 +199,7 @@
 	-- use the mean between min and max, but make at least one...
 	local minMade, maxMade = GetTradeSkillNumMade(reagentIndex)
 	numToMake = math.max(math.floor(2*numToMake/(maxMade+minMade)),1)
-	
+
 	-- Choose number or craft directly
 	if chooseNumber then
 		-- the dialog window is linked to the reagent button