comparison ReagentMaker.lua @ 107:d64a19e5a47d

Bypass the filtering. Not fully tested, but mostly works.
author contrebasse
date Thu, 02 Jun 2011 00:57:17 +0200
parents c8d527a9fb3a
children 618163a6d970
comparison
equal deleted inserted replaced
106:f857e01b067e 107:d64a19e5a47d
1 local addonName, A = ... 1 local addonName, A = ...
2 2
3 -- @todo clean the A table 3 -- @todo clean the A table
4 -- @todo check local copy of globals functions 4 -- @todo check local copy of globals functions
5 -- @todo add support for dez ? 5 -- @todo add support for dez ?
6 -- @todo add support for hidden recipes, removing filtering 6 -- @todo add support for hidden recipes, removing filtering => save the reagent count to be able to compute the number of craftable items
7 -- @todo add support for cross tradeskill, like mining + forge/ingé 7 -- @todo add support for cross tradeskill, like mining + forge/ingé
8 -- @todo when a reagent can not be crafted and the recipe has many reagents, do like ReverseEngeneering and go to this recipe (with a one step return button) 8 -- @todo when a reagent can not be crafted and the recipe has many reagents, do like ReverseEngeneering and go to this recipe (with a one step return button)
9 -- @todo scroll to the selected recipe on opening (usefull also for the previous todo) 9 -- @todo scroll to the selected recipe on opening (usefull also for the previous todo)
10 -- @todo shift+clic on a reagent name while the serachbar is focused fills the serachbar with the reagent name (idem with the crafted item) 10 -- @todo shift+clic on a reagent name while the serachbar is focused fills the serachbar with the reagent name (idem with the crafted item)
11 -- @todo add a button to clear search 11 -- @todo add a button to clear search
149 numMakable, reagentIndex = A.numMakable(reagentID) 149 numMakable, reagentIndex = A.numMakable(reagentID)
150 end 150 end
151 151
152 if not numMakable then 152 if not numMakable then
153 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."]) 153 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."])
154 A.RestoreActiveFilters()
154 return 155 return
155 end 156 end
156 if numMakable>0 then 157 if numMakable>0 then
157 A.craft(recipeIndex,reagentRecipeIndex,reagentIndex,numMakable,chooseNumberToCraft) 158 A.craft(recipeIndex,reagentRecipeIndex,reagentIndex,numMakable,chooseNumberToCraft)
159 A.RestoreActiveFilters()
158 return 160 return
159 end 161 end
160 162
161 -- If we can make the item needed to make the reagent, open a window to make it 163 -- If we can make the item needed to make the reagent, open a window to make it
162 -- one step recursion, enables to mill to create an ink 164 -- one step recursion, enables to mill to create an ink
163 if A.data[reagentID][1][1] and A.data[A.data[reagentID][1][1]] then 165 if A.data[reagentID][1][1] and A.data[A.data[reagentID][1][1]] then
164 if A.externalCraftWindow(A.data[reagentID][1][1],reagentID) ~= false then 166 if A.externalCraftWindow(A.data[reagentID][1][1],reagentID) ~= false then
167 A.RestoreActiveFilters()
165 return 168 return
166 end 169 end
167 end 170 end
168 171
169 A.Error(A.L["You do not have enough reagents to craft [%s]"]:format(GetItemInfo(reagentID) or "item #"..reagentID)) 172 A.Error(A.L["You do not have enough reagents to craft [%s]"]:format(GetItemInfo(reagentID) or "item #"..reagentID))
173 A.RestoreActiveFilters()
170 return 174 return
171 else 175 else
172 A.externalCraftWindow(reagentID) 176 A.externalCraftWindow(reagentID)
173 end -- if 177 end -- if
174 --A.RestoreActiveFilters() 178 --A.RestoreActiveFilters()