diff ReagentMaker.lua @ 13:5eb02d3e1647

Do not manage guild or linked tradeskills
author contrebasse
date Sun, 03 Apr 2011 13:28:25 +0200
parents 17844b0b88c1
children cc56799582f2
line wrap: on
line diff
--- a/ReagentMaker.lua	Sun Apr 03 00:25:08 2011 +0200
+++ b/ReagentMaker.lua	Sun Apr 03 13:28:25 2011 +0200
@@ -29,15 +29,26 @@
 
 A.EventsFrame:SetScript("OnEvent", function(self, event, ...)
 	if event == "TRADE_SKILL_UPDATE" then
-		-- Scan availabe recipes
-		A:ScanSimpleRecipes()
-
 		-- Close the external window if the tradeskill changed
 		if A.currentTradeSkill ~= GetTradeSkillLine() then
 			A.MenuFrame:Hide()
 		end
+
+		if IsTradeSkillGuild() or IsTradeSkillLinked() then
+			A.MenuFrame:Hide()
+			return
+		end
+
+		-- Scan availabe recipes
+		A:ScanSimpleRecipes()
+
 	elseif event == "TRADE_SKILL_SHOW" then
+		if IsTradeSkillGuild() or IsTradeSkillLinked() then
+			A.MenuFrame:Hide()
+			return
+		end
 		A:Initialize()
+		A.EventsFrame:UnregisterEvent("TRADE_SKILL_SHOW")
 	end -- if
 end) -- function
 A.EventsFrame:RegisterEvent("TRADE_SKILL_SHOW")
@@ -46,9 +57,7 @@
 ---------------------------------------------------
 -- Initialize
 ---------------------------------------------------
-local toInitialize = true
 function A:Initialize()
-	A.EventsFrame:UnregisterEvent("TRADE_SKILL_SHOW")
 
 	-- Register clics on reagent's buttons
 	for i=1,7 do
@@ -86,9 +95,11 @@
 	--]]
 end -- function
 
+-- Function run after selecting a item in the tradeskill window
+function A.ProcessReagent(btn, ...)
+	-- Do not manage guild tradeskill
+	if IsTradeSkillGuild() or IsTradeSkillLinked() then return end
 
--- Function run avter selecting a item in the tradeskill window
-function A.ProcessReagent(btn, ...)
 	-- We want no modifiers, or shift to choose the number of reagent to craft
 	if IsModifierKeyDown() and not IsShiftKeyDown() then return end
 	local chooseNumberToCraft = IsShiftKeyDown()
@@ -167,6 +178,9 @@
 
 -- Button hovering
 function A.btnEntered(btn)
+	-- Do not manage guild tradeskill
+	if IsTradeSkillGuild() or IsTradeSkillLinked() then return end
+
 	-- Index of the reagent in the recipe, taken from the button name
 	local reagentRecipeIndex = A.buttonNumber(btn)