comparison 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
comparison
equal deleted inserted replaced
100:0fd1fd1ba2d9 101:060f5d0f7a35
54 -- Show makables reagents 54 -- Show makables reagents
55 A.updateCounts(GetTradeSkillSelectionIndex()) 55 A.updateCounts(GetTradeSkillSelectionIndex())
56 end 56 end
57 end 57 end
58 A.EventsFrame:SetScript("OnEvent", function(self, event) 58 A.EventsFrame:SetScript("OnEvent", function(self, event)
59 A.ManageCampFireBtn()
60 if event == "TRADE_SKILL_UPDATE" then 59 if event == "TRADE_SKILL_UPDATE" then
61 t_throttle = SCAN_DELAY 60 t_throttle = SCAN_DELAY
62 self:SetScript("OnUpdate", throttleScan) 61 self:SetScript("OnUpdate", throttleScan)
62 A.ManageCampFireBtn()
63
64 elseif event == "PLAYER_REGEN_DISABLED" then
65 A.HideCampFireBtn()
66 elseif event == "PLAYER_REGEN_ENABLED" then
67 A.ManageCampFireBtn()
63 68
64 elseif event == "TRADE_SKILL_SHOW" then 69 elseif event == "TRADE_SKILL_SHOW" then
65 A:Initialize() 70 A:Initialize()
66 A.EventsFrame:UnregisterEvent("TRADE_SKILL_SHOW") 71 A.EventsFrame:UnregisterEvent("TRADE_SKILL_SHOW")
67 end -- if 72 end -- if
102 107
103 -- Secondary Tooltip 108 -- Secondary Tooltip
104 A.tooltipRecipe = CreateFrame("GameTooltip", "ReagentMaker_tooltipRecipe",UIParent, "GameTooltipTemplate") 109 A.tooltipRecipe = CreateFrame("GameTooltip", "ReagentMaker_tooltipRecipe",UIParent, "GameTooltipTemplate")
105 A.tooltipRecipe:SetFrameStrata("TOOLTIP") 110 A.tooltipRecipe:SetFrameStrata("TOOLTIP")
106 A.tooltipRecipe:Hide() 111 A.tooltipRecipe:Hide()
107 112
108 -- Button for enchanting directy on a scroll 113 -- Button for enchanting directy on a scroll
109 A.LoadEnchantOnScroll() 114 A.LoadEnchantOnScroll()
110 115
111 -- Button to cast a campfire 116 -- Button to cast a campfire
112 A.InitialiseCampFireBtn() 117 A.InitialiseCampFireBtn()
113 end -- function 118 end -- function
114 119
115 -- Function run after selecting a item in the tradeskill window 120 -- Function run after selecting a item in the tradeskill window
192 197
193 -- take into account that some recipe craft more than one item 198 -- take into account that some recipe craft more than one item
194 -- use the mean between min and max, but make at least one... 199 -- use the mean between min and max, but make at least one...
195 local minMade, maxMade = GetTradeSkillNumMade(reagentIndex) 200 local minMade, maxMade = GetTradeSkillNumMade(reagentIndex)
196 numToMake = math.max(math.floor(2*numToMake/(maxMade+minMade)),1) 201 numToMake = math.max(math.floor(2*numToMake/(maxMade+minMade)),1)
197 202
198 -- Choose number or craft directly 203 -- Choose number or craft directly
199 if chooseNumber then 204 if chooseNumber then
200 -- the dialog window is linked to the reagent button 205 -- the dialog window is linked to the reagent button
201 local btn = _G["TradeSkillReagent"..reagentRecipeIndex] 206 local btn = _G["TradeSkillReagent"..reagentRecipeIndex]
202 207