Mercurial > wow > reagentmaker
comparison ReagentMaker.lua @ 25:578b9c9479c9
Remove errors for hidden recipes and show a '?' when count isn't available
| author | contrebasse |
|---|---|
| date | Thu, 28 Apr 2011 19:31:01 +0200 |
| parents | 5f3a5b88fb19 |
| children | fb02770b8b5e |
comparison
equal
deleted
inserted
replaced
| 24:5f3a5b88fb19 | 25:578b9c9479c9 |
|---|---|
| 39 A.MenuFrame:Hide() | 39 A.MenuFrame:Hide() |
| 40 return | 40 return |
| 41 end | 41 end |
| 42 | 42 |
| 43 -- Scan availabe recipes | 43 -- Scan availabe recipes |
| 44 A:ScanSimpleRecipes() | 44 local ok = A:ScanSimpleRecipes() |
| 45 | 45 |
| 46 -- Show makables reagents | 46 -- Show makables reagents |
| 47 A.updateCounts(GetTradeSkillSelectionIndex()) | 47 A.updateCounts(GetTradeSkillSelectionIndex()) |
| 48 end | 48 end |
| 49 end | 49 end |
| 121 if not reagentID or not A.data[reagentID] then return end | 121 if not reagentID or not A.data[reagentID] then return end |
| 122 | 122 |
| 123 -- If only one recipe is known for the reagent, use it | 123 -- If only one recipe is known for the reagent, use it |
| 124 if #(A.data[reagentID]) == 1 and not A.data[reagentID].spell then | 124 if #(A.data[reagentID]) == 1 and not A.data[reagentID].spell then |
| 125 local numMakable, reagentIndex = A.numMakable(reagentID) | 125 local numMakable, reagentIndex = A.numMakable(reagentID) |
| 126 if not numMakable then | |
| 127 print("Sorry, i can't determine the number of makables reagents...") | |
| 128 return | |
| 129 end | |
| 126 if numMakable>0 then | 130 if numMakable>0 then |
| 127 A.craft(reagentID,reagentRecipeIndex,reagentIndex,numMakable,chooseNumberToCraft) | 131 A.craft(reagentID,reagentRecipeIndex,reagentIndex,numMakable,chooseNumberToCraft) |
| 128 return | 132 return |
| 129 end | 133 end |
| 130 -- If we can make the item needed to make the reagent, open a window to make it | 134 -- If we can make the item needed to make the reagent, open a window to make it |
| 131 -- one step recursion, enables to mill to create an ink | 135 -- one step recursion, enables to mill to create an ink |
| 132 if A.data[A.data[reagentID][1][1]] then | 136 if A.data[A.data[reagentID][1][1]] then |
| 133 A.externalCraftWindow(A.data[reagentID][1][1]) | 137 A.externalCraftWindow(A.data[reagentID][1][1]) |
| 134 else | 138 else |
| 135 print("Sorry, can not make reagent...") | 139 print("Sorry, couldn't make reagent...") |
| 136 end | 140 end |
| 137 else | 141 else |
| 138 A.externalCraftWindow(reagentID) | 142 A.externalCraftWindow(reagentID) |
| 139 end -- if | 143 end -- if |
| 140 --A.RestoreActiveFilters() | 144 --A.RestoreActiveFilters() |
| 207 -- Tooltips | 211 -- Tooltips |
| 208 local link | 212 local link |
| 209 if A.data[reagentID].spell then | 213 if A.data[reagentID].spell then |
| 210 link = GetSpellLink(A.data[reagentID].spellID) | 214 link = GetSpellLink(A.data[reagentID].spellID) |
| 211 else | 215 else |
| 212 local index = A.findSkillIndex(reagentID) | 216 local reagentIndex = A.findSkillIndex(reagentID) |
| 213 if index then | 217 if reagentIndex then |
| 214 link = GetTradeSkillRecipeLink(A.findSkillIndex(reagentID)) | 218 link = GetTradeSkillRecipeLink(A.findSkillIndex(reagentID)) |
| 215 end | 219 end |
| 216 end | 220 end |
| 217 | 221 |
| 218 --A.RestoreActiveFilters() | 222 --A.RestoreActiveFilters() |
| 257 if not reagentID or not A.data[reagentID] or #(A.data[reagentID]) ~= 1 or A.data[reagentID].spell then | 261 if not reagentID or not A.data[reagentID] or #(A.data[reagentID]) ~= 1 or A.data[reagentID].spell then |
| 258 label:Hide() | 262 label:Hide() |
| 259 else | 263 else |
| 260 -- Count and show | 264 -- Count and show |
| 261 local numMakable = A.numMakable(reagentID) | 265 local numMakable = A.numMakable(reagentID) |
| 262 label:SetText(numMakable) | 266 label:SetText(numMakable or "?") |
| 263 if numMakable==0 then | 267 if not numMakable or numMakable==0 then |
| 264 label:SetTextColor(1, 0, 0, 1) | 268 label:SetTextColor(1, 0, 0, 1) |
| 265 else | 269 else |
| 266 label:SetTextColor(0, 5, 0, 1) | 270 label:SetTextColor(0, 5, 0, 1) |
| 267 end -- if | 271 end -- if |
| 268 label:Show() | 272 label:Show() |
