comparison ReagentMaker.lua @ 108:618163a6d970 v1.0beta13

Always show counts and bypass all filtering and searches
author contrebasse
date Thu, 02 Jun 2011 14:12:06 +0200
parents d64a19e5a47d
children d60d6b4cab0c
comparison
equal deleted inserted replaced
107:d64a19e5a47d 108:618163a6d970
114 A.LoadEnchantOnScroll() 114 A.LoadEnchantOnScroll()
115 end -- function 115 end -- function
116 116
117 -- Function run after selecting a item in the tradeskill window 117 -- Function run after selecting a item in the tradeskill window
118 function A.ProcessReagent(btn, ...) 118 function A.ProcessReagent(btn, ...)
119 --SPELL_FAILED_REAGENTS = "Missing reagent: %s";
120 --ERR_SPELL_FAILED_REAGENTS_GENERIC = "Missing reagent";
121 --ERR_INTERNAL_BAG_ERROR = "Internal Bag Error";
122 --SPELL_FAILED_ERROR = "Internal error";
119 123
120 -- Do not manage guild tradeskill 124 -- Do not manage guild tradeskill
121 if IsTradeSkillGuild() or IsTradeSkillLinked() then return end 125 if IsTradeSkillGuild() or IsTradeSkillLinked() then return end
122 126
123 -- We want no modifiers, or shift to choose the number of reagent to craft 127 -- We want no modifiers, or shift to choose the number of reagent to craft
139 if A.data[reagentID][1].spellName and A.data[reagentID][1].spellName ~= GetTradeSkillLine() then 143 if A.data[reagentID][1].spellName and A.data[reagentID][1].spellName ~= GetTradeSkillLine() then
140 A.Error(A.L["The recipe to make this reagent is in another tradeskill. Currently ReagentMaker can not manage such a case, sorry."]) 144 A.Error(A.L["The recipe to make this reagent is in another tradeskill. Currently ReagentMaker can not manage such a case, sorry."])
141 return 145 return
142 end 146 end
143 147
144 local numMakable, reagentIndex = A.numMakable(reagentID) 148 local reagentIndex = A.findSkillIndex(reagentID) -- finds only the first recipe that creates the reagent, should check recipe name too
145 149
146 -- Try to show the recipe by removing filters once if it was not found 150 -- Try to show the recipe by removing filters once if it was not found
147 if not reagentIndex then 151 if not reagentIndex then
148 A.SaveActiveFilters(A.data[reagentID][1].header) 152 A.SaveActiveFilters(A.data[reagentID][1].header)
149 numMakable, reagentIndex = A.numMakable(reagentID) 153 reagentIndex = A.findSkillIndex(reagentID)
150 end 154 end
151 155 if not reagentIndex then
156 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."])
157 A.RestoreActiveFilters()
158 return
159 end
160
161 local numMakable = A.numMakable(reagentID)
152 if not numMakable then 162 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."]) 163 A.Error(A.L["There was a problem while retrieving informations, please retry."])
154 A.RestoreActiveFilters() 164 A.RestoreActiveFilters()
155 return 165 return
156 end 166 end
157 if numMakable>0 then 167 if numMakable>0 then
158 A.craft(recipeIndex,reagentRecipeIndex,reagentIndex,numMakable,chooseNumberToCraft) 168 A.craft(recipeIndex,reagentRecipeIndex,reagentIndex,numMakable,chooseNumberToCraft)
289 if not reagentID or not A.data[reagentID] then 299 if not reagentID or not A.data[reagentID] then
290 label:Hide() 300 label:Hide()
291 else 301 else
292 -- Count and show 302 -- Count and show
293 local numMakable = A.numMakable(reagentID) 303 local numMakable = A.numMakable(reagentID)
294 if not numMakable or #(A.data[reagentID]) ~= 1 or A.data[reagentID][1].macro then 304 --if not numMakable or #(A.data[reagentID]) ~= 1 or A.data[reagentID][1].macro then
305 if not numMakable then
295 label:SetText("?") 306 label:SetText("?")
296 label:SetTextColor(0, 0.5, 1, 1) -- blue 307 label:SetTextColor(0, 0.5, 1, 1) -- blue
297 else 308 else
298 label:SetText(numMakable) 309 label:SetText(numMakable)
299 if numMakable==0 then 310 if numMakable==0 then