# HG changeset patch # User contrebasse # Date 1304028865 -7200 # Node ID 218e1dd1b821d29009244390604f2d6b457dde25 # Parent 416c307fd00b964f5fcdefd2d394899bd25ba012 Hide external frame when selecting a recipe which doesn't need this reagent diff -r 416c307fd00b -r 218e1dd1b821 ReagentMaker.lua --- a/ReagentMaker.lua Thu Apr 28 23:39:30 2011 +0200 +++ b/ReagentMaker.lua Fri Apr 29 00:14:25 2011 +0200 @@ -122,17 +122,18 @@ if #(A.data[reagentID]) == 1 and not A.data[reagentID].spell then local numMakable, reagentIndex = A.numMakable(reagentID) if not numMakable then - print("Sorry, i can't determine the number of makables reagents...") + print("Sorry, I can't determine the number of makables reagents...") return end if numMakable>0 then A.craft(reagentID,reagentRecipeIndex,reagentIndex,numMakable,chooseNumberToCraft) return end + -- If we can make the item needed to make the reagent, open a window to make it -- one step recursion, enables to mill to create an ink if A.data[A.data[reagentID][1][1]] then - A.externalCraftWindow(A.data[reagentID][1][1]) + A.externalCraftWindow(A.data[reagentID][1][1],reagentID) else print("Sorry, couldn't make reagent...") end diff -r 416c307fd00b -r 218e1dd1b821 SecureMenu.lua --- a/SecureMenu.lua Thu Apr 28 23:39:30 2011 +0200 +++ b/SecureMenu.lua Fri Apr 29 00:14:25 2011 +0200 @@ -51,6 +51,18 @@ GameTooltip:Hide() A.tooltipRecipe:Hide() end) + +-- Hide frame when selecting a recipe which doesn't need this reagent +hooksecurefunc("SelectTradeSkill",function() + local selectedIndex = GetTradeSkillSelectionIndex() + for reagentRecipeIndex = 1,GetTradeSkillNumReagents(selectedIndex) do + local reagentID = A.link2ID(GetTradeSkillReagentItemLink(selectedIndex, reagentRecipeIndex)) + if reagentID == MenuFrame.itemID or (MenuFrame.superItemID and reagentID == MenuFrame.superItemID) then + return + end + end + MenuFrame:Hide() +end) A.MenuFrame = MenuFrame -- Background adaptable vertically @@ -272,7 +284,7 @@ end -- function -- Fill the window and open it -function A.externalCraftWindow(itemID) +function A.externalCraftWindow(itemID,superItemID) -- Do not open during combat if InCombatLockdown() then return end @@ -296,6 +308,8 @@ -- Save vars to show the tooltip later MenuFrame.reagentLink = link MenuFrame.spellLink = A.data[itemID].spellLink + MenuFrame.itemID = itemID + MenuFrame.superItemID = superItemID -- optional -- Loop over the available recipes for _,reagent in ipairs(A.data[itemID]) do