comparison SecureMenu.lua @ 33:218e1dd1b821

Hide external frame when selecting a recipe which doesn't need this reagent
author contrebasse
date Fri, 29 Apr 2011 00:14:25 +0200
parents 416c307fd00b
children 0af9cb8a79f0
comparison
equal deleted inserted replaced
32:416c307fd00b 33:218e1dd1b821
49 end) 49 end)
50 MenuFrame:SetScript("OnLeave",function() 50 MenuFrame:SetScript("OnLeave",function()
51 GameTooltip:Hide() 51 GameTooltip:Hide()
52 A.tooltipRecipe:Hide() 52 A.tooltipRecipe:Hide()
53 end) 53 end)
54
55 -- Hide frame when selecting a recipe which doesn't need this reagent
56 hooksecurefunc("SelectTradeSkill",function()
57 local selectedIndex = GetTradeSkillSelectionIndex()
58 for reagentRecipeIndex = 1,GetTradeSkillNumReagents(selectedIndex) do
59 local reagentID = A.link2ID(GetTradeSkillReagentItemLink(selectedIndex, reagentRecipeIndex))
60 if reagentID == MenuFrame.itemID or (MenuFrame.superItemID and reagentID == MenuFrame.superItemID) then
61 return
62 end
63 end
64 MenuFrame:Hide()
65 end)
54 A.MenuFrame = MenuFrame 66 A.MenuFrame = MenuFrame
55 67
56 -- Background adaptable vertically 68 -- Background adaptable vertically
57 local bg_top = MenuFrame:CreateTexture(nil,"BACKGROUND",nil,0) 69 local bg_top = MenuFrame:CreateTexture(nil,"BACKGROUND",nil,0)
58 bg_top:SetTexture("Interface\\LootFrame\\UI-LootPanel") 70 bg_top:SetTexture("Interface\\LootFrame\\UI-LootPanel")
270 -- Increase the entry number 282 -- Increase the entry number
271 numActiveEntries = numActiveEntries + 1 283 numActiveEntries = numActiveEntries + 1
272 end -- function 284 end -- function
273 285
274 -- Fill the window and open it 286 -- Fill the window and open it
275 function A.externalCraftWindow(itemID) 287 function A.externalCraftWindow(itemID,superItemID)
276 -- Do not open during combat 288 -- Do not open during combat
277 if InCombatLockdown() then return end 289 if InCombatLockdown() then return end
278 290
279 -- Save the tradeskill 291 -- Save the tradeskill
280 A.currentTradeSkill = GetTradeSkillLine() 292 A.currentTradeSkill = GetTradeSkillLine()
294 TitleText:SetTextColor(color.r, color.g, color.b) 306 TitleText:SetTextColor(color.r, color.g, color.b)
295 307
296 -- Save vars to show the tooltip later 308 -- Save vars to show the tooltip later
297 MenuFrame.reagentLink = link 309 MenuFrame.reagentLink = link
298 MenuFrame.spellLink = A.data[itemID].spellLink 310 MenuFrame.spellLink = A.data[itemID].spellLink
311 MenuFrame.itemID = itemID
312 MenuFrame.superItemID = superItemID -- optional
299 313
300 -- Loop over the available recipes 314 -- Loop over the available recipes
301 for _,reagent in ipairs(A.data[itemID]) do 315 for _,reagent in ipairs(A.data[itemID]) do
302 if A.data[itemID].spell then 316 if A.data[itemID].spell then
303 -- Special spell 317 -- Special spell