comparison ReagentMaker.lua @ 28:76414c6318ff

Remove useless comments
author contrebasse
date Thu, 28 Apr 2011 19:46:29 +0200
parents fb02770b8b5e
children fd76c8951b7d
comparison
equal deleted inserted replaced
27:fb02770b8b5e 28:76414c6318ff
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 show number of craftable items
6 -- @todo show owned items 5 -- @todo show owned items
7 -- @todo add support for dez ? 6 -- @todo add support for dez ?
8 -- @todo add support for cross tradeskill, like mining + forge/ingé 7 -- @todo add support for cross tradeskill, like mining + forge/ingé
9 8
10 --------------------------------------------------- 9 ---------------------------------------------------
94 end -- for 93 end -- for
95 94
96 A.tooltipRecipe = CreateFrame("GameTooltip", "ReagentMaker_tooltipRecipe",UIParent, "GameTooltipTemplate") 95 A.tooltipRecipe = CreateFrame("GameTooltip", "ReagentMaker_tooltipRecipe",UIParent, "GameTooltipTemplate")
97 A.tooltipRecipe:SetFrameStrata("TOOLTIP") 96 A.tooltipRecipe:SetFrameStrata("TOOLTIP")
98 A.tooltipRecipe:Hide() 97 A.tooltipRecipe:Hide()
99 --[[
100 A.tooltipReagent = CreateFrame("GameTooltip", "ReagentMaker_tooltipReagent",UIParent, "GameTooltipTemplate")
101 A.tooltipReagent:SetFrameStrata("TOOLTIP")
102 A.tooltipReagent:Hide()
103 --]]
104 end -- function 98 end -- function
105 99
106 -- Function run after selecting a item in the tradeskill window 100 -- Function run after selecting a item in the tradeskill window
107 function A.ProcessReagent(btn, ...) 101 function A.ProcessReagent(btn, ...)
108 102
162 function A.craft(reagentID,reagentRecipeIndex,reagentIndex,numReagentMakable,chooseNumber) 156 function A.craft(reagentID,reagentRecipeIndex,reagentIndex,numReagentMakable,chooseNumber)
163 -- Look at how many we need to make one item for the selected recipe 157 -- Look at how many we need to make one item for the selected recipe
164 local numToMake = 1 158 local numToMake = 1
165 local selectedIndex = GetTradeSkillSelectionIndex() 159 local selectedIndex = GetTradeSkillSelectionIndex()
166 local skillName, skillType, numAvailable, isExpanded, serviceType, numSkillUps = GetTradeSkillInfo(selectedIndex) 160 local skillName, skillType, numAvailable, isExpanded, serviceType, numSkillUps = GetTradeSkillInfo(selectedIndex)
167 --if numAvailable==0 then 161 local reagentName, reagentTexture, reagentCount, playerReagentCount = GetTradeSkillReagentInfo(selectedIndex, reagentRecipeIndex)
168 local reagentName, reagentTexture, reagentCount, playerReagentCount = GetTradeSkillReagentInfo(selectedIndex, reagentRecipeIndex) 162 -- make enough reagents to craft one more item
169 -- make enough reagents to craft one more item 163 numToMake = math.min(reagentCount*(1+numAvailable) - playerReagentCount,numReagentMakable)
170 numToMake = math.min(reagentCount*(1+numAvailable) - playerReagentCount,numReagentMakable)
171 --end -- if
172 164
173 -- Choose number or craft directly 165 -- Choose number or craft directly
174 if chooseNumber and numReagentMakable>1 then 166 if chooseNumber and numReagentMakable>1 then
175 -- the dialog window is linked to the reagent button 167 -- the dialog window is linked to the reagent button
176 local btn = _G["TradeSkillReagent"..reagentRecipeIndex] 168 local btn = _G["TradeSkillReagent"..reagentRecipeIndex]
198 -- Do not manage guild tradeskill 190 -- Do not manage guild tradeskill
199 if IsTradeSkillGuild() or IsTradeSkillLinked() then return end 191 if IsTradeSkillGuild() or IsTradeSkillLinked() then return end
200 192
201 -- Index of the reagent in the recipe, taken from the button name 193 -- Index of the reagent in the recipe, taken from the button name
202 local reagentRecipeIndex = A.buttonNumber(btn) 194 local reagentRecipeIndex = A.buttonNumber(btn)
203
204 --A.SaveActiveFilters()
205 195
206 -- ID of the reagent we want to craft 196 -- ID of the reagent we want to craft
207 local reagentLink = GetTradeSkillReagentItemLink(GetTradeSkillSelectionIndex(), reagentRecipeIndex) 197 local reagentLink = GetTradeSkillReagentItemLink(GetTradeSkillSelectionIndex(), reagentRecipeIndex)
208 local reagentID = A.link2ID(reagentLink) 198 local reagentID = A.link2ID(reagentLink)
209 199
221 if reagentIndex then 211 if reagentIndex then
222 link = GetTradeSkillRecipeLink(A.findSkillIndex(reagentID)) 212 link = GetTradeSkillRecipeLink(A.findSkillIndex(reagentID))
223 end 213 end
224 end 214 end
225 215
226 --A.RestoreActiveFilters()
227
228 if link then 216 if link then
229 A.tooltipRecipe:SetOwner(btn) 217 A.tooltipRecipe:SetOwner(btn)
230 A.tooltipRecipe:SetHyperlink(link) 218 A.tooltipRecipe:SetHyperlink(link)
231 A.tooltipRecipe:Show() 219 A.tooltipRecipe:Show()
232 A.tooltipRecipe:ClearAllPoints() 220 A.tooltipRecipe:ClearAllPoints()
235 end 223 end
236 224
237 function A.btnLeft(btn) 225 function A.btnLeft(btn)
238 btn.textureHighlight:Hide() 226 btn.textureHighlight:Hide()
239 A.tooltipRecipe:Hide() 227 A.tooltipRecipe:Hide()
240 --A.tooltipReagent:Hide()
241 end -- function 228 end -- function
242 229
243 function A.updateCounts(recipeIndex) 230 function A.updateCounts(recipeIndex)
244 -- Needs an argument 231 -- Needs an argument
245 if not recipeIndex then return end 232 if not recipeIndex then return end