comparison ReagentMaker.lua @ 82:cf1da2654dc6 v1.0beta3

Expand headers when needed. Not heavily tested, could fail on a slow computer...
author contrebasse
date Sun, 15 May 2011 09:23:15 +0200
parents 32c398de6812
children 996aaa818d04
comparison
equal deleted inserted replaced
81:32c398de6812 82:cf1da2654dc6
114 114
115 -- We want no modifiers, or shift to choose the number of reagent to craft 115 -- We want no modifiers, or shift to choose the number of reagent to craft
116 if IsModifierKeyDown() and not IsShiftKeyDown() then return end 116 if IsModifierKeyDown() and not IsShiftKeyDown() then return end
117 local chooseNumberToCraft = IsShiftKeyDown() 117 local chooseNumberToCraft = IsShiftKeyDown()
118 118
119 --A.SaveActiveFilters()
120
121 -- Index of the reagent in the recipe, taken from the button name 119 -- Index of the reagent in the recipe, taken from the button name
122 local reagentRecipeIndex = A.buttonNumber(btn) 120 local reagentRecipeIndex = A.buttonNumber(btn)
123 121
124 -- ID of the reagent we want to craft 122 -- ID of the reagent we want to craft
125 local recipeIndex = GetTradeSkillSelectionIndex() 123 local recipeIndex = GetTradeSkillSelectionIndex()
127 125
128 -- Continue only if the reagent is known 126 -- Continue only if the reagent is known
129 if not reagentID or not A.data[reagentID] then return end 127 if not reagentID or not A.data[reagentID] then return end
130 128
131 -- If only one recipe is known for the reagent, use it 129 -- If only one recipe is known for the reagent, use it
132 if #(A.data[reagentID]) == 1 and not A.data[reagentID][1].macro then 130 if #(A.data[reagentID]) == 1 and not A.data[reagentID][1].macro then
133 local numMakable, reagentIndex = A.numMakable(reagentID) 131 local numMakable, reagentIndex = A.numMakable(reagentID)
134 if not numMakable then 132
133 -- Try to show the recipe once if it was not found
134 if not reagentIndex then
135 A.SaveActiveFilters(A.data[reagentID][1].header)
136 numMakable, reagentIndex = A.numMakable(reagentID)
137 end
138
139 if not numMakable then
135 A.Error(A.L["The recipe to make the reagent seems to be hidden, it is not makable. Try to remove the filters on the recipes."]) 140 A.Error(A.L["The recipe to make the reagent seems to be hidden, it is not makable. Try to remove the filters on the recipes."])
136 return 141 return
137 end 142 end
138 if numMakable>0 then 143 if numMakable>0 then
139 A.craft(recipeIndex,reagentRecipeIndex,reagentIndex,numMakable,chooseNumberToCraft) 144 A.craft(recipeIndex,reagentRecipeIndex,reagentIndex,numMakable,chooseNumberToCraft)